mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-01 08:34:02 +03:00
fix(chromium): do not wait forever for navigations that target another tab/download (#2068)
This commit is contained in:
parent
3251465657
commit
d7a1e013c6
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playwright-core",
|
||||
"version": "0.15.0-post",
|
||||
"version": "0.16.0-post",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -502,7 +502,8 @@ class FrameSession {
|
||||
}
|
||||
|
||||
_onFrameRequestedNavigation(payload: Protocol.Page.frameRequestedNavigationPayload) {
|
||||
this._page._frameManager.frameRequestedNavigation(payload.frameId, '');
|
||||
if (payload.disposition === 'currentTab')
|
||||
this._page._frameManager.frameRequestedNavigation(payload.frameId, '');
|
||||
}
|
||||
|
||||
_onFrameNavigatedWithinDocument(frameId: string, url: string) {
|
||||
|
@ -651,9 +651,7 @@ describe('Events.BrowserContext.Page', function() {
|
||||
]);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(CHROMIUM || WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
|
||||
// Chromium: Shift+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new window.
|
||||
it.fail(WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
|
||||
// WebKit: Shift+Click does not open a new window.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
@ -663,13 +661,11 @@ describe('Events.BrowserContext.Page', function() {
|
||||
context.waitForEvent('page'),
|
||||
page.click('a', { modifiers: ['Shift'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.opener()).toBe(null);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(CHROMIUM || WEBKIT)('should work with Ctrl-clicking', async({browser, server}) => {
|
||||
// Chromium: Ctrl+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new tab.
|
||||
it.fail(WEBKIT || FFOX)('should work with Ctrl-clicking', async({browser, server}) => {
|
||||
// Firefox: reports an opener in this case.
|
||||
// WebKit: Ctrl+Click does not open a new tab.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
@ -679,8 +675,7 @@ describe('Events.BrowserContext.Page', function() {
|
||||
context.waitForEvent('page'),
|
||||
page.click('a', { modifiers: [ MAC ? 'Meta' : 'Control'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.opener()).toBe(null);
|
||||
await context.close();
|
||||
});
|
||||
});
|
||||
|
@ -96,10 +96,9 @@ describe('Download', function() {
|
||||
expect(fs.readFileSync(path).toString()).toBe('Hello world');
|
||||
await page.close();
|
||||
})
|
||||
it.skip(FFOX).fail(CHROMIUM || WEBKIT)('should report alt-click downloads', async({browser, server}) => {
|
||||
it.skip(FFOX).fail(WEBKIT)('should report alt-click downloads', async({browser, server}) => {
|
||||
// Firefox does not download on alt-click by default.
|
||||
// Our WebKit embedder does not download on alt-click, although Safari does.
|
||||
// Chromium hangs waiting for navigation because of Page.frameRequestedNavigation.
|
||||
server.setRoute('/download', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/octet-stream');
|
||||
res.end(`Hello world`);
|
||||
|
@ -304,43 +304,6 @@ describe('Page.Events.Popup', function() {
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(true)('should work with Shift-clicking', async({browser, server}) => {
|
||||
// Chromium:
|
||||
// - Shift+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new window.
|
||||
// - New window does not report an opener.
|
||||
// WebKit: Shift+Click does not open a new window.
|
||||
// Firefox: new window does not report an opener.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.click('a', { modifiers: ['Shift'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
|
||||
await context.close();
|
||||
});
|
||||
it.fail(CHROMIUM || WEBKIT)('should work with Control-clicking', async({browser, server}) => {
|
||||
// Chromium:
|
||||
// - Shift+Click fires frameRequestedNavigation that never materializes
|
||||
// because it actually opens a new tab.
|
||||
// - New tab does not report an opener.
|
||||
// WebKit: Shift+Click does not open a new tab.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent('<a href="/one-style.html">yo</a>');
|
||||
const [popup] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.click('a', { modifiers: [MAC ? 'Meta' : 'Control'] }),
|
||||
]);
|
||||
expect(await page.evaluate(() => !!window.opener)).toBe(false);
|
||||
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
|
||||
await context.close();
|
||||
});
|
||||
it('should work with fake-clicking target=_blank and rel=noopener', async({browser, server}) => {
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
Loading…
Reference in New Issue
Block a user