Closed Bug 1167325 Opened 9 years ago Closed 9 years ago

about:serviceworker update/unregister buttons don't seem to work on desktop (e10s enabled) and b2g

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1155153

People

(Reporter: bkelly, Unassigned)

References

Details

STR:

1) open a page with a sw
2) reload
3) modify the sw script
4) click update in about:serviceworkers
5) open page in new tab

At this point I would expect the new sw script to be running, but its not.

6) unregister the sw in about:serviceworkers
7) wipe storage for the origin by going to lock icon->more information->permissions->clear storage
8) open page in new tab

Again, the new sw script is not running.

9) restart browser
10) open page

Now that new script is running.

I think whats happening is we never actually kill the original SW worker thread or something.

I was testing this in e10s mode.
I observed this while trying to offline this page:

  http://pancaketheorem.com/stuff/bomp/

My code and resulting page:

  https://github.com/wanderview/who-visualized-the-bomp/blob/gh-pages/sw.js
  https://blog.wanderview.com/who-visualized-the-bomp/

Note, there are other problems in non-e10s.  The page overall works in e10s.
I tried calling .update() via the console and it seemed to update correctly.  So it appears to just be an issue with about:serviceworkers.
Summary: Service Worker updates don't seem to work without browser restart → about:serviceworker update button doesn't seem to work without browser restart
(In reply to Ben Kelly [:bkelly] from comment #2)
> I tried calling .update() via the console and it seemed to update correctly.
> So it appears to just be an issue with about:serviceworkers.

When e10s mode on about:sw is chrome process. The  programatic .update() works because it happens in the child process. This is more or less what we discussed at bug 1155153.
Per comment 3, dupe of Bug 1155153?
See Also: → 1155153
I think we should do something instead of just marking WONTFIX.  At a minimum the buttons should be disabled in e10s with a note on the page about not working in e10s.
Is this also happening on b2g?
Flags: needinfo?(jaoo)
Hi,

I've just checked it on b2g and the update process is properly made (through "update" button within Settings->Developer->Service Workers menu).

Please find below the traces corresponding to an example just updating from Service Worker version 9 to version 10:

I/Gecko   (  229):  -*- ServiceWorkers - Worker -*-: Install event
I/GeckoConsole(  229): Content JS LOG:  -*- ServiceWorkers - Worker -*-: Install event
I/GeckoConsole(  229):  
I/GeckoConsole(  229):     at debug (https://acperez.github.io/gecko-sw-test/service-worker.js:5:3)
I/Gecko   (  229):  -*- ServiceWorkers - Worker -*-: Install version 10
I/GeckoConsole(  229): Content JS LOG:  -*- ServiceWorkers - Worker -*-: Install version 10
I/GeckoConsole(  229):  
I/GeckoConsole(  229):     at debug (https://acperez.github.io/gecko-sw-test/service-worker.js:5:3)
I/Gecko   (  229):  -*- ServiceWorkers - Worker -*-: Activate event
I/GeckoConsole(  229): Content JS LOG:  -*- ServiceWorkers - Worker -*-: Activate event
I/GeckoConsole(  229):  
I/GeckoConsole(  229):     at debug (https://acperez.github.io/gecko-sw-test/service-worker.js:5:3)
Flags: needinfo?(jaoo)
(In reply to Fernando Jiménez Moreno [:ferjm] from comment #6)
> Is this also happening on b2g?

(In reply to Ben Kelly [:bkelly] from comment #2)
> I tried calling .update() via the console and it seemed to update correctly.
> So it appears to just be an issue with about:serviceworkers.

Fernando, Ben, the same is happening in b2g. The SW update via about:sw doesn't work, the SW update via ServiceWorkerRegistration.update() call does.
ok, let's block then Bug 1153312 too. I'll re-check it again. Thanks!
Just adding that also "Unregister" process is not working both b2g and desktop from about:sw
modifying the subject to gather comment 10
Summary: about:serviceworker update button doesn't seem to work without browser restart → about:serviceworker update/unregister buttons don't seem to work on desktop (e10s enabled) and b2g
(In reply to Noemí Freire (:noemi) from comment #7)
> Hi,
> 
> I've just checked it on b2g and the update process is properly made (through
> "update" button within Settings->Developer->Service Workers menu).
> 
> Please find below the traces corresponding to an example just updating from
> Service Worker version 9 to version 10:
> 
> I/Gecko   (  229):  -*- ServiceWorkers - Worker -*-: Install event
> I/GeckoConsole(  229): Content JS LOG:  -*- ServiceWorkers - Worker -*-:
> Install event
> I/GeckoConsole(  229):  
> I/GeckoConsole(  229):     at debug
> (https://acperez.github.io/gecko-sw-test/service-worker.js:5:3)
> I/Gecko   (  229):  -*- ServiceWorkers - Worker -*-: Install version 10
> I/GeckoConsole(  229): Content JS LOG:  -*- ServiceWorkers - Worker -*-:
> Install version 10
> I/GeckoConsole(  229):  
> I/GeckoConsole(  229):     at debug
> (https://acperez.github.io/gecko-sw-test/service-worker.js:5:3)
> I/Gecko   (  229):  -*- ServiceWorkers - Worker -*-: Activate event
> I/GeckoConsole(  229): Content JS LOG:  -*- ServiceWorkers - Worker -*-:
> Activate event
> I/GeckoConsole(  229):  
> I/GeckoConsole(  229):     at debug
> (https://acperez.github.io/gecko-sw-test/service-worker.js:5:3)

OK, just trying to clarify the working scenario described in comment 7 where "update" and "unregister" buttons were behaving as expected on b2g. Please find below the needed STRs to see that happening:
1- Open the Browser and register a SW
2- Re-load the page
3- Go to Settings->Developer->Service Workers. The SW is properly listed
4- Update the SW script
5- Hit update button, nothing happens.
6- Switch off the phone
7- Switch on the phone
8- The SW gets updated
9- Go to Settings->Developer->Service Workers. The SW is properly listed
10- Update the SW script
8- The SW gets updated 
Notice that the unregister button also works after switching off/on the device
(In reply to Noemí Freire (:noemi) from comment #12)
> Notice that the unregister button also works after switching off/on the
> device

I don't think we should need to switch the device off/on.  I had similar behavior with desktop where restarting the browser could cause the change to take effect.
Per offline discussion with :baku we will mark this bug as a DUP of bug 1155153. He is working on it. Thanks!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
(In reply to Ben Kelly [:bkelly] from comment #14)
> (In reply to Noemí Freire (:noemi) from comment #12)
> > Notice that the unregister button also works after switching off/on the
> > device
> 
> I don't think we should need to switch the device off/on.  I had similar
> behavior with desktop where restarting the browser could cause the change to
> take effect.

In B2G it is necessary to switch off/on the device so that ServiceWorkerRegistrar object reads “serviceworker.txt” file again so when the parent loads about:sw it has all the information about the ServiceWorkerRegistration object to be updated/unregistered
You need to log in before you can comment on or make changes to this bug.