Closed Bug 1884257 Opened 11 months ago Closed 11 months ago

navigator.serviceWorker.register

Categories

(Core :: DOM: Service Workers, defect)

Firefox 115
defect

Tracking

()

RESOLVED DUPLICATE of bug 1360870

People

(Reporter: adrianoenache, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0

Steps to reproduce:

Hello there

I'm trying to resolve this issue a some time now, and the problem happens only on firefox (115.8.0esr (64-bits)).

On Edge (122.0.2365.80 (64 bits)) and Chrome (122.0.6261.112 (64 bits)) the code works properly.

To reproduce clone the repository bellow on the branch bug/firefox-service-worker-register, this is a snapshot of my code and I will not change it.

Code on GitHub
https://github.com/adrianoenache/pwa/tree/bug/firefox-service-worker-register

Start your local server on the root and access
/webdev/service-workers.html

I'm using the live preview on VSCode to do this
(http://localhost:5500/webdev/service-workers.html) on your machine will be some like, if you do the same.

If works a picture black white of a dog will appear and when you reload a picture in colors of a cat will replace the dog image. If fail a image of a dog with sun glasses will appear.

On the example "MDN - Service-worker example" the code works but use a different approach, and I dont will go by this path.

I don't know what is wrong with my code don't work on Firefox and work on Edge and Chrome, please help me.

Actual results:

On the file checkServiceWorkerAndRegister.js line 11 the navigator does not resolve the promise

navigator.serviceWorker.register

The error

Service Worker my-pwa-app error on register!!! TypeError: ServiceWorker script at http://localhost:5500/webdev/serviceworker.js for scope http://localhost:5500/webdev/ threw an exception during script evaluation. checkServiceWorkerAndRegister.js:39:38
checkServiceWorkerAndRegister http://localhost:5500/webdev/js/pwa-code/checkServiceWorkerAndRegister.js:39
(assíncrono: promise callback)
checkServiceWorkerAndRegister http://localhost:5500/webdev/js/pwa-code/checkServiceWorkerAndRegister.js:37
initCode http://localhost:5500/webdev/js/my-app.js:11
<anonymous> http://localhost:5500/webdev/js/my-app.js:25
(assíncrono: EventListener.handleEvent)
<anonymous> http://localhost:5500/webdev/js/my-app.js:23

Expected results:

The promise supposed to be resolved like on Edge and Chrome browsers.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Service Workers' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Service Workers
Product: Firefox → Core

Thank you for the reproduction and pointers! Per https://github.com/adrianoenache/pwa/blob/bug/firefox-service-worker-register/webdev/js/pwa-code/pwaConfig.js you are trying to install a module service worker; we are hoping to fix bug 1360870 shortly to enable that. Duping to that bug.

Status: UNCONFIRMED → RESOLVED
Closed: 11 months ago
Duplicate of bug: 1360870
Resolution: --- → DUPLICATE

(In reply to Andrew Sutherland [:asuth] (he/him) from comment #2)

Thank you for the reproduction and pointers! Per https://github.com/adrianoenache/pwa/blob/bug/firefox-service-worker-register/webdev/js/pwa-code/pwaConfig.js you are trying to install a module service worker; we are hoping to fix bug 1360870 shortly to enable that. Duping to that bug.

*** This bug has been marked as a duplicate of bug 1360870 ***

Hello Andrew

I'm glad to help and thank you by the feedback.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: