netwerk/cookie/test/unit/test_parser_0019.js

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 const Cc = Components.classes;
     2 const Ci = Components.interfaces;
     4 Components.utils.import("resource://gre/modules/NetUtil.jsm");
     5 Components.utils.import("resource://gre/modules/Services.jsm");
     7 function inChildProcess() {
     8   return Cc["@mozilla.org/xre/app-info;1"]
     9            .getService(Ci.nsIXULRuntime)
    10            .processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
    11 }
    13 function run_test() {
    14   // Allow all cookies if the pref service is available in this process.
    15   if (!inChildProcess())
    16     Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
    18   let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
    20   let uri = NetUtil.newURI("http://example.org/");
    22   let set = "foo=b;max-age=3600, c=d;path=/";
    23   cs.setCookieStringFromHttp(uri, null, null, set, null, null);
    25   let expected = "foo=b";
    26   let actual = cs.getCookieStringFromHttp(uri, null, null);
    27   do_check_eq(actual, expected);
    28 }

mercurial