#210: Consider general storage observer that works for cookies

Visit on Github.

Opened Oct 31, 2017

As discussed in https://github.com/w3ctag/design-reviews/issues/189, cookies are a very unique form of storage in our platform. The issue 189 was a review for IndexedDB Observers, and the TAG thought about how a unified "observer" across all storage items might work.

Cookies didn't really fit the model, but they clearly could use a similar observer-type thing (so devs can see when cookie values change).

Note, there are new API proposals around cookies that should be reviewed, e.g., https://github.com/WICG/async-cookies-api

Discussions

Discussed Jan 1, 2018 (See Github)

Travis: this is a derivative of our last discussion on storage observer... we couldn't get cookies and local storage to fit in that box... is there something else we need? The next step on this issue... formally async cookies api renamed to cookie store API. I've seen the explainer...

[ link? ]

... in general this looks really good. It's a relatively simple model for having rights and reads on cookies that happen asynchronously. I just noticed that there's a cookie observer...

Alex: there's a bunch of APIs... There is the notion of being able to listen for a cookie change... get an event for that. one of the scenarios we get with auth is that the auth tokens are held in cookies and apps have legal requirements to dump local serialized data when user logs out. detecting that requires this...

Travis: that looks only applicable to service worker...

Alex: agreed that's a good question to have an answer to.

Travis: more reading to do here before we have a more complete picture... more time. bump 2 weeks.

Peter: OK

--

Comment by @travisleithead Jan 10, 2018 (See Github)

Forgot to add this additional cookie proposal (https://patrickkettner.github.io/cookie-change-events/) though it doesn't help non-UI thread consumers.

Comment by @triblondon Feb 2, 2018 (See Github)

TAG London F2F discussion summary (extensive discussion!)

  • While we see the logic for a generalised storage observer abstraction over localstorage, cookies, filesystem and other storage backends, we don't think one is feasible.
  • We would like to strongly encourage the development of a better API for cookies. We note the existence of WICG's and @patrickkettner's proposals and we'd love to see one or both of these for TAG review soon.
  • Getting, setting and observing cookies are desirable features in service workers, and we'd like to see that functionality supported by a new cookie API.