tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug643051.html (1714B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=643051
      5 -->
      6 <head>
      7  <title>Test for Bug 643051</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=643051">Mozilla Bug 643051</a>
     13 <p id="display"></p>
     14 <div id="content" style="display: none">
     15  
     16 </div>
     17 <pre id="test">
     18 <script type="application/javascript">
     19 
     20 SimpleTest.waitForExplicitFinish();
     21 
     22 SpecialPowers.pushPrefEnv({
     23  "set": [
     24    // Bug 1617611: Fix all the tests broken by "cookies SameSite=lax by default"
     25    ["network.cookie.sameSite.laxByDefault", false],
     26  ]
     27 }, () => {
     28  /** Test for Bug 643051 */
     29  document.cookie = "a=; expires=Thu, 01-Jan-1970 00:00:01 GMT";  // clear cookie
     30  document.cookie = "a2=; expires=Thu, 01-Jan-1970 00:00:01 GMT";  // clear cookie
     31  document.cookie = "a3=; expires=Thu, 01-Jan-1970 00:00:01 GMT";  // clear cookie
     32 
     33  // single cookie, should work
     34  document.cookie = "a=bar";
     35  is(document.cookie, "a=bar", "Can't read stored cookie!");
     36 
     37  document.cookie = "a2=bar\na3=bar";
     38  is(document.cookie, "a=bar", "Wrong cookie value");
     39 
     40  document.cookie = "a2=baz; a3=bar";
     41  is(document.cookie, "a=bar; a2=baz", "Wrong cookie value");
     42 
     43  // clear cookies again to avoid affecting other tests
     44  document.cookie = "a=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
     45  document.cookie = "a2=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
     46  document.cookie = "a3=; expires=Thu, 01-Jan-1970 00:00:01 GMT";
     47 
     48  SpecialPowers.clearUserPref("network.cookie.sameSite.laxByDefault");
     49  SimpleTest.finish();
     50 });
     51 
     52 </script>
     53 </pre>
     54 </body>
     55 </html>