W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2017

[service-workers] Aggressive worker fetching in Chrome

From: Mike Pennisi <mike@bocoup.com>
Date: Thu, 9 Mar 2017 19:50:10 -0500
To: public-webapps@w3.org
Message-ID: <a2030a6d-c026-4449-df66-d9083920f737@bocoup.com>
Hello all,

I'm working on some tests for ServiceWorkers in the Web Platform Tests 
and I was wondering about the behavior I'm seeing from Chrome.

Basically, I am seeing the browser check for Service Worker script updates
after handling a fetch request. I am able to observe this because the server
is modifying a JavaScript comment in the requested source file for every
request, so simply registering a worker, waiting for it to activate, and 
triggering its `fetch` handler results in an (eventual) `updatefound` 
event on
the registration. The same Service Worker is used throughout--no termination
occurs between initial registration and handling of the `fetch` (verified by
logging to the developer's console at the top-level of the script).

I've been looking for spec language that dictates this behavior, but I 
been able to find anything so far. Beyond certain rules such as the 24-hour
expiry, the strategy for invalidating Service Worker scripts seems like it
could support implementation-specific tuning, so I wouldn't be surprised if
Chrome's behavior was not formally specified but still allowable. I 
wanted to
verify here, though, because I'll need to account for that kind of 
variation in
these tests!


Received on Friday, 10 March 2017 00:50:45 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:41 UTC