Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

128
Visualizações
Why did the browser never update itself from zombie service worker?

In this brillant talk Alexander Pope: ServiceWorkers Outbreak: index-sw-9a4c43b4b47781ca619eaaf5ac1db.js | JSConf EU 2017: The presenter has a situation where a broken service worker gets installed, and its stuck in the broken state. The presenter tries a kill switch and an empty service worker to remedey it, but there are still some browsers permantely infected. I am trying to understand why it happened, and not do a similar thing.

Here is his code (from 22m:57s):

function onInstall(event) {
    event.waitUntil(
        install(config.version, config.assets)
            .catch((err) => {
                reportError(err);
                // Ok, you know what you're doing, Installing now....
            })
    );
}

It gets stuck because within the call to install he uses cache.addAll(), but long ago Chrome didnt support cache, so this error never bubbled up, and the browser thought it was installed correctly.

Now the browser is reponsible for fetching the sw.js file and checking if its byte different to the currently installed worker. The code to register the new sw.js file is outside of the service worker file. This means even if a service worker is broken, the browser should be able to fetch the new one, determine its different, register it, and activate it (eventually). The newer sw.js file could then check for the presence of cache API. So why are there some clients still in a broken state?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda