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"].getService(Ci.nsICookieManager2);
10 function clear_cookies() {
11 cookie_manager.removeAll();
13 interactive("clear-cookies", "Permanently delete all existing cookies.",
16 I.minibuffer.message("Cookies cleared.");
19 define_label("COOKIE_LIFETIME_DEFAULT");
20 define_label("COOKIE_LIFETIME_SESSION");
21 define_label("COOKIE_LIFETIME_DAYS", "days");
22 define_label("COOKIE_LIFETIME_PROMPT");
24 define_special_variable("cookie_lifetime_policy",
26 switch (get_pref("network.cookie.lifetimePolicy")) {
28 return COOKIE_LIFETIME_DEFAULT;
30 return COOKIE_LIFETIME_PROMPT;
32 return COOKIE_LIFETIME_SESSION;
34 return COOKIE_LIFETIME_DAYS(get_pref("network.cookie.lifetime.days"));
40 switch (label_id(value)) {
41 case COOKIE_LIFETIME_DEFAULT:
42 session_pref("network.cookie.lifetimePolicy", 0);
44 case COOKIE_LIFETIME_PROMPT:
45 session_pref("network.cookie.lifetimePolicy", 1);
47 case COOKIE_LIFETIME_SESSION:
48 session_pref("network.cookie.lifetimePolicy", 2);
50 case COOKIE_LIFETIME_DAYS:
51 session_pref("network.cookie.lifetimePolicy", 3);
52 session_pref("network.cookie.lifetime.days", value.days);
56 "Specifies the default cookie lifetime policy.");