Skip to content

Commit

Permalink
Replace document.origin with self.origin in cookie-helper.sub.js (#12377
Browse files Browse the repository at this point in the history
)

In anticipation of whatwg/dom#410
  • Loading branch information
foolip authored and mikewest committed Aug 9, 2018
1 parent f8ff0b7 commit 0e1ac36
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cookies/resources/cookie-helper.sub.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ function assert_cookie(origin, obj, name, value, present) {
}

// Remove the cookie named |name| from |origin|, then set it on |origin| anew.
// If |origin| matches `document.origin`, also assert (via `document.cookie`) that
// If |origin| matches `self.origin`, also assert (via `document.cookie`) that
// the cookie was correctly removed and reset.
function create_cookie(origin, name, value, extras) {
alert("Create_cookie: " + origin + "/cookies/resources/drop.py?name=" + name);
return credFetch(origin + "/cookies/resources/drop.py?name=" + name)
.then(_ => {
if (origin == document.origin)
if (origin == self.origin)
assert_dom_cookie(name, value, false);
})
.then(_ => {
return credFetch(origin + "/cookies/resources/set.py?" + name + "=" + value + ";path=/;" + extras)
.then(_ => {
if (origin == document.origin)
if (origin == self.origin)
assert_dom_cookie(name, value, true);
});
});
Expand Down Expand Up @@ -96,7 +96,7 @@ function set_prefixed_cookie_via_http_test(options) {

var name = options.prefix + "prefixtestcookie";
if (!options.origin) {
options.origin = document.origin;
options.origin = self.origin;
erase_cookie_from_js(name);
return postDelete;
} else {
Expand All @@ -116,12 +116,12 @@ window.SameSiteStatus = {
STRICT: "strict"
};

// Reset SameSite test cookies on |origin|. If |origin| matches `document.origin`, assert
// Reset SameSite test cookies on |origin|. If |origin| matches `self.origin`, assert
// (via `document.cookie`) that they were properly removed and reset.
function resetSameSiteCookies(origin, value) {
return credFetch(origin + "/cookies/resources/dropSameSite.py")
.then(_ => {
if (origin == document.origin) {
if (origin == self.origin) {
assert_dom_cookie("samesite_strict", value, false);
assert_dom_cookie("samesite_lax", value, false);
assert_dom_cookie("samesite_none", value, false);
Expand All @@ -130,7 +130,7 @@ function resetSameSiteCookies(origin, value) {
.then(_ => {
return credFetch(origin + "/cookies/resources/setSameSite.py?" + value)
.then(_ => {
if (origin == document.origin) {
if (origin == self.origin) {
assert_dom_cookie("samesite_strict", value, true);
assert_dom_cookie("samesite_lax", value, true);
assert_dom_cookie("samesite_none", value, true);
Expand Down Expand Up @@ -164,12 +164,12 @@ window.SecureStatus = {
BOTH_COOKIES: "2",
};

//Reset SameSite test cookies on |origin|. If |origin| matches `document.origin`, assert
//Reset SameSite test cookies on |origin|. If |origin| matches `self.origin`, assert
//(via `document.cookie`) that they were properly removed and reset.
function resetSecureCookies(origin, value) {
return credFetch(origin + "/cookies/resources/dropSecure.py")
.then(_ => {
if (origin == document.origin) {
if (origin == self.origin) {
assert_dom_cookie("alone_secure", value, false);
assert_dom_cookie("alone_insecure", value, false);
}
Expand Down

0 comments on commit 0e1ac36

Please sign in to comment.