Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(chromium): allow PlzDedicatedWorker (#32711)

Dmitry Gozmancc302fa51507
diff --git a/packages/playwright-core/src/server/chromium/chromiumSwitches.ts b/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
index 34c89af653..5064145fb8 100644
--- a/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
+++ b/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
@@ -35,9 +35,8 @@ export const chromiumSwitches = [
// Translate - https://github.com/microsoft/playwright/issues/16126
// HttpsUpgrades - https://github.com/microsoft/playwright/pull/27605
// PaintHolding - https://github.com/microsoft/playwright/issues/28023
- // PlzDedicatedWorker - https://github.com/microsoft/playwright/issues/31747
// ThirdPartyStoragePartitioning - https://github.com/microsoft/playwright/issues/32230
- '--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,PlzDedicatedWorker,ThirdPartyStoragePartitioning',
+ '--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,ThirdPartyStoragePartitioning',
'--allow-pre-commit-input',
'--disable-hang-monitor',
'--disable-ipc-flooding-protection',
diff --git a/tests/page/interception.spec.ts b/tests/page/interception.spec.ts
index 338ac97a05..e50b5fdb08 100644
--- a/tests/page/interception.spec.ts
+++ b/tests/page/interception.spec.ts
@@ -123,20 +123,24 @@ it('should intercept network activity from worker', async function({ page, serve
it('should intercept worker requests when enabled after worker creation', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32355' }
-}, async function({ page, server, isAndroid, browserName }) {
+}, async ({ page, server, isAndroid, browserName }) => {
it.skip(isAndroid);
it.fixme(browserName === 'chromium');
await page.goto(server.EMPTY_PAGE);
server.setRoute('/data_for_worker', (req, res) => res.end('failed to intercept'));
const url = server.PREFIX + '/data_for_worker';
- await page.evaluate(url => {
- (window as any).w = new Worker(URL.createObjectURL(new Blob([`
- onmessage = function(e) {
- fetch("${url}").then(response => response.text()).then(console.log);
- };
- `], { type: 'application/javascript' })));
- }, url);
+ await Promise.all([
+ page.waitForEvent('worker'),
+ page.evaluate(url => {
+ (window as any).w = new Worker(URL.createObjectURL(new Blob([`
+ onmessage = function(e) {
+ fetch("${url}").then(response => response.text()).then(console.log);
+ };
+ `], { type: 'application/javascript' })));
+ }, url),
+ ]);
+ // Install the route **after** the worker has been created.
await page.route(url, route => {
route.fulfill({
status: 200,
@@ -150,7 +154,9 @@ it('should intercept worker requests when enabled after worker creation', {
expect(msg.text()).toBe('intercepted');
});
-it('should intercept network activity from worker 2', async function({ page, server, isAndroid }) {
+it('should intercept network activity from worker 2', {
+ annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31747' }
+}, async ({ page, server, isAndroid }) => {
it.skip(isAndroid);
const url = server.PREFIX + '/worker/worker.js';
diff --git a/tests/page/workers.spec.ts b/tests/page/workers.spec.ts
index 3b4d1bf5c8..ead741602b 100644
--- a/tests/page/workers.spec.ts
+++ b/tests/page/workers.spec.ts
@@ -225,7 +225,9 @@ it('should report and intercept network from nested worker', async function({ pa
await expect.poll(() => messages).toEqual(['{"foo":"not bar"}', '{"foo":"not bar"}']);
});
-it('should support extra http headers', async ({ page, server }) => {
+it('should support extra http headers', {
+ annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31747' }
+}, async ({ page, server }) => {
await page.setExtraHTTPHeaders({ foo: 'bar' });
const [worker, request1] = await Promise.all([
page.waitForEvent('worker'),