diff --git a/lib/renderer/web-view/web-view-impl.ts b/lib/renderer/web-view/web-view-impl.ts index f3cad3353453..cef62fd2c769 100644 --- a/lib/renderer/web-view/web-view-impl.ts +++ b/lib/renderer/web-view/web-view-impl.ts @@ -24,7 +24,6 @@ export class WebViewImpl { public guestInstanceId?: number public hasFocus = false public internalInstanceId?: number; - public resizeObserver?: ResizeObserver; public viewInstanceId: number // on* Event handlers. @@ -103,14 +102,6 @@ export class WebViewImpl { this.attributes.get(attributeName)!.handleMutation(oldValue, newValue); } - onElementResize () { - const props = { - newWidth: this.webviewNode.clientWidth, - newHeight: this.webviewNode.clientHeight - }; - this.dispatchEvent('resize', props); - } - createGuest () { this.internalInstanceId = getNextId(); this.hooks.guestViewInternal.createGuest(this.internalElement, this.internalInstanceId, this.buildParams()) @@ -203,10 +194,6 @@ export class WebViewImpl { } this.guestInstanceId = guestInstanceId; - // TODO(zcbenz): Should we deprecate the "resize" event? Wait, it is not - // even documented. - this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this)); - this.resizeObserver.observe(this.internalElement); } } diff --git a/spec/webview-spec.ts b/spec/webview-spec.ts index 9bda6215bdcd..2a30247057da 100644 --- a/spec/webview-spec.ts +++ b/spec/webview-spec.ts @@ -1957,36 +1957,6 @@ describe(' tag', function () { ['with sandbox', true] as const ]) { describe(description, () => { - it('emits resize events', async () => { - await loadWebViewAndWaitForEvent(w, { - src: `file://${fixtures}/pages/a.html`, - webpreferences: `sandbox=${sandbox ? 'yes' : 'no'}` - }, 'dom-ready'); - - const firstResizeSignal = w.executeJavaScript(`new Promise((resolve, reject) => { - webview.addEventListener('resize', (e) => resolve({...e}), {once: true}) - })`); - - const insertedCSS = await w.insertCSS('webview { width: 100px; height: 10px; }'); - - const firstResizeEvent = await firstResizeSignal; - expect(firstResizeEvent.newWidth).to.equal(100); - expect(firstResizeEvent.newHeight).to.equal(10); - - await w.removeInsertedCSS(insertedCSS); - - const secondResizeSignal = w.executeJavaScript(`new Promise((resolve, reject) => { - webview.addEventListener('resize', (e) => resolve({...e}), {once: true}) - })`); - - const newWidth = 1234; - const newHeight = 789; - await w.insertCSS(`webview { width: ${newWidth}px; height: ${newHeight}px; }`); - const secondResizeEvent = await secondResizeSignal; - expect(secondResizeEvent.newWidth).to.equal(newWidth); - expect(secondResizeEvent.newHeight).to.equal(newHeight); - }); - it('emits focus event', async () => { await loadWebViewAndWaitForEvent(w, { src: `file://${fixtures}/pages/a.html`,