Giter Club home page Giter Club logo

Comments (2)

jeffposnick avatar jeffposnick commented on June 15, 2024

Just to correct my previous statement to be more accurate: disabling AppCache happens as part of the service worker activation algorithm, described as step 8 in https://w3c.github.io/ServiceWorker/#activation-algorithm. So it's once a registered service worker activates that AppCache is effectively disabled, not immediately following registration.

I would probably not recommend this, but if you did want to go down the path of trying to register a no-op service worker as early as possible, the best way to do it would be:

// Avoid re-registering the no-op service worker if there's
// already a service worker in control of the page.
if (!navigator.serviceWorker.controller) {
  navigator.serviceWorker.register('no-op-sw.js');
}

If there's something about the way your AppCache manifest is set up that would prevent any of the caching operations that need to be performed in init() from succeeding, that would in turn prevent the service worker registration from happening. I'd probably start by hanging a .catch() off of the init() promise chain and if you have some sort of centralizing logging or error reporting, use that to report any exceptions you catch. That might point to the underlying issue.

from sw-appcache-behavior.

kirill578 avatar kirill578 commented on June 15, 2024

I don't think init() will throws an exception. There is an internal try-catch. I checked our logs and I could not find any instances of the error messaged logged in the catch clause.

I am certain that the service worker is conflicting with app cache as I can see the app cache logs in the console while the service worker is registered. Given that it's going to be removed anyway we'll try to disable the app cache on the webview on our android app. Hopefully that will resolve this strange behavior.

in case anyone reads it in the future, there are two erros that I have seen what that happans. There is a 500 error to fetch the appcache.manifest file. And we keep getting a cache updated event.

from sw-appcache-behavior.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.