[service-workers] Aggressive worker fetching in Chrome

Hello all,

I'm working on some tests for ServiceWorkers in the Web Platform Tests 
suite,
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 
then
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 
haven't
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!

Thanks,

Mike

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