test_bug667087.js (925B)
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("dom.security.https_first", false); 8 var expiry = Date.now() + 10000; 9 10 // Test our handling of host names with a single character consisting only 11 // of a single character 12 const cv = Services.cookies.add( 13 "a", 14 "/", 15 "foo", 16 "bar", 17 false, 18 false, 19 true, 20 expiry, 21 {}, 22 Ci.nsICookie.SAMESITE_UNSET, 23 Ci.nsICookie.SCHEME_HTTP 24 ); 25 Assert.equal(cv.result, Ci.nsICookieValidation.eOK, "Valid cookie"); 26 Assert.equal(Services.cookies.countCookiesFromHost("a"), 1); 27 28 CookieXPCShellUtils.createServer({ hosts: ["a"] }); 29 const cookies = 30 await CookieXPCShellUtils.getCookieStringFromDocument("http://a/"); 31 Assert.equal(cookies, "foo=bar"); 32 Services.prefs.clearUserPref("dom.security.https_first"); 33 });