Bug 469158 - Remove the 'privacy.sanitize.promptOnSanitize' preference; r=gavin ui-r=beltzner

This commit is contained in:
Ehsan Akhgari 2009-01-02 03:30:49 +03:30
parent 31758b411a
commit 4f803cdd28
8 changed files with 26 additions and 104 deletions

View File

@ -417,7 +417,6 @@ pref("privacy.item.offlineApps", false);
// 4 - Today
pref("privacy.sanitize.timeSpan", 0);
pref("privacy.sanitize.sanitizeOnShutdown", false);
pref("privacy.sanitize.promptOnSanitize", true);
pref("network.proxy.share_proxy_settings", false); // use the same proxy settings for all protocols

View File

@ -87,8 +87,6 @@ var gContextMenu = null;
var gChromeState = null; // chrome state before we went into print preview
var gSanitizeListener = null;
var gAutoHideTabbarPrefListener = null;
var gBookmarkAllTabsHandler = null;
@ -1200,7 +1198,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
gNavToolbox.customizeChange = BrowserToolboxCustomizeChange;
// Set up Sanitize Item
gSanitizeListener = new SanitizeListener();
initializeSanitizer();
// Enable/Disable auto-hide tabbar
gAutoHideTabbarPrefListener = new AutoHideTabbarPrefListener();
@ -1400,9 +1398,6 @@ function BrowserShutdown()
Components.utils.reportError(ex);
}
if (gSanitizeListener)
gSanitizeListener.shutdown();
BrowserOffline.uninit();
OfflineApps.uninit();
DownloadMonitorPanel.uninit();
@ -1482,14 +1477,11 @@ function nonBrowserWindowDelayedStartup()
BrowserOffline.init();
// Set up Sanitize Item
gSanitizeListener = new SanitizeListener();
initializeSanitizer();
}
function nonBrowserWindowShutdown()
{
if (gSanitizeListener)
gSanitizeListener.shutdown();
BrowserOffline.uninit();
}
#endif
@ -1525,46 +1517,21 @@ AutoHideTabbarPrefListener.prototype =
}
}
function SanitizeListener()
function initializeSanitizer()
{
gPrefService.addObserver(this.promptDomain, this, false);
// Always use the label with ellipsis
var label = gNavigatorBundle.getString("sanitizeWithPromptLabel2");
document.getElementById("sanitizeItem").setAttribute("label", label);
this._defaultLabel = document.getElementById("sanitizeItem")
.getAttribute("label");
this._updateSanitizeItem();
if (gPrefService.prefHasUserValue(this.didSanitizeDomain)) {
gPrefService.clearUserPref(this.didSanitizeDomain);
const kDidSanitizeDomain = "privacy.sanitize.didShutdownSanitize";
if (gPrefService.prefHasUserValue(kDidSanitizeDomain)) {
gPrefService.clearUserPref(kDidSanitizeDomain);
// We need to persist this preference change, since we want to
// check it at next app start even if the browser exits abruptly
gPrefService.QueryInterface(Ci.nsIPrefService).savePrefFile(null);
}
}
SanitizeListener.prototype =
{
promptDomain : "privacy.sanitize.promptOnSanitize",
didSanitizeDomain : "privacy.sanitize.didShutdownSanitize",
observe: function (aSubject, aTopic, aPrefName)
{
this._updateSanitizeItem();
},
shutdown: function ()
{
gPrefService.removeObserver(this.promptDomain, this);
},
_updateSanitizeItem: function ()
{
var label = gPrefService.getBoolPref(this.promptDomain) ?
gNavigatorBundle.getString("sanitizeWithPromptLabel2") :
this._defaultLabel;
document.getElementById("sanitizeItem").setAttribute("label", label);
}
}
function gotoHistoryIndex(aEvent)
{
var index = aEvent.target.getAttribute("index");

View File

@ -23,6 +23,7 @@
# Ben Goodger <ben@mozilla.org>
# Giorgio Maone <g.maone@informaction.com>
# Johnathan Nightingale <johnath@mozilla.com>
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -344,7 +345,6 @@ Sanitizer.prototype = {
// "Static" members
Sanitizer.prefDomain = "privacy.sanitize.";
Sanitizer.prefPrompt = "promptOnSanitize";
Sanitizer.prefShutdown = "sanitizeOnShutdown";
Sanitizer.prefDidShutdown = "didShutdownSanitize";
@ -418,17 +418,12 @@ Sanitizer.showUI = function(aParentWindow)
* Deletes privacy sensitive data in a batch, optionally showing the
* sanitize UI, according to user preferences
*
* @returns null if everything's fine (no error or displayed UI, which
* should handle errors);
* an object in the form { itemName: error, ... } on (partial) failure
* @returns null (displayed UI, which should handle errors)
*/
Sanitizer.sanitize = function(aParentWindow)
{
if (Sanitizer.prefs.getBoolPref(Sanitizer.prefPrompt)) {
Sanitizer.showUI(aParentWindow);
return null;
}
return new Sanitizer().sanitize();
Sanitizer.showUI(aParentWindow);
return null;
};
Sanitizer.onStartup = function()
@ -450,7 +445,7 @@ Sanitizer._checkAndSanitize = function()
if (prefs.getBoolPref(Sanitizer.prefShutdown) &&
!prefs.prefHasUserValue(Sanitizer.prefDidShutdown)) {
// this is a shutdown or a startup after an unclean exit
Sanitizer.sanitize(null) || // sanitize() returns null on full success
new Sanitizer().sanitize() || // sanitize() returns null on full success
prefs.setBoolPref(Sanitizer.prefDidShutdown, true);
}
};

View File

@ -64,7 +64,7 @@ interface nsIBrowserGlue : nsISupports
* Deletes privacy sensitive data according to user preferences
*
* @param aParentWindow an optionally null window which is the parent of the
* sanitization dialog (if it has to be shown per user preferences)
* sanitization dialog
*
*/
void sanitize(in nsIDOMWindow aParentWindow);

View File

@ -23,6 +23,7 @@
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Jeff Walden <jwalden+code@mit.edu>
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -48,7 +49,6 @@ var gPrivacyPane = {
init: function ()
{
this._updateHistoryDaysUI();
this.updateClearNowButtonLabel();
},
// HISTORY
@ -257,28 +257,8 @@ var gPrivacyPane = {
* privacy.sanitize.sanitizeOnShutdown
* - true if the user's private data is cleared on startup according to the
* Clear Private Data settings, false otherwise
* privacy.sanitize.promptOnSanitize
* - true if sanitizing forces the user to accept a dialog, false otherwise
*/
/**
* Sets the label of the "Clear Now..." button according to the
* privacy.sanitize.promptOnSanitize preference. Read valueFromPreferences to
* only change the button when the underlying pref changes, since in the case
* of instantApply=false, the call to clearPrivateDataNow would result in the
* dialog appearing when the user just unchecked the "Ask me" checkbox.
*/
updateClearNowButtonLabel: function ()
{
var pref = document.getElementById("privacy.sanitize.promptOnSanitize");
var clearNowButton = document.getElementById("clearDataNow");
if (pref.valueFromPreferences)
clearNowButton.label = clearNowButton.getAttribute("label1"); // "Clear Now..."
else
clearNowButton.label = clearNowButton.getAttribute("label2"); // "Clear Now"
},
/**
* Displays the Clear Private Data settings dialog.
*/
@ -286,14 +266,11 @@ var gPrivacyPane = {
{
document.documentElement.openSubDialog("chrome://browser/content/preferences/sanitize.xul",
"", null);
this.updateClearNowButtonLabel();
},
/**
* Either displays a dialog from which individual parts of private data may be
* cleared, or automatically clears private data according to current
* CPD settings. The former happens if privacy.sanitize.promptOnSanitize is
* true, and the latter happens otherwise.
* Displays a dialog from which individual parts of private data may be
* cleared.
*/
clearPrivateDataNow: function ()
{

View File

@ -24,6 +24,7 @@
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Jeff Walden <jwalden+code@mit.edu>
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -94,10 +95,6 @@
<preference id="privacy.sanitize.sanitizeOnShutdown"
name="privacy.sanitize.sanitizeOnShutdown"
type="bool"/>
<preference id="privacy.sanitize.promptOnSanitize"
name="privacy.sanitize.promptOnSanitize"
type="bool"
onchange="gPrivacyPane.updateClearNowButtonLabel();"/>
</preferences>
@ -205,13 +202,9 @@
oncommand="gPrivacyPane.showClearPrivateDataSettings();"/>
</hbox>
<hbox id="askClearBox">
<checkbox id="askBeforeClear" flex="1"
preference="privacy.sanitize.promptOnSanitize"
label="&askBeforeClear.label;"
accesskey="&askBeforeClear.accesskey;"/>
<spacer flex="1"/>
<button id="clearDataNow" icon="clear"
label1="&clearDataNow.label;"
label2="&clearDataNow.label2;"
label="&clearDataNow.label;"
accesskey="&clearDataNow.accesskey;"
oncommand="gPrivacyPane.clearPrivateDataNow();"/>
</hbox>

View File

@ -52,12 +52,8 @@
<!ENTITY alwaysClear.label "Always clear my private data when I close &brandShortName;">
<!ENTITY alwaysClear.accesskey "w">
<!ENTITY askBeforeClear.label "Ask me before clearing private data">
<!ENTITY askBeforeClear.accesskey "A">
<!ENTITY clearDataSettings.label "Settings…">
<!ENTITY clearDataSettings.accesskey "t">
<!ENTITY clearDataNow.label "Clear Now…">
<!ENTITY clearDataNow.label2 "Clear Now">
<!ENTITY clearDataNow.accesskey "N">

View File

@ -22,6 +22,7 @@
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Giorgio Maone <g.maone@informaction.com>
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -255,7 +256,6 @@ Sanitizer.prototype = {
// "Static" members
Sanitizer.prefDomain = "privacy.sanitize.";
Sanitizer.prefPrompt = "promptOnSanitize";
Sanitizer.prefShutdown = "sanitizeOnShutdown";
Sanitizer.prefDidShutdown = "didShutdownSanitize";
@ -288,17 +288,12 @@ Sanitizer.showUI = function(aParentWindow)
* Deletes privacy sensitive data in a batch, optionally showing the
* sanitize UI, according to user preferences
*
* @returns null if everything's fine (no error or displayed UI, which
* should handle errors);
* an object in the form { itemName: error, ... } on (partial) failure
* @returns null (displayed UI, which should handle errors)
*/
Sanitizer.sanitize = function(aParentWindow)
{
if (Sanitizer.prefs.getBoolPref(Sanitizer.prefPrompt)) {
Sanitizer.showUI(aParentWindow);
return null;
}
return new Sanitizer().sanitize();
Sanitizer.showUI(aParentWindow);
return null;
};
Sanitizer.onStartup = function()
@ -320,7 +315,7 @@ Sanitizer._checkAndSanitize = function()
if (prefs.getBoolPref(Sanitizer.prefShutdown) &&
!prefs.prefHasUserValue(Sanitizer.prefDidShutdown)) {
// this is a shutdown or a startup after an unclean exit
Sanitizer.sanitize(null) || // sanitize() returns null on full success
new Sanitizer().sanitize() || // sanitize() returns null on full success
prefs.setBoolPref(Sanitizer.prefDidShutdown, true);
}
};