I am working on a trip planning application that used to implement offline support with the combination of appcache and localStorage. As soon as Service Worker became a viable option we started using it. Transition went without a hitch in Chrome (Chromium, Opera etc.) but Firefox (both 44 and 45) is posing some issues: Firefox registers new service worker but sill loads pages in its scope from the outdated appcache.
In other words, if you are lucky enough to never have stumbled upon our website, and if you open it for the first time in FF 44/45, you are going to get a new shiny service worker that takes care of all your offline needs. Life is great.
However if you had a misfortune to use Firefox before Service Worker was enabled you'd still have our website's older version in your appcache.
- you go to the welcome page - the service worker gets activated and it (supposedly) takes care of handling everything for the entire scope
- you log in, which redirects you one of the pages in SW scope (/ui) - it still should be handled by service worker, but instead Firefox suddenly realizes that it has that old appcache and without even trying to load anything from the network it loads the old content from the appcache
I would OK with that (alhough my reading of the Mozilla docs tells me that appcache should be ignored in the scope controlled by service worker) if that happened only once. Sadly Firefox does not even try to GET a manifest to check if that old appcache is up to date. If it did attempt to GET manifest, it would have received 404, which would invalidated the appcache (as it did on Chrome). I do not see anything like that on the wire (or on the server side).
To add insult to the injury Firefox console proudly anounces: The Application Cache API (AppCache) is deprecated and will be removed at a future date. Please consider using ServiceWorker for offline support. :-)
Simple refresh (F5) does load the current version of the page through the service worker. Sadly it only works once. After closing and reopening the tab the whole dance replays itself: service worker takes care of all the pages in the scope with the exception of the ones that used to have appcache manifest declaration.
Clearing the appcache (appcache clear in developer's console or through Settings UI) does remedy the situation, but I cannot possible suggest it to all our Firefox users.
I tried to find something Firefox bugzilla without much luck. If someone can find a relevant issue that would be great. For now we just had to disable SW support for Firefox.
Is there any way of signaling to Firefox that it should ignore the old appcache when in Service Worker scope?