QwikDev/qwik

[๐Ÿž] Firefox: navigator.serviceWorker is undefined

sotasan opened this issue ยท 3 comments

Which component is affected?

Qwik Runtime

Describe the bug

Hey,

when I visit the page in Firefox private browsing mode, it throws the error:
navigator.serviceWorker is undefined

Apparently service workers are not supported in Firefox's private browsing mode. The counter works like expected, but the error gets printed to the console regardless.

Reproduction

https://github.com/sotasan/unbiased-cherry

Steps to reproduce

  1. pnpm install
  2. pnpm build
  3. pnpm preview
  4. Open http://localhost:4173 in incognito Firefox

System Info

System:
    OS: macOS 14.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 777.31 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.7.2 - /opt/homebrew/bin/node
    npm: 10.5.0 - /opt/homebrew/bin/npm
    pnpm: 8.15.6 - /opt/homebrew/bin/pnpm
    bun: 1.1.3 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 123.0.6312.123
    Safari: 17.3
  npmPackages:
    @builder.io/qwik: ^1.5.2 => 1.5.2 
    @builder.io/qwik-city: ^1.5.2 => 1.5.2 
    undici: * => 6.12.0 
    vite: ^5.1.6 => 5.2.8

Additional Information

No response

There's not anything we can do about this, is there? Not really a bug?

Well, since it appears that the Counter is working fine, a check could be implemented, to see if the serviceWorker is defined, to supress the error. But I don't know if this would bring technical incompatibilities.

I have a fix for this