Closed arronei closed 7 years ago
Note: I am not sure how this is going to work for interop. You might need to do this...
attribute (USVString or Cookie) cookie;
dictionary CookieInit {
USVString name;
required USVString value;
DOMString expirationDate;
};
[Exposed=Window]
[Constructor(CookieInit cookieInitDict)]
interface Cookie {
readonly attribute USVString name;
attribute USVString value;
readonly attribute USVString domain;
readonly attribute USVString path;
readonly attribute boolean secure;
readonly attribute boolean session;
attribute DOMString expirationDate;
stringifier USVString;
};
[Exposed=Window]
interface CookieJar{
stringifier attribute USVString value;
maplike<USVString, Cookie>;
};
partial interface Document {
[PutForwards=value] attribute CookieJar cookie;
};
Another option for the maplike<USVString, Cookie>; in the CookieJar would be to use a setlike
I am thinking more about this and I think it would be great to be able to access the new Cookie object by the [] notation. You would not be able to set using that notation.
document.cookie["foo"]; would get you the full Cookie object for "foo".
you would have to add to CookieJar: getter Cookie (USVString name);
@arronei thinking about this a bit more after our chat, and the only way I would be comfortable with this would feel correct would be if I could do both
document.cookie["foo"] = "bar"
and
document.cookie["foo"].expirationDate = Date.now()
setter USVString (Cookie or USVString);
This was fixed in cfad667
You need to update the
Document
interface and update the way cookie works.