Firefox don't swap cache of the applicationCache object and throws an error

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
6 years ago
3 years ago

People

(Reporter: u452416, Unassigned)

Tracking

({html5, js1.7})

18 Branch
x86
Linux
html5, js1.7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0
Build ID: 20130107224806

Steps to reproduce:

the HTML5 applicationCache object, has the method swapCache() that is used when a new version of the manifest file is Ready to update (applicationCache.status == applicationCache.UPDATEREADY) and need to get the new file from the server.


Actual results:

The method was not executed, and I got the error:
InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable


Expected results:

the browser should swap the file in the client-side by file downloaded.
(Reporter)

Updated

6 years ago
Component: Untriaged → Web Apps
Keywords: html5, js1.7

Updated

6 years ago
Component: Web Apps → DOM: Apps
Product: Firefox → Core

Updated

6 years ago
Component: DOM: Apps → Networking: Cache

Comment 1

6 years ago
sjc: do you have a concrete test case we can see here (either files or a URI)?  That would be very helpful.
(Reporter)

Comment 2

6 years ago
yes, I will make the file and put in my website. ok? Just one second, I'll adjust the file to you see the results.
(Reporter)

Comment 3

6 years ago
I finished. You just have to allow the page to cache content in your computer clickink in allow, after you click in the test button named "Update Cache"

Here is the URI I am using to test:
http://dev.erickribeiro.com.br/moz_832497.html

The manifest file is:
http://dev.erickribeiro.com.br/manifest.appcache
(Reporter)

Comment 4

6 years ago
In scripts used in a tutorial by Google, it shoud not throw an exception, but it does. W3 says that swapcache method do the following:
"step 4. Check that there is an application cache in the same application cache group as cache whose completeness flag is complete and that is newer than cache. If there is not, then raise an INVALID_STATE_ERR exception and abort these steps."



but it is impossible with the google code, because the method only is called when the event "updateready" is fired

(Note: The updateready event is ONLY fired when: "The resources listed in the manifest have been newly redownloaded, and the script can use swapCache() to switch to the new cache." )

here is the google code:
// Check if a new cache is available on page load.
window.addEventListener('load', function(e) {

  window.applicationCache.addEventListener('updateready', function(e) {
    if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
      // Browser downloaded a new app cache.
      // Swap it in and reload the page to get the new hotness.
      window.applicationCache.swapCache();
      if (confirm('A new version of this site is available. Load it?')) {
        window.location.reload();
      }
    } else {
      // Manifest didn't changed. Nothing new to server.
    }
  }, false);

}, false);


References:

http://www.w3.org/TR/2011/WD-html5-20110525/offline.html#dom-appcache-swapcache
http://www.w3.org/TR/2011/WD-html5-20110525/offline.html#event-appcache-updateready

Comment 5

5 years ago
I confirm that as of Firefox/24 calling applicationCache.swapCache() inside the onupdateready event causes a DOM Exception to be thrown: An attempt was made to use an object that is not, or is no longer, usable

I believe this is a dupe of 769171 ( https://bugzilla.mozilla.org/show_bug.cgi?id=769171 )

Comment 6

3 years ago
This is still occurring in FF 40. This is a critical bug.

Comment 7

3 years ago
We still see this bug in FF ESR (38.6) but not with FF 44. So this might have been fixed between these versions.
based on comment 7
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.