bug 436077 - Preferences, merged with the central repo

This commit is contained in:
Daniel Brooks 2008-09-22 12:37:07 -05:00
Родитель 1f8d6ee203 d2ed3d6c9f
Коммит 373d5dc4df
12 изменённых файлов: 826 добавлений и 1 удалений

Просмотреть файл

@ -236,3 +236,14 @@ pref("gfx.color_management.mode", 0);
// don't allow JS to move and resize existing windows
pref("dom.disable_window_move_resize", true);
// controls which bits of private data to clear. by default we clear them all.
pref("privacy.sanitize.promptOnSanitize", false);
pref("privacy.item.cache", true);
pref("privacy.item.cookies", true);
pref("privacy.item.offlineApps", true);
pref("privacy.item.history", true);
pref("privacy.item.formdata", true);
pref("privacy.item.downloads", true);
pref("privacy.item.passwords", true);
pref("privacy.item.sessions", true);

Просмотреть файл

@ -1,3 +1,4 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -591,6 +592,11 @@ var BrowserUI = {
var bookmark = document.getElementById("bookmark-container");
var urllist = document.getElementById("urllist-container");
var container = document.getElementById("browser-container");
var prefs = document.getElementById("pref-pane");
// Make sure the UI elements are sized correctly since the window size can change
sidebar.left = container.boxObject.width;
sidebar.height = tablist.height = container.boxObject.height;
if (aMode == UIMODE_URLVIEW)
{
@ -647,6 +653,8 @@ var BrowserUI = {
if (dloads.getAttribute("src") == "")
dloads.setAttribute("src", "chrome://mozapps/content/downloads/downloads.xul");
PreferencesUI.init();
this._showPanel(aMode);
}
else if (aMode == UIMODE_TABS || aMode == UIMODE_CONTROLS) {
@ -794,6 +802,7 @@ var BrowserUI = {
case "cmd_closeTab":
case "cmd_actions":
case "cmd_panel":
case "cmd_sanitize":
isSupported = true;
break;
default:
@ -865,7 +874,8 @@ var BrowserUI = {
case "cmd_closeTab":
Browser.content.removeTab(Browser.content.browser);
break;
case "cmd_actions":
case "cmd_sanitize":
Sanitizer.sanitize();
break;
case "cmd_panel":
{

Просмотреть файл

@ -10,6 +10,22 @@ richlistitem[type="documenttab"] {
-moz-binding: url("chrome://browser/content/deckbrowser.xml#documenttab");
}
richpreflist {
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpreflist");
}
richpref[type="bool"] {
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-bool");
}
richpref[type="boolint"] {
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-boolint");
}
richpref[type="button"] {
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-button");
}
notification {
-moz-binding: url("chrome://browser/content/notification.xml#notification");
}

Просмотреть файл

@ -40,12 +40,15 @@
<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/richpref.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % prefsDTD SYSTEM "chrome://browser/locale/preferences.dtd">
%prefsDTD;
]>
<window id="main-window"
@ -61,6 +64,7 @@
<script type="application/x-javascript" src="chrome://browser/content/commandUtil.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser-ui.js"/>
<script type="application/x-javascript" src="chrome://browser/content/sanitize.js"/>
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>
@ -89,6 +93,7 @@
<command id="cmd_fullscreen" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_actions" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_panel" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_sanitize" oncommand="CommandUpdater.doCommand(this.id);"/>
<!-- scrolling -->
<command id="cmd_scrollPageUp" oncommand="CommandUpdater.doCommand(this.id);"/>
@ -288,6 +293,42 @@
</vbox>
</vbox>
<vbox id="addons-container" hidden="true" style="-moz-stack-sizing: ignore;" top="60" left="0">
<iframe id="addons-items-container" flex="1" src=""/>
</vbox>
<vbox id="pref-pane" hidden="true" style="-moz-stack-sizing: ignore;" top="60" left="0">
<hbox pack="center" id="buttons"/>
<richlistbox id="pref-list" seltype="single" flex="1">
<richlistitem class="section">
<label class="sectiontitle" value="&content.title;" crop="end" flex="1"/>
</richlistitem>
<richpref pref="permissions.default.image" title="&permissions.default.image.title;" type="boolint" on="1" off="2">
&permissions.default.image.description;
</richpref>
<richpref pref="javascript.enabled" type="bool" title="&javascript.enabled.title;">
&javascript.enabled.description;
</richpref>
<richpref pref="plugins.enabled" type="bool" title="&plugins.enabled.title;">
&plugins.enabled.description;
</richpref>
<richlistitem class="section">
<label class="sectiontitle" value="&privacy.title;" crop="end" flex="1"/>
</richlistitem>
<richpref pref="network.cookie.cookieBehavior" title="&network.cookie.cookieBehavior.title;" type="boolint" on="1" off="3">
&network.cookie.cookieBehavior.description;
</richpref>
<richpref title="&clear.private.data.title;" type="button">
&clear.private.data.description;
<button label="&clear.private.data.button;" command="cmd_sanitize"/>
</richpref>
</richlistbox>
<hbox pack="end">
<button label="Dismiss" oncommand="BrowserUI.show(PANELMODE_NONE);"/>
</hbox>
</vbox>
</stack>
<vbox id="findpanel-placeholder" sizetopopup="always">

Просмотреть файл

@ -0,0 +1,145 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla Mobile Browser.
-
- The Initial Developer of the Original Code is
- Mozilla Corporation.
- Portions created by the Initial Developer are Copyright (C) 2008
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Daniel Brooks <db48x@yahoo.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
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<!DOCTYPE bindings PUBLIC "-//MOZILLA//DTD XBL V1.0//EN" "http://www.mozilla.org/xbl">
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="richpref-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<implementation>
<constructor>
this.pref._setValue(this.pref.valueFromPreferences, false);
this.prefChanged();
</constructor>
<method name="inputChanged">
<body>
this.pref.value = this.value;
</body>
</method>
<method name="prefChanged">
<body>
this.value = this.pref.value;
</body>
</method>
<property name="value" onget="return this.input.value;" onset="return this.input.value = val;"/>
<field name="type">this.getAttribute("type");</field>
<field name="pref">document.getAnonymousElementByAttribute(this, "anonid", "pref");</field>
<field name="input">document.getAnonymousElementByAttribute(this, "anonid", "input");</field>
</implementation>
</binding>
<binding id="richpref-bool" extends="chrome://browser/content/preferences/richpref.xml#richpref-base">
<content>
<xul:hbox flex="1" class="prefbox">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container">
<xul:checkbox anonid="input" oncommand="inputChanged();"/>
</xul:hbox>
</xul:hbox>
<xul:preferences>
<xul:preference anonid="pref" xbl:inherits="name=pref,type,inverted" instantApply="true" onchange="prefChanged();"/>
</xul:preferences>
</content>
<implementation>
<property name="value" onget="return this.input.checked;" onset="return this.input.setChecked(val);"/>
</implementation>
</binding>
<binding id="richpref-boolint" extends="chrome://browser/content/preferences/richpref.xml#richpref-base">
<content>
<xul:hbox flex="1" class="prefbox">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container">
<xul:checkbox anonid="input" oncommand="inputChanged();"/>
</xul:hbox>
</xul:hbox>
<xul:preferences>
<xul:preference anonid="pref" xbl:inherits="name=pref,inverted" type="int" instantApply="true" onchange="prefChanged();"/>
</xul:preferences>
</content>
<implementation>
<method name="inputChanged">
<body>
this.pref.value = this.getAttribute(this.value ? "on" : "off");
</body>
</method>
<method name="prefChanged">
<body>
this.value = this.pref.value == this.getAttribute("on");
</body>
</method>
<property name="value" onget="return this.input.checked;" onset="return this.input.setChecked(val);"/>
</implementation>
</binding>
<binding id="richpref-button" extends="chrome://browser/content/preferences/richpref.xml#richpref-base">
<content>
<xul:hbox flex="1" class="prefbox">
<xul:vbox flex="1">
<xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
<xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
<children/>
</xul:label>
</xul:vbox>
<xul:hbox anonid="input-container">
<children includes="button"/>
</xul:hbox>
</xul:hbox>
<xul:preferences>
<xul:preference anonid="pref" xbl:inherits="name=pref,type,inverted" instantApply="true" onchange="prefChanged();"/>
</xul:preferences>
</content>
</binding>
</bindings>

Просмотреть файл

@ -0,0 +1,336 @@
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Firefox Sanitizer.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Giorgio Maone <g.maone@informaction.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
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
function Sanitizer() {}
Sanitizer.prototype = {
// warning to the caller: this one may raise an exception (e.g. bug #265028)
clearItem: function (aItemName)
{
if (this.items[aItemName].canClear)
this.items[aItemName].clear();
},
canClearItem: function (aItemName)
{
return this.items[aItemName].canClear;
},
_prefDomain: "privacy.item.",
getNameFromPreference: function (aPreferenceName)
{
return aPreferenceName.substr(this._prefDomain.length);
},
/**
* Deletes privacy sensitive data in a batch, according to user preferences
*
* @returns null if everything's fine; an object in the form
* { itemName: error, ... } on (partial) failure
*/
sanitize: function ()
{
var psvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var branch = psvc.getBranch(this._prefDomain);
var errors = null;
for (var itemName in this.items) {
var item = this.items[itemName];
if ("clear" in item && item.canClear && branch.getBoolPref(itemName)) {
// Some of these clear() may raise exceptions (see bug #265028)
// to sanitize as much as possible, we catch and store them,
// rather than fail fast.
// Callers should check returned errors and give user feedback
// about items that could not be sanitized
try {
item.clear();
} catch(er) {
if (!errors)
errors = {};
errors[itemName] = er;
dump("Error sanitizing " + itemName + ": " + er + "\n");
}
}
}
return errors;
},
items: {
cache: {
clear: function ()
{
const cc = Components.classes;
const ci = Components.interfaces;
var cacheService = cc["@mozilla.org/network/cache-service;1"]
.getService(ci.nsICacheService);
try {
cacheService.evictEntries(ci.nsICache.STORE_ANYWHERE);
} catch(er) {}
},
get canClear()
{
return true;
}
},
cookies: {
clear: function ()
{
var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager);
cookieMgr.removeAll();
},
get canClear()
{
return true;
}
},
offlineApps: {
clear: function ()
{
const Cc = Components.classes;
const Ci = Components.interfaces;
var cacheService = Cc["@mozilla.org/network/cache-service;1"].
getService(Ci.nsICacheService);
try {
cacheService.evictEntries(Ci.nsICache.STORE_OFFLINE);
} catch(er) {}
var storageManagerService = Cc["@mozilla.org/dom/storagemanager;1"].
getService(Ci.nsIDOMStorageManager);
storageManagerService.clearOfflineApps();
},
get canClear()
{
return true;
}
},
history: {
clear: function ()
{
var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
.getService(Components.interfaces.nsIBrowserHistory);
globalHistory.removeAllPages();
try {
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.notifyObservers(null, "browser:purge-session-history", "");
}
catch (e) { }
// Clear last URL of the Open Web Location dialog
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
try {
prefs.clearUserPref("general.open_location.last_url");
}
catch (e) { }
},
get canClear()
{
// bug 347231: Always allow clearing history due to dependencies on
// the browser:purge-session-history notification. (like error console)
return true;
}
},
formdata: {
clear: function ()
{
//Clear undo history of all searchBars
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
var windows = windowManagerInterface.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
var searchBar = windows.getNext().document.getElementById("searchbar");
if (searchBar) {
searchBar.value = "";
searchBar.textbox.editor.transactionManager.clear();
}
}
var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory2);
formHistory.removeAllEntries();
},
get canClear()
{
var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"]
.getService(Components.interfaces.nsIFormHistory2);
return formHistory.hasEntries;
}
},
downloads: {
clear: function ()
{
var dlMgr = Components.classes["@mozilla.org/download-manager;1"]
.getService(Components.interfaces.nsIDownloadManager);
dlMgr.cleanUp();
},
get canClear()
{
var dlMgr = Components.classes["@mozilla.org/download-manager;1"]
.getService(Components.interfaces.nsIDownloadManager);
return dlMgr.canCleanUp;
}
},
passwords: {
clear: function ()
{
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
.getService(Components.interfaces.nsILoginManager);
pwmgr.removeAllLogins();
},
get canClear()
{
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
.getService(Components.interfaces.nsILoginManager);
var count = pwmgr.countLogins("", "", ""); // count all logins
return (count > 0);
}
},
sessions: {
clear: function ()
{
// clear all auth tokens
var sdr = Components.classes["@mozilla.org/security/sdr;1"]
.getService(Components.interfaces.nsISecretDecoderRing);
sdr.logoutAndTeardown();
// clear plain HTTP auth sessions
var authMgr = Components.classes['@mozilla.org/network/http-auth-manager;1']
.getService(Components.interfaces.nsIHttpAuthManager);
authMgr.clearAll();
},
get canClear()
{
return true;
}
}
}
};
// "Static" members
Sanitizer.prefDomain = "privacy.sanitize.";
Sanitizer.prefPrompt = "promptOnSanitize";
Sanitizer.prefShutdown = "sanitizeOnShutdown";
Sanitizer.prefDidShutdown = "didShutdownSanitize";
Sanitizer._prefs = null;
Sanitizer.__defineGetter__("prefs", function()
{
return Sanitizer._prefs ? Sanitizer._prefs
: Sanitizer._prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch(Sanitizer.prefDomain);
});
// Shows sanitization UI
Sanitizer.showUI = function(aParentWindow)
{
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
#ifdef XP_MACOSX
ww.openWindow(null, // make this an app-modal window on Mac
#else
ww.openWindow(aParentWindow,
#endif
"chrome://browser/content/sanitize.xul",
"Sanitize",
"chrome,titlebar,centerscreen,modal",
null);
};
/**
* 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
*/
Sanitizer.sanitize = function(aParentWindow)
{
if (Sanitizer.prefs.getBoolPref(Sanitizer.prefPrompt)) {
Sanitizer.showUI(aParentWindow);
return null;
}
return new Sanitizer().sanitize();
};
Sanitizer.onStartup = function()
{
// we check for unclean exit with pending sanitization
Sanitizer._checkAndSanitize();
};
Sanitizer.onShutdown = function()
{
// we check if sanitization is needed and perform it
Sanitizer._checkAndSanitize();
};
// this is called on startup and shutdown, to perform pending sanitizations
Sanitizer._checkAndSanitize = function()
{
const prefs = Sanitizer.prefs;
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
prefs.setBoolPref(Sanitizer.prefDidShutdown, true);
}
};

Просмотреть файл

@ -0,0 +1,201 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Firefox Sanitizer.
#
# The Initial Developer of the Original Code is
# Ben Goodger.
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Goodger <ben@mozilla.org>
# Giorgio Maone <g.maone@informaction.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
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://global/skin/"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
%brandDTD;
%sanitizeDTD;
]>
<prefwindow id="SanitizeDialog" type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
dlgbuttons="accept,cancel"
title="&sanitizeDialog.title;"
style="width: &window.width;;"
ondialogaccept="gSanitizePromptDialog.sanitize();">
<prefpane id="SanitizeDialogPane" onpaneload="gSanitizePromptDialog.init();">
<stringbundle id="bundleBrowser" src="chrome://browser/locale/browser.properties"/>
<script type="application/x-javascript" src="chrome://browser/content/sanitize.js"/>
<script type="application/x-javascript">
<![CDATA[
var gSanitizePromptDialog = {
init: function ()
{
var s = new Sanitizer();
var sanitizePreferences = document.getElementById("sanitizePreferences");
for (var i = 0; i < sanitizePreferences.childNodes.length; ++i) {
var preference = sanitizePreferences.childNodes[i];
var name = s.getNameFromPreference(preference.name);
if (!s.canClearItem(name))
preference.disabled = true;
}
var bundleBrowser = document.getElementById("bundleBrowser");
document.documentElement.getButton("accept").label = bundleBrowser.getString("sanitizeButton");
},
sanitize: function ()
{
var s = new Sanitizer();
var sanitizePreferences = document.getElementById("sanitizePreferences");
var preference, name;
for (var i = 0; i < sanitizePreferences.childNodes.length; ++i) {
preference = sanitizePreferences.childNodes[i];
if (preference.value) {
name = s.getNameFromPreference(preference.name);
try {
s.clearItem(name);
} catch(er) {
dump(er + " sanitizing " + name);
// TODO: give user feedback about partially failed sanitization
}
}
}
},
onReadGeneric: function ()
{
var preferences = document.getElementById("sanitizePreferences");
var found = false;
for (var i = 0; i < preferences.childNodes.length; ++i) {
var preference = preferences.childNodes[i];
if (preference.value && !preference.disabled) {
found = true;
break;
}
}
try {
document.documentElement.getButton("accept").disabled = !found;
}
catch (e) { }
return undefined;
},
onReadDownloads: function (aEvent)
{
// Call the common function that will update the accept button if needed
this.onReadGeneric();
let historyPref = document.getElementById("privacy.item.history")
let downloadPref = document.getElementById("privacy.item.downloads");
// Disable the checkbox if history is selected
let downloads = document.getElementById("downloads-checkbox");
downloads.disabled = historyPref.value;
// The "Download History" checkbox is selected if either of the history or
// downloads preferences are true.
return historyPref.value || downloadPref.value;
},
updateDownloadHistory: function ()
{
// When toggling history, we automatically clear download history too,
// so we disable that control and set its value to true.
let downloads = document.getElementById("downloads-checkbox");
let history = document.getElementById("history-checkbox");
let s = new Sanitizer();
downloads.disabled = history.checked ||
!s.canClearItem("downloads");
if (history.checked)
downloads.checked = true;
},
};
]]>
</script>
<preferences id="sanitizePreferences">
<preference id="privacy.item.history" name="privacy.item.history" type="bool" readonly="true"/>
<preference id="privacy.item.formdata" name="privacy.item.formdata" type="bool" readonly="true"/>
<preference id="privacy.item.passwords" name="privacy.item.passwords" type="bool" readonly="true"/>
<preference id="privacy.item.downloads" name="privacy.item.downloads" type="bool" readonly="true"/>
<preference id="privacy.item.cookies" name="privacy.item.cookies" type="bool" readonly="true"/>
<preference id="privacy.item.cache" name="privacy.item.cache" type="bool" readonly="true"/>
<preference id="privacy.item.offlineApps" name="privacy.item.offlineApps" type="bool"/>
<preference id="privacy.item.sessions" name="privacy.item.sessions" type="bool" readonly="true"/>
</preferences>
<description>&sanitizeItems.label;</description>
<checkbox id="history-checkbox"
label="&itemHistory.label;"
accesskey="&itemHistory.accesskey;"
preference="privacy.item.history"
oncommand="gSanitizePromptDialog.updateDownloadHistory();"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox id="downloads-checkbox"
class="indent"
label="&itemDownloads.label;"
accesskey="&itemDownloads.accesskey;"
preference="privacy.item.downloads"
onsyncfrompreference="return gSanitizePromptDialog.onReadDownloads();"/>
<checkbox label="&itemFormSearchHistory.label;"
accesskey="&itemFormSearchHistory.accesskey;"
preference="privacy.item.formdata"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemCache.label;"
accesskey="&itemCache.accesskey;"
preference="privacy.item.cache"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemCookies.label;"
accesskey="&itemCookies.accesskey;"
preference="privacy.item.cookies"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemOfflineApps.label;"
accesskey="&itemOfflineApps.accesskey;"
preference="privacy.item.offlineApps"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemPasswords.label;"
accesskey="&itemPasswords.accesskey;"
preference="privacy.item.passwords"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
<checkbox label="&itemSessions.label;"
accesskey="&itemSessions.accesskey;"
preference="privacy.item.sessions"
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
</prefpane>
</prefwindow>

Просмотреть файл

@ -17,6 +17,9 @@ browser.jar:
branding/brand.dtd (locale/@AB_CD@/brand/brand.dtd)
branding/brand.properties (locale/@AB_CD@/brand/brand.properties)
% style chrome://mozapps/content/extensions/extensions.xul chrome://browser/skin/extensions.css
content/preferences/richpref.xml
* content/sanitize.xul
* content/sanitize.js
classic.jar:
% skin browser classic/1.0 %
@ -49,6 +52,8 @@ classic.jar:
images/right_sidebar_middle.png (skin/images/right_sidebar_middle.png)
images/right_sidebar_bottom.png (skin/images/right_sidebar_bottom.png)
images/right_buttons.png (skin/images/right_buttons.png)
section.css (skin/section.css)
richpref.css (skin/richpref.css)
@AB_CD@.jar:
% locale browser @AB_CD@ %
@ -56,6 +61,7 @@ classic.jar:
browser.properties (locale/@AB_CD@/browser.properties)
search.properties (locale/@AB_CD@/search.properties)
region.properties (locale/@AB_CD@/region.properties)
preferences.dtd (locale/@AB_CD@/preferences.dtd)
# Fennec-specific overrides of generic strings
* netError.dtd (locale/@AB_CD@/overrides/netError.dtd)
% override chrome://global/locale/netErrorApp.dtd chrome://browser/locale/netError.dtd

Просмотреть файл

@ -0,0 +1,13 @@
<!ENTITY content.title "Content">
<!ENTITY permissions.default.image.title "Load images">
<!ENTITY permissions.default.image.description "Makes websites pretty">
<!ENTITY javascript.enabled.title "Enable Javascript">
<!ENTITY javascript.enabled.description "Makes websites flashy">
<!ENTITY plugins.enabled.title "Enable Plugins">
<!ENTITY plugins.enabled.description "Makes websites annoying">
<!ENTITY privacy.title "Privacy">
<!ENTITY network.cookie.cookieBehavior.title "Save cookies">
<!ENTITY network.cookie.cookieBehavior.description "Delicious delicacies">
<!ENTITY clear.private.data.title "Clear private data">
<!ENTITY clear.private.data.button "Clear…">
<!ENTITY clear.private.data.description "Saves your hide">

Просмотреть файл

@ -544,3 +544,7 @@ findbar {
min-width: 280px;
padding: 10px;
}
#pref-pane {
background-color: rgba(123,125,123,0.9);
}

Просмотреть файл

@ -0,0 +1,20 @@
richlistitem.section {
font-size: 1.5em ! important;
color: white;
background-color: grey;
}
.prefbox {
padding: .3em .3em .3em .5em;
border: thin solid lightgrey;
}
.preftitle {
font-size: 1.2em ! important;
}
.prefdesc {
font-size: 1em ! important;
color: grey;
background-color: white;
}

Просмотреть файл

@ -0,0 +1,22 @@
section .section-head {
font-size: larger;
font-weight: bolder;
display: list-item;
}
section .section-indicator {
width: 16px;
height: 16px;
}
section image.closed {
list-style-image: url("chrome://global/skin/arrow/arrow-rit-sharp.gif");
}
section image.open {
list-style-image: url("chrome://global/skin/arrow/arrow-dn-sharp.gif");
}
section > vbox > vbox {
margin-left: 16px;
}