2 * (C) Copyright 2008 Jeremy Maitin-Shepard
4 * Use, modification, and distribution are subject to the terms specified in the
8 var cookie_manager
= Cc
["@mozilla.org/cookiemanager;1"]
9 .getService(Ci
.nsICookieManager2
);
11 function clear_cookies () {
12 cookie_manager
.removeAll();
14 interactive("clear-cookies", "Permanently delete all existing cookies.",
17 I
.minibuffer
.message("Cookies cleared.");
20 define_label("COOKIE_LIFETIME_DEFAULT");
21 define_label("COOKIE_LIFETIME_SESSION");
22 define_label("COOKIE_LIFETIME_DAYS", "days");
23 define_label("COOKIE_LIFETIME_PROMPT");
25 define_special_variable("cookie_lifetime_policy",
27 switch (get_pref("network.cookie.lifetimePolicy")) {
29 return COOKIE_LIFETIME_DEFAULT
;
31 return COOKIE_LIFETIME_PROMPT
;
33 return COOKIE_LIFETIME_SESSION
;
35 return COOKIE_LIFETIME_DAYS(get_pref("network.cookie.lifetime.days"));
41 switch (label_id(value
)) {
42 case COOKIE_LIFETIME_DEFAULT
:
43 session_pref("network.cookie.lifetimePolicy", 0);
45 case COOKIE_LIFETIME_PROMPT
:
46 session_pref("network.cookie.lifetimePolicy", 1);
48 case COOKIE_LIFETIME_SESSION
:
49 session_pref("network.cookie.lifetimePolicy", 2);
51 case COOKIE_LIFETIME_DAYS
:
52 session_pref("network.cookie.lifetimePolicy", 3);
53 session_pref("network.cookie.lifetime.days", value
.days
);
57 "Specifies the default cookie lifetime policy.");