Skip to content

Respecify cookieStore.delete(name) semantics #257

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

Open
aamuley opened this issue May 8, 2025 · 1 comment
Open

Respecify cookieStore.delete(name) semantics #257

aamuley opened this issue May 8, 2025 · 1 comment

Comments

@aamuley
Copy link
Collaborator

aamuley commented May 8, 2025

Currently, cookieStore.delete(name) can only be called on a cookie where the rest of the uniquely identifying values (domain, path, partitioned) are the cookieStore API defaults

A developer may expect that if they set the following cookies:

cookieStore.set({name: "cookie1", value: "val", partitioned: true});
cookieStore.set({name: "cookie2", value: "val", path: "/v2"});
cookieStore.set({name: "cookie3", value: "val", domain: "sub.example.com", samesite: "none" });
document.cookie = "cookie4=val;" (executed at path /v2)

Calling cookieStore delete on each of these by name
cookieStore.delete("cookie[1-4]"); should work but it does not, the options that are different than the defaults are required to be specified with the cookieStore.delete(options) method

Is this actually intended behavior as it seems misleading and would make it particularly difficult to delete a cookie if we opted for a more limited cookieStore.get/All() that only returns a name and value as suggested in #241 and #238 and not the other unique options the delete method requires.

@annevk
Copy link
Collaborator

annevk commented May 9, 2025

This seems reasonable to improve, provided there are sufficient tests to catch all the nuances. I would not expect websites to rely on deleting to not work.

For deleting to become more natural I suspect we need more of the options to default to some kind of wildcard. This is also needed for the Delete-Cookie HTTP header proposal. I suspect this will require two things:

  1. Some API changes. At least how we handle the dictionary for delete() has to change.
  2. Some kind of model change. Today we delete by overwriting a cookie. As we move to wildcarding and potentially delete several cookies with a single operation, we'd need new infrastructure.

cc @RupinMittal @DCtheTall @johannhof @bakulf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants