2013-02-22 08:16:01 -08:00
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
|
|
|
2011-07-26 13:34:11 -07:00
|
|
|
function makeURI(str) {
|
|
|
|
return Components.classes["@mozilla.org/network/io-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIIOService)
|
|
|
|
.newURI(str, null, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
function run_test() {
|
2013-02-22 08:16:01 -08:00
|
|
|
// Allow all cookies.
|
|
|
|
Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
|
2011-07-26 13:34:11 -07:00
|
|
|
var serv = Components.classes["@mozilla.org/cookieService;1"]
|
|
|
|
.getService(Components.interfaces.nsICookieService);
|
|
|
|
var uri = makeURI("http://example.com/");
|
|
|
|
// Try an expiration time before the epoch
|
|
|
|
serv.setCookieString(uri, null, "test=test; path=/; domain=example.com; expires=Sun, 31-Dec-1899 16:00:00 GMT;", null);
|
|
|
|
do_check_eq(serv.getCookieString(uri, null), null);
|
|
|
|
// Now sanity check
|
|
|
|
serv.setCookieString(uri, null, "test2=test2; path=/; domain=example.com;", null);
|
|
|
|
do_check_eq(serv.getCookieString(uri, null), "test2=test2");
|
|
|
|
}
|