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