Skip to content

Commit

Permalink
fix(webkit): initialize popups on start
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Jan 28, 2020
1 parent aa2ecde commit 32c24e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"playwright": {
"chromium_revision": "733125",
"firefox_revision": "1018",
"webkit_revision": "1113"
"webkit_revision": "1118"
},
"scripts": {
"unit": "node test/test.js",
Expand Down
8 changes: 6 additions & 2 deletions src/webkit/wkPageProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ 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) {
if (targetInfo.isProvisional)
this._pageProxySession.send('Target.resume', { targetId: targetInfo.targetId }).catch(debugError);
else if (this._pagePromise)
this._pagePromise.then(() => this._pageProxySession.send('Target.resume', { targetId: targetInfo.targetId }).catch(debugError));
}
}

private _onTargetDestroyed(event: Protocol.Target.targetDestroyedPayload) {
Expand Down
6 changes: 3 additions & 3 deletions test/page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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([
Expand Down

0 comments on commit 32c24e1

Please sign in to comment.