fix(firefox): disable cache when request interception is enabled (#30113)
Fixes #30000
This commit is contained in:
parent
a440800403
commit
4781b3c3a8
|
|
@ -366,7 +366,10 @@ export class FFBrowserContext extends BrowserContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
async doUpdateRequestInterception(): Promise<void> {
|
async doUpdateRequestInterception(): Promise<void> {
|
||||||
await this._browser.session.send('Browser.setRequestInterception', { browserContextId: this._browserContextId, enabled: !!this._requestInterceptor });
|
await Promise.all([
|
||||||
|
this._browser.session.send('Browser.setRequestInterception', { browserContextId: this._browserContextId, enabled: !!this._requestInterceptor }),
|
||||||
|
this._browser.session.send('Browser.setCacheDisabled', { browserContextId: this._browserContextId, cacheDisabled: !!this._requestInterceptor }),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosePersistent() {}
|
onClosePersistent() {}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,10 @@ export class FFNetworkManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
async setRequestInterception(enabled: boolean) {
|
async setRequestInterception(enabled: boolean) {
|
||||||
await this._session.send('Network.setRequestInterception', { enabled });
|
await Promise.all([
|
||||||
|
this._session.send('Network.setRequestInterception', { enabled }),
|
||||||
|
this._session.send('Page.setCacheDisabled', { cacheDisabled: enabled }),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onRequestWillBeSent(event: Protocol.Network.requestWillBeSentPayload) {
|
_onRequestWillBeSent(event: Protocol.Network.requestWillBeSentPayload) {
|
||||||
|
|
|
||||||
|
|
@ -348,9 +348,8 @@ it('should return body for prefetch script', async ({ page, server, browserName
|
||||||
expect(body.toString()).toBe('// Scripts will be pre-fetched');
|
expect(body.toString()).toBe('// Scripts will be pre-fetched');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should bypass disk cache when page interception is enabled', async ({ page, server, browserName }) => {
|
it('should bypass disk cache when page interception is enabled', async ({ page, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30000' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30000' });
|
||||||
it.fixme(browserName === 'firefox', 'Returns cached response.');
|
|
||||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
await page.route('**/api*', route => route.continue());
|
await page.route('**/api*', route => route.continue());
|
||||||
{
|
{
|
||||||
|
|
@ -400,9 +399,8 @@ it('should bypass disk cache when page interception is enabled', async ({ page,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should bypass disk cache when context interception is enabled', async ({ page, server, browserName }) => {
|
it('should bypass disk cache when context interception is enabled', async ({ page, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30000' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30000' });
|
||||||
it.fixme(browserName === 'firefox', 'Returns cached response.');
|
|
||||||
await page.context().route('**/api*', route => route.continue());
|
await page.context().route('**/api*', route => route.continue());
|
||||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -739,7 +739,7 @@ it('should respect cors overrides', async ({ page, server, browserName, isAndroi
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not auto-intercept non-preflight OPTIONS', async ({ page, server, isAndroid }) => {
|
it('should not auto-intercept non-preflight OPTIONS', async ({ page, server, isAndroid, browserName }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20469' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20469' });
|
||||||
it.fixme(isAndroid);
|
it.fixme(isAndroid);
|
||||||
|
|
||||||
|
|
@ -793,7 +793,10 @@ it('should not auto-intercept non-preflight OPTIONS', async ({ page, server, isA
|
||||||
expect.soft(text1).toBe('Hello');
|
expect.soft(text1).toBe('Hello');
|
||||||
expect.soft(text2).toBe('World');
|
expect.soft(text2).toBe('World');
|
||||||
// Preflight for OPTIONS is auto-fulfilled, then OPTIONS, then GET without preflight.
|
// Preflight for OPTIONS is auto-fulfilled, then OPTIONS, then GET without preflight.
|
||||||
expect.soft(requests).toEqual(['OPTIONS:/something', 'GET:/something']);
|
if (browserName === 'firefox')
|
||||||
|
expect.soft(requests).toEqual(['OPTIONS:/something', 'OPTIONS:/something', 'GET:/something']);
|
||||||
|
else
|
||||||
|
expect.soft(requests).toEqual(['OPTIONS:/something', 'GET:/something']);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue