Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Issue 5749 (Denying cookies for a specific path and accepting to

remove them deletes all cookies for a site)
http://code.google.com/p/fbug/issues/detail?id=5749
  • Loading branch information...
commit 70ed3a6d2dc1ee6130f65f3f1f53fd2c044d5537 1 parent fe488f5
@SebastianZ SebastianZ authored
View
44 extension/content/firebug/cookies/cookieModule.js
@@ -676,6 +676,12 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
return true;
},
+ /**
+ * Removes cookies defined for a website
+ * @param {Object} context context, in which the cookies are defined
+ * @param {Object} [filter] filter to define, which cookies should be removed
+ * (format: {session: true/false, host: string})
+ */
removeCookies: function(context, filter)
{
var panel = context.getPanel(panelName, true);
@@ -690,10 +696,7 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
{
var cookie = cookieEnumerator.getNext().QueryInterface(Ci.nsICookie2);
- var sessionCookieToRemove = filter && filter.session && cookie.isSession;
- var remove = !filter || sessionCookieToRemove;
-
- if (remove && !cookies[cookie.name])
+ if (!filter || ((!filter.session || cookie.isSession) && (!filter.host || filter.host == cookie.host)))
cookieManager.remove(cookie.host, cookie.name, cookie.path, false);
}
}
@@ -705,23 +708,23 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
{
var check = {value: false};
var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +
- prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO;
-
+ prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO;
+
if (!prompts.confirmEx(context.chrome.window, Locale.$STR("Firebug"),
Locale.$STR("cookies.confirm.removeall"), flags, "", "", "",
Locale.$STR("cookies.msg.Do_not_show_this_message_again"), check) == 0)
{
return;
}
-
+
// Update 'Remove Cookies' confirmation option according to the value
// of the dialog's "do not show again" checkbox.
Options.set(removeConfirmation, !check.value);
}
-
+
Firebug.CookieModule.removeCookies(context);
},
-
+
onRemoveAllSession: function(context)
{
if (Options.get(removeSessionConfirmation))
@@ -745,6 +748,29 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
Firebug.CookieModule.removeCookies(context, {session: true});
},
+ onRemoveAllFromHost: function(context, host)
+ {
+ if (Options.get(removeConfirmation))
+ {
+ var check = {value: false};
+ var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +
+ prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO;
+
+ if (!prompts.confirmEx(context.chrome.window, Locale.$STR("Firebug"),
+ Locale.$STRF("cookies.confirm.Remove_All_From_Host", [host]), flags, "", "", "",
+ Locale.$STR("cookies.msg.Do_not_show_this_message_again"), check) == 0)
+ {
+ return;
+ }
+
+ // Update 'Remove Cookies' confirmation option according to the value
+ // of the dialog's "do not show again" checkbox.
+ Options.set(removeConfirmation, !check.value);
+ }
+
+ Firebug.CookieModule.removeCookies(context, {host: host});
+ },
+
onCreateCookieShowTooltip: function(tooltip, context)
{
var host = context.window.location.host;
View
2  extension/content/firebug/cookies/cookiePermissions.js
@@ -154,7 +154,7 @@ var CookiePermissions = Obj.extend(Object,
case "default-deny":
if (Options.get("cookies.clearWhenDeny"))
- Firebug.CookieModule.onRemoveAll(context);
+ Firebug.CookieModule.onRemoveAllFromHost(context, location.host);
break;
}
View
8 extension/locale/en-US/cookies.properties
@@ -65,14 +65,18 @@ cookies.PermissionsIntro=Choose web sites where Cookies panel will be enabled or
cookies.SystemPages=System Pages
cookies.LocalFiles=Local Files
-# LOCALIZATION NOTE (cookies.confirm.removeall): Used in a confirmation dialog when cookies
-# are going to be deleted deleted (or permission is set do deny and cookies should be deleted).
+# LOCALIZATION NOTE (cookies.confirm.removeall): Used in a confirmation dialog when all cookies
+# of a website are going to be deleted (or permission is set do deny and cookies should be deleted).
cookies.confirm.removeall=Do you want to remove all cookies in the list?
# LOCALIZATION NOTE (cookies.confirm.removeallsession): Used in a confirmation dialog when
# all session cookies are going to be deleted
cookies.confirm.removeallsession=Do you want to remove all session cookies in the list?
+# LOCALIZATION NOTE (cookies.confirm.Remove_All_From_Host): Used in a confirmation dialog when cookies
+# from a specific host are going to be deleted (or permission is set do deny and cookies should be deleted).
+cookies.confirm.Remove_All_From_Host=Do you want to remove all cookies from %S?
+
# LOCALIZATION NOTE (cookies.msg.Do_not_show_this_message_again):
# Message within a confirmation dialog that is displayed when deleting cookies.
# This message is displayed next to a check-box that can be used to disabled this
Please sign in to comment.
Something went wrong with that request. Please try again.