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