2007-03-22 10:30:00 -07:00
|
|
|
<?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>
|
2008-11-05 19:57:00 -08:00
|
|
|
# Johnathan Nightingale <johnath@mozilla.com>
|
2007-03-22 10:30:00 -07:00
|
|
|
#
|
|
|
|
# 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/"?>
|
2008-11-05 19:57:00 -08:00
|
|
|
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
<!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"
|
2008-11-05 19:57:00 -08:00
|
|
|
title="&sanitizeDialog2.title;"
|
2007-03-22 10:30:00 -07:00
|
|
|
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 ()
|
|
|
|
{
|
2008-11-05 19:57:00 -08:00
|
|
|
this.checkPrefs();
|
2007-03-22 10:30:00 -07:00
|
|
|
var s = new Sanitizer();
|
2008-11-05 19:57:00 -08:00
|
|
|
s.prefDomain = "privacy.cpd.";
|
2007-03-22 10:30:00 -07:00
|
|
|
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");
|
2008-11-05 19:57:00 -08:00
|
|
|
document.documentElement.getButton("accept").label = bundleBrowser.getString("sanitizeButton2");
|
2007-03-22 10:30:00 -07:00
|
|
|
},
|
|
|
|
|
2008-11-05 19:57:00 -08:00
|
|
|
checkPrefs : function ()
|
|
|
|
{
|
|
|
|
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
|
|
|
.getService(Components.interfaces.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));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
sanitize: function ()
|
|
|
|
{
|
2008-11-12 05:58:24 -08:00
|
|
|
// Update pref values before handing off to the sanitizer (bug 453440)
|
|
|
|
this.updatePrefs();
|
2007-03-22 10:30:00 -07:00
|
|
|
var s = new Sanitizer();
|
2008-11-05 19:57:00 -08:00
|
|
|
s.ignoreTimespan = false;
|
|
|
|
s.prefDomain = "privacy.cpd.";
|
2008-11-12 05:58:24 -08:00
|
|
|
try {
|
|
|
|
s.sanitize();
|
|
|
|
} catch (er) {
|
|
|
|
Components.utils.reportError("Exception during sanitize: " + er);
|
|
|
|
}
|
|
|
|
return true;
|
2007-03-22 10:30:00 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
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;
|
2008-05-05 12:54:29 -07:00
|
|
|
},
|
|
|
|
|
2008-05-06 11:52:09 -07:00
|
|
|
onReadDownloads: function (aEvent)
|
|
|
|
{
|
|
|
|
// Call the common function that will update the accept button if needed
|
|
|
|
this.onReadGeneric();
|
|
|
|
|
2008-11-05 19:57:00 -08:00
|
|
|
let historyPref = document.getElementById("privacy.cpd.history")
|
|
|
|
let downloadPref = document.getElementById("privacy.cpd.downloads");
|
2008-05-06 11:52:09 -07:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
},
|
|
|
|
|
2008-05-05 12:54:29 -07:00
|
|
|
updateDownloadHistory: function ()
|
|
|
|
{
|
|
|
|
// When toggling history, we automatically clear download history too,
|
2008-05-06 11:52:09 -07:00
|
|
|
// so we disable that control and set its value to true.
|
2008-05-05 12:54:29 -07:00
|
|
|
let downloads = document.getElementById("downloads-checkbox");
|
|
|
|
let history = document.getElementById("history-checkbox");
|
|
|
|
let s = new Sanitizer();
|
|
|
|
downloads.disabled = history.checked ||
|
|
|
|
!s.canClearItem("downloads");
|
2008-05-06 11:52:09 -07:00
|
|
|
if (history.checked)
|
|
|
|
downloads.checked = true;
|
2008-05-05 12:54:29 -07:00
|
|
|
},
|
2008-11-12 05:58:24 -08:00
|
|
|
|
|
|
|
updatePrefs : function ()
|
|
|
|
{
|
|
|
|
var tsPref = document.getElementById("privacy.sanitize.timeSpan");
|
|
|
|
Sanitizer.prefs.setIntPref("timeSpan", tsPref.value);
|
|
|
|
var sanitizePreferences = document.getElementById("sanitizePreferences");
|
|
|
|
var prefs = sanitizePreferences.rootBranch;
|
|
|
|
for (var i = 0; i < sanitizePreferences.childNodes.length; ++i) {
|
|
|
|
var p = sanitizePreferences.childNodes[i];
|
|
|
|
prefs.setBoolPref(p.name, p.value);
|
|
|
|
}
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<preferences id="sanitizePreferences">
|
2008-11-05 19:57:00 -08:00
|
|
|
<preference id="privacy.cpd.history" name="privacy.cpd.history" type="bool"/>
|
|
|
|
<preference id="privacy.cpd.formdata" name="privacy.cpd.formdata" type="bool"/>
|
|
|
|
<preference id="privacy.cpd.passwords" name="privacy.cpd.passwords" type="bool"/>
|
|
|
|
<preference id="privacy.cpd.downloads" name="privacy.cpd.downloads" type="bool"/>
|
|
|
|
<preference id="privacy.cpd.cookies" name="privacy.cpd.cookies" type="bool"/>
|
|
|
|
<preference id="privacy.cpd.cache" name="privacy.cpd.cache" type="bool"/>
|
|
|
|
<preference id="privacy.cpd.offlineApps" name="privacy.cpd.offlineApps" type="bool"/>
|
|
|
|
<preference id="privacy.cpd.sessions" name="privacy.cpd.sessions" type="bool"/>
|
|
|
|
</preferences>
|
|
|
|
|
|
|
|
<preferences id="nonItemPreferences">
|
|
|
|
<preference id="privacy.sanitize.timeSpan"
|
|
|
|
name="privacy.sanitize.timeSpan"
|
|
|
|
type="int"/>
|
2007-03-22 10:30:00 -07:00
|
|
|
</preferences>
|
|
|
|
|
2008-11-05 19:57:00 -08:00
|
|
|
<groupbox orient="vertical">
|
|
|
|
<caption label="&historySection.label;"/>
|
2008-11-16 10:24:35 -08:00
|
|
|
<hbox id="SanitizeDurationBox" align="center">
|
2008-11-05 19:57:00 -08:00
|
|
|
<label value="&clearDuration.label;" control="sanitizeDurationChoice" id="sanitizeDurationLabel"/>
|
|
|
|
<menulist id="sanitizeDurationChoice"
|
|
|
|
preference="privacy.sanitize.timeSpan">
|
|
|
|
<menupopup>
|
|
|
|
<menuitem label="&clearDuration.lastHour;" value="1"/>
|
|
|
|
<menuitem label="&clearDuration.last2Hours;" value="2"/>
|
|
|
|
<menuitem label="&clearDuration.last4Hours;" value="3"/>
|
|
|
|
<menuitem label="&clearDuration.today;" value="4"/>
|
|
|
|
<menuseparator/>
|
|
|
|
<menuitem label="&clearDuration.everything;" value="0"/>
|
|
|
|
</menupopup>
|
|
|
|
</menulist>
|
|
|
|
<label value="&clearDuration.suffix;" flex="1"/>
|
|
|
|
</hbox>
|
|
|
|
<hbox>
|
|
|
|
<vbox style="width: &column.width;">
|
|
|
|
<checkbox id="history-checkbox"
|
|
|
|
label="&itemVisitedPages.label;"
|
|
|
|
accesskey="&itemVisitedPages.accesskey;"
|
|
|
|
preference="privacy.cpd.history"
|
|
|
|
oncommand="gSanitizePromptDialog.updateDownloadHistory();"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
|
|
|
<checkbox id="downloads-checkbox"
|
|
|
|
label="&itemDownloadList.label;"
|
|
|
|
accesskey="&itemDownloadList.accesskey;"
|
|
|
|
preference="privacy.cpd.downloads"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadDownloads();"/>
|
|
|
|
<checkbox label="&itemFormSearchEntries.label;"
|
|
|
|
accesskey="&itemFormSearchEntries.accesskey;"
|
|
|
|
preference="privacy.cpd.formdata"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
|
|
|
</vbox>
|
|
|
|
<vbox style="width: &column.width;">
|
|
|
|
<checkbox label="&itemCookies.label;"
|
|
|
|
accesskey="&itemCookies.accesskey;"
|
|
|
|
preference="privacy.cpd.cookies"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
|
|
|
<checkbox label="&itemActiveLogins.label;"
|
|
|
|
accesskey="&itemActiveLogins.accesskey;"
|
|
|
|
preference="privacy.cpd.sessions"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
|
|
|
<checkbox label="&itemWebCache.label;"
|
|
|
|
accesskey="&itemWebCache.accesskey;"
|
|
|
|
preference="privacy.cpd.cache"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
|
|
|
</vbox>
|
|
|
|
</hbox>
|
|
|
|
</groupbox>
|
|
|
|
<groupbox orient="horizontal">
|
|
|
|
<caption label="&dataSection.label;"/>
|
|
|
|
<vbox style="width: &column.width;">
|
|
|
|
<checkbox label="&itemPasswords.label;"
|
|
|
|
accesskey="&itemPasswords.accesskey;"
|
|
|
|
preference="privacy.cpd.passwords"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
|
|
|
</vbox>
|
|
|
|
<vbox style="width: &column.width;">
|
|
|
|
<checkbox label="&itemOfflineApps.label;"
|
|
|
|
accesskey="&itemOfflineApps.accesskey;"
|
|
|
|
preference="privacy.cpd.offlineApps"
|
|
|
|
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
|
|
|
|
</vbox>
|
|
|
|
</groupbox>
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
</prefpane>
|
|
|
|
</prefwindow>
|