tor-browser

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

test_bug650522.js (1014B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 add_task(async () => {
      7  Services.prefs.setBoolPref("network.cookie.sameSite.schemeful", false);
      8  Services.prefs.setBoolPref("dom.security.https_first", false);
      9 
     10  var expiry = Date.now() + 10000;
     11 
     12  // Test our handling of host names with a single character at the beginning
     13  // followed by a dot.
     14  const cv = Services.cookies.add(
     15    "e.com",
     16    "/",
     17    "foo",
     18    "bar",
     19    false,
     20    false,
     21    true,
     22    expiry,
     23    {},
     24    Ci.nsICookie.SAMESITE_UNSET,
     25    Ci.nsICookie.SCHEME_HTTP
     26  );
     27  Assert.equal(cv.result, Ci.nsICookieValidation.eOK, "Valid cookie");
     28  Assert.equal(Services.cookies.countCookiesFromHost("e.com"), 1);
     29 
     30  CookieXPCShellUtils.createServer({ hosts: ["e.com"] });
     31  const cookies =
     32    await CookieXPCShellUtils.getCookieStringFromDocument("http://e.com/");
     33  Assert.equal(cookies, "foo=bar");
     34  Services.prefs.clearUserPref("dom.security.https_first");
     35 });