Skip to content

Commit 5c55bfa

Browse files
authored
test: popup opened while a cross-site iframe is loading (#43919)
1 parent 478f14f commit 5c55bfa

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

‎tests/page/page-event-popup.spec.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,38 @@ it('PO-013 should report popup opened from iframes', async ({ page, server, brow
156156
]);
157157
expect(popup).toBeTruthy();
158158
});
159+
160+
it('PO-030 should finish loading after opening a popup while a cross-site iframe is loading', {
161+
annotation: [
162+
{ type: 'issue', description: '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/microsoft/playwright/issues/43629' },
163+
{ type: 'issue', description: 'https://crbug.com/581925564' },
164+
],
165+
}, async ({ page, server, isHeadlessShell, isElectron, isAndroid }) => {
166+
it.skip(isElectron || isAndroid, 'No defined site-isolation policy');
167+
it.fixme(isHeadlessShell, 'Without site isolation, which is the default in headless shell, the opener never fires the load event');
168+
169+
let finishFrame: () => void;
170+
const frameMayFinish = new Promise<void>(resolve => finishFrame = resolve);
171+
server.setRoute('/frame.html', async (req, res) => {
172+
await frameMayFinish;
173+
res.setHeader('Content-Type', 'text/html');
174+
res.end('<body>frame</body>');
175+
});
176+
server.setRoute('/opener.html', (req, res) => {
177+
res.setHeader('Content-Type', 'text/html');
178+
res.end(`
179+
<iframe src="${server.CROSS_PROCESS_PREFIX}/frame.html"></iframe>
180+
<script>window.open('${server.EMPTY_PAGE}')</script>
181+
`);
182+
});
183+
184+
const [popup] = await Promise.all([
185+
page.waitForEvent('popup'),
186+
page.goto(server.PREFIX + '/opener.html', { waitUntil: 'commit' }),
187+
]);
188+
// The iframe is still loading when the popup opens.
189+
finishFrame();
190+
await popup.waitForLoadState('load');
191+
await page.waitForLoadState('load');
192+
expect(await page.evaluate(() => document.readyState)).toBe('complete');
193+
});

‎tests/registry.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4190,6 +4190,7 @@ subsystem, add a row to the Subsystems table. Then update this file:
41904190
| `PO-027` | `library/popup.spec.ts` | should not throttle rAF in the opener page |
41914191
| `PO-028` | `library/popup.spec.ts` | should not throw when click closes popup |
41924192
| `PO-029` | `library/popup.spec.ts` | should load subresources of an about:blank popup when the opener has routes |
4193+
| `PO-030` | `page/page-event-popup.spec.ts` | should finish loading after opening a popup while a cross-site iframe is loading |
41934194

41944195
### PR — Proxy
41954196

0 commit comments

Comments
 (0)