Re: [w3c/ServiceWorker] Update shouldn't fail due to MIME check or 404 for the incumbent's worker scripts (#1374)

At https://github.com/w3c/ServiceWorker/pull/1377, @wanderview pointed out that Firefox's implementation considers error importScripts to be "no change" on the update check, while the patch will consider a change of success/error to be a "change".

I think Firefox's implementation could be reasonable. The importScript update check will result in "no change" on error importScripts, expecting the main script to change to remove the offending import. I did not consider this when filing this issue.

But there is some inconsistency in the current spec because the normal install/update doesn't require the importScripts to be non-errors. E.g., suppose the worker is ```try { importScripts('a.js`); importScripts('b.js'); } catch () {};```. Then the site changes so 'a.js' is a 404 and 'b.js' content changes. The worker would not be updated because the 404 aborts the byte-for-byte check.

A simpler issue is ```try { importScripts('404.js`); } catch () {};``` would not update if '404.js' is changed to serve something, since 404.js wouldn't be in the service worker's script resource map (only non-error importScripts() are stored).

I guess my patch makes for a more consistent system since error importScripts() are catchable so don't necessarily fail installation. But it comes at a cost of complexity: you must store the error imports now, or at least record that they were errors) and it's incompatible with Firefox's implementation.

I'm a bit undecided but I think I'm ok abandoning this and living with the inconsistency. One gentle change (which may be in-line with Firefox's implementation) is to consider failures to be "no change" but continue the update check. That would allow the first case above to update.

So the rule would be:
- Only success importScripts are remembered at installation, and compared against during the importScripts update check.
- Any failure importScripts don't affect the importScripts update check (consider "no change" and continue to the next script).

@makotoshimazu: do you know what Chrome's implementation is doing for error importScripts?

@jakearchibald @wanderview @asutherland WDYT?




-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1374#issuecomment-455057460

Received on Thursday, 17 January 2019 06:28:11 UTC