зеркало из https://github.com/mozilla/pjs.git
Bug 488706: Migrate clear private data settings. r=mconnor
This commit is contained in:
Родитель
f7948763a8
Коммит
9a2f0589cf
|
@ -390,16 +390,28 @@ pref("privacy.popups.policy", 1);
|
|||
pref("privacy.popups.usecustom", true);
|
||||
pref("privacy.popups.firstTime", true);
|
||||
pref("privacy.popups.showBrowserMessage", true);
|
||||
|
||||
pref("privacy.item.history", true);
|
||||
pref("privacy.item.formdata", true);
|
||||
pref("privacy.item.passwords", false);
|
||||
pref("privacy.item.downloads", true);
|
||||
pref("privacy.item.cookies", true);
|
||||
pref("privacy.item.cache", true);
|
||||
pref("privacy.item.sessions", true);
|
||||
pref("privacy.item.offlineApps", false);
|
||||
pref("privacy.item.siteSettings", false);
|
||||
|
||||
pref("privacy.item.cookies", false);
|
||||
|
||||
pref("privacy.clearOnShutdown.history", true);
|
||||
pref("privacy.clearOnShutdown.formdata", true);
|
||||
pref("privacy.clearOnShutdown.passwords", false);
|
||||
pref("privacy.clearOnShutdown.downloads", true);
|
||||
pref("privacy.clearOnShutdown.cookies", true);
|
||||
pref("privacy.clearOnShutdown.cache", true);
|
||||
pref("privacy.clearOnShutdown.sessions", true);
|
||||
pref("privacy.clearOnShutdown.offlineApps", false);
|
||||
pref("privacy.clearOnShutdown.siteSettings", false);
|
||||
|
||||
pref("privacy.cpd.history", true);
|
||||
pref("privacy.cpd.formdata", true);
|
||||
pref("privacy.cpd.passwords", false);
|
||||
pref("privacy.cpd.downloads", true);
|
||||
pref("privacy.cpd.cookies", true);
|
||||
pref("privacy.cpd.cache", true);
|
||||
pref("privacy.cpd.sessions", true);
|
||||
pref("privacy.cpd.offlineApps", false);
|
||||
pref("privacy.cpd.siteSettings", false);
|
||||
|
||||
// What default should we use for the time span in the sanitizer:
|
||||
// 0 - Clear everything
|
||||
|
@ -410,6 +422,8 @@ pref("privacy.item.siteSettings", false);
|
|||
pref("privacy.sanitize.timeSpan", 1);
|
||||
pref("privacy.sanitize.sanitizeOnShutdown", false);
|
||||
|
||||
pref("privacy.sanitize.migrateFx3Prefs", false);
|
||||
|
||||
pref("network.proxy.share_proxy_settings", false); // use the same proxy settings for all protocols
|
||||
|
||||
pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontUse
|
||||
|
|
|
@ -1564,6 +1564,44 @@ function initializeSanitizer()
|
|||
// check it at next app start even if the browser exits abruptly
|
||||
gPrefService.QueryInterface(Ci.nsIPrefService).savePrefFile(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate Firefox 3.0 privacy.item prefs under one of these conditions:
|
||||
*
|
||||
* a) User has customized any privacy.item prefs
|
||||
* b) privacy.sanitize.sanitizeOnShutdown is set
|
||||
*/
|
||||
(function() {
|
||||
var prefService = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService);
|
||||
if (!prefService.getBoolPref("privacy.sanitize.migrateFx3Prefs")) {
|
||||
var itemBranch = prefService.getBranch("privacy.item.");
|
||||
var itemCount = { value: 0 };
|
||||
var itemArray = itemBranch.getChildList("", itemCount);
|
||||
|
||||
// See if any privacy.item prefs are set
|
||||
var doMigrate = itemArray.some(function (name) itemBranch.prefHasUserValue(name));
|
||||
// Or if sanitizeOnShutdown is set
|
||||
if (!doMigrate)
|
||||
doMigrate = prefService.getBoolPref("privacy.sanitize.sanitizeOnShutdown");
|
||||
|
||||
if (doMigrate) {
|
||||
var cpdBranch = prefService.getBranch("privacy.cpd.");
|
||||
var clearOnShutdownBranch = prefService.getBranch("privacy.clearOnShutdown.");
|
||||
itemArray.forEach(function (name) {
|
||||
try {
|
||||
cpdBranch.setBoolPref(name, itemBranch.getBoolPref(name));
|
||||
clearOnShutdownBranch.setBoolPref(name, itemBranch.getBoolPref(name));
|
||||
}
|
||||
catch(e) {
|
||||
Components.utils.reportError("Exception thrown during privacy pref migration: " + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
prefService.setBoolPref("privacy.sanitize.migrateFx3Prefs", true);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
function gotoHistoryIndex(aEvent)
|
||||
|
|
|
@ -53,7 +53,7 @@ Sanitizer.prototype = {
|
|||
return this.items[aItemName].canClear;
|
||||
},
|
||||
|
||||
prefDomain: "privacy.item.",
|
||||
prefDomain: "",
|
||||
|
||||
getNameFromPreference: function (aPreferenceName)
|
||||
{
|
||||
|
@ -488,7 +488,9 @@ Sanitizer._checkAndSanitize = function()
|
|||
if (prefs.getBoolPref(Sanitizer.prefShutdown) &&
|
||||
!prefs.prefHasUserValue(Sanitizer.prefDidShutdown)) {
|
||||
// this is a shutdown or a startup after an unclean exit
|
||||
new Sanitizer().sanitize() || // sanitize() returns null on full success
|
||||
var s = new Sanitizer();
|
||||
s.prefDomain = "privacy.clearOnShutdown.";
|
||||
s.sanitize() || // sanitize() returns null on full success
|
||||
prefs.setBoolPref(Sanitizer.prefDidShutdown, true);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -76,7 +76,6 @@ var gSanitizePromptDialog = {
|
|||
// This is used by selectByTimespan() to determine if the window has loaded.
|
||||
this._inited = true;
|
||||
|
||||
this.checkPrefs();
|
||||
var s = new Sanitizer();
|
||||
s.prefDomain = "privacy.cpd.";
|
||||
for (let i = 0; i < this.sanitizePreferences.childNodes.length; ++i) {
|
||||
|
@ -165,25 +164,6 @@ var gSanitizePromptDialog = {
|
|||
this.bundleBrowser.getString("sanitizeEverythingNoVisitsWarning");
|
||||
},
|
||||
|
||||
checkPrefs : function ()
|
||||
{
|
||||
var prefService = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefService);
|
||||
var cpdBranch = prefService.getBranch("privacy.cpd.");
|
||||
|
||||
// If we don't have defaults for the privacy.cpd branch,
|
||||
// clone the privacy.item (clear at shutdown) defaults
|
||||
if (cpdBranch.prefHasUserValue("history"))
|
||||
return;
|
||||
|
||||
var itemBranch = prefService.getBranch("privacy.item.");
|
||||
var itemCount = { value: 0 };
|
||||
var itemArray = itemBranch.getChildList("", itemCount);
|
||||
itemArray.forEach(function (name) {
|
||||
cpdBranch.setBoolPref(name, itemBranch.getBoolPref(name));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when the value of a preference element is synced from the actual
|
||||
* pref. Enables or disables the OK button appropriately.
|
||||
|
@ -278,7 +258,6 @@ var gSanitizePromptDialog = {
|
|||
// This is used by selectByTimespan() to determine if the window has loaded.
|
||||
this._inited = true;
|
||||
|
||||
this.checkPrefs();
|
||||
var s = new Sanitizer();
|
||||
s.prefDomain = "privacy.cpd.";
|
||||
for (let i = 0; i < this.sanitizePreferences.childNodes.length; ++i) {
|
||||
|
|
|
@ -61,15 +61,15 @@
|
|||
helpTopic="prefs-clear-private-data">
|
||||
|
||||
<preferences>
|
||||
<preference id="privacy.item.history" name="privacy.item.history" type="bool"/>
|
||||
<preference id="privacy.item.formdata" name="privacy.item.formdata" type="bool"/>
|
||||
<preference id="privacy.item.passwords" name="privacy.item.passwords" type="bool"/>
|
||||
<preference id="privacy.item.downloads" name="privacy.item.downloads" type="bool"/>
|
||||
<preference id="privacy.item.cookies" name="privacy.item.cookies" type="bool"/>
|
||||
<preference id="privacy.item.cache" name="privacy.item.cache" type="bool"/>
|
||||
<preference id="privacy.item.offlineApps" name="privacy.item.offlineApps" type="bool"/>
|
||||
<preference id="privacy.item.sessions" name="privacy.item.sessions" type="bool"/>
|
||||
<preference id="privacy.item.siteSettings" name="privacy.item.siteSettings" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.history" name="privacy.clearOnShutdown.history" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.formdata" name="privacy.clearOnShutdown.formdata" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.passwords" name="privacy.clearOnShutdown.passwords" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.downloads" name="privacy.clearOnShutdown.downloads" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.cookies" name="privacy.clearOnShutdown.cookies" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.cache" name="privacy.clearOnShutdown.cache" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.offlineApps" name="privacy.clearOnShutdown.offlineApps" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.sessions" name="privacy.clearOnShutdown.sessions" type="bool"/>
|
||||
<preference id="privacy.clearOnShutdown.siteSettings" name="privacy.clearOnShutdown.siteSettings" type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<description>&clearDataSettings2.label;</description>
|
||||
|
@ -85,26 +85,26 @@
|
|||
<row>
|
||||
<checkbox label="&itemBrowsingHistory.label;"
|
||||
accesskey="&itemBrowsingHistory.accesskey;"
|
||||
preference="privacy.item.history"/>
|
||||
preference="privacy.clearOnShutdown.history"/>
|
||||
<checkbox label="&itemCookies.label;"
|
||||
accesskey="&itemCookies.accesskey;"
|
||||
preference="privacy.item.cookies"/>
|
||||
preference="privacy.clearOnShutdown.cookies"/>
|
||||
</row>
|
||||
<row>
|
||||
<checkbox label="&itemDownloadHistory.label;"
|
||||
accesskey="&itemDownloadHistory.accesskey;"
|
||||
preference="privacy.item.downloads"/>
|
||||
preference="privacy.clearOnShutdown.downloads"/>
|
||||
<checkbox label="&itemActiveLogins.label;"
|
||||
accesskey="&itemActiveLogins.accesskey;"
|
||||
preference="privacy.item.sessions"/>
|
||||
preference="privacy.clearOnShutdown.sessions"/>
|
||||
</row>
|
||||
<row>
|
||||
<checkbox label="&itemFormSearchHistory.label;"
|
||||
accesskey="&itemFormSearchHistory.accesskey;"
|
||||
preference="privacy.item.formdata"/>
|
||||
preference="privacy.clearOnShutdown.formdata"/>
|
||||
<checkbox label="&itemCache.label;"
|
||||
accesskey="&itemCache.accesskey;"
|
||||
preference="privacy.item.cache"/>
|
||||
preference="privacy.clearOnShutdown.cache"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
@ -120,15 +120,15 @@
|
|||
<row>
|
||||
<checkbox label="&itemPasswords.label;"
|
||||
accesskey="&itemPasswords.accesskey;"
|
||||
preference="privacy.item.passwords"/>
|
||||
preference="privacy.clearOnShutdown.passwords"/>
|
||||
<checkbox label="&itemOfflineApps.label;"
|
||||
accesskey="&itemOfflineApps.accesskey;"
|
||||
preference="privacy.item.offlineApps"/>
|
||||
preference="privacy.clearOnShutdown.offlineApps"/>
|
||||
</row>
|
||||
<row>
|
||||
<checkbox label="&itemSitePreferences.label;"
|
||||
accesskey="&itemSitePreferences.accesskey;"
|
||||
preference="privacy.item.siteSettings"/>
|
||||
preference="privacy.clearOnShutdown.siteSettings"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
Загрузка…
Ссылка в новой задаче