Skip to content
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

Cookie Store: Rework the SW change events API. #19616

Merged
merged 1 commit into from Nov 27, 2019

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Oct 10, 2019

Looking into two crashers revealed misconceptions in the initial Cookie
Store API implementation for change events in service works. This CL
reworks the API surface and brings it closer to other features.

The current API shape is that a SW version specifies the cookie changes
it's interested in by calling subscribeToCookieChanges() on the SW
global scope. getChangeSubscriptions() is available on the SW global
scope, and reflects the cumulative effect of all
subscribeToCookieChanges() calls during the install event.
Implementation errors aside, this API shape doesn't have a simple model
for continuously monitoring a cookie's change -- in the window between
deactivating an old SW version and activating the new version, there is
no obvious list of cookie change subscriptions.

The new API shape brings Cookie Store in line with the other SW APIs.
Cookie change subscriptions are associated with the SW registration, and
can be managed using
registration.cookies.{subscribe,unsubscribe,getSubscriptions}().

Unlike other SW APIs, the registration's subscriptions can be managed
from the SW itself, as well as from windows. We expect that most
applications will prefer to manage subscriptions from the SW code. This
exposes a rough edge -- a registration cannot be modified until the
first version of a SW is installed, so the methods listed above will
fail during a SW's first install event, but succeed during later install
events. We intend to evaluate the impact of this rough edge in an Origin
Trial.

Associated spec change: WICG/cookie-store#111

Bug: 729800, 956732, 963042
Change-Id: I106a7d9b2e50a7304c5ad126e0f699ecac1de531
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837146
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Staphany Park <staphany@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719476}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already reviewed downstream.

@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-1837146 branch 2 times, most recently from dba6836 to 54610a7 Compare October 17, 2019 17:31
@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-1837146 branch 2 times, most recently from d7c8b3b to cfcf365 Compare November 4, 2019 02:44
@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-1837146 branch 5 times, most recently from e29de4f to c721cba Compare November 25, 2019 23:27
@chromium-wpt-export-bot chromium-wpt-export-bot force-pushed the chromium-export-cl-1837146 branch 3 times, most recently from 53f3795 to 64738ec Compare November 27, 2019 02:03
Looking into two crashers revealed misconceptions in the initial Cookie
Store API implementation for change events in service works. This CL
reworks the API surface and brings it closer to other features.

The current API shape is that a SW version specifies the cookie changes
it's interested in by calling subscribeToCookieChanges() on the SW
global scope. getChangeSubscriptions() is available on the SW global
scope, and reflects the cumulative effect of all
subscribeToCookieChanges() calls during the install event.
Implementation errors aside, this API shape doesn't have a simple model
for continuously monitoring a cookie's change -- in the window between
deactivating an old SW version and activating the new version, there is
no obvious list of cookie change subscriptions.

The new API shape brings Cookie Store in line with the other SW APIs.
Cookie change subscriptions are associated with the SW registration, and
can be managed using
registration.cookies.{subscribe,unsubscribe,getSubscriptions}().

Unlike other SW APIs, the registration's subscriptions can be managed
from the SW itself, as well as from windows. We expect that most
applications will prefer to manage subscriptions from the SW code. This
exposes a rough edge -- a registration cannot be modified until the
first version of a SW is installed, so the methods listed above will
fail during a SW's first install event, but succeed during later install
events. We intend to evaluate the impact of this rough edge in an Origin
Trial.

Associated spec change: WICG/cookie-store#111

Bug: 729800, 956732, 963042
Change-Id: I106a7d9b2e50a7304c5ad126e0f699ecac1de531
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1837146
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Staphany Park <staphany@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719476}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants