[BUG] Firefox page.goto broken for sites with service worker
See original GitHub issueContext:
- Playwright Version: 1.0.2
- Operating System: Ubuntu 20.04 LTS
- Node version: 12.17.0
- Browser: Firefox
With the firefox
browser page.goto
seems to never be resolved nor rejected when a service worker is running.
On my project I’m using Workbox for my service worker, but you can see the bug with any service worker. The following example uses the Svelte website and its service worker. The OK message is never logged and we get a timeout error:
const { firefox } = require('playwright');
(async () => {
const browser = await firefox.launch();
const page = await browser.newPage();
await page.goto('https://svelte.dev');
console.log("Waiting for the service worker…");
await page.waitForTimeout(1000);
console.log("Service worker running, going to the homepage again…");
await page.goto('https://svelte.dev');
console.log("OK");
await browser.close();
})();
With the firefox
browser I have to disable the service worker for the OK message to finally show up:
const { firefox } = require('playwright');
(async () => {
const browser = await firefox.launch();
const page = await browser.newPage();
await page.addInitScript(
() => Object.defineProperty(navigator.serviceWorker, 'register', { get: Promise.reject })
);
await page.goto('https://svelte.dev');
console.log("Waiting even if no service worker to have the same test conditions…");
await page.waitForTimeout(1000);
console.log("Service worker not running, going to the homepage again…");
await page.goto('https://svelte.dev');
console.log("OK");
await browser.close();
})();
Note that there is no bug with the chromium
browser. I couldn’t test whith WebKit because of #2447.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (1 by maintainers)
Top Results From Across the Web
1430764 - Service Worker is not working properly
Go to https://www.chromestatus.com/features 2. Open console Actual results: Error during service worker registration: DOMException: The operation is ...
Read more >Pinned tabs that use ServiceWorkers and do not skipWaiting ...
The bug impacted page loads that happened when the target process type wasn't already running, which would be the case for non-fission-enabled Firefox...
Read more >Firefox refuses to connect to some websites (IndexedDB ...
The site's results suggest that your profile's QuotaManager storage is broken such that any site that uses a ServiceWorker may in turn be...
Read more >1665368 - Strict tracking protection breaks fetches from ...
It looks like the error is shared between a "real" network error and the "service worker" error, see https://searchfox.org/mozilla-central/rev/ ...
Read more >consider allowing service workers when cookie policy is "keep ...
My cookies were set to allow for session (delete when I close firefox). Added an exception for the site to "Allow" and it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This should be fixed in the next release. You can try using
playwright@next
to check whether this works today.@kishorambare As far as I remember I was using Playwright runner.
These logs you and @shirshGit are getting look like a totally different problem. You should definitively open a new issue.