netwerk/test/unit/test_bug667818.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 Cu.import("resource://gre/modules/Services.jsm");
     3 function makeURI(str) {
     4     return Components.classes["@mozilla.org/network/io-service;1"]
     5                      .getService(Components.interfaces.nsIIOService)
     6                      .newURI(str, null, null);
     7 }
     9 function run_test() {
    10     // Allow all cookies.
    11     Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
    12     var serv =   Components.classes["@mozilla.org/cookieService;1"]
    13                            .getService(Components.interfaces.nsICookieService);
    14     var uri = makeURI("http://example.com/");
    15     // Try an expiration time before the epoch
    16     serv.setCookieString(uri, null, "test=test; path=/; domain=example.com; expires=Sun, 31-Dec-1899 16:00:00 GMT;", null);
    17     do_check_eq(serv.getCookieString(uri, null), null);
    18     // Now sanity check
    19     serv.setCookieString(uri, null, "test2=test2; path=/; domain=example.com;", null);
    20     do_check_eq(serv.getCookieString(uri, null), "test2=test2");
    21 }

mercurial