-
Notifications
You must be signed in to change notification settings - Fork 319
Improve "update via cache" and "worker type" in register algorithms. #1411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This makes the following changes: * updateViaCache is a live property. This is covered by the WPT registration-updateviacache.https.html. However we are missing tests for a register() that rejects with a new updateViaCache property. The desired behavior is to only update the property if register() resolves. * Changing worker type bypasses the byte-for-byte update check. This is covered by WPT update-registration-with-type.https.html. * Adds Worker type and updateViaCache to the job equivalence check. This probably can have a WPT for successive register() calls that vary these properties don’t get coalesced into a single job. Addresses w3c#1189, w3c#1408, w3c#1359, and w3c#1358.
Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job.
Adding the missing tests at web-platform-tests/wpt#17131 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small nit.
@@ -637,7 +637,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe | |||
|
|||
Note: The {{ServiceWorkerContainer/register(scriptURL, options)}} method creates or updates a [=/service worker registration=] for the given [=service worker registration/scope url=]. If successful, a [=/service worker registration=] ties the provided |scriptURL| to a [=service worker registration/scope url=], which is subsequently used for <a lt="handle fetch">navigation matching</a>. | |||
|
|||
<dfn method for="ServiceWorkerContainer"><code>register(|scriptURL|, |options|)</code></dfn> method *must* run these steps: | |||
The <dfn method for="ServiceWorkerContainer"><code>register(|scriptURL|, |options|)</code></dfn> method *must* run these steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah we're pretty inconsistent about this. Fine with adding them as we go along. I agree "The" is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, agreed.
docs/index.bs
Outdated
1. Set |hasUpdatedResources| to true if any of the following are true: | ||
1. |newestWorker| is null. | ||
1. |newestWorker|'s [=service worker/script url=] is not |url| or |newestWorker|'s [=service worker/type=] is not |job|'s [=worker type=]. | ||
1. |newestWorker|'s [=script resource map=][|url|]'s [=response/body=] is not byte-for-byte identical with |response|'s [=response/body=]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Since it's "any of the following", these should start "*" not "1.", since the order doesn't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Updated, and also revised slightly to set updateViaCache even when there is no byte-for-byte change (though we can discuss whether updateViaCache should trigger the update at all in another issue). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you create an issue to discuss the change?
…er. (#17131) Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job.
Thanks, filed #1414 ! |
…eViaCache and type in register., a=testonly Automatic update from web-platform-tests service worker: Add more tests for updateViaCache and type in register. (#17131) Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job. -- wp5At-commits: 8603f095d72afd7cbd78e875167ddabf38266fa0 wpt-pr: 17131
…eViaCache and type in register., a=testonly Automatic update from web-platform-tests service worker: Add more tests for updateViaCache and type in register. (#17131) Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job. -- wp5At-commits: 8603f095d72afd7cbd78e875167ddabf38266fa0 wpt-pr: 17131
…er. (#17131) Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job.
…eViaCache and type in register., a=testonly Automatic update from web-platform-tests service worker: Add more tests for updateViaCache and type in register. (#17131) Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job. -- wp5At-commits: 8603f095d72afd7cbd78e875167ddabf38266fa0 wpt-pr: 17131 UltraBlame original commit: 02fa74b9185dcf933168e8541f346268053515dd
…eViaCache and type in register., a=testonly Automatic update from web-platform-tests service worker: Add more tests for updateViaCache and type in register. (#17131) Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job. -- wp5At-commits: 8603f095d72afd7cbd78e875167ddabf38266fa0 wpt-pr: 17131 UltraBlame original commit: 02fa74b9185dcf933168e8541f346268053515dd
…eViaCache and type in register., a=testonly Automatic update from web-platform-tests service worker: Add more tests for updateViaCache and type in register. (#17131) Tests for w3c/ServiceWorker#1411. * updateViaCache only updates if register() resolves. * Changes to updateViaCache and type prevent the job from being coalesced to the previous job. -- wp5At-commits: 8603f095d72afd7cbd78e875167ddabf38266fa0 wpt-pr: 17131 UltraBlame original commit: 02fa74b9185dcf933168e8541f346268053515dd
This makes the following changes:
registration-updateviacache.https.html. However we are missing tests for a
register() that rejects with a new updateViaCache property. The desired
behavior is to only update the property if register() resolves.
by WPT update-registration-with-type.https.html.
probably can have a WPT for successive register() calls that vary these
properties don’t get coalesced into a single job.
Addresses #1189, #1408, #1359, and #1358.
Preview | Diff