Bug 285836 - Add a confirm dialog for delete all cookies
MozReview-Commit-ID: 9aVTG5SrFkG
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -717,28 +717,40 @@ var gCookiesWindow = {
seln.clearSelection();
else {
seln.select(nextSelected);
this._tree.focus();
}
},
deleteAllCookies: function () {
+ let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
+ getService(Components.interfaces.nsIPromptService);
if (this._view._filtered) {
var rowCount = this._view.rowCount;
+ if (!prompts.confirm(null,
+ this._bundle.getString("confirmDeleteCookiesTitle"),
+ this._bundle.getFormattedString("confirmDeleteCookies", [rowCount]))) {
+ return;
+ }
var deleteItems = [];
for (var index = 0; index < rowCount; index++) {
deleteItems.push(this._view._getItemAtIndex(index));
}
this._view._removeItemAtIndex(0, rowCount);
this._view._rowCount = 0;
this._tree.treeBoxObject.rowCountChanged(0, -rowCount);
this.performDeletion(deleteItems);
}
else {
+ if (!prompts.confirm(null,
+ this._bundle.getString("confirmDeleteCookiesTitle"),
+ this._bundle.getString("confirmDeleteAllCookies"))) {
+ return;
+ }
this._cm.removeAll();
}
this._updateRemoveAllButton();
this.focusFilterBox();
},
onCookieKeyPress: function (aEvent) {
if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -116,16 +116,19 @@ forAnyConnection=Any type of connection
expireAtEndOfSession=At end of session
can=Allow
canAccessFirstParty=Allow first party only
canSession=Allow for Session
cannot=Block
noCookieSelected=<no cookie selected>
cookiesAll=The following cookies are stored on your computer:
cookiesFiltered=The following cookies match your search:
+confirmDeleteCookiesTitle=Remove Cookies
+confirmDeleteCookies=%S cookies will be removed. Are you sure?
+confirmDeleteAllCookies=ALL cookies will be removed. Are you sure?
# LOCALIZATION NOTE (removeSelectedCookies):
# Semicolon-separated list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
# If you need to display the number of selected elements in your language,
# you can use #1 in your localization as a placeholder for the number.
# For example this is the English string with numbers:
# removeSelectedCookied=Remove #1 Selected;Remove #1 Selected
removeSelectedCookies=Remove Selected;Remove Selected