mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
fix(webkit): initialize popups on start (#693)
This commit is contained in:
parent
a64fc0e45f
commit
2ddc987854
@ -144,8 +144,13 @@ export class WKPageProxy {
|
||||
(session as any)[isPovisionalSymbol] = true;
|
||||
if (targetInfo.isProvisional && this._wkPage)
|
||||
this._wkPage.onProvisionalLoadStarted(session);
|
||||
if (targetInfo.isPaused)
|
||||
this._pageProxySession.send('Target.resume', { targetId: targetInfo.targetId }).catch(debugError);
|
||||
if (targetInfo.isPaused) {
|
||||
const resume = () => this._pageProxySession.send('Target.resume', { targetId: targetInfo.targetId }).catch(debugError);
|
||||
if (targetInfo.isProvisional || !this._pagePromise)
|
||||
resume();
|
||||
else
|
||||
this._pagePromise.then(resume);
|
||||
}
|
||||
}
|
||||
|
||||
private _onTargetDestroyed(event: Protocol.Target.targetDestroyedPayload) {
|
||||
|
@ -154,7 +154,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a target=_blank rel=noopener href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.waitForEvent('popup').then(async popup => { await popup.waitForLoadState(); return popup; }),
|
||||
page.$eval('a', a => a.click()),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
@ -166,13 +166,13 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a target=_blank rel=noopener href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
new Promise(x => page.once('popup', x)),
|
||||
page.waitForEvent('popup').then(async popup => { await popup.waitForLoadState(); return popup; }),
|
||||
page.click('a'),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||
});
|
||||
it.skip(WEBKIT || FFOX)('should not treat navigations as new popups', async({page, server}) => {
|
||||
it.skip(FFOX)('should not treat navigations as new popups', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a target=_blank rel=noopener href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
|
Loading…
Reference in New Issue
Block a user