diff --git a/src/common/FrameManager.ts b/src/common/FrameManager.ts index 163c92d14874d..3016e24aa5fe1 100644 --- a/src/common/FrameManager.ts +++ b/src/common/FrameManager.ts @@ -259,6 +259,11 @@ export class FrameManager extends EventEmitter { ); if (frame) frame._updateClient(session); this.setupEventListeners(session); + session.send('Target.setAutoAttach', { + autoAttach: true, + waitForDebuggerOnStart: false, + flatten: true, + }); await this.initialize(session); } diff --git a/test/assets/inner-frame1.html b/test/assets/inner-frame1.html new file mode 100644 index 0000000000000..00f19ec166b19 --- /dev/null +++ b/test/assets/inner-frame1.html @@ -0,0 +1,10 @@ + diff --git a/test/assets/inner-frame2.html b/test/assets/inner-frame2.html new file mode 100644 index 0000000000000..9a236cc48f035 --- /dev/null +++ b/test/assets/inner-frame2.html @@ -0,0 +1 @@ + diff --git a/test/assets/main-frame.html b/test/assets/main-frame.html new file mode 100644 index 0000000000000..0c50feff85828 --- /dev/null +++ b/test/assets/main-frame.html @@ -0,0 +1,10 @@ + diff --git a/test/oopif.spec.ts b/test/oopif.spec.ts index b8e39b6973ccd..fbd1cdf5fccd3 100644 --- a/test/oopif.spec.ts +++ b/test/oopif.spec.ts @@ -31,6 +31,7 @@ describeChromeOnly('OOPIF', function () { args: (defaultBrowserOptions.args || []).concat([ '--site-per-process', '--remote-debugging-port=21222', + '--host-rules=MAP * 127.0.0.1', ]), }) ); @@ -263,6 +264,20 @@ describeChromeOnly('OOPIF', function () { expect(oopifs(context).length).toBe(1); expect(page.frames().length).toBe(2); }); + + it('should wait for inner OOPIFs', async () => { + const { server } = getTestState(); + await page.goto(`http://mainframe:${server.PORT}/main-frame.html`); + const frame2 = await page.waitForFrame((frame) => + frame.url().endsWith('inner-frame2.html') + ); + expect(oopifs(context).length).toBe(2); + expect(page.frames().filter((frame) => frame.isOOPFrame()).length).toBe(2); + expect( + await frame2.evaluate(() => document.querySelectorAll('button').length) + ).toStrictEqual(1); + }); + it('should load oopif iframes with subresources and request interception', async () => { const { server } = getTestState();