4 https://bugzilla.mozilla.org/show_bug.cgi?id=1425031
7 <title>Cookies set in content processes update immediately.
</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1425031">Mozilla Bug
1425031</a>
14 <div id=
"content" style=
"display: none">
15 <script type=
"application/javascript">
17 // Verify that cookie operations initiated by content processes do not cause
18 // asynchronous updates for those operations to be processed later.
20 SimpleTest.waitForExplicitFinish();
22 var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('file_1331680.js'));
24 var cookieString =
"cookie0=test";
25 let {COOKIE_ADDED, COOKIE_DELETED} = SpecialPowers.Ci.nsICookieNotification;
27 // Confirm the notify which represents the cookie is updating.
28 function confirmCookieOperation(op) {
32 is(op, COOKIE_ADDED,
"Confirm the cookie operation is added.");
33 is(document.cookie, cookieString,
"Confirm the cookie string is unaffected by the addition");
36 is(op, COOKIE_DELETED,
"Confirm the cookie operation is deleted.");
37 is(document.cookie, cookieString,
"Confirm the cookie string is unaffected by the deletion");
40 is(op, COOKIE_ADDED,
"Confirm the cookie operation is added.");
41 is(document.cookie, cookieString,
"Confirm the cookie string is unaffected by the second addition.");
42 document.cookie =
"cookie0=; expires=Thu, 01-Jan-1970 00:00:01 GMT;";
43 gScript.sendAsyncMessage('removeObserver');
44 SpecialPowers.clearUserPref(
"network.cookie.sameSite.laxByDefault");
50 function testSetCookie() {
51 document.cookie = cookieString;
52 is(document.cookie, cookieString,
"Confirm cookie string.");
53 document.cookie =
"cookie0=; expires=Thu, 01-Jan-1970 00:00:01 GMT;";
54 is(document.cookie,
"",
"Removed all cookies.");
55 document.cookie = cookieString;
56 is(document.cookie, cookieString,
"Confirm cookie string.");
59 // Bug
1617611: Fix all the tests broken by
"cookies SameSite=lax by default"
60 SpecialPowers.pushPrefEnv({
61 set: [[
"network.cookie.sameSite.laxByDefault", false]],
63 gScript.addMessageListener(
"cookieOperation", confirmCookieOperation);
64 gScript.addMessageListener(
"createObserver:return", testSetCookie);
65 gScript.sendAsyncMessage('createObserver');