- From: Kenneth Rohde Christiansen <notifications@github.com>
- Date: Tue, 26 May 2020 01:11:34 -0700
- To: w3ctag/design-reviews <design-reviews@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3ctag/design-reviews/issues/469/633877021@github.com>
So the way the above works is because you have two dictionaries which are very similar but not named the same way and one is called options.
the `Options` ending is wrong here as it is more a `CookieListItemInit` as used by other specs instead of actually options to the behavior of the setter.
If you compare `CookieStoreSetExtraOptions` with `CookieListItem`, the only difference is the `secure` field.
```
dictionary CookieListItem {
required USVString name;
USVString value;
USVString? domain = null;
USVString path = "/";
DOMTimeStamp? expires = null;
boolean secure = true;
CookieSameSite sameSite = "strict";
};
```
```
dictionary CookieStoreSetExtraOptions : CookieStoreSetOptions {
required USVString name;
required USVString value;
};
dictionary CookieStoreSetOptions {
DOMTimeStamp? expires = null;
USVString? domain = null;
USVString path = "/";
CookieSameSite sameSite = "strict";
};
```
The `CookieStoreGetOptions` is actually options as they change the behavior of the `get` functions
```
dictionary CookieStoreGetOptions {
USVString name;
USVString url;
CookieMatchType matchType = "equals";
};
```
I don't find this method very useful
```
Promise<void> set(USVString name, USVString value,
optional CookieStoreSetOptions options = {});
```
It splits out name and value but keeps the rest in the options, but in JS this is much easier to just write an a initDict anyway
```js
cookieStore.set({ name, value, path: '/'})
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/469#issuecomment-633877021
Received on Tuesday, 26 May 2020 08:11:46 UTC