Re: [service-workers] Aggressive worker fetching in Chrome

On Fri, Mar 10, 2017 at 11:10 AM, Mike Pennisi <mike@bocoup.com> wrote:

> > The user agent may call this as often as it likes to check for updates.
>
> And further:
>
> > Note: Implementers may use the force bypass cache flag to aid debugging
> (e.g.
> > invocations from developer tools), and other specifications that extend
> > service workers may also use the flag on their own needs.
>
> If I'm interpreting them correctly, these two details mean that any of a
> Service Worker's lifecycle events (as well as a registration's
> `updatefound`
> event) may fire at any time.
>
Well, the lifecycle events would only fire in the *new* updated service
worker.  Once a service worker has activated, for example, its install
event better never fire again.

You are correct, though, these kind of weasel-words in the spec make
testing harder

> But to be able to test the implementation and validate that browsers are
> working as per spec (and again, assuming my assessment is correct), this is
> problematic. It makes it impossible to make any assertions about lifecycle
> events observed over a given time frame. Any test for "normal" operation
> (e.g.
> call `registration.update()` and observe `updatefound` followed by
> `install`,
> followed finally by `active`) could be interrupted by an independent
> invocation
> of Soft Update.  Would you agree? Or have I tripped myself up somewhere
> along
> the way?
>
In theory this is correct, but in practice its not a problem today AFAIK.

If a browser implementation decided to randomly update service workers then
they might start failing this kind of test.  That browser, however, could
also add an implementation-specific setting to disable this "random update"
feature.

I think we should test the spec'd update points and not worry about the
"update at any time" non-normative text for now.

Just my opinion.

Ben

Received on Friday, 10 March 2017 16:20:16 UTC