mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(chromium): support main resource request interception for popups (#1449)
This commit is contained in:
parent
053bab1afd
commit
bae56ea9d3
@ -23,6 +23,7 @@ import * as network from '../network';
|
||||
import * as frames from '../frames';
|
||||
import * as platform from '../platform';
|
||||
import { Credentials } from '../types';
|
||||
import { CRTarget } from './crTarget';
|
||||
|
||||
export class CRNetworkManager {
|
||||
private _client: CRSession;
|
||||
@ -165,7 +166,16 @@ export class CRNetworkManager {
|
||||
redirectedFrom = request.request;
|
||||
}
|
||||
}
|
||||
const frame = event.frameId ? this._page._frameManager.frame(event.frameId) : workerFrame;
|
||||
let frame = event.frameId ? this._page._frameManager.frame(event.frameId) : workerFrame;
|
||||
|
||||
// Check if it's main resource request interception (targetId === main frame id).
|
||||
if (!frame && interceptionId && event.frameId === CRTarget.fromPage(this._page)._targetId) {
|
||||
// Main resource request for the page is being intercepted so the Frame is not created
|
||||
// yet. Precreate it here for the purposes of request interception. It will be updated
|
||||
// later as soon as the request contnues and we receive frame tree from the page.
|
||||
frame = this._page._frameManager.frameAttached(event.frameId, null);
|
||||
}
|
||||
|
||||
if (!frame) {
|
||||
if (interceptionId)
|
||||
this._client.send('Fetch.continueRequest', { requestId: interceptionId }).catch(debugError);
|
||||
|
@ -39,7 +39,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
|
||||
expect(userAgent).toBe('hey');
|
||||
expect(request.headers['user-agent']).toBe('hey');
|
||||
});
|
||||
it.fail(CHROMIUM || FFOX)('should respect routes from browser context', async function({browser, server}) {
|
||||
it.fail(FFOX)('should respect routes from browser context', async function({browser, server}) {
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user