Repository: electron/electron (language: cpp)

Issue:
re-enable test: <webview> tag DOM events emits resize events
disabled during a chromium roll here: https://github.com/electron/electron/pull/18648/commits/87902ad19cec639c1ef6dd6c7b8ab1803d77721d


Discussion / hints:
This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment!

Fix patch:
diff --git a/spec/webview-spec.ts b/spec/webview-spec.ts
index 8ccb5265aaa0d..9bda6215bdcd2 100644
--- a/spec/webview-spec.ts
+++ b/spec/webview-spec.ts
@@ -309,6 +309,7 @@ describe('<webview> tag', function () {
       const [, { runtimeId, tabId }] = await emittedOnce(ipcMain, 'answer');
       expect(runtimeId).to.match(/^[a-z]{32}$/);
       expect(tabId).to.equal(childWebContentsId);
+      await w.webContents.executeJavaScript('webview.closeDevTools()');
     });
   });
 
@@ -1534,6 +1535,7 @@ describe('<webview> tag', function () {
           webview.openDevTools()
           webview.addEventListener('devtools-opened', () => resolve(), {once: true})
         })`);
+        await w.executeJavaScript('webview.closeDevTools()');
       });
     });
 
@@ -1950,60 +1952,40 @@ describe('<webview> tag', function () {
     });
 
     describe('DOM events', () => {
-      /*
-      let div;
-
-      beforeEach(() => {
-        div = document.createElement('div');
-        div.style.width = '100px';
-        div.style.height = '10px';
-        div.style.overflow = 'hidden';
-        webview.style.height = '100%';
-        webview.style.width = '100%';
-      });
-
-      afterEach(() => {
-        if (div != null) div.remove();
-      });
-      */
-
       for (const [description, sandbox] of [
         ['without sandbox', false] as const,
         ['with sandbox', true] as const
       ]) {
         describe(description, () => {
-        // TODO(nornagon): disabled during chromium roll 2019-06-11 due to a
-        // 'ResizeObserver loop limit exceeded' error on Windows
-        /*
-          xit('emits resize events', async () => {
-            const firstResizeSignal = waitForEvent(webview, 'resize');
-            const domReadySignal = waitForEvent(webview, 'dom-ready');
-
-            webview.src = `file://${fixtures}/pages/a.html`;
-            webview.webpreferences = `sandbox=${sandbox ? 'yes' : 'no'}`;
-            div.appendChild(webview);
-            document.body.appendChild(div);
+          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.target).to.equal(webview);
             expect(firstResizeEvent.newWidth).to.equal(100);
             expect(firstResizeEvent.newHeight).to.equal(10);
 
-            await domReadySignal;
+            await w.removeInsertedCSS(insertedCSS);
 
-            const secondResizeSignal = waitForEvent(webview, 'resize');
+            const secondResizeSignal = w.executeJavaScript(`new Promise((resolve, reject) => {
+              webview.addEventListener('resize', (e) => resolve({...e}), {once: true})
+            })`);
 
             const newWidth = 1234;
             const newHeight = 789;
-            div.style.width = `${newWidth}px`;
-            div.style.height = `${newHeight}px`;
-
+            await w.insertCSS(`webview { width: ${newWidth}px; height: ${newHeight}px; }`);
             const secondResizeEvent = await secondResizeSignal;
-            expect(secondResizeEvent.target).to.equal(webview);
             expect(secondResizeEvent.newWidth).to.equal(newWidth);
             expect(secondResizeEvent.newHeight).to.equal(newHeight);
           });
-          */
 
           it('emits focus event', async () => {
             await loadWebViewAndWaitForEvent(w, {


Test patch: