Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2017-05-31 14:23:37 +02:00
Родитель e6ae2fa637 1a0d9545b9
Коммит eb742c507d
289 изменённых файлов: 12295 добавлений и 13339 удалений

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

@ -165,6 +165,7 @@ devtools/server/actors/utils/automation-timeline.js
# Ignore devtools files testing sourcemaps / code style # Ignore devtools files testing sourcemaps / code style
devtools/client/debugger/test/mochitest/code_binary_search.js devtools/client/debugger/test/mochitest/code_binary_search.js
devtools/client/debugger/test/mochitest/code_binary_search_absolute.js
devtools/client/debugger/test/mochitest/code_math.min.js devtools/client/debugger/test/mochitest/code_math.min.js
devtools/client/debugger/test/mochitest/code_math_bogus_map.js devtools/client/debugger/test/mochitest/code_math_bogus_map.js
devtools/client/debugger/test/mochitest/code_ugly* devtools/client/debugger/test/mochitest/code_ugly*

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

@ -701,6 +701,13 @@ pref("browser.preferences.instantApply", true);
// Toggling Search bar on and off in about:preferences // Toggling Search bar on and off in about:preferences
pref("browser.preferences.search", false); pref("browser.preferences.search", false);
// Use the new in-content about:preferences in Nightly only for now
#if defined(NIGHTLY_BUILD)
pref("browser.preferences.useOldOrganization", false);
#else
pref("browser.preferences.useOldOrganization", true);
#endif
// Once the Storage Management is completed. // Once the Storage Management is completed.
// (The Storage Management-related prefs are browser.storageManager.* ) // (The Storage Management-related prefs are browser.storageManager.* )
// The Offline(Appcache) Group section in about:preferences will be hidden. // The Offline(Appcache) Group section in about:preferences will be hidden.
@ -1651,6 +1658,7 @@ pref("extensions.formautofill.experimental", true);
pref("extensions.formautofill.experimental", false); pref("extensions.formautofill.experimental", false);
#endif #endif
pref("extensions.formautofill.addresses.enabled", true); pref("extensions.formautofill.addresses.enabled", true);
pref("extensions.formautofill.heuristics.enabled", false);
pref("extensions.formautofill.loglevel", "Warn"); pref("extensions.formautofill.loglevel", "Warn");
// Whether or not to restore a session with lazy-browser tabs. // Whether or not to restore a session with lazy-browser tabs.

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

@ -68,7 +68,7 @@ var gDataNotificationInfoBar = {
this._actionTaken = true; this._actionTaken = true;
// The advanced subpanes are only supported in the old organization, which will // The advanced subpanes are only supported in the old organization, which will
// be removed by bug 1349689. // be removed by bug 1349689.
if (Preferences.get("browser.preferences.useOldOrganization", false)) { if (Preferences.get("browser.preferences.useOldOrganization")) {
window.openAdvancedPreferences("dataChoicesTab", {origin: "dataReporting"}); window.openAdvancedPreferences("dataChoicesTab", {origin: "dataReporting"});
} else { } else {
window.openPreferences("privacy-reports", {origin: "dataReporting"}); window.openPreferences("privacy-reports", {origin: "dataReporting"});

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

@ -532,7 +532,7 @@ const gStoragePressureObserver = {
// The advanced subpanes are only supported in the old organization, which will // The advanced subpanes are only supported in the old organization, which will
// be removed by bug 1349689. // be removed by bug 1349689.
let win = gBrowser.ownerGlobal; let win = gBrowser.ownerGlobal;
if (Preferences.get("browser.preferences.useOldOrganization", false)) { if (Preferences.get("browser.preferences.useOldOrganization")) {
win.openAdvancedPreferences("networkTab", {origin: "storagePressure"}); win.openAdvancedPreferences("networkTab", {origin: "storagePressure"});
} else { } else {
win.openPreferences("panePrivacy", {origin: "storagePressure"}); win.openPreferences("panePrivacy", {origin: "storagePressure"});
@ -6305,7 +6305,7 @@ var OfflineApps = {
manage() { manage() {
// The advanced subpanes are only supported in the old organization, which will // The advanced subpanes are only supported in the old organization, which will
// be removed by bug 1349689. // be removed by bug 1349689.
if (Preferences.get("browser.preferences.useOldOrganization", false)) { if (Preferences.get("browser.preferences.useOldOrganization")) {
openAdvancedPreferences("networkTab", {origin: "offlineApps"}); openAdvancedPreferences("networkTab", {origin: "offlineApps"});
} else { } else {
openPreferences("panePrivacy", {origin: "offlineApps"}); openPreferences("panePrivacy", {origin: "offlineApps"});

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

@ -28,20 +28,20 @@ add_task(async function test_toolbar_element_restyles_on_activation() {
Services.focus.clearFocus(win2); Services.focus.clearFocus(win2);
let utils1 = SpecialPowers.getDOMWindowUtils(win1); let utils1 = SpecialPowers.getDOMWindowUtils(win1);
restyles.win1.initial = utils1.elementsRestyled; restyles.win1.initial = utils1.restyleGeneration;
let utils2 = SpecialPowers.getDOMWindowUtils(win2); let utils2 = SpecialPowers.getDOMWindowUtils(win2);
restyles.win2.initial = utils2.elementsRestyled; restyles.win2.initial = utils2.restyleGeneration;
// switch back to 1st window, and snapshot elementsStyled // switch back to 1st window, and snapshot elementsStyled
Services.focus.activeWindow = win1; Services.focus.activeWindow = win1;
restyles.win1.activate = utils1.elementsRestyled; restyles.win1.activate = utils1.restyleGeneration;
restyles.win2.deactivate = utils2.elementsRestyled; restyles.win2.deactivate = utils2.restyleGeneration;
// switch back to 2nd window, and snapshot elementsStyled // switch back to 2nd window, and snapshot elementsStyled
Services.focus.activeWindow = win2; Services.focus.activeWindow = win2;
restyles.win2.activate = utils2.elementsRestyled; restyles.win2.activate = utils2.restyleGeneration;
restyles.win1.deactivate = utils1.elementsRestyled; restyles.win1.deactivate = utils1.restyleGeneration;
is(restyles.win1.activate - restyles.win1.deactivate, 0, is(restyles.win1.activate - restyles.win1.deactivate, 0,
"No elements restyled when re-activating/deactivating a window"); "No elements restyled when re-activating/deactivating a window");

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

@ -158,8 +158,8 @@ AboutRedirector::NewChannel(nsIURI* aURI,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rv = aboutNewTabService->GetDefaultURL(url); rv = aboutNewTabService->GetDefaultURL(url);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} else if (path.EqualsLiteral("preferences") && sUseOldPreferences) { } else if (path.EqualsLiteral("preferences") && !sUseOldPreferences) {
url.AssignASCII("chrome://browser/content/preferences/in-content-old/preferences.xul"); url.AssignASCII("chrome://browser/content/preferences/in-content-new/preferences.xul");
} }
// fall back to the specified url in the map // fall back to the specified url in the map
if (url.IsEmpty()) { if (url.IsEmpty()) {

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

@ -22,7 +22,7 @@
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/applicationManager.js"/> src="chrome://browser/content/preferences/applicationManager.js"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content/applications.js"/> src="chrome://browser/content/preferences/in-content-new/applications.js"/>
<commandset id="appManagerCommandSet"> <commandset id="appManagerCommandSet">
<command id="cmd_remove" <command id="cmd_remove"

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

@ -0,0 +1,202 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from preferences.js */
/* import-globals-from ../../../base/content/aboutDialog-appUpdater.js */
// Load DownloadUtils module for convertByteUnits
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var gAdvancedPane = {
_inited: false,
init() {
function setEventListener(aId, aEventType, aCallback) {
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gAdvancedPane));
}
this._inited = true;
let version = AppConstants.MOZ_APP_VERSION_DISPLAY;
// Include the build ID if this is an "a#" (nightly) build
if (/a\d+$/.test(version)) {
let buildID = Services.appinfo.appBuildID;
let year = buildID.slice(0, 4);
let month = buildID.slice(4, 6);
let day = buildID.slice(6, 8);
version += ` (${year}-${month}-${day})`;
}
// Append "(32-bit)" or "(64-bit)" build architecture to the version number:
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let archResource = Services.appinfo.is64Bit
? "aboutDialog.architecture.sixtyFourBit"
: "aboutDialog.architecture.thirtyTwoBit";
let arch = bundle.GetStringFromName(archResource);
version += ` (${arch})`;
document.getElementById("version").textContent = version;
// Show a release notes link if we have a URL.
let relNotesLink = document.getElementById("releasenotes");
let relNotesPrefType = Services.prefs.getPrefType("app.releaseNotesURL");
if (relNotesPrefType != Services.prefs.PREF_INVALID) {
let relNotesURL = Services.urlFormatter.formatURLPref("app.releaseNotesURL");
if (relNotesURL != "about:blank") {
relNotesLink.href = relNotesURL;
relNotesLink.hidden = false;
}
}
let distroId = Services.prefs.getCharPref("distribution.id", "");
if (distroId) {
let distroVersion = Services.prefs.getCharPref("distribution.version");
let distroIdField = document.getElementById("distributionId");
distroIdField.value = distroId + " - " + distroVersion;
distroIdField.hidden = false;
let distroAbout = Services.prefs.getStringPref("distribution.about", "");
if (distroAbout) {
let distroField = document.getElementById("distribution");
distroField.value = distroAbout;
distroField.hidden = false;
}
}
if (AppConstants.MOZ_UPDATER) {
gAppUpdater = new appUpdater();
let onUnload = () => {
window.removeEventListener("unload", onUnload);
Services.prefs.removeObserver("app.update.", this);
};
window.addEventListener("unload", onUnload);
Services.prefs.addObserver("app.update.", this);
this.updateReadPrefs();
setEventListener("updateRadioGroup", "command",
gAdvancedPane.updateWritePrefs);
setEventListener("showUpdateHistory", "command",
gAdvancedPane.showUpdates);
}
},
/*
* Preferences:
*
* app.update.enabled
* - true if updates to the application are enabled, false otherwise
* app.update.auto
* - true if updates should be automatically downloaded and installed and
* false if the user should be asked what he wants to do when an update is
* available
* extensions.update.enabled
* - true if updates to extensions and themes are enabled, false otherwise
* browser.search.update
* - true if updates to search engines are enabled, false otherwise
*/
/**
* Selects the item of the radiogroup based on the pref values and locked
* states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* Radiogroup i = app.update.enabled
* ii = app.update.auto
*
* Disabled states:
* Element pref value locked disabled
* radiogroup i t/f f false
* i t/f *t* *true*
* ii t/f f false
* ii t/f *t* *true*
*/
updateReadPrefs() {
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value = "manual"; // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value = "auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value = "checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch (e) {
}
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
}
}
},
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
updateWritePrefs() {
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates for Desktop only
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
}
}
},
/**
* Displays the history of installed updates.
*/
showUpdates() {
gSubDialog.open("chrome://mozapps/content/update/history.xul");
},
observe(aSubject, aTopic, aData) {
if (AppConstants.MOZ_UPDATER) {
switch (aTopic) {
case "nsPref:changed":
this.updateReadPrefs();
break;
}
}
},
};

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

@ -0,0 +1,195 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- Advanced panel -->
#ifdef MOZ_UPDATER
<script type="application/javascript" src="chrome://browser/content/aboutDialog-appUpdater.js"/>
#endif
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content-new/advanced.js"/>
<preferences id="advancedPreferences" hidden="true" data-category="paneAdvanced">
<preference id="browser.preferences.advanced.selectedTabIndex"
name="browser.preferences.advanced.selectedTabIndex"
type="int"/>
<!-- Update tab -->
#ifdef MOZ_UPDATER
<preference id="app.update.enabled"
name="app.update.enabled"
type="bool"/>
<preference id="app.update.auto"
name="app.update.auto"
type="bool"/>
<preference id="app.update.disable_button.showUpdateHistory"
name="app.update.disable_button.showUpdateHistory"
type="bool"/>
#ifdef MOZ_MAINTENANCE_SERVICE
<preference id="app.update.service.enabled"
name="app.update.service.enabled"
type="bool"/>
#endif
#endif
<preference id="browser.search.update"
name="browser.search.update"
type="bool"/>
</preferences>
#ifdef HAVE_SHELL_SERVICE
<stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
#endif
<hbox id="header-advanced"
class="header"
hidden="true"
data-category="paneAdvanced">
<label class="header-name" flex="1">&paneUpdates.title;</label>
</hbox>
<!-- Update -->
<groupbox id="updateApp" data-category="paneAdvanced" hidden="true">
<caption><label>&updateApplication.label;</label></caption>
<hbox align="start">
<vbox flex="1">
<description>
&updateApplication.version.pre;<label id="version"/>&updateApplication.version.post;
<label id="releasenotes" class="learnMore text-link" hidden="true">&releaseNotes.link;</label>
</description>
<description id="distribution" class="text-blurb" hidden="true"/>
<description id="distributionId" class="text-blurb" hidden="true"/>
</vbox>
#ifdef MOZ_UPDATER
<spacer flex="1"/>
<vbox>
<button id="showUpdateHistory"
class="accessory-button"
label="&updateHistory2.label;"
accesskey="&updateHistory2.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
searchkeywords="&history.title; &history.intro;"/>
</vbox>
#endif
</hbox>
#ifdef MOZ_UPDATER
<vbox id="updateBox">
<deck id="updateDeck" orient="vertical">
<hbox id="checkForUpdates" align="center">
<spacer flex="1"/>
<button id="checkForUpdatesButton"
label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
oncommand="gAppUpdater.checkForUpdates();"/>
</hbox>
<hbox id="downloadAndInstall" align="center">
<spacer flex="1"/>
<button id="downloadAndInstallButton"
oncommand="gAppUpdater.startDownload();"/>
<!-- label and accesskey will be filled by JS -->
</hbox>
<hbox id="apply" align="center">
<spacer flex="1"/>
<button id="updateButton"
label="&update.updateButton.label3;"
accesskey="&update.updateButton.accesskey;"
oncommand="gAppUpdater.buttonRestartAfterDownload();"/>
</hbox>
<hbox id="checkingForUpdates" align="center">
<image class="update-throbber"/><label>&update.checkingForUpdates;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="downloading" align="center">
<image class="update-throbber"/><label>&update.downloading.start;</label><label id="downloadStatus"/><label>&update.downloading.end;</label>
</hbox>
<hbox id="applying" align="center">
<image class="update-throbber"/><label>&update.applying;</label>
</hbox>
<hbox id="downloadFailed" align="center">
<label>&update.failed.start;</label><label id="failedLink" class="text-link">&update.failed.linkText;</label><label>&update.failed.end;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
oncommand="gAppUpdater.checkForUpdates();"/>
</hbox>
<hbox id="adminDisabled" align="center">
<label>&update.adminDisabled;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="noUpdatesFound" align="center">
<label>&update.noUpdatesFound;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
oncommand="gAppUpdater.checkForUpdates();"/>
</hbox>
<hbox id="otherInstanceHandlingUpdates" align="center">
<label>&update.otherInstanceHandlingUpdates;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="manualUpdate" align="center">
<label>&update.manual.start;</label><label id="manualLink" class="text-link"/><label>&update.manual.end;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="unsupportedSystem" align="center">
<label>&update.unsupported.start;</label><label id="unsupportedLink" class="text-link">&update.unsupported.linkText;</label><label>&update.unsupported.end;</label>
<spacer flex="1"/>
<button label="&update.checkForUpdatesButton.label;"
accesskey="&update.checkForUpdatesButton.accesskey;"
disabled="true"/>
</hbox>
<hbox id="restarting" align="center">
<image class="update-throbber"/><label>&update.restarting;</label>
<spacer flex="1"/>
<button label="&update.updateButton.label3;"
accesskey="&update.updateButton.accesskey;"
disabled="true"/>
</hbox>
</deck>
</vbox>
#endif
<separator/>
#ifdef MOZ_UPDATER
<description>&updateApplication.description;</description>
<radiogroup id="updateRadioGroup">
<radio id="autoDesktop"
value="auto"
label="&updateAuto2.label;"
accesskey="&updateAuto2.accesskey;"/>
<radio value="checkOnly"
label="&updateCheckChoose2.label;"
accesskey="&updateCheckChoose2.accesskey;"/>
<radio value="manual"
label="&updateManual2.label;"
accesskey="&updateManual2.accesskey;"/>
</radiogroup>
#ifdef MOZ_MAINTENANCE_SERVICE
<checkbox id="useService"
label="&useService.label;"
accesskey="&useService.accesskey;"
preference="app.update.service.enabled"/>
#endif
#endif
<checkbox id="enableSearchUpdate"
label="&enableSearchUpdate2.label;"
accesskey="&enableSearchUpdate2.accesskey;"
preference="browser.search.update"/>
</groupbox>

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

@ -10,6 +10,7 @@
Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/AppConstants.jsm");
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed"; const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
const TYPE_MAYBE_VIDEO_FEED = "application/vnd.mozilla.maybe.video.feed"; const TYPE_MAYBE_VIDEO_FEED = "application/vnd.mozilla.maybe.video.feed";
const TYPE_MAYBE_AUDIO_FEED = "application/vnd.mozilla.maybe.audio.feed"; const TYPE_MAYBE_AUDIO_FEED = "application/vnd.mozilla.maybe.audio.feed";
@ -910,6 +911,8 @@ var gApplicationsPane = {
gApplicationsPane.onSelectionChanged); gApplicationsPane.onSelectionChanged);
setEventListener("typeColumn", "click", gApplicationsPane.sort); setEventListener("typeColumn", "click", gApplicationsPane.sort);
setEventListener("actionColumn", "click", gApplicationsPane.sort); setEventListener("actionColumn", "click", gApplicationsPane.sort);
setEventListener("chooseFolder", "command", gApplicationsPane.chooseFolder);
setEventListener("browser.download.dir", "change", gApplicationsPane.displayDownloadDirPref);
// Listen for window unload so we can remove our preference observers. // Listen for window unload so we can remove our preference observers.
window.addEventListener("unload", this); window.addEventListener("unload", this);
@ -1892,6 +1895,207 @@ var gApplicationsPane = {
// the icon, or if we couldn't retrieve the icon for some other reason, // the icon, or if we couldn't retrieve the icon for some other reason,
// then use a generic icon. // then use a generic icon.
return ICON_URL_APP; return ICON_URL_APP;
},
// DOWNLOADS
/*
* Preferences:
*
* browser.download.useDownloadDir - bool
* True - Save files directly to the folder configured via the
* browser.download.folderList preference.
* False - Always ask the user where to save a file and default to
* browser.download.lastDir when displaying a folder picker dialog.
* browser.download.dir - local file handle
* A local folder the user may have selected for downloaded files to be
* saved. Migration of other browser settings may also set this path.
* This folder is enabled when folderList equals 2.
* browser.download.lastDir - local file handle
* May contain the last folder path accessed when the user browsed
* via the file save-as dialog. (see contentAreaUtils.js)
* browser.download.folderList - int
* Indicates the location users wish to save downloaded files too.
* It is also used to display special file labels when the default
* download location is either the Desktop or the Downloads folder.
* Values:
* 0 - The desktop is the default download location.
* 1 - The system's downloads folder is the default download location.
* 2 - The default download location is elsewhere as specified in
* browser.download.dir.
* browser.download.downloadDir
* deprecated.
* browser.download.defaultFolder
* deprecated.
*/
/**
* Enables/disables the folder field and Browse button based on whether a
* default download directory is being used.
*/
readUseDownloadDir() {
var downloadFolder = document.getElementById("downloadFolder");
var chooseFolder = document.getElementById("chooseFolder");
var preference = document.getElementById("browser.download.useDownloadDir");
downloadFolder.disabled = !preference.value || preference.locked;
chooseFolder.disabled = !preference.value || preference.locked;
// don't override the preference's value in UI
return undefined;
},
/**
* Displays a file picker in which the user can choose the location where
* downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made.
*/
chooseFolder() {
return this.chooseFolderTask().catch(Components.utils.reportError);
},
async chooseFolderTask() {
let bundlePreferences = document.getElementById("bundlePreferences");
let title = bundlePreferences.getString("chooseDownloadFolderTitle");
let folderListPref = document.getElementById("browser.download.folderList");
let currentDirPref = await this._indexToFolder(folderListPref.value);
let defDownloads = await this._indexToFolder(1);
let fp = Components.classes["@mozilla.org/filepicker;1"].
createInstance(Components.interfaces.nsIFilePicker);
fp.init(window, title, Components.interfaces.nsIFilePicker.modeGetFolder);
fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
// First try to open what's currently configured
if (currentDirPref && currentDirPref.exists()) {
fp.displayDirectory = currentDirPref;
} else if (defDownloads && defDownloads.exists()) {
// Try the system's download dir
fp.displayDirectory = defDownloads;
} else {
// Fall back to Desktop
fp.displayDirectory = await this._indexToFolder(0);
}
let result = await new Promise(resolve => fp.open(resolve));
if (result != Components.interfaces.nsIFilePicker.returnOK) {
return;
}
let downloadDirPref = document.getElementById("browser.download.dir");
downloadDirPref.value = fp.file;
folderListPref.value = await this._folderToIndex(fp.file);
// Note, the real prefs will not be updated yet, so dnld manager's
// userDownloadsDirectory may not return the right folder after
// this code executes. displayDownloadDirPref will be called on
// the assignment above to update the UI.
},
/**
* Initializes the download folder display settings based on the user's
* preferences.
*/
displayDownloadDirPref() {
this.displayDownloadDirPrefTask().catch(Components.utils.reportError);
// don't override the preference's value in UI
return undefined;
},
async displayDownloadDirPrefTask() {
var folderListPref = document.getElementById("browser.download.folderList");
var bundlePreferences = document.getElementById("bundlePreferences");
var downloadFolder = document.getElementById("downloadFolder");
var currentDirPref = document.getElementById("browser.download.dir");
// Used in defining the correct path to the folder icon.
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fph = ios.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var iconUrlSpec;
// Display a 'pretty' label or the path in the UI.
if (folderListPref.value == 2) {
// Custom path selected and is configured
downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
} else if (folderListPref.value == 1) {
// 'Downloads'
downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
iconUrlSpec = fph.getURLSpecFromFile(await this._indexToFolder(1));
} else {
// 'Desktop'
downloadFolder.label = bundlePreferences.getString("desktopFolderName");
iconUrlSpec = fph.getURLSpecFromFile(await this._getDownloadsFolder("Desktop"));
}
downloadFolder.image = "moz-icon://" + iconUrlSpec + "?size=16";
},
/**
* Returns the textual path of a folder in readable form.
*/
_getDisplayNameOfFile(aFolder) {
// TODO: would like to add support for 'Downloads on Macintosh HD'
// for OS X users.
return aFolder ? aFolder.path : "";
},
/**
* Returns the Downloads folder. If aFolder is "Desktop", then the Downloads
* folder returned is the desktop folder; otherwise, it is a folder whose name
* indicates that it is a download folder and whose path is as determined by
* the XPCOM directory service via the download manager's attribute
* defaultDownloadsDirectory.
*
* @throws if aFolder is not "Desktop" or "Downloads"
*/
async _getDownloadsFolder(aFolder) {
switch (aFolder) {
case "Desktop":
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
case "Downloads":
let downloadsDir = await Downloads.getSystemDownloadsDirectory();
return new FileUtils.File(downloadsDir);
}
throw "ASSERTION FAILED: folder type should be 'Desktop' or 'Downloads'";
},
/**
* Determines the type of the given folder.
*
* @param aFolder
* the folder whose type is to be determined
* @returns integer
* 0 if aFolder is the Desktop or is unspecified,
* 1 if aFolder is the Downloads folder,
* 2 otherwise
*/
async _folderToIndex(aFolder) {
if (!aFolder || aFolder.equals(await this._getDownloadsFolder("Desktop")))
return 0;
else if (aFolder.equals(await this._getDownloadsFolder("Downloads")))
return 1;
return 2;
},
/**
* Converts an integer into the corresponding folder.
*
* @param aIndex
* an integer
* @returns the Desktop folder if aIndex == 0,
* the Downloads folder if aIndex == 1,
* the folder stored in browser.download.dir
*/
async _indexToFolder(aIndex) {
switch (aIndex) {
case 0:
return await this._getDownloadsFolder("Desktop");
case 1:
return await this._getDownloadsFolder("Downloads");
}
var currentDirPref = document.getElementById("browser.download.dir");
return currentDirPref.value;
} }
}; };

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

@ -5,7 +5,7 @@
<!-- Applications panel --> <!-- Applications panel -->
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/applications.js"/> src="chrome://browser/content/preferences/in-content-new/applications.js"/>
<preferences id="feedsPreferences" hidden="true" data-category="paneApplications"> <preferences id="feedsPreferences" hidden="true" data-category="paneApplications">
<preference id="browser.feeds.handler" <preference id="browser.feeds.handler"
@ -63,33 +63,69 @@
class="header" class="header"
hidden="true" hidden="true"
data-category="paneApplications"> data-category="paneApplications">
<label class="header-name" flex="1">&paneApplications.title;</label> <label class="header-name" flex="1">&paneFilesApplications.title;</label>
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox> </hbox>
<vbox id="applicationsContent" <vbox id="applicationsContent"
data-category="paneApplications" data-category="paneApplications"
hidden="true" hidden="true"
flex="1"> flex="1">
<hbox>
<!--Downloads-->
<groupbox id="downloadsGroup">
<caption><label>&downloads.label;</label></caption>
<radiogroup id="saveWhere"
preference="browser.download.useDownloadDir"
onsyncfrompreference="return gApplicationsPane.readUseDownloadDir();">
<hbox id="saveToRow">
<radio id="saveTo"
value="true"
label="&saveTo.label;"
accesskey="&saveTo.accesskey;"
aria-labelledby="saveTo downloadFolder"/>
<filefield id="downloadFolder"
flex="1"
preference="browser.download.folderList"
preference-editable="true"
aria-labelledby="saveTo"
onsyncfrompreference="return gApplicationsPane.displayDownloadDirPref();"/>
<button id="chooseFolder"
#ifdef XP_MACOSX
accesskey="&chooseFolderMac.accesskey;"
label="&chooseFolderMac.label;"
#else
accesskey="&chooseFolderWin.accesskey;"
label="&chooseFolderWin.label;"
#endif
/>
</hbox>
<radio id="alwaysAsk"
value="false"
label="&alwaysAskWhere.label;"
accesskey="&alwaysAskWhere.accesskey;"/>
</radiogroup>
</groupbox>
<groupbox id="applicationsGroup">
<caption><label>&applications.label;</label></caption>
<description>&applications.description;</description>
<textbox id="filter" flex="1" <textbox id="filter" flex="1"
type="search" type="search"
placeholder="&filter.emptytext;" placeholder="&filter2.emptytext;"
aria-controls="handlersView"/> aria-controls="handlersView"/>
</hbox>
<separator class="thin"/> <richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
preference="pref.downloads.disable_button.edit_actions"
<richlistbox id="handlersView" orient="vertical" persist="lastSelectedType" flex="1">
preference="pref.downloads.disable_button.edit_actions" <listheader equalsize="always">
flex="1"> <treecol id="typeColumn" label="&typeColumn.label;" value="type"
<listheader equalsize="always"> accesskey="&typeColumn.accesskey;" persist="sortDirection"
<treecol id="typeColumn" label="&typeColumn.label;" value="type" flex="1" sortDirection="ascending"/>
accesskey="&typeColumn.accesskey;" persist="sortDirection" <treecol id="actionColumn" label="&actionColumn2.label;" value="action"
flex="1" sortDirection="ascending"/> accesskey="&actionColumn2.accesskey;" persist="sortDirection"
<treecol id="actionColumn" label="&actionColumn2.label;" value="action" flex="1"/>
accesskey="&actionColumn2.accesskey;" persist="sortDirection" </listheader>
flex="1"/> </richlistbox>
</listheader> </groupbox>
</richlistbox>
</vbox> </vbox>

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

@ -7,7 +7,7 @@
Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm"); Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm");
const containersBundle = Services.strings.createBundle("chrome://browser/locale/preferences-old/containers.properties"); const containersBundle = Services.strings.createBundle("chrome://browser/locale/preferences/containers.properties");
const defaultContainerIcon = "fingerprint"; const defaultContainerIcon = "fingerprint";
const defaultContainerColor = "blue"; const defaultContainerColor = "blue";

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

@ -5,7 +5,7 @@
<!-- Containers panel --> <!-- Containers panel -->
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/containers.js"/> src="chrome://browser/content/preferences/in-content-new/containers.js"/>
<preferences id="containerPreferences" hidden="true" data-category="paneContainer"> <preferences id="containerPreferences" hidden="true" data-category="paneContainer">
<!-- Containers --> <!-- Containers -->
@ -18,7 +18,7 @@
<hbox hidden="true" <hbox hidden="true"
class="container-header-links" class="container-header-links"
data-category="paneContainers"> data-category="paneContainers">
<label class="text-link" id="backContainersLink" value="&backLink.label;" /> <label class="text-link" id="backContainersLink">&backLink.label;</label>
</hbox> </hbox>
<hbox id="header-containers" <hbox id="header-containers"
@ -26,8 +26,6 @@
hidden="true" hidden="true"
data-category="paneContainers"> data-category="paneContainers">
<label class="header-name" flex="1">&paneContainers.title;</label> <label class="header-name" flex="1">&paneContainers.title;</label>
<button class="help-button"
aria-label="&helpButton.label;"/>
</hbox> </hbox>
<!-- Containers --> <!-- Containers -->

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

@ -0,0 +1,16 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
browser.jar:
content/browser/preferences/in-content-new/preferences.js
* content/browser/preferences/in-content-new/preferences.xul
content/browser/preferences/in-content-new/subdialogs.js
content/browser/preferences/in-content-new/main.js
content/browser/preferences/in-content-new/privacy.js
content/browser/preferences/in-content-new/containers.js
content/browser/preferences/in-content-new/advanced.js
content/browser/preferences/in-content-new/applications.js
content/browser/preferences/in-content-new/sync.js
content/browser/preferences/in-content-new/findInPage.js

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,663 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- General panel -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content-new/main.js"/>
<script type="application/javascript"
src="chrome://mozapps/content/preferences/fontbuilder.js"/>
<stringbundle id="engineManagerBundle" src="chrome://browser/locale/engineManager.properties"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/>
<preferences id="mainPreferences" hidden="true" data-category="paneGeneral">
#ifdef E10S_TESTING_ONLY
<preference id="browser.tabs.remote.autostart"
name="browser.tabs.remote.autostart"
type="bool"/>
<preference id="e10sTempPref"
name="browser.tabs.remote.autostart.2"
type="bool"/>
<preference id="e10sForceEnable"
name="browser.tabs.remote.force-enable"
type="bool"/>
#endif
<!-- Startup -->
<preference id="browser.startup.page"
name="browser.startup.page"
type="int"/>
<preference id="browser.startup.homepage"
name="browser.startup.homepage"
type="wstring"/>
#ifdef HAVE_SHELL_SERVICE
<preference id="browser.shell.checkDefaultBrowser"
name="browser.shell.checkDefaultBrowser"
type="bool"/>
<preference id="pref.general.disable_button.default_browser"
name="pref.general.disable_button.default_browser"
type="bool"/>
#endif
<preference id="pref.browser.homepage.disable_button.current_page"
name="pref.browser.homepage.disable_button.current_page"
type="bool"/>
<preference id="pref.browser.homepage.disable_button.bookmark_page"
name="pref.browser.homepage.disable_button.bookmark_page"
type="bool"/>
<preference id="pref.browser.homepage.disable_button.restore_default"
name="pref.browser.homepage.disable_button.restore_default"
type="bool"/>
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
type="bool"/>
<!-- Search Engine -->
<preference id="browser.search.suggest.enabled"
name="browser.search.suggest.enabled"
type="bool"/>
<preference id="browser.urlbar.suggest.searches"
name="browser.urlbar.suggest.searches"
type="bool"/>
<preference id="browser.search.hiddenOneOffs"
name="browser.search.hiddenOneOffs"
type="unichar"/>
<!-- Downloads -->
<preference id="browser.download.useDownloadDir"
name="browser.download.useDownloadDir"
type="bool"/>
<preference id="browser.download.folderList"
name="browser.download.folderList"
type="int"/>
<preference id="browser.download.dir"
name="browser.download.dir"
type="file"/>
<!-- Tab preferences
Preferences:
browser.link.open_newwindow
1 opens such links in the most recent window or tab,
2 opens such links in a new window,
3 opens such links in a new tab
browser.tabs.loadInBackground
- true if display should switch to a new tab which has been opened from a
link, false if display shouldn't switch
browser.tabs.warnOnClose
- true if when closing a window with multiple tabs the user is warned and
allowed to cancel the action, false to just close the window
browser.tabs.warnOnOpen
- true if the user should be warned if he attempts to open a lot of tabs at
once (e.g. a large folder of bookmarks), false otherwise
browser.taskbar.previews.enable
- true if tabs are to be shown in the Windows 7 taskbar
-->
<preference id="browser.link.open_newwindow"
name="browser.link.open_newwindow"
type="int"/>
<preference id="browser.tabs.loadInBackground"
name="browser.tabs.loadInBackground"
type="bool"
inverted="true"/>
<preference id="browser.tabs.warnOnClose"
name="browser.tabs.warnOnClose"
type="bool"/>
<preference id="browser.tabs.warnOnOpen"
name="browser.tabs.warnOnOpen"
type="bool"/>
<preference id="browser.sessionstore.restore_on_demand"
name="browser.sessionstore.restore_on_demand"
type="bool"/>
#ifdef XP_WIN
<preference id="browser.taskbar.previews.enable"
name="browser.taskbar.previews.enable"
type="bool"/>
#endif
<preference id="browser.ctrlTab.previews"
name="browser.ctrlTab.previews"
type="bool"/>
<!-- Fonts -->
<preference id="font.language.group"
name="font.language.group"
type="wstring"/>
<!-- Languages -->
<preference id="browser.translation.detectLanguage"
name="browser.translation.detectLanguage"
type="bool"/>
<!-- General tab -->
<!-- Accessibility
* accessibility.browsewithcaret
- true enables keyboard navigation and selection within web pages using a
visible caret, false uses normal keyboard navigation with no caret
* accessibility.typeaheadfind
- when set to true, typing outside text areas and input boxes will
automatically start searching for what's typed within the current
document; when set to false, no search action happens -->
<preference id="accessibility.browsewithcaret"
name="accessibility.browsewithcaret"
type="bool"/>
<preference id="accessibility.typeaheadfind"
name="accessibility.typeaheadfind"
type="bool"/>
<preference id="accessibility.blockautorefresh"
name="accessibility.blockautorefresh"
type="bool"/>
#ifdef XP_WIN
<preference id="ui.osk.enabled"
name="ui.osk.enabled"
type="bool"/>
#endif
<!-- Browsing
* general.autoScroll
- when set to true, clicking the scroll wheel on the mouse activates a
mouse mode where moving the mouse down scrolls the document downward with
speed correlated with the distance of the cursor from the original
position at which the click occurred (and likewise with movement upward);
if false, this behavior is disabled
* general.smoothScroll
- set to true to enable finer page scrolling than line-by-line on page-up,
page-down, and other such page movements -->
<preference id="general.autoScroll"
name="general.autoScroll"
type="bool"/>
<preference id="general.smoothScroll"
name="general.smoothScroll"
type="bool"/>
<preference id="layout.spellcheckDefault"
name="layout.spellcheckDefault"
type="int"/>
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
#endif
<preference id="browser.preferences.defaultPerformanceSettings.enabled"
name="browser.preferences.defaultPerformanceSettings.enabled"
type="bool"/>
<preference id="dom.ipc.processCount"
name="dom.ipc.processCount"
type="int"/>
<preference id="layers.acceleration.disabled"
name="layers.acceleration.disabled"
type="bool"
inverted="true"/>
</preferences>
<hbox id="header-general"
class="header"
hidden="true"
data-category="paneGeneral">
<label class="header-name" flex="1">&paneGeneral.title;</label>
</hbox>
<!-- Startup -->
<groupbox id="startupGroup"
data-category="paneGeneral"
hidden="true">
<caption><label>&startup.label;</label></caption>
#ifdef MOZ_DEV_EDITION
<vbox id="separateProfileBox">
<checkbox id="separateProfileMode"
label="&separateProfileMode.label;"/>
<hbox align="center" class="indent">
<label id="useFirefoxSync">&useFirefoxSync.label;</label>
<deck id="getStarted">
<label class="text-link">&getStarted.notloggedin.label;</label>
<label class="text-link">&getStarted.configured.label;</label>
</deck>
</hbox>
</vbox>
#endif
#ifdef E10S_TESTING_ONLY
<checkbox id="e10sAutoStart"
label="&e10sEnabled.label;"/>
#endif
#ifdef HAVE_SHELL_SERVICE
<vbox id="defaultBrowserBox">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault2.label;" accesskey="&alwaysCheckDefault2.accesskey;"/>
<deck id="setDefaultPane">
<hbox align="center" class="indent">
<label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
<button id="setDefaultButton"
class="accessory-button"
label="&setAsMyDefaultBrowser2.label;" accesskey="&setAsMyDefaultBrowser2.accesskey;"
preference="pref.general.disable_button.default_browser"/>
</hbox>
<hbox align="center" class="indent">
<label id="isDefaultLabel" flex="1">&isDefault.label;</label>
</hbox>
</deck>
<separator class="thin"/>
</vbox>
#endif
<html:table id="startupTable">
<html:tr>
<html:td class="label-cell">
<label accesskey="&startupPage2.accesskey;"
control="browserStartupPage">&startupPage2.label;</label>
</html:td>
<html:td class="content-cell">
<menulist id="browserStartupPage"
class="content-cell-item"
preference="browser.startup.page">
<menupopup>
<menuitem label="&startupUserHomePage.label;"
value="1"
id="browserStartupHomePage"/>
<menuitem label="&startupBlankPage.label;"
value="0"
id="browserStartupBlank"/>
<menuitem label="&startupPrevSession.label;"
value="3"
id="browserStartupLastSession"/>
</menupopup>
</menulist>
</html:td>
</html:tr>
<html:tr>
<html:td class="label-cell">
<label accesskey="&homepage2.accesskey;"
control="browserHomePage">&homepage2.label;</label>
</html:td>
<html:td class="content-cell">
<textbox id="browserHomePage"
class="padded uri-element content-cell-item"
type="autocomplete"
autocompletesearch="unifiedcomplete"
onsyncfrompreference="return gMainPane.syncFromHomePref();"
onsynctopreference="return gMainPane.syncToHomePref(this.value);"
placeholder="&abouthome.pageTitle;"
preference="browser.startup.homepage"/>
</html:td>
</html:tr>
<html:tr>
<html:td class="label-cell" />
<html:td class="content-cell homepage-buttons">
<button id="useCurrent"
class="content-cell-item"
label=""
accesskey="&useCurrentPage.accesskey;"
label1="&useCurrentPage.label;"
label2="&useMultiple.label;"
preference="pref.browser.homepage.disable_button.current_page"/>
<button id="useBookmark"
class="content-cell-item"
label="&chooseBookmark.label;"
accesskey="&chooseBookmark.accesskey;"
preference="pref.browser.homepage.disable_button.bookmark_page"
searchkeywords="&selectBookmark.title; &selectBookmark.label;"/>
<button id="restoreDefaultHomePage"
class="content-cell-item"
label="&restoreDefault.label;"
accesskey="&restoreDefault.accesskey;"
preference="pref.browser.homepage.disable_button.restore_default"/>
</html:td>
</html:tr>
</html:table>
</groupbox>
<!-- Default Search Engine -->
<groupbox id="defaultEngineGroup" data-category="paneGeneral" data-subcategory="search">
<caption label="&defaultSearchEngine.label;"/>
<label>&chooseYourDefaultSearchEngine.label;</label>
<box align="start">
<menulist id="defaultEngine">
<menupopup/>
</menulist>
</box>
<checkbox id="suggestionsInSearchFieldsCheckbox"
label="&provideSearchSuggestions.label;"
accesskey="&provideSearchSuggestions.accesskey;"
preference="browser.search.suggest.enabled"/>
<vbox class="indent">
<checkbox id="urlBarSuggestion" label="&showURLBarSuggestions.label;"
accesskey="&showURLBarSuggestions.accesskey;"
preference="browser.urlbar.suggest.searches"/>
<hbox id="urlBarSuggestionPermanentPBLabel"
align="center" class="indent">
<label flex="1">&urlBarSuggestionsPermanentPB.label;</label>
</hbox>
</vbox>
</groupbox>
<groupbox id="oneClickSearchProvidersGroup" data-category="paneGeneral" data-subcategory="search">
<caption label="&oneClickSearchEngines.label;"/>
<label>&chooseWhichOneToDisplay.label;</label>
<tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true"
seltype="single" allowunderflowscroll="true">
<treechildren id="engineChildren" flex="1"/>
<treecols>
<treecol id="engineShown" type="checkbox" editable="true" sortable="false"/>
<treecol id="engineName" flex="4" label="&engineNameColumn.label;" sortable="false"/>
<treecol id="engineKeyword" flex="1" label="&engineKeywordColumn.label;" editable="true"
sortable="false"/>
</treecols>
</tree>
<hbox>
<button id="restoreDefaultSearchEngines"
label="&restoreDefaultSearchEngines.label;"
accesskey="&restoreDefaultSearchEngines.accesskey;"/>
<spacer flex="1"/>
<button id="removeEngineButton"
class="searchEngineAction accessory-button"
label="&removeEngine.label;"
accesskey="&removeEngine.accesskey;"
disabled="true"/>
</hbox>
<separator class="thin"/>
<hbox id="addEnginesBox" pack="start">
<label id="addEngines" class="text-link">&addMoreSearchEngines2.label;</label>
</hbox>
</groupbox>
<!-- Tab preferences -->
<groupbox data-category="paneGeneral"
hidden="true">
<caption><label>&tabsGroup.label;</label></caption>
<checkbox id="ctrlTabRecentlyUsedOrder" label="&ctrlTabRecentlyUsedOrder.label;"
accesskey="&ctrlTabRecentlyUsedOrder.accesskey;"
preference="browser.ctrlTab.previews"/>
<checkbox id="linkTargeting" label="&newWindowsAsTabs.label;"
accesskey="&newWindowsAsTabs.accesskey;"
preference="browser.link.open_newwindow"
onsyncfrompreference="return gMainPane.readLinkTarget();"
onsynctopreference="return gMainPane.writeLinkTarget();"/>
<checkbox id="warnCloseMultiple" label="&warnOnCloseMultipleTabs.label;"
accesskey="&warnOnCloseMultipleTabs.accesskey;"
preference="browser.tabs.warnOnClose"/>
<checkbox id="warnOpenMany" label="&warnOnOpenManyTabs.label;"
accesskey="&warnOnOpenManyTabs.accesskey;"
preference="browser.tabs.warnOnOpen"/>
<checkbox id="switchToNewTabs" label="&switchLinksToNewTabs.label;"
accesskey="&switchLinksToNewTabs.accesskey;"
preference="browser.tabs.loadInBackground"/>
#ifdef XP_WIN
<checkbox id="showTabsInTaskbar" label="&showTabsInTaskbar.label;"
accesskey="&showTabsInTaskbar.accesskey;"
preference="browser.taskbar.previews.enable"/>
#endif
</groupbox>
<!-- Accessibility -->
<groupbox data-category="paneGeneral" id="accessibilityGroup">
<caption><label>&accessibility.label;</label></caption>
#ifdef XP_WIN
<checkbox id="useOnScreenKeyboard"
hidden="true"
label="&useOnScreenKeyboard.label;"
accesskey="&useOnScreenKeyboard.accesskey;"
preference="ui.osk.enabled"/>
#endif
<checkbox id="useCursorNavigation"
label="&useCursorNavigation.label;"
accesskey="&useCursorNavigation.accesskey;"
preference="accessibility.browsewithcaret"/>
<checkbox id="searchStartTyping"
label="&searchOnStartTyping.label;"
accesskey="&searchOnStartTyping.accesskey;"
preference="accessibility.typeaheadfind"/>
<checkbox id="blockAutoRefresh"
label="&blockAutoReload.label;"
accesskey="&blockAutoReload.accesskey;"
preference="accessibility.blockautorefresh"/>
</groupbox>
<!-- Languages -->
<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true">
<caption><label>&languages.label;</label></caption>
<hbox id="languagesBox" align="center">
<description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
<button id="chooseLanguage"
class="accessory-button"
label="&chooseButton.label;"
accesskey="&chooseButton.accesskey;"
searchkeywords="&languages.customize.Header;
&languages.customize.description;
&languages.customize.moveUp.label;
&languages.customize.moveDown.label;
&languages.customize.deleteButton.label;
&languages.customize.selectLanguage.label;
&languages.customize.addButton.label;"/>
</hbox>
<hbox id="translationBox" hidden="true">
<hbox align="center" flex="1">
<checkbox id="translate" preference="browser.translation.detectLanguage"
label="&translateWebPages.label;." accesskey="&translateWebPages.accesskey;"
onsyncfrompreference="return gMainPane.updateButtons('translateButton',
'browser.translation.detectLanguage');"/>
<hbox id="bingAttribution" hidden="true">
<label>&translation.options.attribution.beforeLogo;</label>
<separator orient="vertical" class="thin"/>
<image id="translationAttributionImage" aria-label="Microsoft Translator"
src="chrome://browser/content/microsoft-translator-attribution.png"/>
<separator orient="vertical" class="thin"/>
<label>&translation.options.attribution.afterLogo;</label>
</hbox>
</hbox>
<button id="translateButton"
class="accessory-button"
label="&translateExceptions.label;"
accesskey="&translateExceptions.accesskey;"/>
</hbox>
<checkbox id="checkSpelling"
label="&checkUserSpelling.label;"
accesskey="&checkUserSpelling.accesskey;"
onsyncfrompreference="return gMainPane.readCheckSpelling();"
onsynctopreference="return gMainPane.writeCheckSpelling();"
preference="layout.spellcheckDefault"/>
</groupbox>
<!-- Fonts and Colors -->
<groupbox id="fontsGroup" data-category="paneGeneral" hidden="true">
<caption><label>&fontsAndColors.label;</label></caption>
<vbox>
<hbox id="fontSettings">
<hbox align="center">
<label control="defaultFont" accesskey="&defaultFont2.accesskey;">&defaultFont2.label;</label>
<menulist id="defaultFont" delayprefsave="true" onsyncfrompreference="return FontBuilder.readFontSelection(this);"/>
<label id="defaultFontSizeLabel" control="defaultFontSize" accesskey="&defaultSize2.accesskey;">&defaultSize2.label;</label>
<menulist id="defaultFontSize" delayprefsave="true">
<menupopup>
<menuitem value="9" label="9"/>
<menuitem value="10" label="10"/>
<menuitem value="11" label="11"/>
<menuitem value="12" label="12"/>
<menuitem value="13" label="13"/>
<menuitem value="14" label="14"/>
<menuitem value="15" label="15"/>
<menuitem value="16" label="16"/>
<menuitem value="17" label="17"/>
<menuitem value="18" label="18"/>
<menuitem value="20" label="20"/>
<menuitem value="22" label="22"/>
<menuitem value="24" label="24"/>
<menuitem value="26" label="26"/>
<menuitem value="28" label="28"/>
<menuitem value="30" label="30"/>
<menuitem value="32" label="32"/>
<menuitem value="34" label="34"/>
<menuitem value="36" label="36"/>
<menuitem value="40" label="40"/>
<menuitem value="44" label="44"/>
<menuitem value="48" label="48"/>
<menuitem value="56" label="56"/>
<menuitem value="64" label="64"/>
<menuitem value="72" label="72"/>
</menupopup>
</menulist>
</hbox>
<spacer flex="1" />
<button id="advancedFonts"
class="accessory-button"
icon="select-font"
label="&advancedFonts.label;"
accesskey="&advancedFonts.accesskey;"
searchkeywords="&fontsDialog.title;
&language.label;
&size.label;
&proportional.label;
&serif.label;
&sans-serif.label;
&monospace.label;
&font.langGroup.latin;
&font.langGroup.japanese;
&font.langGroup.trad-chinese;
&font.langGroup.simpl-chinese;
&font.langGroup.trad-chinese-hk;
&font.langGroup.korean;
&font.langGroup.cyrillic;
&font.langGroup.el;
&font.langGroup.other;
&font.langGroup.thai;
&font.langGroup.hebrew;
&font.langGroup.arabic;
&font.langGroup.devanagari;
&font.langGroup.tamil;
&font.langGroup.armenian;
&font.langGroup.bengali;
&font.langGroup.canadian;
&font.langGroup.ethiopic;
&font.langGroup.georgian;
&font.langGroup.gujarati;
&font.langGroup.gurmukhi;
&font.langGroup.khmer;
&font.langGroup.malayalam;
&font.langGroup.math;
&font.langGroup.odia;
&font.langGroup.telugu;
&font.langGroup.kannada;
&font.langGroup.sinhala;
&font.langGroup.tibetan;
&minSize.label;
&minSize.none;
&useDefaultFontSerif.label;
&useDefaultFontSansSerif.label;
&allowPagesToUseOwn.label;
&languages.customize.Fallback2.grouplabel;
&languages.customize.Fallback2.label;
&languages.customize.Fallback2.desc;
&languages.customize.Fallback.auto;
&languages.customize.Fallback.arabic;
&languages.customize.Fallback.baltic;
&languages.customize.Fallback.ceiso;
&languages.customize.Fallback.cewindows;
&languages.customize.Fallback.simplified;
&languages.customize.Fallback.traditional;
&languages.customize.Fallback.cyrillic;
&languages.customize.Fallback.greek;
&languages.customize.Fallback.hebrew;
&languages.customize.Fallback.japanese;
&languages.customize.Fallback.korean;
&languages.customize.Fallback.thai;
&languages.customize.Fallback.turkish;
&languages.customize.Fallback.vietnamese;
&languages.customize.Fallback.other;"/>
</hbox>
<hbox id="colorsSettings">
<spacer flex="1" />
<button id="colors"
class="accessory-button"
icon="select-color"
label="&colors.label;"
accesskey="&colors.accesskey;"
searchkeywords="&overrideDefaultPageColors.label;
&overrideDefaultPageColors.always.label;
&overrideDefaultPageColors.auto.label;
&overrideDefaultPageColors.never.label;
&useSystemColors.label;
&underlineLinks.label;
&linkColor.label;
&visitedLinkColor.label;"/>
</hbox>
</vbox>
</groupbox>
<!-- Browsing -->
<groupbox id="browsingGroup" data-category="paneGeneral">
<caption><label>&browsing.label;</label></caption>
<checkbox id="useAutoScroll"
label="&useAutoScroll.label;"
accesskey="&useAutoScroll.accesskey;"
preference="general.autoScroll"/>
<checkbox id="useSmoothScrolling"
label="&useSmoothScrolling.label;"
accesskey="&useSmoothScrolling.accesskey;"
preference="general.smoothScroll"/>
</groupbox>
<!-- Performance -->
<groupbox id="performanceGroup" data-category="paneGeneral" hidden="true">
<caption><label>&performance.label;</label></caption>
<hbox align="center">
<checkbox id="useRecommendedPerformanceSettings"
label="&useRecommendedPerformanceSettings2.label;"
accesskey="&useRecommendedPerformanceSettings2.accesskey;"
preference="browser.preferences.defaultPerformanceSettings.enabled"/>
<label id="performanceSettingsLearnMore" class="learnMore text-link">&performanceSettingsLearnMore.label;</label>
</hbox>
<description class="indent">&useRecommendedPerformanceSettings2.description;</description>
<vbox id="performanceSettings" class="indent" hidden="true">
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.disabled"/>
<hbox align="center">
<label id="limitContentProcess" accesskey="&limitContentProcessOption.accesskey;" control="contentProcessCount">&limitContentProcessOption.label;</label>
<menulist id="contentProcessCount" preference="dom.ipc.processCount">
<menupopup>
<menuitem label="1" value="1"/>
<menuitem label="2" value="2"/>
<menuitem label="3" value="3"/>
<menuitem label="4" value="4"/>
<menuitem label="5" value="5"/>
<menuitem label="6" value="6"/>
<menuitem label="7" value="7"/>
</menupopup>
</menulist>
</hbox>
<description>&limitContentProcessOption.description;</description>
</vbox>
</groupbox>

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

@ -6,13 +6,11 @@
/* import-globals-from subdialogs.js */ /* import-globals-from subdialogs.js */
/* import-globals-from advanced.js */ /* import-globals-from advanced.js */
/* import-globals-from main.js */ /* import-globals-from main.js */
/* import-globals-from search.js */
/* import-globals-from containers.js */ /* import-globals-from containers.js */
/* import-globals-from content.js */
/* import-globals-from privacy.js */ /* import-globals-from privacy.js */
/* import-globals-from applications.js */ /* import-globals-from applications.js */
/* import-globals-from security.js */
/* import-globals-from sync.js */ /* import-globals-from sync.js */
/* import-globals-from findInPage.js */
/* import-globals-from ../../../base/content/utilityOverlay.js */ /* import-globals-from ../../../base/content/utilityOverlay.js */
"use strict"; "use strict";
@ -57,14 +55,13 @@ function init_all() {
gSubDialog.init(); gSubDialog.init();
register_module("paneGeneral", gMainPane); register_module("paneGeneral", gMainPane);
register_module("paneSearch", gSearchPane);
register_module("panePrivacy", gPrivacyPane); register_module("panePrivacy", gPrivacyPane);
register_module("paneContainers", gContainersPane); register_module("paneContainers", gContainersPane);
register_module("paneAdvanced", gAdvancedPane); register_module("paneAdvanced", gAdvancedPane);
register_module("paneApplications", gApplicationsPane); register_module("paneApplications", gApplicationsPane);
register_module("paneContent", gContentPane);
register_module("paneSync", gSyncPane); register_module("paneSync", gSyncPane);
register_module("paneSecurity", gSecurityPane); register_module("paneSearchResults", gSearchResultsPane);
gSearchResultsPane.init();
let categories = document.getElementById("categories"); let categories = document.getElementById("categories");
categories.addEventListener("select", event => gotoPref(event.target.value)); categories.addEventListener("select", event => gotoPref(event.target.value));
@ -89,13 +86,9 @@ function init_all() {
}); });
document.dispatchEvent(initFinished); document.dispatchEvent(initFinished);
categories = categories.querySelectorAll("richlistitem.category"); let helpButton = document.querySelector(".help-button");
for (let category of categories) { let helpUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "preferences";
let name = internalPrefCategoryNameToFriendlyName(category.value); helpButton.setAttribute("href", helpUrl);
let helpSelector = `#header-${name} > .help-button`;
let helpButton = document.querySelector(helpSelector);
helpButton.setAttribute("href", getHelpLinkURL(category.getAttribute("helpTopic")));
}
// Wait until initialization of all preferences are complete before // Wait until initialization of all preferences are complete before
// notifying observers that the UI is now ready. // notifying observers that the UI is now ready.
@ -107,11 +100,25 @@ function init_dynamic_padding() {
let categories = document.getElementById("categories"); let categories = document.getElementById("categories");
let catPadding = Number.parseInt(getComputedStyle(categories) let catPadding = Number.parseInt(getComputedStyle(categories)
.getPropertyValue("padding-top")); .getPropertyValue("padding-top"));
let fullHeight = categories.lastElementChild.getBoundingClientRect().bottom; let helpButton = document.querySelector(".help-button");
let helpButtonCS = getComputedStyle(helpButton);
let helpHeight = Number.parseInt(helpButtonCS.height);
let helpBottom = Number.parseInt(helpButtonCS.bottom);
// Reduce the padding to account for less space, but due
// to bug 1357841, the status panel will overlap the link.
const reducedHelpButtonBottomFactor = .75;
let reducedHelpButtonBottom = helpBottom * reducedHelpButtonBottomFactor;
let fullHelpHeight = helpHeight + reducedHelpButtonBottom;
let fullHeight = categories.lastElementChild.getBoundingClientRect().bottom +
fullHelpHeight;
let mediaRule = ` let mediaRule = `
@media (max-height: ${fullHeight}px) { @media (max-height: ${fullHeight}px) {
#categories { #categories {
padding-top: calc(100vh - ${fullHeight - catPadding}px); padding-top: calc(100vh - ${fullHeight - catPadding}px);
padding-bottom: ${fullHelpHeight}px;
}
.help-button {
bottom: ${reducedHelpButtonBottom / 2}px;
} }
} }
`; `;
@ -122,30 +129,16 @@ function init_dynamic_padding() {
} }
function telemetryBucketForCategory(category) { function telemetryBucketForCategory(category) {
category = category.toLowerCase();
switch (category) { switch (category) {
case "general":
case "search":
case "content":
case "applications": case "applications":
case "privacy":
case "security":
case "sync":
return category;
case "advanced": case "advanced":
let advancedPaneTabs = document.getElementById("advancedPrefs"); case "containers":
switch (advancedPaneTabs.selectedTab.id) { case "general":
case "generalTab": case "privacy":
return "advancedGeneral"; case "sync":
case "dataChoicesTab": case "searchresults":
return "advancedDataChoices"; return category;
case "networkTab":
return "advancedNetwork";
case "updateTab":
return "advancedUpdates";
case "encryptionTab":
return "advancedCerts";
}
// fall-through for unknown.
default: default:
return "unknown"; return "unknown";
} }
@ -157,14 +150,27 @@ function onHashChange() {
function gotoPref(aCategory) { function gotoPref(aCategory) {
let categories = document.getElementById("categories"); let categories = document.getElementById("categories");
const kDefaultCategoryInternalName = categories.firstElementChild.value; const kDefaultCategoryInternalName = "paneGeneral";
let hash = document.location.hash; let hash = document.location.hash;
let category = aCategory || hash.substr(1) || kDefaultCategoryInternalName; let category = aCategory || hash.substr(1) || kDefaultCategoryInternalName;
let breakIndex = category.indexOf("-");
// Subcategories allow for selecting smaller sections of the preferences
// until proper search support is enabled (bug 1353954).
let subcategory = breakIndex != -1 && category.substring(breakIndex + 1);
if (subcategory) {
category = category.substring(0, breakIndex);
}
category = friendlyPrefCategoryNameToInternalName(category); category = friendlyPrefCategoryNameToInternalName(category);
if (category != "paneSearchResults") {
gSearchResultsPane.searchInput.value = "";
gSearchResultsPane.searchResultsCategory.hidden = true;
gSearchResultsPane.findSelection.removeAllRanges();
}
// Updating the hash (below) or changing the selected category // Updating the hash (below) or changing the selected category
// will re-enter gotoPref. // will re-enter gotoPref.
if (gLastHash == category) if (gLastHash == category && !subcategory)
return; return;
let item = categories.querySelector(".category[value=" + category + "]"); let item = categories.querySelector(".category[value=" + category + "]");
if (!item) { if (!item) {
@ -180,7 +186,7 @@ function gotoPref(aCategory) {
} }
let friendlyName = internalPrefCategoryNameToFriendlyName(category); let friendlyName = internalPrefCategoryNameToFriendlyName(category);
if (gLastHash || category != kDefaultCategoryInternalName) { if (gLastHash || category != kDefaultCategoryInternalName || subcategory) {
document.location.hash = friendlyName; document.location.hash = friendlyName;
} }
// Need to set the gLastHash before setting categories.selectedItem since // Need to set the gLastHash before setting categories.selectedItem since
@ -188,21 +194,38 @@ function gotoPref(aCategory) {
gLastHash = category; gLastHash = category;
categories.selectedItem = item; categories.selectedItem = item;
window.history.replaceState(category, document.title); window.history.replaceState(category, document.title);
search(category, "data-category"); search(category, "data-category", subcategory, "data-subcategory");
let mainContent = document.querySelector(".main-content"); let mainContent = document.querySelector(".main-content");
mainContent.scrollTop = 0; mainContent.scrollTop = 0;
Services.telemetry Services.telemetry
.getHistogramById("FX_PREFERENCES_CATEGORY_OPENED") .getHistogramById("FX_PREFERENCES_CATEGORY_OPENED_V2")
.add(telemetryBucketForCategory(friendlyName)); .add(telemetryBucketForCategory(friendlyName));
} }
function search(aQuery, aAttribute) { function search(aQuery, aAttribute, aSubquery, aSubAttribute) {
let mainPrefPane = document.getElementById("mainPrefPane"); let mainPrefPane = document.getElementById("mainPrefPane");
let elements = mainPrefPane.children; let elements = mainPrefPane.children;
for (let element of elements) { for (let element of elements) {
let attributeValue = element.getAttribute(aAttribute); // If the "data-hidden-from-search" is "true", the
element.hidden = (attributeValue != aQuery); // element will not get considered during search. This
// should only be used when an element is still under
// development and should not be shown for any reason.
if (element.getAttribute("data-hidden-from-search") != "true") {
let attributeValue = element.getAttribute(aAttribute);
if (attributeValue == aQuery) {
if (!element.classList.contains("header") &&
aSubquery && aSubAttribute) {
let subAttributeValue = element.getAttribute(aSubAttribute);
element.hidden = subAttributeValue != aSubquery;
} else {
element.hidden = false;
}
} else {
element.hidden = true;
}
}
} }
let keysets = mainPrefPane.getElementsByTagName("keyset"); let keysets = mainPrefPane.getElementsByTagName("keyset");

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

@ -8,38 +8,64 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://global/skin/in-content/common.css"?> <?xml-stylesheet href="chrome://global/skin/in-content/common.css"?>
<?xml-stylesheet <?xml-stylesheet
href="chrome://browser/skin/preferences/in-content-old/preferences.css"?> href="chrome://browser/skin/preferences/in-content-new/preferences.css"?>
<?xml-stylesheet <?xml-stylesheet
href="chrome://browser/content/preferences/handlers.css"?> href="chrome://browser/content/preferences/handlers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-old/search.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/search.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-old/containers.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/containers.css"?>
<!DOCTYPE page [ <!DOCTYPE page [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % globalPreferencesDTD SYSTEM "chrome://global/locale/preferences.dtd"> <!ENTITY % globalPreferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
<!ENTITY % preferencesDTD SYSTEM <!ENTITY % preferencesDTD SYSTEM
"chrome://browser/locale/preferences-old/preferences.dtd"> "chrome://browser/locale/preferences/preferences.dtd">
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences-old/privacy.dtd"> <!ENTITY % selectBookmarkDTD SYSTEM
<!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences-old/tabs.dtd"> "chrome://browser/locale/preferences/selectBookmark.dtd">
<!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences-old/search.dtd"> <!ENTITY % languagesDTD SYSTEM "chrome://browser/locale/preferences/languages.dtd">
<!ENTITY % fontDTD SYSTEM "chrome://browser/locale/preferences/fonts.dtd">
<!ENTITY % colorsDTD SYSTEM "chrome://browser/locale/preferences/colors.dtd">
<!ENTITY % permissionsDTD SYSTEM "chrome://browser/locale/preferences/permissions.dtd">
<!ENTITY % passwordManagerDTD SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd">
<!ENTITY % historyDTD SYSTEM "chrome://mozapps/locale/update/history.dtd">
<!ENTITY % certManagerDTD SYSTEM "chrome://pippki/locale/certManager.dtd">
<!ENTITY % deviceManangerDTD SYSTEM "chrome://pippki/locale/deviceManager.dtd">
<!ENTITY % connectionDTD SYSTEM "chrome://browser/locale/preferences/connection.dtd">
<!ENTITY % siteDataSettingsDTD SYSTEM
"chrome://browser/locale/preferences/siteDataSettings.dtd" >
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
<!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences/tabs.dtd">
<!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences/search.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd"> <!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences-old/sync.dtd"> <!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
<!ENTITY % securityDTD SYSTEM <!ENTITY % securityDTD SYSTEM
"chrome://browser/locale/preferences-old/security.dtd"> "chrome://browser/locale/preferences/security.dtd">
<!ENTITY % containersDTD SYSTEM <!ENTITY % containersDTD SYSTEM
"chrome://browser/locale/preferences-old/containers.dtd"> "chrome://browser/locale/preferences/containers.dtd">
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd"> <!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
<!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences-old/main.dtd"> <!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences/main.dtd">
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd"> <!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
<!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences-old/content.dtd"> <!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences/content.dtd">
<!ENTITY % applicationsDTD SYSTEM <!ENTITY % applicationsDTD SYSTEM
"chrome://browser/locale/preferences-old/applications.dtd"> "chrome://browser/locale/preferences/applications.dtd">
<!ENTITY % advancedDTD SYSTEM <!ENTITY % advancedDTD SYSTEM
"chrome://browser/locale/preferences-old/advanced.dtd"> "chrome://browser/locale/preferences/advanced.dtd">
<!ENTITY % aboutDialogDTD SYSTEM "chrome://browser/locale/aboutDialog.dtd" >
%aboutDialogDTD;
%brandDTD; %brandDTD;
%globalPreferencesDTD; %globalPreferencesDTD;
%preferencesDTD; %preferencesDTD;
%selectBookmarkDTD;
%languagesDTD;
%fontDTD;
%colorsDTD;
%permissionsDTD;
%passwordManagerDTD;
%historyDTD;
%certManagerDTD;
%deviceManangerDTD;
%connectionDTD;
%siteDataSettingsDTD;
%privacyDTD; %privacyDTD;
%tabsDTD; %tabsDTD;
%searchDTD; %searchDTD;
@ -69,18 +95,23 @@
#endif #endif
<html:link rel="shortcut icon" <html:link rel="shortcut icon"
href="chrome://browser/skin/preferences/in-content-old/favicon.ico"/> href="chrome://browser/skin/preferences/in-content-new/favicon.ico"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/> src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/preferences.js"/> src="chrome://browser/content/preferences/in-content-new/preferences.js"/>
<script src="chrome://browser/content/preferences/in-content-old/subdialogs.js"/> <script src="chrome://browser/content/preferences/in-content-new/findInPage.js"/>
<script src="chrome://browser/content/preferences/in-content-new/subdialogs.js"/>
<stringbundle id="bundleBrand" <stringbundle id="bundleBrand"
src="chrome://branding/locale/brand.properties"/> src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundlePreferences" <stringbundle id="bundlePreferences"
src="chrome://browser/locale/preferences-old/preferences.properties"/> src="chrome://browser/locale/preferences/preferences.properties"/>
<stringbundle id="pkiBundle"
src="chrome://pippki/locale/pippki.properties"/>
<stringbundle id="browserBundle"
src="chrome://browser/locale/browser.properties"/>
<stringbundleset id="appManagerBundleset"> <stringbundleset id="appManagerBundleset">
<stringbundle id="appManagerBundle" <stringbundle id="appManagerBundle"
@ -92,6 +123,17 @@
<!-- category list --> <!-- category list -->
<richlistbox id="categories"> <richlistbox id="categories">
<richlistitem id="category-search-results"
class="category"
value="paneSearchResults"
helpTopic="prefs-main"
tooltiptext="&paneSearchResults.title;"
align="center"
hidden="true">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneSearchResults.title;</label>
</richlistitem>
<richlistitem id="category-general" <richlistitem id="category-general"
class="category" class="category"
value="paneGeneral" value="paneGeneral"
@ -102,44 +144,14 @@
<label class="category-name" flex="1">&paneGeneral.title;</label> <label class="category-name" flex="1">&paneGeneral.title;</label>
</richlistitem> </richlistitem>
<richlistitem id="category-search"
class="category"
value="paneSearch"
helpTopic="prefs-search"
tooltiptext="&paneSearch.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneSearch.title;</label>
</richlistitem>
<richlistitem id="category-content"
class="category"
value="paneContent"
helpTopic="prefs-content"
tooltiptext="&paneContent.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneContent.title;</label>
</richlistitem>
<richlistitem id="category-application" <richlistitem id="category-application"
class="category" class="category"
value="paneApplications" value="paneApplications"
helpTopic="prefs-applications" helpTopic="prefs-applications"
tooltiptext="&paneApplications.title;" tooltiptext="&paneFilesApplications.title;"
align="center"> align="center">
<image class="category-icon"/> <image class="category-icon"/>
<label class="category-name" flex="1">&paneApplications.title;</label> <label class="category-name" flex="1">&paneFilesApplications.title;</label>
</richlistitem>
<richlistitem id="category-privacy"
class="category"
value="panePrivacy"
helpTopic="prefs-privacy"
tooltiptext="&panePrivacy.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&panePrivacy.title;</label>
</richlistitem> </richlistitem>
<richlistitem id="category-containers" <richlistitem id="category-containers"
@ -148,34 +160,34 @@
helpTopic="prefs-containers" helpTopic="prefs-containers"
hidden="true"/> hidden="true"/>
<richlistitem id="category-security"
class="category"
value="paneSecurity"
helpTopic="prefs-security"
tooltiptext="&paneSecurity.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneSecurity.title;</label>
</richlistitem>
<richlistitem id="category-sync" <richlistitem id="category-sync"
class="category" class="category"
value="paneSync" value="paneSync"
helpTopic="prefs-weave" helpTopic="prefs-weave"
tooltiptext="&paneSync.title;" tooltiptext="&paneSync1.title;"
align="center"> align="center">
<image class="category-icon"/> <image class="category-icon"/>
<label class="category-name" flex="1">&paneSync.title;</label> <label class="category-name" flex="1">&paneSync1.title;</label>
</richlistitem>
<richlistitem id="category-privacy"
class="category"
value="panePrivacy"
helpTopic="prefs-privacy"
tooltiptext="&panePrivacySecurity.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&panePrivacySecurity.title;</label>
</richlistitem> </richlistitem>
<richlistitem id="category-advanced" <richlistitem id="category-advanced"
class="category" class="category"
value="paneAdvanced" value="paneAdvanced"
helpTopic="prefs-advanced-general" helpTopic="prefs-advanced-general"
tooltiptext="&paneAdvanced.title;" tooltiptext="&paneUpdates.title;"
align="center"> align="center">
<image class="category-icon"/> <image class="category-icon"/>
<label class="category-name" flex="1">&paneAdvanced.title;</label> <label class="category-name" flex="1">&paneUpdates.title;</label>
</richlistitem> </richlistitem>
</richlistbox> </richlistbox>
@ -186,20 +198,23 @@
<key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/> <key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/>
</keyset> </keyset>
<html:a class="help-button" target="_blank" aria-label="&helpButton2.label;">&helpButton2.label;</html:a>
<vbox class="main-content" flex="1"> <vbox class="main-content" flex="1">
<hbox pack="end">
<textbox type="search" id="searchInput" placeholder="&searchInput.label;" hidden="true"
clickSelectsAll="true"/>
</hbox>
<prefpane id="mainPrefPane"> <prefpane id="mainPrefPane">
#include searchResults.xul
#include main.xul #include main.xul
#include search.xul
#include privacy.xul #include privacy.xul
#include containers.xul #include containers.xul
#include advanced.xul #include advanced.xul
#include applications.xul #include applications.xul
#include content.xul
#include security.xul
#include sync.xul #include sync.xul
</prefpane> </prefpane>
</vbox> </vbox>
</hbox> </hbox>
<vbox id="dialogOverlay" align="center" pack="center"> <vbox id="dialogOverlay" align="center" pack="center">

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,805 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- Privacy panel -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content-new/privacy.js"/>
<preferences id="privacyPreferences" hidden="true" data-category="panePrivacy">
<!-- Tracking -->
<preference id="privacy.trackingprotection.enabled"
name="privacy.trackingprotection.enabled"
type="bool"/>
<preference id="privacy.trackingprotection.pbmode.enabled"
name="privacy.trackingprotection.pbmode.enabled"
type="bool"/>
<!-- XXX button prefs -->
<preference id="pref.privacy.disable_button.cookie_exceptions"
name="pref.privacy.disable_button.cookie_exceptions"
type="bool"/>
<preference id="pref.privacy.disable_button.view_cookies"
name="pref.privacy.disable_button.view_cookies"
type="bool"/>
<preference id="pref.privacy.disable_button.change_blocklist"
name="pref.privacy.disable_button.change_blocklist"
type="bool"/>
<preference id="pref.privacy.disable_button.tracking_protection_exceptions"
name="pref.privacy.disable_button.tracking_protection_exceptions"
type="bool"/>
<!-- Location Bar -->
<preference id="browser.urlbar.autocomplete.enabled"
name="browser.urlbar.autocomplete.enabled"
type="bool"/>
<preference id="browser.urlbar.suggest.bookmark"
name="browser.urlbar.suggest.bookmark"
type="bool"/>
<preference id="browser.urlbar.suggest.history"
name="browser.urlbar.suggest.history"
type="bool"/>
<preference id="browser.urlbar.suggest.openpage"
name="browser.urlbar.suggest.openpage"
type="bool"/>
<!-- History -->
<preference id="places.history.enabled"
name="places.history.enabled"
type="bool"/>
<preference id="browser.formfill.enable"
name="browser.formfill.enable"
type="bool"/>
<preference id="privacy.history.custom"
name="privacy.history.custom"
type="bool"/>
<!-- Cookies -->
<preference id="network.cookie.cookieBehavior"
name="network.cookie.cookieBehavior"
type="int"/>
<preference id="network.cookie.lifetimePolicy"
name="network.cookie.lifetimePolicy"
type="int"/>
<preference id="network.cookie.blockFutureCookies"
name="network.cookie.blockFutureCookies"
type="bool"/>
<!-- Clear Private Data -->
<preference id="privacy.sanitize.sanitizeOnShutdown"
name="privacy.sanitize.sanitizeOnShutdown"
type="bool"/>
<preference id="privacy.sanitize.timeSpan"
name="privacy.sanitize.timeSpan"
type="int"/>
<!-- Private Browsing -->
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
type="bool"/>
<!-- DRM content -->
<preference id="media.eme.enabled"
name="media.eme.enabled"
type="bool"/>
<!-- Popups -->
<preference id="dom.disable_open_during_load"
name="dom.disable_open_during_load"
type="bool"/>
<!-- Passwords -->
<preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
<!-- XXX buttons -->
<preference id="pref.privacy.disable_button.view_passwords"
name="pref.privacy.disable_button.view_passwords"
type="bool"/>
<preference id="pref.privacy.disable_button.view_passwords_exceptions"
name="pref.privacy.disable_button.view_passwords_exceptions"
type="bool"/>
<!-- Certificates tab
* security.default_personal_cert
- a string:
"Select Automatically" select a certificate automatically when a site
requests one
"Ask Every Time" present a dialog to the user so he can select
the certificate to use on a site which
requests one -->
<preference id="security.default_personal_cert"
name="security.default_personal_cert"
type="string"/>
<preference id="security.disable_button.openCertManager"
name="security.disable_button.openCertManager"
type="bool"/>
<preference id="security.disable_button.openDeviceManager"
name="security.disable_button.openDeviceManager"
type="bool"/>
<preference id="security.OCSP.enabled"
name="security.OCSP.enabled"
type="int"/>
<!-- Add-ons, malware, phishing -->
<preference id="xpinstall.whitelist.required"
name="xpinstall.whitelist.required"
type="bool"/>
<preference id="browser.safebrowsing.malware.enabled"
name="browser.safebrowsing.malware.enabled"
type="bool"/>
<preference id="browser.safebrowsing.phishing.enabled"
name="browser.safebrowsing.phishing.enabled"
type="bool"/>
<preference id="browser.safebrowsing.downloads.enabled"
name="browser.safebrowsing.downloads.enabled"
type="bool"/>
<preference id="urlclassifier.malwareTable"
name="urlclassifier.malwareTable"
type="string"/>
<preference id="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
name="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
type="bool"/>
<preference id="browser.safebrowsing.downloads.remote.block_uncommon"
name="browser.safebrowsing.downloads.remote.block_uncommon"
type="bool"/>
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
type="int"/>
<preference id="browser.offline-apps.notify"
name="browser.offline-apps.notify"
type="bool"/>
<preference id="browser.cache.disk.smart_size.enabled"
name="browser.cache.disk.smart_size.enabled"
inverted="true"
type="bool"/>
<!-- Data Choices tab -->
#ifdef MOZ_CRASHREPORTER
<preference id="browser.crashReports.unsubmittedCheck.autoSubmit"
name="browser.crashReports.unsubmittedCheck.autoSubmit"
type="bool"/>
#endif
</preferences>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
<stringbundle id="signonBundle" src="chrome://passwordmgr/locale/passwordmgr.properties"/>
<hbox id="header-privacy"
class="header"
hidden="true"
data-category="panePrivacy">
<label class="header-name" flex="1">&panePrivacySecurity.title;</label>
</hbox>
<!-- History -->
<groupbox id="historyGroup" data-category="panePrivacy" hidden="true">
<caption><label>&history.label;</label></caption>
<hbox align="center">
<label id="historyModeLabel"
control="historyMode"
accesskey="&historyHeader2.pre.accesskey;">&historyHeader2.pre.label;
</label>
<menulist id="historyMode">
<menupopup>
<menuitem label="&historyHeader.remember.label;" value="remember"/>
<menuitem label="&historyHeader.dontremember.label;" value="dontremember"/>
<menuitem label="&historyHeader.custom.label;" value="custom"/>
</menupopup>
</menulist>
<label>&historyHeader.post.label;</label>
</hbox>
<deck id="historyPane">
<vbox id="historyRememberPane">
<hbox align="center" flex="1">
<vbox flex="1">
<description>&rememberDescription.label;</description>
<separator class="thin"/>
<description>&rememberActions.pre.label;<label
class="text-link" id="historyRememberClear"
>&rememberActions.clearHistory.label;</label>&rememberActions.middle.label;<label
class="text-link" id="historyRememberCookies"
>&rememberActions.removeCookies.label;</label>&rememberActions.post.label;</description>
</vbox>
</hbox>
</vbox>
<vbox id="historyDontRememberPane">
<hbox align="center" flex="1">
<vbox flex="1">
<description>&dontrememberDescription.label;</description>
<separator class="thin"/>
<description>&dontrememberActions.pre.label;<label
class="text-link" id="historyDontRememberClear"
>&dontrememberActions.clearHistory.label;</label>&dontrememberActions.post.label;</description>
</vbox>
</hbox>
</vbox>
<vbox id="historyCustomPane">
<separator class="thin"/>
<vbox>
<checkbox id="privateBrowsingAutoStart"
label="&privateBrowsingPermanent2.label;"
accesskey="&privateBrowsingPermanent2.accesskey;"
preference="browser.privatebrowsing.autostart"/>
<vbox class="indent">
<checkbox id="rememberHistory"
label="&rememberHistory2.label;"
accesskey="&rememberHistory2.accesskey;"
preference="places.history.enabled"/>
<checkbox id="rememberForms"
label="&rememberSearchForm.label;"
accesskey="&rememberSearchForm.accesskey;"
preference="browser.formfill.enable"/>
<hbox id="cookiesBox">
<checkbox id="acceptCookies" label="&acceptCookies.label;"
preference="network.cookie.cookieBehavior"
accesskey="&acceptCookies.accesskey;"
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"
flex="1" />
<button id="cookieExceptions"
class="accessory-button"
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
preference="pref.privacy.disable_button.cookie_exceptions"/>
</hbox>
<hbox id="acceptThirdPartyRow"
class="indent"
align="center">
<label id="acceptThirdPartyLabel" control="acceptThirdPartyMenu"
accesskey="&acceptThirdParty.pre.accesskey;">&acceptThirdParty.pre.label;</label>
<menulist id="acceptThirdPartyMenu" preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();">
<menupopup>
<menuitem label="&acceptThirdParty.always.label;" value="always"/>
<menuitem label="&acceptThirdParty.visited.label;" value="visited"/>
<menuitem label="&acceptThirdParty.never.label;" value="never"/>
</menupopup>
</menulist>
</hbox>
<hbox id="keepRow"
class="indent"
align="center">
<label id="keepUntil"
control="keepCookiesUntil"
accesskey="&keepUntil.accesskey;">&keepUntil.label;</label>
<menulist id="keepCookiesUntil"
preference="network.cookie.lifetimePolicy">
<menupopup>
<menuitem label="&expire.label;" value="0"/>
<menuitem label="&close.label;" value="2"/>
</menupopup>
</menulist>
<spacer flex="1"/>
<button id="showCookiesButton"
class="accessory-button"
label="&showCookies.label;" accesskey="&showCookies.accesskey;"
preference="pref.privacy.disable_button.view_cookies"/>
</hbox>
<hbox id="clearDataBox"
align="center">
<checkbox id="alwaysClear"
preference="privacy.sanitize.sanitizeOnShutdown"
label="&clearOnClose.label;"
accesskey="&clearOnClose.accesskey;"
flex="1" />
<button id="clearDataSettings"
class="accessory-button"
label="&clearOnCloseSettings.label;"
accesskey="&clearOnCloseSettings.accesskey;"/>
</hbox>
</vbox>
</vbox>
</vbox>
</deck>
</groupbox>
<!-- Passwords -->
<groupbox id="passwordsGroup" orient="vertical" data-category="panePrivacy" hidden="true">
<caption><label>&formsAndPasswords.label;</label></caption>
<vbox id="passwordSettings">
<hbox id="savePasswordsBox">
<checkbox id="savePasswords"
label="&rememberLogins1.label;" accesskey="&rememberLogins1.accesskey;"
preference="signon.rememberSignons"
onsyncfrompreference="return gPrivacyPane.readSavePasswords();"
flex="1" />
<button id="passwordExceptions"
class="accessory-button"
label="&passwordExceptions.label;"
accesskey="&passwordExceptions.accesskey;"
preference="pref.privacy.disable_button.view_passwords_exceptions"
searchkeywords="&address.label;"/>
</hbox>
<hbox id="showPasswordBox" pack="end">
<button id="showPasswords"
class="accessory-button"
label="&savedLogins.label;" accesskey="&savedLogins.accesskey;"
preference="pref.privacy.disable_button.view_passwords"
searchkeywords="&savedLogins.title;"/>
</hbox>
</vbox>
<hbox id="masterPasswordRow">
<checkbox id="useMasterPassword"
label="&useMasterPassword.label;"
accesskey="&useMasterPassword.accesskey;"
flex="1"/>
<button id="changeMasterPassword"
class="accessory-button"
label="&changeMasterPassword.label;"
accesskey="&changeMasterPassword.accesskey;"/>
</hbox>
</groupbox>
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
<caption><label>&trackingProtectionHeader2.label;</label></caption>
<vbox id="trackingprotectionbox" hidden="true">
<hbox align="start">
<vbox flex="1">
<description>
&trackingProtection.description;
<label id="trackingProtectionLearnMore" class="learnMore text-link">&trackingProtectionLearnMore.label;</label>
</description>
<description id="trackingProtectionDesc"
control="trackingProtectionRadioGroup">
&trackingProtection.radioGroupLabel;
</description>
</vbox>
<spacer flex="1"/>
<vbox id="trackingProtectionAdvancedSettings">
<button id="trackingProtectionExceptions"
class="accessory-button"
label="&trackingProtectionExceptions.label;"
accesskey="&trackingProtectionExceptions.accesskey;"
preference="pref.privacy.disable_button.tracking_protection_exceptions"
searchkeywords="&removepermission.label;
&removeallpermissions.label;
&button.cancel.label;
&button.ok.label;"/>
<button id="changeBlockList"
class="accessory-button"
label="&changeBlockList.label;"
accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"
searchkeywords="&button.cancel.label; &button.ok.label;"/>
</vbox>
</hbox>
<radiogroup id="trackingProtectionRadioGroup" aria-labelledby="trackingProtectionDesc">
<radio value="always"
label="&trackingProtectionAlways.label;"
accesskey="&trackingProtectionAlways.accesskey;"/>
<radio value="private"
label="&trackingProtectionPrivate.label;"
accesskey="&trackingProtectionPrivate.accesskey;"/>
<radio value="never"
label="&trackingProtectionNever.label;"
accesskey="&trackingProtectionNever.accesskey;"/>
</radiogroup>
</vbox>
<vbox id="trackingprotectionpbmbox">
<caption><label>&tracking.label;</label></caption>
<hbox align="center">
<checkbox id="trackingProtectionPBM"
preference="privacy.trackingprotection.pbmode.enabled"
accesskey="&trackingProtectionPBM5.accesskey;"
label="&trackingProtectionPBM5.label;" />
<label id="trackingProtectionPBMLearnMore"
class="learnMore text-link">&trackingProtectionPBMLearnMore.label;</label>
<spacer flex="1" />
<button id="changeBlockListPBM"
label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</hbox>
</vbox>
<vbox>
<description>&doNotTrack.pre.label;<label
class="text-link" id="doNotTrackSettings"
>&doNotTrack.settings.label;</label>&doNotTrack.post.label;</description>
</vbox>
</groupbox>
<!-- Pop-ups -->
<groupbox id="miscGroup" data-category="panePrivacy" hidden="true">
<caption><label>&popups.label;</label></caption>
<hbox align="start">
<checkbox id="popupPolicy" preference="dom.disable_open_during_load"
label="&blockPopups.label;" accesskey="&blockPopups.accesskey;"
onsyncfrompreference="return gPrivacyPane.updateButtons('popupPolicyButton',
'dom.disable_open_during_load');"
flex="1" />
<button id="popupPolicyButton"
class="accessory-button"
label="&popupExceptions.label;"
accesskey="&popupExceptions.accesskey;"
searchkeywords="&address.label; &button.cancel.label; &button.ok.label;"/>
</hbox>
</groupbox>
<!-- Notifications -->
<groupbox id="notificationsGroup" data-category="panePrivacy" hidden="true">
<caption><label>&notificationsPolicy.label;</label></caption>
<grid>
<columns>
<column flex="1"/>
<column/>
</columns>
<rows>
<row id="notificationsPolicyRow" align="center">
<hbox flex="1">
<label id="notificationsPolicy">&notificationsPolicyDesc3.label;</label>
<label id="notificationsPolicyLearnMore"
class="learnMore text-link">&notificationsPolicyLearnMore.label;</label>
</hbox>
<hbox pack="end">
<button id="notificationsPolicyButton"
class="accessory-button"
label="&notificationsPolicyButton.label;"
accesskey="&notificationsPolicyButton.accesskey;"
searchkeywords="&removepermission.label;
&removeallpermissions.label;
&button.cancel.label;
&button.ok.label;"/>
</hbox>
</row>
</rows>
</grid>
<vbox id="notificationsDoNotDisturbBox" hidden="true">
<checkbox id="notificationsDoNotDisturb" label="&notificationsDoNotDisturb.label;"
accesskey="&notificationsDoNotDisturb.accesskey;"/>
<label id="notificationsDoNotDisturbDetails"
class="indent">&notificationsDoNotDisturbDetails.value;</label>
</vbox>
</groupbox>
<!-- Location Bar -->
<groupbox id="locationBarGroup"
data-category="panePrivacy"
hidden="true">
<caption><label>&locationBar.label;</label></caption>
<label id="locationBarSuggestionLabel">&locbar.suggest2.label;</label>
<checkbox id="historySuggestion" label="&locbar.history.label;"
accesskey="&locbar.history.accesskey;"
preference="browser.urlbar.suggest.history"/>
<checkbox id="bookmarkSuggestion" label="&locbar.bookmarks.label;"
accesskey="&locbar.bookmarks.accesskey;"
preference="browser.urlbar.suggest.bookmark"/>
<checkbox id="openpageSuggestion" label="&locbar.openpage.label;"
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
<label class="text-link" onclick="gotoPref('general')">
&suggestionSettings2.label;
</label>
</groupbox>
<!-- addons, forgery (phishing) UI Security -->
<groupbox id="addonsPhishingGroup" data-category="panePrivacy" hidden="true">
<caption><label>&security.label;</label></caption>
<hbox id="addonInstallBox">
<checkbox id="warnAddonInstall"
label="&warnOnAddonInstall.label;"
accesskey="&warnOnAddonInstall.accesskey;"
preference="xpinstall.whitelist.required"
onsyncfrompreference="return gPrivacyPane.readWarnAddonInstall();"
flex="1" />
<button id="addonExceptions"
class="accessory-button"
label="&addonExceptions.label;"
accesskey="&addonExceptions.accesskey;"
searchkeywords="&address.label;
&allow.label;
&removepermission.label;
&removeallpermissions.label;
&button.cancel.label;
&button.ok.label;"/>
</hbox>
<separator class="thin"/>
<checkbox id="enableSafeBrowsing"
label="&enableSafeBrowsing.label;"
accesskey="&enableSafeBrowsing.accesskey;" />
<vbox class="indent">
<checkbox id="blockDownloads"
label="&blockDownloads.label;"
accesskey="&blockDownloads.accesskey;" />
<checkbox id="blockUncommonUnwanted"
label="&blockUncommonAndUnwanted.label;"
accesskey="&blockUncommonAndUnwanted.accesskey;" />
</vbox>
</groupbox>
<!-- Certificates -->
<groupbox id="certSelection" data-category="panePrivacy" hidden="true">
<caption><label>&certificateTab.label;</label></caption>
<description id="CertSelectionDesc" control="certSelection">&certPersonal2.description;</description>
<!--
The values on these radio buttons may look like l10n issues, but
they're not - this preference uses *those strings* as its values.
I KID YOU NOT.
-->
<radiogroup id="certSelection"
preftype="string"
preference="security.default_personal_cert"
aria-labelledby="CertSelectionDesc">
<radio label="&selectCerts.auto;"
accesskey="&selectCerts.auto.accesskey;"
value="Select Automatically"/>
<radio label="&selectCerts.ask;"
accesskey="&selectCerts.ask.accesskey;"
value="Ask Every Time"/>
</radiogroup>
<hbox align="start">
<checkbox id="enableOCSP"
label="&enableOCSP.label;"
accesskey="&enableOCSP.accesskey;"
onsyncfrompreference="return gPrivacyPane.readEnableOCSP();"
onsynctopreference="return gPrivacyPane.writeEnableOCSP();"
preference="security.OCSP.enabled"
flex="1" />
<vbox>
<button id="viewCertificatesButton"
class="accessory-button"
label="&viewCerts.label;"
accesskey="&viewCerts.accesskey;"
preference="security.disable_button.openCertManager"
searchkeywords="&certmgr.tab.mine;
&certmgr.tab.others2;
&certmgr.tab.websites3;
&certmgr.tab.ca;
&certmgr.tab.orphan2;
&certmgr.mine;
&certmgr.others;
&certmgr.websites2;
&certmgr.cas;
&certmgr.orphans;
&certmgr.certname;
&certmgr.tokenname;
&certmgr.view2.label;
&certmgr.export.label;
&certmgr.delete2.label;"/>
<button id="viewSecurityDevicesButton"
class="accessory-button"
label="&viewSecurityDevices.label;"
accesskey="&viewSecurityDevices.accesskey;"
preference="security.disable_button.openDeviceManager"
searchkeywords="&devmgr.title;
&devmgr.devlist.label;
&devmgr.details.title;
&devmgr.details.title2;
&devmgr.button.login.label;
&devmgr.button.logout.label;
&devmgr.button.changepw.label;
&devmgr.button.load.label;
&devmgr.button.unload.label;"/>
</vbox>
</hbox>
</groupbox>
<!-- DRM Content -->
<groupbox id="drmGroup" data-category="panePrivacy" hidden="true">
<caption><label>&drmContent.label;</label></caption>
<grid id="contentGrid2">
<columns>
<column flex="1"/>
<column/>
</columns>
<rows id="contentRows-2">
<row id="playDRMContentRow">
<hbox align="center">
<checkbox id="playDRMContent" preference="media.eme.enabled"
label="&playDRMContent.label;" accesskey="&playDRMContent.accesskey;"/>
<label id="playDRMContentLink" class="learnMore text-link">
&playDRMContent.learnMore.label;
</label>
</hbox>
</row>
</rows>
</grid>
</groupbox>
<!-- Containers -->
<groupbox id="browserContainersGroup" data-category="panePrivacy" hidden="true">
<vbox id="browserContainersbox" hidden="true">
<caption><label>&browserContainersHeader.label;</label></caption>
<hbox align="center">
<checkbox id="browserContainersCheckbox"
label="&browserContainersEnabled.label;"
accesskey="&browserContainersEnabled.accesskey;"
preference="privacy.userContext.enabled"
onsyncfrompreference="return gPrivacyPane.readBrowserContainersCheckbox();"/>
<label id="browserContainersLearnMore" class="learnMore text-link">
&browserContainersLearnMore.label;
</label>
<spacer flex="1"/>
<button id="browserContainersSettings"
class="accessory-button"
label="&browserContainersSettings.label;"
accesskey="&browserContainersSettings.accesskey;"
searchkeywords="&addButton.label;
&preferencesButton.label;
&removeButton.label;"/>
</hbox>
</vbox>
</groupbox>
<!-- Network -->
<!-- Connection -->
<groupbox id="connectionGroup" data-category="panePrivacy" hidden="true">
<caption><label>&connection.label;</label></caption>
<hbox align="center">
<description flex="1" control="connectionSettings">&connectionDesc.label;</description>
<button id="connectionSettings"
class="accessory-button"
icon="network"
label="&connectionSettings.label;"
accesskey="&connectionSettings.accesskey;"
searchkeywords="&connectionsDialog.title;
&noProxyTypeRadio.label;
&WPADTypeRadio.label;
&systemTypeRadio.label;
&manualTypeRadio.label;
&http.label;
&ssl.label;
&ftp.label;
&socks.label;
&socks4.label;
&socks5.label;
&noproxy.label;
&noproxyExplain.label;
&shareproxy.label;
&autoTypeRadio.label;
&reload.label;
&autologinproxy.label;
&socksRemoteDNS.label2;"/>
</hbox>
</groupbox>
<!-- Cache -->
<groupbox id="cacheGroup" data-category="panePrivacy" hidden="true">
<caption><label>&httpCache.label;</label></caption>
<hbox align="center">
<label id="actualDiskCacheSize" flex="1"/>
<button id="clearCacheButton"
class="accessory-button"
icon="clear"
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"/>
</hbox>
<checkbox preference="browser.cache.disk.smart_size.enabled"
id="allowSmartSize"
onsyncfrompreference="return gPrivacyPane.readSmartSizeEnabled();"
label="&overrideSmartCacheSize.label;"
accesskey="&overrideSmartCacheSize.accesskey;"/>
<hbox align="center" class="indent">
<label id="useCacheBefore" control="cacheSize"
accesskey="&limitCacheSizeBefore.accesskey;">
&limitCacheSizeBefore.label;
</label>
<textbox id="cacheSize" type="number" size="4" max="1024"
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
<label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
</hbox>
</groupbox>
<!-- Offline apps -->
<groupbox id="offlineGroup" data-category="panePrivacy" hidden="true" data-hidden-from-search="true">
<caption><label>&offlineStorage2.label;</label></caption>
<hbox align="center">
<label id="actualAppCacheSize" flex="1"/>
<button id="clearOfflineAppCacheButton"
class="accessory-button"
icon="clear"
label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"/>
</hbox>
<hbox align="center">
<checkbox id="offlineNotify"
label="&offlineStorageNotify.label;" accesskey="&offlineStorageNotify.accesskey;"
preference="browser.offline-apps.notify"
onsyncfrompreference="return gPrivacyPane.readOfflineNotify();"
flex="1" />
<button id="offlineNotifyExceptions"
class="accessory-button"
label="&offlineStorageNotifyExceptions.label;"
accesskey="&offlineStorageNotifyExceptions.accesskey;"/>
</hbox>
<hbox>
<vbox flex="1">
<label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
<listbox id="offlineAppsList"
flex="1"
aria-labelledby="offlineAppsListLabel">
</listbox>
</vbox>
<vbox pack="end">
<button id="offlineAppsListRemove"
class="accessory-button"
disabled="true"
label="&offlineAppsListRemove.label;"
accesskey="&offlineAppsListRemove.accesskey;"/>
</vbox>
</hbox>
</groupbox>
<!-- Site Data -->
<groupbox id="siteDataGroup" hidden="true" data-category="panePrivacy" data-hidden-from-search="true">
<caption><label>&siteData.label;</label></caption>
<hbox align="baseline">
<label id="totalSiteDataSize"></label>
<label id="siteDataLearnMoreLink" class="learnMore text-link" value="&siteDataLearnMoreLink.label;"></label>
<spacer flex="1" />
<button id="clearSiteDataButton"
class="accessory-button"
icon="clear"
label="&clearSiteData.label;" accesskey="&clearSiteData.accesskey;"/>
</hbox>
<vbox align="end">
<button id="siteDataSettings"
class="accessory-button"
label="&siteDataSettings.label;"
accesskey="&siteDataSettings.accesskey;"
searchkeywords="&window.title;
&hostCol.label;
&statusCol.label;
&usageCol.label;"/>
</vbox>
</groupbox>
<!-- Data Choices -->
#ifdef MOZ_TELEMETRY_REPORTING
<groupbox id="historyGroup" data-category="panePrivacy" data-subcategory="reports" hidden="true">
<caption><label>&reports.label;</label></caption>
<hbox align="center">
<checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
<label id="FHRLearnMore"
class="learnMore text-link">&healthReportLearnMore.label;</label>
</hbox>
<description class="indent">&healthReportDesc.label;</description>
<vbox class="indent">
<hbox align="center">
<checkbox id="submitTelemetryBox" preference="toolkit.telemetry.enabled"
label="&enableTelemetryData.label;"
accesskey="&enableTelemetryData.accesskey;"/>
<label id="telemetryLearnMore"
class="learnMore text-link">&telemetryLearnMore.label;</label>
</hbox>
<description id="telemetryDataDesc"
class="indent">&telemetryDesc.label;</description>
</vbox>
</groupbox>
#endif
#ifdef MOZ_DATA_REPORTING
#ifdef MOZ_CRASHREPORTER
<groupbox id="crashReporterGroup" data-category="panePrivacy" data-subcategory="reports" hidden="true">
#ifndef MOZ_TELEMETRY_REPORTING
<caption><label>&reports.label;</label></caption>
#endif
<hbox align="center">
<checkbox id="automaticallySubmitCrashesBox"
preference="browser.crashReports.unsubmittedCheck.autoSubmit"
label="&alwaysSubmitCrashReports.label;"
accesskey="&alwaysSubmitCrashReports.accesskey;"/>
<label id="crashReporterLearnMore"
class="learnMore text-link">&crashReporterLearnMore.label;</label>
</hbox>
<description class="indent">&crashReporterDesc2.label;</description>
</groupbox>
#endif
#endif

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

@ -18,8 +18,8 @@ var gSubDialog = {
_injectedStyleSheets: [ _injectedStyleSheets: [
"chrome://browser/skin/preferences/preferences.css", "chrome://browser/skin/preferences/preferences.css",
"chrome://global/skin/in-content/common.css", "chrome://global/skin/in-content/common.css",
"chrome://browser/skin/preferences/in-content-old/preferences.css", "chrome://browser/skin/preferences/in-content-new/preferences.css",
"chrome://browser/skin/preferences/in-content-old/dialog.css", "chrome://browser/skin/preferences/in-content-new/dialog.css",
], ],
_resizeObserver: null, _resizeObserver: null,

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

@ -26,14 +26,13 @@
</preferences> </preferences>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/sync.js"/> src="chrome://browser/content/preferences/in-content-new/sync.js"/>
<hbox id="header-sync" <hbox id="header-sync"
class="header" class="header"
hidden="true" hidden="true"
data-category="paneSync"> data-category="paneSync">
<label class="header-name" flex="1">&paneSync.title;</label> <label class="header-name" flex="1">&paneSync1.title;</label>
<html:a class="help-button text-link" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox> </hbox>
<deck id="weavePrefsDeck" data-category="paneSync" hidden="true"> <deck id="weavePrefsDeck" data-category="paneSync" hidden="true">
@ -96,7 +95,7 @@
<label id="fxaDisplayName" hidden="true"/> <label id="fxaDisplayName" hidden="true"/>
<label id="fxaEmailAddress1"/> <label id="fxaEmailAddress1"/>
<hbox class="fxaAccountBoxButtons"> <hbox class="fxaAccountBoxButtons">
<button id="fxaUnlinkButton" label="&disconnect.label;" accesskey="&disconnect.accesskey;"/> <button id="fxaUnlinkButton" label="&disconnect3.label;" accesskey="&disconnect3.accesskey;"/>
<html:a id="verifiedManage" target="_blank" <html:a id="verifiedManage" target="_blank"
accesskey="&verifiedManage.accesskey;" accesskey="&verifiedManage.accesskey;"
onkeypress="gSyncPane.openManageFirefoxAccount(event);"><!-- onkeypress="gSyncPane.openManageFirefoxAccount(event);"><!--
@ -149,7 +148,8 @@
</deck> </deck>
</groupbox> </groupbox>
<groupbox id="syncOptions"> <groupbox id="syncOptions">
<caption><label>&signedIn.engines.label;</label></caption> <caption><label>&signedIn.settings.label;</label></caption>
<description>&signedIn.settings.description;</description>
<hbox id="fxaSyncEngines"> <hbox id="fxaSyncEngines">
<vbox align="start" flex="1"> <vbox align="start" flex="1">
<checkbox label="&engine.tabs.label2;" <checkbox label="&engine.tabs.label2;"
@ -191,8 +191,8 @@
<textbox id="fxaSyncComputerName" disabled="true"/> <textbox id="fxaSyncComputerName" disabled="true"/>
<hbox> <hbox>
<button id="fxaChangeDeviceName" <button id="fxaChangeDeviceName"
label="&changeSyncDeviceName.label;" label="&changeSyncDeviceName2.label;"
accesskey="&changeSyncDeviceName.accesskey;"/> accesskey="&changeSyncDeviceName2.accesskey;"/>
<button id="fxaCancelChangeDeviceName" <button id="fxaCancelChangeDeviceName"
label="&cancelChangeSyncDeviceName.label;" label="&cancelChangeSyncDeviceName.label;"
accesskey="&cancelChangeSyncDeviceName.accesskey;" accesskey="&cancelChangeSyncDeviceName.accesskey;"

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

@ -7,21 +7,27 @@ support-files =
offline/manifest.appcache offline/manifest.appcache
[browser_applications_selection.js] [browser_applications_selection.js]
[browser_advanced_siteData.js]
[browser_advanced_update.js] [browser_advanced_update.js]
skip-if = !updater skip-if = !updater
[browser_basic_rebuild_fonts_test.js] [browser_basic_rebuild_fonts_test.js]
[browser_bug410900.js] [browser_bug410900.js]
[browser_bug705422.js] [browser_bug705422.js]
[browser_bug731866.js] [browser_bug731866.js]
[browser_search_within_preferences.js]
[browser_search_subdialogs_within_preferences_1.js]
[browser_search_subdialogs_within_preferences_2.js]
[browser_search_subdialogs_within_preferences_3.js]
[browser_search_subdialogs_within_preferences_4.js]
[browser_bug795764_cachedisabled.js] [browser_bug795764_cachedisabled.js]
[browser_bug1018066_resetScrollPosition.js] [browser_bug1018066_resetScrollPosition.js]
[browser_bug1020245_openPreferences_to_paneContent.js] [browser_bug1020245_openPreferences_to_paneContent.js]
[browser_bug1184989_prevent_scrolling_when_preferences_flipped.js] [browser_bug1184989_prevent_scrolling_when_preferences_flipped.js]
[browser_engines.js]
support-files = support-files =
browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul
[browser_change_app_handler.js] [browser_change_app_handler.js]
skip-if = os != "win" # This test tests the windows-specific app selection dialog, so can't run on non-Windows skip-if = os != "win" # This test tests the windows-specific app selection dialog, so can't run on non-Windows
[browser_checkspelling.js]
[browser_connection.js] [browser_connection.js]
[browser_connection_bug388287.js] [browser_connection_bug388287.js]
[browser_cookies_exceptions.js] [browser_cookies_exceptions.js]
@ -29,6 +35,8 @@ skip-if = os != "win" # This test tests the windows-specific app selection dialo
[browser_healthreport.js] [browser_healthreport.js]
skip-if = true || !healthreport # Bug 1185403 for the "true" skip-if = true || !healthreport # Bug 1185403 for the "true"
[browser_homepages_filter_aboutpreferences.js] [browser_homepages_filter_aboutpreferences.js]
[browser_layersacceleration.js]
[browser_masterpassword.js]
[browser_notifications_do_not_disturb.js] [browser_notifications_do_not_disturb.js]
[browser_performance.js] [browser_performance.js]
[browser_permissions_urlFieldHidden.js] [browser_permissions_urlFieldHidden.js]
@ -41,6 +49,8 @@ skip-if = true || !healthreport # Bug 1185403 for the "true"
[browser_sanitizeOnShutdown_prefLocked.js] [browser_sanitizeOnShutdown_prefLocked.js]
[browser_searchsuggestions.js] [browser_searchsuggestions.js]
[browser_security.js] [browser_security.js]
[browser_siteData.js]
[browser_siteData2.js]
[browser_subdialogs.js] [browser_subdialogs.js]
support-files = support-files =
subdialog.xul subdialog.xul

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

@ -93,7 +93,7 @@ function formatInstallDate(sec) {
registerCleanupFunction(resetPreferences); registerCleanupFunction(resetPreferences);
add_task(async function() { add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("advanced", "updateTab", { leaveOpen: true }); await openPreferencesViaOpenPreferencesAPI("advanced", { leaveOpen: true });
resetPreferences(); resetPreferences();
Services.prefs.setBoolPref("browser.search.update", false); Services.prefs.setBoolPref("browser.search.update", false);
@ -110,14 +110,19 @@ add_task(async function() {
}); });
add_task(async function() { add_task(async function() {
mockUpdateManager.register(); await openPreferencesViaOpenPreferencesAPI("advanced", { leaveOpen: true });
await openPreferencesViaOpenPreferencesAPI("advanced", "updateTab", { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument; let doc = gBrowser.selectedBrowser.contentDocument;
let showBtn = doc.getElementById("showUpdateHistory"); let showBtn = doc.getElementById("showUpdateHistory");
let dialogOverlay = doc.getElementById("dialogOverlay"); let dialogOverlay = doc.getElementById("dialogOverlay");
// XXX: For unknown reasons, this mock cannot be loaded by
// XPCOMUtils.defineLazyServiceGetter() called in aboutDialog-appUpdater.js.
// It is registered here so that we could assert update history subdialog
// without stopping the preferences advanced pane from loading.
// See bug 1361929.
mockUpdateManager.register();
// Test the dialog window opens // Test the dialog window opens
is(dialogOverlay.style.visibility, "", "The dialog should be invisible"); is(dialogOverlay.style.visibility, "", "The dialog should be invisible");
showBtn.doCommand(); showBtn.doCommand();

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

@ -5,7 +5,7 @@ var container;
SimpleTest.requestCompleteLog(); SimpleTest.requestCompleteLog();
add_task(async function setup() { add_task(async function setup() {
await openPreferencesViaOpenPreferencesAPI("applications", null, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("applications", {leaveOpen: true});
info("Preferences page opened on the applications pane."); info("Preferences page opened on the applications pane.");
registerCleanupFunction(() => { registerCleanupFunction(() => {

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

@ -5,7 +5,7 @@ registerCleanupFunction(function() {
}); });
add_task(async function() { add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data
is(doc.getElementById("font.language.group").value, langGroup, is(doc.getElementById("font.language.group").value, langGroup,

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

@ -11,7 +11,7 @@ registerCleanupFunction(function() {
add_task(async function() { add_task(async function() {
originalWindowHeight = window.outerHeight; originalWindowHeight = window.outerHeight;
window.resizeTo(window.outerWidth, 300); window.resizeTo(window.outerWidth, 300);
let prefs = await openPreferencesViaOpenPreferencesAPI("paneApplications", undefined, {leaveOpen: true}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneApplications", {leaveOpen: true});
is(prefs.selectedPane, "paneApplications", "Applications pane was selected"); is(prefs.selectedPane, "paneApplications", "Applications pane was selected");
let mainContent = gBrowser.contentDocument.querySelector(".main-content"); let mainContent = gBrowser.contentDocument.querySelector(".main-content");
mainContent.scrollTop = 50; mainContent.scrollTop = 50;

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

@ -0,0 +1,77 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.instantApply");
});
// Test opening to the differerent panes and subcategories in Preferences
add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy");
is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
prefs = await openPreferencesViaOpenPreferencesAPI("advanced");
is(prefs.selectedPane, "paneAdvanced", "Advanced pane was selected");
prefs = await openPreferencesViaHash("privacy");
is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected when hash is 'privacy'");
prefs = await openPreferencesViaOpenPreferencesAPI("nonexistant-category");
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default when a nonexistant-category is requested");
prefs = await openPreferencesViaHash("nonexistant-category");
is(prefs.selectedPane, "paneGeneral", "General pane is selected when hash is a nonexistant-category");
prefs = await openPreferencesViaHash();
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
prefs = await openPreferencesViaOpenPreferencesAPI("privacy-reports", {leaveOpen: true});
is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected by default");
let doc = gBrowser.contentDocument;
is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
ok(doc.querySelector("#locationBarGroup").hidden, "Location Bar prefs should be hidden when only Reports are requested");
ok(!doc.querySelector("#header-privacy").hidden, "The header should be visible when a subcategory is requested");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
prefs = await openPreferencesViaOpenPreferencesAPI("general-search", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
doc = gBrowser.contentDocument;
is(doc.location.hash, "#general", "The subcategory should be removed from the URI");
ok(doc.querySelector("#startupGroup").hidden, "Startup should be hidden when only Search is requested");
ok(!doc.querySelector("#engineList").hidden, "The search engine list should be visible when Search is requested");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
// Test opening Preferences with subcategory on an existing Preferences tab. See bug 1358475.
add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("general-search", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
let doc = gBrowser.contentDocument;
is(doc.location.hash, "#general", "The subcategory should be removed from the URI");
ok(doc.querySelector("#startupGroup").hidden, "Startup should be hidden when only Search is requested");
ok(!doc.querySelector("#engineList").hidden, "The search engine list should be visible when Search is requested");
// The reasons that here just call the `openPreferences` API without the helping function are
// - already opened one about:preferences tab up there and
// - the goal is to test on the existing tab and
// - using `openPreferencesViaOpenPreferencesAPI` would introduce more handling of additional about:blank and unneccessary event
openPreferences("privacy-reports");
let selectedPane = gBrowser.contentWindow.history.state;
is(selectedPane, "panePrivacy", "Privacy pane should be selected");
is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
ok(doc.querySelector("#locationBarGroup").hidden, "Location Bar prefs should be hidden when only Reports are requested");
ok(!doc.querySelector("#header-privacy").hidden, "The header should be visible when a subcategory is requested");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
function openPreferencesViaHash(aPane) {
return new Promise(resolve => {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:preferences" + (aPane ? "#" + aPane : ""));
let newTabBrowser = gBrowser.selectedBrowser;
newTabBrowser.addEventListener("Initialized", function() {
newTabBrowser.contentWindow.addEventListener("load", function() {
let win = gBrowser.contentWindow;
let selectedPane = win.history.state;
gBrowser.removeCurrentTab();
resolve({selectedPane});
}, {once: true});
}, {capture: true, once: true});
});
}

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

@ -40,7 +40,7 @@ add_task(async function() {
await checkPageScrolling(container, "radio"); await checkPageScrolling(container, "radio");
}); });
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, async function(browser) { await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences" }, async function(browser) {
let doc = browser.contentDocument; let doc = browser.contentDocument;
let container = doc.getElementsByClassName("main-content")[0]; let container = doc.getElementsByClassName("main-content")[0];

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

@ -22,7 +22,7 @@ function test() {
getService(Ci.nsIHandlerService); getService(Ci.nsIHandlerService);
hserv.store(info); hserv.store(info);
openPreferencesViaOpenPreferencesAPI("applications", null, {leaveOpen: true}).then( openPreferencesViaOpenPreferencesAPI("applications", {leaveOpen: true}).then(
() => runTest(gBrowser.selectedBrowser.contentWindow) () => runTest(gBrowser.selectedBrowser.contentWindow)
); );
} }

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

@ -6,6 +6,7 @@ Components.utils.import("resource://gre/modules/NetUtil.jsm");
const storageManagerDisabled = !SpecialPowers.getBoolPref("browser.storageManager.enabled"); const storageManagerDisabled = !SpecialPowers.getBoolPref("browser.storageManager.enabled");
const offlineGroupDisabled = !SpecialPowers.getBoolPref("browser.preferences.offlineGroup.enabled"); const offlineGroupDisabled = !SpecialPowers.getBoolPref("browser.preferences.offlineGroup.enabled");
const browserContainersGroupDisabled = !SpecialPowers.getBoolPref("privacy.userContext.ui.enabled");
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
@ -38,6 +39,11 @@ function checkElements(expectedPane) {
is_element_hidden(element, "Disabled offlineGroup should be hidden"); is_element_hidden(element, "Disabled offlineGroup should be hidden");
continue; continue;
} }
// The browserContainersGroup is still only pref-on on Nightly
if (element.id == "browserContainersGroup" && browserContainersGroupDisabled) {
is_element_hidden(element, "Disabled browserContainersGroup should be hidden");
continue;
}
let attributeValue = element.getAttribute("data-category"); let attributeValue = element.getAttribute("data-category");
let suffix = " (id=" + element.id + ")"; let suffix = " (id=" + element.id + ")";
@ -56,8 +62,8 @@ function runTest(win) {
gElements = tab.getElementById("mainPrefPane").children; gElements = tab.getElementById("mainPrefPane").children;
let panes = [ let panes = [
"General", "Search", "Content", "Applications", "General", "Applications",
"Privacy", "Security", "Sync", "Advanced", "Privacy", "Sync", "Advanced",
]; ];
for (let pane of panes) { for (let pane of panes) {

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

@ -1,8 +1,9 @@
/* Any copyright is dedicated to the Public Domain. /* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */ * http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); const { interfaces: Ci, utils: Cu } = Components;
Components.utils.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
@ -20,7 +21,8 @@ function test() {
["browser.cache.disk.enable", false], ["browser.cache.disk.enable", false],
["browser.cache.memory.enable", false], ["browser.cache.memory.enable", false],
["browser.storageManager.enabled", true], ["browser.storageManager.enabled", true],
["browser.preferences.offlineGroup.enabled", true] ["browser.preferences.offlineGroup.enabled", true],
["privacy.userContext.ui.enabled", true]
]}).then(() => open_preferences(runTest)); ]}).then(() => open_preferences(runTest));
} }
@ -30,17 +32,17 @@ function runTest(win) {
let tab = win.document; let tab = win.document;
let elements = tab.getElementById("mainPrefPane").children; let elements = tab.getElementById("mainPrefPane").children;
// Test if advanced pane is opened correctly // Test if privacy pane is opened correctly
win.gotoPref("paneAdvanced"); win.gotoPref("panePrivacy");
for (let element of elements) { for (let element of elements) {
if (element.nodeName == "preferences") { if (element.nodeName == "preferences") {
continue; continue;
} }
let attributeValue = element.getAttribute("data-category"); let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneAdvanced") { if (attributeValue == "panePrivacy") {
is_element_visible(element, "Advanced elements should be visible"); is_element_visible(element, `Privacy element of id=${element.id} should be visible`);
} else { } else {
is_element_hidden(element, "Non-Advanced elements should be hidden"); is_element_hidden(element, `Non-Privacy element of id=${element.id} should be hidden`);
} }
} }

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

@ -16,7 +16,7 @@ function setupFakeHandler() {
add_task(async function() { add_task(async function() {
setupFakeHandler(); setupFakeHandler();
await openPreferencesViaOpenPreferencesAPI("applications", null, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("applications", {leaveOpen: true});
info("Preferences page opened on the applications pane."); info("Preferences page opened on the applications pane.");
let win = gBrowser.selectedBrowser.contentWindow; let win = gBrowser.selectedBrowser.contentWindow;

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

@ -334,7 +334,7 @@ var testRunner = {
Services.prefs.clearUserPref("privacy.history.custom"); Services.prefs.clearUserPref("privacy.history.custom");
}); });
openPreferencesViaOpenPreferencesAPI("panePrivacy", null, {leaveOpen: true}).then(function() { openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true}).then(function() {
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
let historyMode = doc.getElementById("historyMode"); let historyMode = doc.getElementById("historyMode");
historyMode.value = "custom"; historyMode.value = "custom";

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

@ -1,7 +1,7 @@
add_task(async function() { add_task(async function() {
is(gBrowser.currentURI.spec, "about:blank", "Test starts with about:blank open"); is(gBrowser.currentURI.spec, "about:blank", "Test starts with about:blank open");
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home"); await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:home");
await openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, "about:preferences#general", is(gBrowser.currentURI.spec, "about:preferences#general",
"#general should be in the URI for about:preferences"); "#general should be in the URI for about:preferences");

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

@ -8,12 +8,12 @@ registerCleanupFunction(function() {
}); });
add_task(async function() { add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneContent", undefined, {leaveOpen: true}); let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
is(prefs.selectedPane, "paneContent", "Content pane was selected"); is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
let notificationsDoNotDisturbRow = doc.getElementById("notificationsDoNotDisturbRow"); let notificationsDoNotDisturbBox = doc.getElementById("notificationsDoNotDisturbBox");
if (notificationsDoNotDisturbRow.hidden) { if (notificationsDoNotDisturbBox.hidden) {
todo(false, "Do not disturb is not available on this platform"); todo(false, "Do not disturb is not available on this platform");
return; return;
} }

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

@ -1,19 +1,19 @@
const DEFAULT_HW_ACCEL_PREF = Services.prefs.getDefaultBranch(null).getBoolPref("layers.acceleration.disabled"); const DEFAULT_HW_ACCEL_PREF = Services.prefs.getDefaultBranch(null).getBoolPref("layers.acceleration.disabled");
const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount"); const DEFAULT_PROCESS_COUNT = Services.prefs.getDefaultBranch(null).getIntPref("dom.ipc.processCount");
add_task(function*() { add_task(async function() {
yield SpecialPowers.pushPrefEnv({set: [ await SpecialPowers.pushPrefEnv({set: [
["layers.acceleration.disabled", DEFAULT_HW_ACCEL_PREF], ["layers.acceleration.disabled", DEFAULT_HW_ACCEL_PREF],
["dom.ipc.processCount", DEFAULT_PROCESS_COUNT], ["dom.ipc.processCount", DEFAULT_PROCESS_COUNT],
["browser.preferences.defaultPerformanceSettings.enabled", true], ["browser.preferences.defaultPerformanceSettings.enabled", true],
]}); ]});
}); });
add_task(function*() { add_task(async function() {
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected"); is(prefs.selectedPane, "paneGeneral", "General pane was selected");
let doc = gBrowser.selectedBrowser.contentDocument; let doc = gBrowser.contentDocument;
let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings"); let useRecommendedPerformanceSettings = doc.querySelector("#useRecommendedPerformanceSettings");
is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true, is(Services.prefs.getBoolPref("browser.preferences.defaultPerformanceSettings.enabled"), true,
@ -64,11 +64,11 @@ add_task(function*() {
is(performanceSettings.hidden, false, "performance settings section should be still shown"); is(performanceSettings.hidden, false, "performance settings section should be still shown");
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
yield BrowserTestUtils.removeTab(gBrowser.selectedTab); await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}); });
add_task(function*() { add_task(async function() {
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected"); is(prefs.selectedPane, "paneGeneral", "General pane was selected");
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
@ -89,11 +89,11 @@ add_task(function*() {
is(performanceSettings.hidden, true, "performance settings section should be still shown"); is(performanceSettings.hidden, true, "performance settings section should be still shown");
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
yield BrowserTestUtils.removeTab(gBrowser.selectedTab); await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}); });
add_task(function*() { add_task(async function() {
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected"); is(prefs.selectedPane, "paneGeneral", "General pane was selected");
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
@ -106,13 +106,13 @@ add_task(function*() {
is(performanceSettings.hidden, false, "performance settings section should be shown"); is(performanceSettings.hidden, false, "performance settings section should be shown");
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
yield BrowserTestUtils.removeTab(gBrowser.selectedTab); await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}); });
add_task(function*() { add_task(async function() {
Services.prefs.setIntPref("dom.ipc.processCount", 7); Services.prefs.setIntPref("dom.ipc.processCount", 7);
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected"); is(prefs.selectedPane, "paneGeneral", "General pane was selected");
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
@ -125,13 +125,13 @@ add_task(function*() {
is(contentProcessCount.selectedItem.value, 7, "selected item should be 7"); is(contentProcessCount.selectedItem.value, 7, "selected item should be 7");
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
yield BrowserTestUtils.removeTab(gBrowser.selectedTab); await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}); });
add_task(function*() { add_task(async function() {
Services.prefs.setBoolPref("layers.acceleration.disabled", true); Services.prefs.setBoolPref("layers.acceleration.disabled", true);
let prefs = yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true}); let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane was selected"); is(prefs.selectedPane, "paneGeneral", "General pane was selected");
let doc = gBrowser.contentDocument; let doc = gBrowser.contentDocument;
@ -145,5 +145,5 @@ add_task(function*() {
ok(!allowHWAccel.checked, "checkbox should not be checked"); ok(!allowHWAccel.checked, "checkbox should not be checked");
Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true); Services.prefs.setBoolPref("browser.preferences.defaultPerformanceSettings.enabled", true);
yield BrowserTestUtils.removeTab(gBrowser.selectedTab); await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}); });

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

@ -3,7 +3,7 @@
const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul"; const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
add_task(async function urlFieldVisibleForPopupPermissions(finish) { add_task(async function urlFieldVisibleForPopupPermissions(finish) {
await openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
let win = gBrowser.selectedBrowser.contentWindow; let win = gBrowser.selectedBrowser.contentWindow;
let doc = win.document; let doc = win.document;
let popupPolicyCheckbox = doc.getElementById("popupPolicy"); let popupPolicyCheckbox = doc.getElementById("popupPolicy");
@ -26,7 +26,7 @@ add_task(async function urlFieldVisibleForPopupPermissions(finish) {
}); });
add_task(async function urlFieldHiddenForNotificationPermissions() { add_task(async function urlFieldHiddenForNotificationPermissions() {
await openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
let win = gBrowser.selectedBrowser.contentWindow; let win = gBrowser.selectedBrowser.contentWindow;
let doc = win.document; let doc = win.document;
let notificationsPolicyButton = doc.getElementById("notificationsPolicyButton"); let notificationsPolicyButton = doc.getElementById("notificationsPolicyButton");

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

@ -28,12 +28,12 @@ add_task(function setup() {
}); });
add_task(async function test_preference_enabled_when_unlocked() { add_task(async function test_preference_enabled_when_unlocked() {
await openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
testPrefStateMatchesLockedState(); testPrefStateMatchesLockedState();
}); });
add_task(async function test_preference_disabled_when_locked() { add_task(async function test_preference_disabled_when_locked() {
Services.prefs.lockPref("privacy.sanitize.sanitizeOnShutdown"); Services.prefs.lockPref("privacy.sanitize.sanitizeOnShutdown");
await openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true}); await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
testPrefStateMatchesLockedState(); testPrefStateMatchesLockedState();
}); });

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

@ -8,7 +8,7 @@ registerCleanupFunction(() => {
add_task(async function() { add_task(async function() {
Services.prefs.setBoolPref("browser.search.suggest.enabled", true); Services.prefs.setBoolPref("browser.search.suggest.enabled", true);
await openPreferencesViaOpenPreferencesAPI("search", undefined, { leaveOpen: true }); await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument; let doc = gBrowser.selectedBrowser.contentDocument;
let urlbarBox = doc.getElementById("urlBarSuggestion"); let urlbarBox = doc.getElementById("urlBarSuggestion");
@ -25,7 +25,7 @@ add_task(async function() {
add_task(async function() { add_task(async function() {
Services.prefs.setBoolPref("browser.search.suggest.enabled", false); Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
await openPreferencesViaOpenPreferencesAPI("search", undefined, { leaveOpen: true }); await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument; let doc = gBrowser.selectedBrowser.contentDocument;
let urlbarBox = doc.getElementById("urlBarSuggestion"); let urlbarBox = doc.getElementById("urlBarSuggestion");

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

@ -20,7 +20,7 @@ registerCleanupFunction(function() {
// only use one tab (instead of opening/closing for each test) for all // only use one tab (instead of opening/closing for each test) for all
// to help improve test times on debug builds. // to help improve test times on debug builds.
add_task(async function setup() { add_task(async function setup() {
await openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true }); await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
registerCleanupFunction(async function() { registerCleanupFunction(async function() {
await BrowserTestUtils.removeTab(gBrowser.selectedTab); await BrowserTestUtils.removeTab(gBrowser.selectedTab);
}); });
@ -45,7 +45,8 @@ add_task(async function() {
is(blockDownloads.hasAttribute("disabled"), !checked, "block downloads checkbox is set correctly"); is(blockDownloads.hasAttribute("disabled"), !checked, "block downloads checkbox is set correctly");
is(blockUncommon.hasAttribute("disabled"), !checked, "block uncommon checkbox is set correctly"); is(blockUncommon.hasAttribute("disabled"), !checked, "block uncommon checkbox is set correctly");
// click the checkbox // scroll the checkbox into the viewport and click checkbox
checkbox.scrollIntoView();
EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow); EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
// check that both settings are now turned on or off // check that both settings are now turned on or off
@ -82,7 +83,8 @@ add_task(async function() {
// should be disabled when val is false (= pref is turned off) // should be disabled when val is false (= pref is turned off)
is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly"); is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly");
// click the checkbox // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
checkbox.scrollIntoView();
EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow); EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
// check that setting is now turned on or off // check that setting is now turned on or off
@ -91,6 +93,7 @@ add_task(async function() {
// check if the uncommon warning checkbox has updated // check if the uncommon warning checkbox has updated
is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly"); is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly");
} }
await checkPrefSwitch(true); await checkPrefSwitch(true);
@ -111,7 +114,8 @@ add_task(async function() {
let checked = checkbox.checked; let checked = checkbox.checked;
is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly"); is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
// click the checkbox // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
checkbox.scrollIntoView();
EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow); EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
// check that both settings are now turned on or off // check that both settings are now turned on or off
@ -129,6 +133,7 @@ add_task(async function() {
let sortedMalware = malwareTable.slice(0); let sortedMalware = malwareTable.slice(0);
sortedMalware.sort(); sortedMalware.sort();
Assert.deepEqual(malwareTable, sortedMalware, "malware table has been sorted"); Assert.deepEqual(malwareTable, sortedMalware, "malware table has been sorted");
} }
await checkPrefSwitch(true, true); await checkPrefSwitch(true, true);

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

@ -11,10 +11,10 @@ Services.scriptloader.loadSubScript("resource://testing-common/sinon-1.16.1.js")
const TEST_QUOTA_USAGE_HOST = "example.com"; const TEST_QUOTA_USAGE_HOST = "example.com";
const TEST_QUOTA_USAGE_ORIGIN = "https://" + TEST_QUOTA_USAGE_HOST; const TEST_QUOTA_USAGE_ORIGIN = "https://" + TEST_QUOTA_USAGE_HOST;
const TEST_QUOTA_USAGE_URL = TEST_QUOTA_USAGE_ORIGIN + "/browser/browser/components/preferences/in-content/tests/site_data_test.html"; const TEST_QUOTA_USAGE_URL = TEST_QUOTA_USAGE_ORIGIN + "/browser/browser/components/preferences/in-content-new/tests/site_data_test.html";
const TEST_OFFLINE_HOST = "example.org"; const TEST_OFFLINE_HOST = "example.org";
const TEST_OFFLINE_ORIGIN = "https://" + TEST_OFFLINE_HOST; const TEST_OFFLINE_ORIGIN = "https://" + TEST_OFFLINE_HOST;
const TEST_OFFLINE_URL = TEST_OFFLINE_ORIGIN + "/browser/browser/components/preferences/in-content/tests/offline/offline.html"; const TEST_OFFLINE_URL = TEST_OFFLINE_ORIGIN + "/browser/browser/components/preferences/in-content-new/tests/offline/offline.html";
const REMOVE_DIALOG_URL = "chrome://browser/content/preferences/siteDataRemoveSelected.xul"; const REMOVE_DIALOG_URL = "chrome://browser/content/preferences/siteDataRemoveSelected.xul";
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {}); const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});

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

@ -3,15 +3,6 @@
Components.utils.import("resource://gre/modules/Promise.jsm"); Components.utils.import("resource://gre/modules/Promise.jsm");
// Tests within /browser/components/preferences/in-content-old/tests/
// test the "old" preferences organization, before it was reorganized.
// Thus, all of these tests should revert back to the "oldOrganization"
// before running.
Services.prefs.setBoolPref("browser.preferences.useOldOrganization", true);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.useOldOrganization");
});
const kDefaultWait = 2000; const kDefaultWait = 2000;
function is_hidden(aElement) { function is_hidden(aElement) {
@ -128,21 +119,19 @@ function waitForEvent(aSubject, aEventName, aTimeoutMs, aTarget) {
return eventDeferred.promise.then(cleanup, cleanup); return eventDeferred.promise.then(cleanup, cleanup);
} }
function openPreferencesViaOpenPreferencesAPI(aPane, aAdvancedTab, aOptions) { function openPreferencesViaOpenPreferencesAPI(aPane, aOptions) {
return new Promise(resolve => { return new Promise(resolve => {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank"); gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank");
openPreferences(aPane, aAdvancedTab ? {advancedTab: aAdvancedTab} : undefined); openPreferences(aPane);
let newTabBrowser = gBrowser.selectedBrowser; let newTabBrowser = gBrowser.selectedBrowser;
newTabBrowser.addEventListener("Initialized", function() { newTabBrowser.addEventListener("Initialized", function() {
newTabBrowser.contentWindow.addEventListener("load", function() { newTabBrowser.contentWindow.addEventListener("load", function() {
let win = gBrowser.contentWindow; let win = gBrowser.contentWindow;
let selectedPane = win.history.state; let selectedPane = win.history.state;
let doc = win.document;
let selectedAdvancedTab = aAdvancedTab && doc.getElementById("advancedPrefs").selectedTab.id;
if (!aOptions || !aOptions.leaveOpen) if (!aOptions || !aOptions.leaveOpen)
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
resolve({selectedPane, selectedAdvancedTab}); resolve({selectedPane});
}, {once: true}); }, {once: true});
}, {capture: true, once: true}); }, {capture: true, once: true});
@ -190,3 +179,102 @@ function promiseWindowDialogOpen(buttonAction, url) {
function promiseAlertDialogOpen(buttonAction) { function promiseAlertDialogOpen(buttonAction) {
return promiseWindowDialogOpen(buttonAction, "chrome://global/content/commonDialog.xul"); return promiseWindowDialogOpen(buttonAction, "chrome://global/content/commonDialog.xul");
} }
function addPersistentStoragePerm(origin) {
let uri = NetUtil.newURI(origin);
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
Services.perms.addFromPrincipal(principal, "persistent-storage", Ci.nsIPermissionManager.ALLOW_ACTION);
}
function promiseSiteDataManagerSitesUpdated() {
return TestUtils.topicObserved("sitedatamanager:sites-updated", () => true);
}
function openSiteDataSettingsDialog() {
let doc = gBrowser.selectedBrowser.contentDocument;
let settingsBtn = doc.getElementById("siteDataSettings");
let dialogOverlay = doc.getElementById("dialogOverlay");
let dialogLoadPromise = promiseLoadSubDialog("chrome://browser/content/preferences/siteDataSettings.xul");
let dialogInitPromise = TestUtils.topicObserved("sitedata-settings-init", () => true);
let fullyLoadPromise = Promise.all([ dialogLoadPromise, dialogInitPromise ]).then(() => {
is(dialogOverlay.style.visibility, "visible", "The Settings dialog should be visible");
});
settingsBtn.doCommand();
return fullyLoadPromise;
}
function assertSitesListed(doc, hosts) {
let frameDoc = doc.getElementById("dialogFrame").contentDocument;
let removeBtn = frameDoc.getElementById("removeSelected");
let removeAllBtn = frameDoc.getElementById("removeAll");
let sitesList = frameDoc.getElementById("sitesList");
let totalSitesNumber = sitesList.getElementsByTagName("richlistitem").length;
is(totalSitesNumber, hosts.length, "Should list the right sites number");
hosts.forEach(host => {
let site = sitesList.querySelector(`richlistitem[host="${host}"]`);
ok(site, `Should list the site of ${host}`);
});
is(removeBtn.disabled, false, "Should enable the removeSelected button");
is(removeAllBtn.disabled, false, "Should enable the removeAllBtn button");
}
function evaluateSearchResults(keyword, searchReults) {
searchReults = Array.isArray(searchReults) ? searchReults : [searchReults];
searchReults.push("header-searchResults");
let searchInput = gBrowser.contentDocument.getElementById("searchInput");
searchInput.focus();
searchInput.value = keyword;
searchInput.doCommand();
let mainPrefTag = gBrowser.contentDocument.getElementById("mainPrefPane");
for (let i = 0; i < mainPrefTag.childElementCount; i++) {
let child = mainPrefTag.children[i];
if (searchReults.includes(child.id)) {
is_element_visible(child, "Should be in search results");
} else if (child.id) {
is_element_hidden(child, "Should not be in search results");
}
}
}
const mockSiteDataManager = {
_SiteDataManager: null,
_originalGetQuotaUsage: null,
_originalRemoveQuotaUsage: null,
_getQuotaUsage() {
let results = [];
this.fakeSites.forEach(site => {
results.push({
origin: site.principal.origin,
usage: site.usage,
persisted: site.persisted
});
});
this._SiteDataManager._getQuotaUsagePromise = Promise.resolve(results);
return this._SiteDataManager._getQuotaUsagePromise;
},
_removeQuotaUsage(site) {
var target = site.principals[0].URI.host;
this.fakeSites = this.fakeSites.filter(fakeSite => {
return fakeSite.principal.URI.host != target;
});
},
register(SiteDataManager) {
this._SiteDataManager = SiteDataManager;
this._originalGetQuotaUsage = this._SiteDataManager._getQuotaUsage;
this._SiteDataManager._getQuotaUsage = this._getQuotaUsage.bind(this);
this._originalRemoveQuotaUsage = this._SiteDataManager._removeQuotaUsage;
this._SiteDataManager._removeQuotaUsage = this._removeQuotaUsage.bind(this);
this.fakeSites = null;
},
unregister() {
this._SiteDataManager._getQuotaUsage = this._originalGetQuotaUsage;
this._SiteDataManager._removeQuotaUsage = this._originalRemoveQuotaUsage;
}
};

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

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html manifest="manifest.appcache"> <html manifest="manifest.appcache">>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Cache-Control" content="public" /> <meta http-equiv="Cache-Control" content="public" />

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

@ -1,835 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from preferences.js */
// Load DownloadUtils module for convertByteUnits
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SiteDataManager",
"resource:///modules/SiteDataManager.jsm");
const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
var gAdvancedPane = {
_inited: false,
/**
* Brings the appropriate tab to the front and initializes various bits of UI.
*/
init() {
function setEventListener(aId, aEventType, aCallback) {
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gAdvancedPane));
}
this._inited = true;
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
if (preference.value !== null)
advancedPrefs.selectedIndex = preference.value;
if (AppConstants.MOZ_UPDATER) {
let onUnload = () => {
window.removeEventListener("unload", onUnload);
Services.prefs.removeObserver("app.update.", this);
};
window.addEventListener("unload", onUnload);
Services.prefs.addObserver("app.update.", this);
this.updateReadPrefs();
}
if (AppConstants.MOZ_CRASHREPORTER) {
this.initSubmitCrashes();
}
this.initTelemetry();
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this.initSubmitHealthReport();
}
this.updateOnScreenKeyboardVisibility();
this.updateCacheSizeInputField();
this.updateActualCacheSize();
if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
Services.obs.addObserver(this, "sitedatamanager:sites-updated");
Services.obs.addObserver(this, "sitedatamanager:updating-sites");
let unload = () => {
window.removeEventListener("unload", unload);
Services.obs.removeObserver(this, "sitedatamanager:sites-updated");
Services.obs.removeObserver(this, "sitedatamanager:updating-sites");
};
window.addEventListener("unload", unload);
SiteDataManager.updateSites();
setEventListener("clearSiteDataButton", "command",
gAdvancedPane.clearSiteData);
setEventListener("siteDataSettings", "command",
gAdvancedPane.showSiteDataSettings);
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
document.getElementById("siteDataLearnMoreLink").setAttribute("href", url);
let siteDataGroup = document.getElementById("siteDataGroup");
siteDataGroup.hidden = false;
}
setEventListener("layers.acceleration.disabled", "change",
gAdvancedPane.updateHardwareAcceleration);
setEventListener("advancedPrefs", "select",
gAdvancedPane.tabSelectionChanged);
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
setEventListener("submitHealthReportBox", "command",
gAdvancedPane.updateSubmitHealthReport);
}
setEventListener("connectionSettings", "command",
gAdvancedPane.showConnections);
setEventListener("clearCacheButton", "command",
gAdvancedPane.clearCache);
if (AppConstants.MOZ_UPDATER) {
setEventListener("updateRadioGroup", "command",
gAdvancedPane.updateWritePrefs);
setEventListener("showUpdateHistory", "command",
gAdvancedPane.showUpdates);
}
setEventListener("viewCertificatesButton", "command",
gAdvancedPane.showCertificates);
setEventListener("viewSecurityDevicesButton", "command",
gAdvancedPane.showSecurityDevices);
setEventListener("cacheSize", "change",
gAdvancedPane.updateCacheSizePref);
if (Services.prefs.getBoolPref("browser.preferences.offlineGroup.enabled")) {
this.updateOfflineApps();
this.updateActualAppCacheSize();
setEventListener("offlineNotifyExceptions", "command",
gAdvancedPane.showOfflineExceptions);
setEventListener("offlineAppsList", "select",
gAdvancedPane.offlineAppSelected);
setEventListener("offlineAppsListRemove", "command",
gAdvancedPane.removeOfflineApp);
setEventListener("clearOfflineAppCacheButton", "command",
gAdvancedPane.clearOfflineAppCache);
let bundlePrefs = document.getElementById("bundlePreferences");
document.getElementById("offlineAppsList")
.style.height = bundlePrefs.getString("offlineAppsList.height");
let offlineGroup = document.getElementById("offlineGroup");
offlineGroup.hidden = false;
}
if (AppConstants.MOZ_WIDGET_GTK) {
// GTK tabbox' allow the scroll wheel to change the selected tab,
// but we don't want this behavior for the in-content preferences.
let tabsElement = document.getElementById("tabsElement");
tabsElement.addEventListener("DOMMouseScroll", event => {
event.stopPropagation();
}, true);
}
},
/**
* Stores the identity of the current tab in preferences so that the selected
* tab can be persisted between openings of the preferences window.
*/
tabSelectionChanged() {
if (!this._inited)
return;
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
// tabSelectionChanged gets called twice due to the selectedIndex being set
// by both the selectedItem and selectedPanel callstacks. This guard is used
// to prevent double-counting in Telemetry.
if (preference.valueFromPreferences != advancedPrefs.selectedIndex) {
Services.telemetry
.getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
.add(telemetryBucketForCategory("advanced"));
}
preference.valueFromPreferences = advancedPrefs.selectedIndex;
},
// GENERAL TAB
/*
* Preferences:
*
* accessibility.browsewithcaret
* - true enables keyboard navigation and selection within web pages using a
* visible caret, false uses normal keyboard navigation with no caret
* accessibility.typeaheadfind
* - when set to true, typing outside text areas and input boxes will
* automatically start searching for what's typed within the current
* document; when set to false, no search action happens
* ui.osk.enabled
* - when set to true, subject to other conditions, we may sometimes invoke
* an on-screen keyboard when a text input is focused.
* (Currently Windows-only, and depending on prefs, may be Windows-8-only)
* general.autoScroll
* - when set to true, clicking the scroll wheel on the mouse activates a
* mouse mode where moving the mouse down scrolls the document downward with
* speed correlated with the distance of the cursor from the original
* position at which the click occurred (and likewise with movement upward);
* if false, this behavior is disabled
* general.smoothScroll
* - set to true to enable finer page scrolling than line-by-line on page-up,
* page-down, and other such page movements
* layout.spellcheckDefault
* - an integer:
* 0 disables spellchecking
* 1 enables spellchecking, but only for multiline text fields
* 2 enables spellchecking for all text fields
*/
/**
* Stores the original value of the spellchecking preference to enable proper
* restoration if unchanged (since we're mapping a tristate onto a checkbox).
*/
_storedSpellCheck: 0,
/**
* Returns true if any spellchecking is enabled and false otherwise, caching
* the current value to enable proper pref restoration if the checkbox is
* never changed.
*/
readCheckSpelling() {
var pref = document.getElementById("layout.spellcheckDefault");
this._storedSpellCheck = pref.value;
return (pref.value != 0);
},
/**
* Returns the value of the spellchecking preference represented by UI,
* preserving the preference's "hidden" value if the preference is
* unchanged and represents a value not strictly allowed in UI.
*/
writeCheckSpelling() {
var checkbox = document.getElementById("checkSpelling");
if (checkbox.checked) {
if (this._storedSpellCheck == 2) {
return 2;
}
return 1;
}
return 0;
},
/**
* readEnableOCSP is used by the preferences UI to determine whether or not
* the checkbox for OCSP fetching should be checked (it returns true if it
* should be checked and false otherwise). The about:config preference
* "security.OCSP.enabled" is an integer rather than a boolean, so it can't be
* directly mapped from {true,false} to {checked,unchecked}. The possible
* values for "security.OCSP.enabled" are:
* 0: fetching is disabled
* 1: fetch for all certificates
* 2: fetch only for EV certificates
* Hence, if "security.OCSP.enabled" is non-zero, the checkbox should be
* checked. Otherwise, it should be unchecked.
*/
readEnableOCSP() {
var preference = document.getElementById("security.OCSP.enabled");
// This is the case if the preference is the default value.
if (preference.value === undefined) {
return true;
}
return preference.value != 0;
},
/**
* writeEnableOCSP is used by the preferences UI to map the checked/unchecked
* state of the OCSP fetching checkbox to the value that the preference
* "security.OCSP.enabled" should be set to (it returns that value). See the
* readEnableOCSP documentation for more background. We unfortunately don't
* have enough information to map from {true,false} to all possible values for
* "security.OCSP.enabled", but a reasonable alternative is to map from
* {true,false} to {<the default value>,0}. That is, if the box is checked,
* "security.OCSP.enabled" will be set to whatever default it should be, given
* the platform and channel. If the box is unchecked, the preference will be
* set to 0. Obviously this won't work if the default is 0, so we will have to
* revisit this if we ever set it to 0.
*/
writeEnableOCSP() {
var checkbox = document.getElementById("enableOCSP");
var defaults = Services.prefs.getDefaultBranch(null);
var defaultValue = defaults.getIntPref("security.OCSP.enabled");
return checkbox.checked ? defaultValue : 0;
},
updateHardwareAcceleration() {
// Placeholder for restart
},
// DATA CHOICES TAB
/**
* Set up or hide the Learn More links for various data collection options
*/
_setupLearnMoreLink(pref, element) {
// set up the Learn More link with the correct URL
let url = Services.prefs.getCharPref(pref);
let el = document.getElementById(element);
if (url) {
el.setAttribute("href", url);
} else {
el.setAttribute("hidden", "true");
}
},
/**
*
*/
initSubmitCrashes() {
this._setupLearnMoreLink("toolkit.crashreporter.infoURL",
"crashReporterLearnMore");
},
/**
* The preference/checkbox is configured in XUL.
*
* In all cases, set up the Learn More link sanely.
*/
initTelemetry() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
}
},
/**
* Set the status of the telemetry controls based on the input argument.
* @param {Boolean} aEnabled False disables the controls, true enables them.
*/
setTelemetrySectionEnabled(aEnabled) {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
// If FHR is disabled, additional data sharing should be disabled as well.
let disabled = !aEnabled;
document.getElementById("submitTelemetryBox").disabled = disabled;
if (disabled) {
// If we disable FHR, untick the telemetry checkbox.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
document.getElementById("telemetryDataDesc").disabled = disabled;
}
},
/**
* Initialize the health report service reference and checkbox.
*/
initSubmitHealthReport() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
let checkbox = document.getElementById("submitHealthReportBox");
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
checkbox.setAttribute("disabled", "true");
return;
}
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED);
this.setTelemetrySectionEnabled(checkbox.checked);
}
},
/**
* Update the health report preference with state from checkbox.
*/
updateSubmitHealthReport() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
let checkbox = document.getElementById("submitHealthReportBox");
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
this.setTelemetrySectionEnabled(checkbox.checked);
}
},
updateOnScreenKeyboardVisibility() {
if (AppConstants.platform == "win") {
let minVersion = Services.prefs.getBoolPref("ui.osk.require_win10") ? 10 : 6.2;
if (Services.vc.compare(Services.sysinfo.getProperty("version"), minVersion) >= 0) {
document.getElementById("useOnScreenKeyboard").hidden = false;
}
}
},
// NETWORK TAB
/*
* Preferences:
*
* browser.cache.disk.capacity
* - the size of the browser cache in KB
* - Only used if browser.cache.disk.smart_size.enabled is disabled
*/
/**
* Displays a dialog in which proxy settings may be changed.
*/
showConnections() {
gSubDialog.open("chrome://browser/content/preferences/connection.xul");
},
showSiteDataSettings() {
gSubDialog.open("chrome://browser/content/preferences/siteDataSettings.xul");
},
toggleSiteData(shouldShow) {
let clearButton = document.getElementById("clearSiteDataButton");
let settingsButton = document.getElementById("siteDataSettings");
clearButton.disabled = !shouldShow;
settingsButton.disabled = !shouldShow;
},
updateTotalDataSizeLabel(usage) {
let prefStrBundle = document.getElementById("bundlePreferences");
let totalSiteDataSizeLabel = document.getElementById("totalSiteDataSize");
if (usage < 0) {
totalSiteDataSizeLabel.textContent = prefStrBundle.getString("loadingSiteDataSize");
} else {
let size = DownloadUtils.convertByteUnits(usage);
totalSiteDataSizeLabel.textContent = prefStrBundle.getFormattedString("totalSiteDataSize", size);
}
},
// Retrieves the amount of space currently used by disk cache
updateActualCacheSize() {
var actualSizeLabel = document.getElementById("actualDiskCacheSize");
var prefStrBundle = document.getElementById("bundlePreferences");
// Needs to root the observer since cache service keeps only a weak reference.
this.observer = {
onNetworkCacheDiskConsumption(consumption) {
var size = DownloadUtils.convertByteUnits(consumption);
// The XBL binding for the string bundle may have been destroyed if
// the page was closed before this callback was executed.
if (!prefStrBundle.getFormattedString) {
return;
}
actualSizeLabel.value = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
},
QueryInterface: XPCOMUtils.generateQI([
Components.interfaces.nsICacheStorageConsumptionObserver,
Components.interfaces.nsISupportsWeakReference
])
};
actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
try {
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cacheService.asyncGetDiskConsumption(this.observer);
} catch (e) {}
},
updateCacheSizeUI(smartSizeEnabled) {
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
},
readSmartSizeEnabled() {
// The smart_size.enabled preference element is inverted="true", so its
// value is the opposite of the actual pref value
var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
this.updateCacheSizeUI(!disabled);
},
/**
* Converts the cache size from units of KB to units of MB and stores it in
* the textbox element.
*/
updateCacheSizeInputField() {
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("browser.cache.disk.capacity");
cacheSizeElem.value = cachePref.value / 1024;
if (cachePref.locked)
cacheSizeElem.disabled = true;
},
/**
* Updates the cache size preference once user enters a new value.
* We intentionally do not set preference="browser.cache.disk.capacity"
* onto the textbox directly, as that would update the pref at each keypress
* not only after the final value is entered.
*/
updateCacheSizePref() {
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("browser.cache.disk.capacity");
// Converts the cache size as specified in UI (in MB) to KB.
let intValue = parseInt(cacheSizeElem.value, 10);
cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
},
/**
* Clears the cache.
*/
clearCache() {
try {
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cache.clear();
} catch (ex) {}
this.updateActualCacheSize();
},
clearSiteData() {
let flags =
Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 +
Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1 +
Services.prompt.BUTTON_POS_0_DEFAULT;
let prefStrBundle = document.getElementById("bundlePreferences");
let title = prefStrBundle.getString("clearSiteDataPromptTitle");
let text = prefStrBundle.getString("clearSiteDataPromptText");
let btn0Label = prefStrBundle.getString("clearSiteDataNow");
let result = Services.prompt.confirmEx(
window, title, text, flags, btn0Label, null, null, null, {});
if (result == 0) {
SiteDataManager.removeAll();
}
},
// Methods for Offline Apps(Appcache)
/**
* Clears the application cache.
*/
clearOfflineAppCache() {
Components.utils.import("resource:///modules/offlineAppCache.jsm");
OfflineAppCacheHelper.clear();
this.updateActualAppCacheSize();
this.updateOfflineApps();
},
// Retrieves the amount of space currently used by offline cache
updateActualAppCacheSize() {
var visitor = {
onCacheStorageInfo(aEntryCount, aConsumption, aCapacity, aDiskDirectory) {
var actualSizeLabel = document.getElementById("actualAppCacheSize");
var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
var prefStrBundle = document.getElementById("bundlePreferences");
// The XBL binding for the string bundle may have been destroyed if
// the page was closed before this callback was executed.
if (!prefStrBundle.getFormattedString) {
return;
}
var sizeStr = prefStrBundle.getFormattedString("actualAppCacheSize", sizeStrings);
actualSizeLabel.value = sizeStr;
}
};
try {
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
storage.asyncVisitStorage(visitor, false);
} catch (e) {}
},
readOfflineNotify() {
var pref = document.getElementById("browser.offline-apps.notify");
var button = document.getElementById("offlineNotifyExceptions");
button.disabled = !pref.value;
return pref.value;
},
showOfflineExceptions() {
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: false,
sessionVisible: false,
allowVisible: false,
prefilledHost: "",
permissionType: "offline-app",
manageCapability: Components.interfaces.nsIPermissionManager.DENY_ACTION,
windowTitle: bundlePreferences.getString("offlinepermissionstitle"),
introText: bundlePreferences.getString("offlinepermissionstext") };
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
// XXX: duplicated in browser.js
_getOfflineAppUsage(perm, groups) {
let cacheService = Cc["@mozilla.org/network/application-cache-service;1"].
getService(Ci.nsIApplicationCacheService);
if (!groups) {
try {
groups = cacheService.getGroups();
} catch (ex) {
return 0;
}
}
let usage = 0;
for (let group of groups) {
let uri = Services.io.newURI(group);
if (perm.matchesURI(uri, true)) {
let cache = cacheService.getActiveCache(group);
usage += cache.usage;
}
}
return usage;
},
/**
* Updates the list of offline applications
*/
updateOfflineApps() {
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var list = document.getElementById("offlineAppsList");
while (list.firstChild) {
list.firstChild.remove();
}
var groups;
try {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
groups = cacheService.getGroups();
} catch (e) {
return;
}
var bundle = document.getElementById("bundlePreferences");
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
if (perm.type == "offline-app" &&
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
row.setAttribute("origin", perm.principal.origin);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
list.appendChild(row);
}
}
},
offlineAppSelected() {
var removeButton = document.getElementById("offlineAppsListRemove");
var list = document.getElementById("offlineAppsList");
if (list.selectedItem) {
removeButton.setAttribute("disabled", "false");
} else {
removeButton.setAttribute("disabled", "true");
}
},
removeOfflineApp() {
var list = document.getElementById("offlineAppsList");
var item = list.selectedItem;
var origin = item.getAttribute("origin");
var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
var bundle = document.getElementById("bundlePreferences");
var title = bundle.getString("offlineAppRemoveTitle");
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
var confirm = bundle.getString("offlineAppRemoveConfirm");
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
null, null, null, {});
if (result != 0)
return;
// get the permission
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var perm = pm.getPermissionObject(principal, "offline-app", true);
if (perm) {
// clear offline cache entries
try {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) {
var uri = Services.io.newURI(groups[i]);
if (perm.matchesURI(uri, true)) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
}
}
} catch (e) {}
pm.removePermission(perm);
}
list.removeChild(item);
gAdvancedPane.offlineAppSelected();
this.updateActualAppCacheSize();
},
// Methods for Offline Apps(Appcache) end
// UPDATE TAB
/*
* Preferences:
*
* app.update.enabled
* - true if updates to the application are enabled, false otherwise
* app.update.auto
* - true if updates should be automatically downloaded and installed and
* false if the user should be asked what he wants to do when an update is
* available
* extensions.update.enabled
* - true if updates to extensions and themes are enabled, false otherwise
* browser.search.update
* - true if updates to search engines are enabled, false otherwise
*/
/**
* Selects the item of the radiogroup based on the pref values and locked
* states.
*
* UI state matrix for update preference conditions
*
* UI Components: Preferences
* Radiogroup i = app.update.enabled
* ii = app.update.auto
*
* Disabled states:
* Element pref value locked disabled
* radiogroup i t/f f false
* i t/f *t* *true*
* ii t/f f false
* ii t/f *t* *true*
*/
updateReadPrefs() {
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value = "manual"; // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value = "auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value = "checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch (e) {
}
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
}
}
},
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
updateWritePrefs() {
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
switch (radiogroup.value) {
case "auto": // 1. Automatically install updates for Desktop only
enabledPref.value = true;
autoPref.value = true;
break;
case "checkOnly": // 2. Check, but let me choose
enabledPref.value = true;
autoPref.value = false;
break;
case "manual": // 3. Never check for updates.
enabledPref.value = false;
autoPref.value = false;
}
}
},
/**
* Displays the history of installed updates.
*/
showUpdates() {
gSubDialog.open("chrome://mozapps/content/update/history.xul");
},
// ENCRYPTION TAB
/*
* Preferences:
*
* security.default_personal_cert
* - a string:
* "Select Automatically" select a certificate automatically when a site
* requests one
* "Ask Every Time" present a dialog to the user so he can select
* the certificate to use on a site which
* requests one
*/
/**
* Displays the user's certificates and associated options.
*/
showCertificates() {
gSubDialog.open("chrome://pippki/content/certManager.xul");
},
/**
* Displays a dialog from which the user can manage his security devices.
*/
showSecurityDevices() {
gSubDialog.open("chrome://pippki/content/device_manager.xul");
},
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "nsPref:changed":
this.updateReadPrefs();
break;
case "sitedatamanager:updating-sites":
// While updating, we want to disable this section and display loading message until updated
this.toggleSiteData(false);
this.updateTotalDataSizeLabel(-1);
break;
case "sitedatamanager:sites-updated":
this.toggleSiteData(true);
SiteDataManager.getTotalUsage()
.then(this.updateTotalDataSizeLabel.bind(this));
break;
}
},
};

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

@ -1,422 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- Advanced panel -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/advanced.js"/>
<preferences id="advancedPreferences" hidden="true" data-category="paneAdvanced">
<preference id="browser.preferences.advanced.selectedTabIndex"
name="browser.preferences.advanced.selectedTabIndex"
type="int"/>
<!-- General tab -->
<preference id="accessibility.browsewithcaret"
name="accessibility.browsewithcaret"
type="bool"/>
<preference id="accessibility.typeaheadfind"
name="accessibility.typeaheadfind"
type="bool"/>
<preference id="accessibility.blockautorefresh"
name="accessibility.blockautorefresh"
type="bool"/>
#ifdef XP_WIN
<preference id="ui.osk.enabled"
name="ui.osk.enabled"
type="bool"/>
#endif
<preference id="general.autoScroll"
name="general.autoScroll"
type="bool"/>
<preference id="general.smoothScroll"
name="general.smoothScroll"
type="bool"/>
<preference id="layout.spellcheckDefault"
name="layout.spellcheckDefault"
type="int"/>
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
#endif
<!-- Data Choices tab -->
#ifdef MOZ_CRASHREPORTER
<preference id="browser.crashReports.unsubmittedCheck.autoSubmit"
name="browser.crashReports.unsubmittedCheck.autoSubmit"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
type="int"/>
<preference id="browser.offline-apps.notify"
name="browser.offline-apps.notify"
type="bool"/>
<preference id="browser.cache.disk.smart_size.enabled"
name="browser.cache.disk.smart_size.enabled"
inverted="true"
type="bool"/>
<!-- Update tab -->
#ifdef MOZ_UPDATER
<preference id="app.update.enabled"
name="app.update.enabled"
type="bool"/>
<preference id="app.update.auto"
name="app.update.auto"
type="bool"/>
<preference id="app.update.disable_button.showUpdateHistory"
name="app.update.disable_button.showUpdateHistory"
type="bool"/>
#ifdef MOZ_MAINTENANCE_SERVICE
<preference id="app.update.service.enabled"
name="app.update.service.enabled"
type="bool"/>
#endif
#endif
<preference id="browser.search.update"
name="browser.search.update"
type="bool"/>
<!-- Certificates tab -->
<preference id="security.default_personal_cert"
name="security.default_personal_cert"
type="string"/>
<preference id="security.disable_button.openCertManager"
name="security.disable_button.openCertManager"
type="bool"/>
<preference id="security.disable_button.openDeviceManager"
name="security.disable_button.openDeviceManager"
type="bool"/>
<preference id="security.OCSP.enabled"
name="security.OCSP.enabled"
type="int"/>
</preferences>
#ifdef HAVE_SHELL_SERVICE
<stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
#endif
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences-old/preferences.properties"/>
<hbox id="header-advanced"
class="header"
hidden="true"
data-category="paneAdvanced">
<label class="header-name" flex="1">&paneAdvanced.title;</label>
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox>
<tabbox id="advancedPrefs"
handleCtrlTab="false"
handleCtrlPageUpDown="false"
flex="1"
data-category="paneAdvanced"
hidden="true">
<tabs id="tabsElement">
<tab id="generalTab" label="&generalTab.label;"/>
#ifdef MOZ_DATA_REPORTING
<tab id="dataChoicesTab" label="&dataChoicesTab.label;"/>
#endif
<tab id="networkTab" label="&networkTab.label;"/>
<tab id="updateTab" label="&updateTab.label;"/>
<tab id="encryptionTab" label="&certificateTab.label;"/>
</tabs>
<tabpanels flex="1">
<!-- General -->
<tabpanel id="generalPanel" orient="vertical">
<!-- Accessibility -->
<groupbox id="accessibilityGroup" align="start">
<caption><label>&accessibility.label;</label></caption>
#ifdef XP_WIN
<checkbox id="useOnScreenKeyboard"
hidden="true"
label="&useOnScreenKeyboard.label;"
accesskey="&useOnScreenKeyboard.accesskey;"
preference="ui.osk.enabled"/>
#endif
<checkbox id="useCursorNavigation"
label="&useCursorNavigation.label;"
accesskey="&useCursorNavigation.accesskey;"
preference="accessibility.browsewithcaret"/>
<checkbox id="searchStartTyping"
label="&searchOnStartTyping.label;"
accesskey="&searchOnStartTyping.accesskey;"
preference="accessibility.typeaheadfind"/>
<checkbox id="blockAutoRefresh"
label="&blockAutoReload.label;"
accesskey="&blockAutoReload.accesskey;"
preference="accessibility.blockautorefresh"/>
</groupbox>
<!-- Browsing -->
<groupbox id="browsingGroup" align="start">
<caption><label>&browsing.label;</label></caption>
<checkbox id="useAutoScroll"
label="&useAutoScroll.label;"
accesskey="&useAutoScroll.accesskey;"
preference="general.autoScroll"/>
<checkbox id="useSmoothScrolling"
label="&useSmoothScrolling.label;"
accesskey="&useSmoothScrolling.accesskey;"
preference="general.smoothScroll"/>
<checkbox id="checkSpelling"
label="&checkUserSpelling.label;"
accesskey="&checkUserSpelling.accesskey;"
onsyncfrompreference="return gAdvancedPane.readCheckSpelling();"
onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
preference="layout.spellcheckDefault"/>
</groupbox>
</tabpanel>
#ifdef MOZ_DATA_REPORTING
<!-- Data Choices -->
<tabpanel id="dataChoicesPanel" orient="vertical">
#ifdef MOZ_TELEMETRY_REPORTING
<groupbox>
<caption>
<checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
</caption>
<vbox>
<hbox class="indent" flex="1">
<label flex="1">&healthReportDesc.label;</label>
<label id="FHRLearnMore" flex="1"
class="learnMore text-link">&healthReportLearnMore.label;</label>
</hbox>
<hbox class="indent">
<groupbox flex="1">
<caption>
<checkbox id="submitTelemetryBox" preference="toolkit.telemetry.enabled"
label="&enableTelemetryData.label;"
accesskey="&enableTelemetryData.accesskey;"/>
</caption>
<hbox class="indent" flex="1">
<label id="telemetryDataDesc" flex="1">&telemetryDesc.label;</label>
<label id="telemetryLearnMore" flex="1"
class="learnMore text-link">&telemetryLearnMore.label;</label>
</hbox>
</groupbox>
</hbox>
</vbox>
</groupbox>
#endif
#ifdef MOZ_CRASHREPORTER
<groupbox>
<caption>
<checkbox id="automaticallySubmitCrashesBox"
preference="browser.crashReports.unsubmittedCheck.autoSubmit"
label="&alwaysSubmitCrashReports.label;"
accesskey="&alwaysSubmitCrashReports.accesskey;"/>
</caption>
<hbox class="indent" flex="1">
<label flex="1">&crashReporterDesc2.label;</label>
<label id="crashReporterLearnMore" flex="1"
class="learnMore text-link">&crashReporterLearnMore.label;</label>
</hbox>
</groupbox>
#endif
</tabpanel>
#endif
<!-- Network -->
<tabpanel id="networkPanel" orient="vertical">
<!-- Connection -->
<groupbox id="connectionGroup">
<caption><label>&connection.label;</label></caption>
<hbox align="center">
<description flex="1" control="connectionSettings">&connectionDesc.label;</description>
<button id="connectionSettings" icon="network" label="&connectionSettings.label;"
accesskey="&connectionSettings.accesskey;"/>
</hbox>
</groupbox>
<!-- Cache -->
<groupbox id="cacheGroup">
<caption><label>&httpCache.label;</label></caption>
<hbox align="center">
<label id="actualDiskCacheSize" flex="1"/>
<button id="clearCacheButton" icon="clear"
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"/>
</hbox>
<hbox>
<checkbox preference="browser.cache.disk.smart_size.enabled"
id="allowSmartSize"
onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
label="&overrideSmartCacheSize.label;"
accesskey="&overrideSmartCacheSize.accesskey;"/>
</hbox>
<hbox align="center" class="indent">
<label id="useCacheBefore" control="cacheSize"
accesskey="&limitCacheSizeBefore.accesskey;">
&limitCacheSizeBefore.label;
</label>
<textbox id="cacheSize" type="number" size="4" max="1024"
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
<label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
</hbox>
</groupbox>
<!-- Offline apps -->
<groupbox id="offlineGroup" hidden="true">
<caption><label>&offlineStorage2.label;</label></caption>
<hbox align="center">
<label id="actualAppCacheSize" flex="1"/>
<button id="clearOfflineAppCacheButton" icon="clear"
label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"/>
</hbox>
<hbox align="center">
<checkbox id="offlineNotify"
label="&offlineStorageNotify.label;" accesskey="&offlineStorageNotify.accesskey;"
preference="browser.offline-apps.notify"
onsyncfrompreference="return gAdvancedPane.readOfflineNotify();"/>
<spacer flex="1"/>
<button id="offlineNotifyExceptions"
label="&offlineStorageNotifyExceptions.label;"
accesskey="&offlineStorageNotifyExceptions.accesskey;"/>
</hbox>
<hbox>
<vbox flex="1">
<label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
<listbox id="offlineAppsList"
flex="1"
aria-labelledby="offlineAppsListLabel">
</listbox>
</vbox>
<vbox pack="end">
<button id="offlineAppsListRemove"
disabled="true"
label="&offlineAppsListRemove.label;"
accesskey="&offlineAppsListRemove.accesskey;"/>
</vbox>
</hbox>
</groupbox>
<!-- Site Data -->
<groupbox id="siteDataGroup" hidden="true">
<caption><label>&siteData.label;</label></caption>
<hbox align="baseline">
<label id="totalSiteDataSize"></label>
<label id="siteDataLearnMoreLink" class="learnMore text-link" value="&siteDataLearnMoreLink.label;"></label>
<spacer flex="1" />
<button id="clearSiteDataButton" icon="clear"
label="&clearSiteData.label;" accesskey="&clearSiteData.accesskey;"/>
</hbox>
<vbox align="end">
<button id="siteDataSettings"
label="&siteDataSettings.label;"
accesskey="&siteDataSettings.accesskey;"/>
</vbox>
</groupbox>
</tabpanel>
<!-- Update -->
<tabpanel id="updatePanel" orient="vertical">
#ifdef MOZ_UPDATER
<groupbox id="updateApp" align="start">
<caption><label>&updateApplication.label;</label></caption>
<radiogroup id="updateRadioGroup" align="start">
<radio id="autoDesktop"
value="auto"
label="&updateAuto1.label;"
accesskey="&updateAuto1.accesskey;"/>
<radio value="checkOnly"
label="&updateCheckChoose.label;"
accesskey="&updateCheckChoose.accesskey;"/>
<radio value="manual"
label="&updateManual.label;"
accesskey="&updateManual.accesskey;"/>
</radiogroup>
<separator class="thin"/>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;"
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"/>
</hbox>
#ifdef MOZ_MAINTENANCE_SERVICE
<checkbox id="useService"
label="&useService.label;"
accesskey="&useService.accesskey;"
preference="app.update.service.enabled"/>
#endif
</groupbox>
#endif
<groupbox id="updateOthers" align="start">
<caption><label>&autoUpdateOthers.label;</label></caption>
<checkbox id="enableSearchUpdate"
label="&enableSearchUpdate.label;"
accesskey="&enableSearchUpdate.accesskey;"
preference="browser.search.update"/>
</groupbox>
</tabpanel>
<!-- Certificates -->
<tabpanel id="encryptionPanel" orient="vertical">
<groupbox id="certSelection" align="start">
<caption><label>&certPersonal.label;</label></caption>
<description id="CertSelectionDesc" control="certSelection">&certPersonal.description;</description>
<!--
The values on these radio buttons may look like l12y issues, but
they're not - this preference uses *those strings* as its values.
I KID YOU NOT.
-->
<radiogroup id="certSelection"
preftype="string"
preference="security.default_personal_cert"
aria-labelledby="CertSelectionDesc">
<radio label="&selectCerts.auto;"
accesskey="&selectCerts.auto.accesskey;"
value="Select Automatically"/>
<radio label="&selectCerts.ask;"
accesskey="&selectCerts.ask.accesskey;"
value="Ask Every Time"/>
</radiogroup>
</groupbox>
<separator/>
<checkbox id="enableOCSP"
label="&enableOCSP.label;"
accesskey="&enableOCSP.accesskey;"
onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
preference="security.OCSP.enabled"/>
<separator/>
<hbox>
<button id="viewCertificatesButton"
flex="1"
label="&viewCerts.label;"
accesskey="&viewCerts.accesskey;"
preference="security.disable_button.openCertManager"/>
<button id="viewSecurityDevicesButton"
flex="1"
label="&viewSecurityDevices.label;"
accesskey="&viewSecurityDevices.accesskey;"
preference="security.disable_button.openDeviceManager"/>
<hbox flex="10"/>
</hbox>
</tabpanel>
</tabpanels>
</tabbox>

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

@ -1,18 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
browser.jar:
content/browser/preferences/in-content-old/preferences.js
* content/browser/preferences/in-content-old/preferences.xul
content/browser/preferences/in-content-old/subdialogs.js
content/browser/preferences/in-content-old/main.js
content/browser/preferences/in-content-old/privacy.js
content/browser/preferences/in-content-old/containers.js
content/browser/preferences/in-content-old/advanced.js
content/browser/preferences/in-content-old/applications.js
content/browser/preferences/in-content-old/content.js
content/browser/preferences/in-content-old/sync.js
content/browser/preferences/in-content-old/security.js
content/browser/preferences/in-content-old/search.js

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

@ -1,756 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from preferences.js */
Components.utils.import("resource://gre/modules/Downloads.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource:///modules/ShellService.jsm");
Components.utils.import("resource:///modules/TransientPrefs.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
if (AppConstants.E10S_TESTING_ONLY) {
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
}
if (AppConstants.MOZ_DEV_EDITION) {
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm");
}
var gMainPane = {
/**
* Initialization of this.
*/
init() {
function setEventListener(aId, aEventType, aCallback) {
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gMainPane));
}
if (AppConstants.HAVE_SHELL_SERVICE) {
this.updateSetDefaultBrowser();
if (AppConstants.platform == "win") {
// In Windows 8 we launch the control panel since it's the only
// way to get all file type association prefs. So we don't know
// when the user will select the default. We refresh here periodically
// in case the default changes. On other Windows OS's defaults can also
// be set while the prefs are open.
window.setInterval(this.updateSetDefaultBrowser.bind(this), 1000);
}
}
this.buildContentProcessCountMenuList();
this.updateDefaultPerformanceSettingsPref();
let defaultPerformancePref =
document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
defaultPerformancePref.addEventListener("change", () => {
this.updatePerformanceSettingsBox();
});
this.updatePerformanceSettingsBox();
let performanceSettingsLink = document.getElementById("performanceSettingsLearnMore");
let performanceSettingsUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "performance";
performanceSettingsLink.setAttribute("href", performanceSettingsUrl);
// set up the "use current page" label-changing listener
this._updateUseCurrentButton();
window.addEventListener("focus", this._updateUseCurrentButton.bind(this));
this.updateBrowserStartupLastSession();
if (AppConstants.platform == "win") {
// Functionality for "Show tabs in taskbar" on Windows 7 and up.
try {
let sysInfo = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2);
let ver = parseFloat(sysInfo.getProperty("version"));
let showTabsInTaskbar = document.getElementById("showTabsInTaskbar");
showTabsInTaskbar.hidden = ver < 6.1;
} catch (ex) {}
}
// The "closing multiple tabs" and "opening multiple tabs might slow down
// &brandShortName;" warnings provide options for not showing these
// warnings again. When the user disabled them, we provide checkboxes to
// re-enable the warnings.
if (!TransientPrefs.prefShouldBeVisible("browser.tabs.warnOnClose"))
document.getElementById("warnCloseMultiple").hidden = true;
if (!TransientPrefs.prefShouldBeVisible("browser.tabs.warnOnOpen"))
document.getElementById("warnOpenMany").hidden = true;
setEventListener("browser.privatebrowsing.autostart", "change",
gMainPane.updateBrowserStartupLastSession);
setEventListener("browser.download.dir", "change",
gMainPane.displayDownloadDirPref);
if (AppConstants.HAVE_SHELL_SERVICE) {
setEventListener("setDefaultButton", "command",
gMainPane.setDefaultBrowser);
}
setEventListener("useCurrent", "command",
gMainPane.setHomePageToCurrent);
setEventListener("useBookmark", "command",
gMainPane.setHomePageToBookmark);
setEventListener("restoreDefaultHomePage", "command",
gMainPane.restoreDefaultHomePage);
setEventListener("chooseFolder", "command",
gMainPane.chooseFolder);
if (AppConstants.E10S_TESTING_ONLY) {
setEventListener("e10sAutoStart", "command",
gMainPane.enableE10SChange);
let e10sCheckbox = document.getElementById("e10sAutoStart");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let e10sForceEnable = document.getElementById("e10sForceEnable");
let preffedOn = e10sPref.value || e10sTempPref.value || e10sForceEnable.value;
if (preffedOn) {
// The checkbox is checked if e10s is preffed on and enabled.
e10sCheckbox.checked = Services.appinfo.browserTabsRemoteAutostart;
// but if it's force disabled, then the checkbox is disabled.
e10sCheckbox.disabled = !Services.appinfo.browserTabsRemoteAutostart;
}
}
if (AppConstants.MOZ_DEV_EDITION) {
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
setEventListener("separateProfileMode", "command", gMainPane.separateProfileModeChange);
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
setEventListener("getStarted", "click", gMainPane.onGetStarted);
OS.File.stat(ignoreSeparateProfile).then(() => separateProfileModeCheckbox.checked = false,
() => separateProfileModeCheckbox.checked = true);
fxAccounts.getSignedInUser().then(data => {
document.getElementById("getStarted").selectedIndex = data ? 1 : 0;
});
}
// Notify observers that the UI is now ready
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(window, "main-pane-loaded");
},
enableE10SChange() {
if (AppConstants.E10S_TESTING_ONLY) {
let e10sCheckbox = document.getElementById("e10sAutoStart");
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let prefsToChange;
if (e10sCheckbox.checked) {
// Enabling e10s autostart
prefsToChange = [e10sPref];
} else {
// Disabling e10s autostart
prefsToChange = [e10sPref];
if (e10sTempPref.value) {
prefsToChange.push(e10sTempPref);
}
}
let buttonIndex = confirmRestartPrompt(e10sCheckbox.checked, 0,
true, false);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
for (let prefToChange of prefsToChange) {
prefToChange.value = e10sCheckbox.checked;
}
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
// Revert the checkbox in case we didn't quit
e10sCheckbox.checked = e10sPref.value || e10sTempPref.value;
}
},
separateProfileModeChange() {
if (AppConstants.MOZ_DEV_EDITION) {
function quitApp() {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestartNotSameProfile);
}
function revertCheckbox(error) {
separateProfileModeCheckbox.checked = !separateProfileModeCheckbox.checked;
if (error) {
Cu.reportError("Failed to toggle separate profile mode: " + error);
}
}
function createOrRemoveSpecialDevEditionFile(onSuccess) {
let uAppData = OS.Constants.Path.userApplicationDataDir;
let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
if (separateProfileModeCheckbox.checked) {
OS.File.remove(ignoreSeparateProfile).then(onSuccess, revertCheckbox);
} else {
OS.File.writeAtomic(ignoreSeparateProfile, new Uint8Array()).then(onSuccess, revertCheckbox);
}
}
let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
let button_index = confirmRestartPrompt(separateProfileModeCheckbox.checked,
0, false, true);
switch (button_index) {
case CONFIRM_RESTART_PROMPT_CANCEL:
revertCheckbox();
return;
case CONFIRM_RESTART_PROMPT_RESTART_NOW:
const Cc = Components.classes, Ci = Components.interfaces;
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
.createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
"restart");
if (!cancelQuit.data) {
createOrRemoveSpecialDevEditionFile(quitApp);
return;
}
// Revert the checkbox in case we didn't quit
revertCheckbox();
return;
case CONFIRM_RESTART_PROMPT_RESTART_LATER:
createOrRemoveSpecialDevEditionFile();
}
}
},
onGetStarted(aEvent) {
if (AppConstants.MOZ_DEV_EDITION) {
const Cc = Components.classes, Ci = Components.interfaces;
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let win = wm.getMostRecentWindow("navigator:browser");
fxAccounts.getSignedInUser().then(data => {
if (win) {
if (data) {
// We have a user, open Sync preferences in the same tab
win.openUILinkIn("about:preferences#sync", "current");
return;
}
let accountsTab = win.gBrowser.addTab("about:accounts?action=signin&entrypoint=dev-edition-setup");
win.gBrowser.selectedTab = accountsTab;
}
});
}
},
// HOME PAGE
/*
* Preferences:
*
* browser.startup.homepage
* - the user's home page, as a string; if the home page is a set of tabs,
* this will be those URLs separated by the pipe character "|"
* browser.startup.page
* - what page(s) to show when the user starts the application, as an integer:
*
* 0: a blank page
* 1: the home page (as set by the browser.startup.homepage pref)
* 2: the last page the user visited (DEPRECATED)
* 3: windows and tabs from the last session (a.k.a. session restore)
*
* The deprecated option is not exposed in UI; however, if the user has it
* selected and doesn't change the UI for this preference, the deprecated
* option is preserved.
*/
syncFromHomePref() {
let homePref = document.getElementById("browser.startup.homepage");
// If the pref is set to about:home or about:newtab, set the value to ""
// to show the placeholder text (about:home title) rather than
// exposing those URLs to users.
let defaultBranch = Services.prefs.getDefaultBranch("");
let defaultValue = defaultBranch.getComplexValue("browser.startup.homepage",
Ci.nsIPrefLocalizedString).data;
let currentValue = homePref.value.toLowerCase();
if (currentValue == "about:home" ||
(currentValue == defaultValue && currentValue == "about:newtab")) {
return "";
}
// If the pref is actually "", show about:blank. The actual home page
// loading code treats them the same, and we don't want the placeholder text
// to be shown.
if (homePref.value == "")
return "about:blank";
// Otherwise, show the actual pref value.
return undefined;
},
syncToHomePref(value) {
// If the value is "", use about:home.
if (value == "")
return "about:home";
// Otherwise, use the actual textbox value.
return undefined;
},
/**
* Sets the home page to the current displayed page (or frontmost tab, if the
* most recent browser window contains multiple tabs), updating preference
* window UI to reflect this.
*/
setHomePageToCurrent() {
let homePage = document.getElementById("browser.startup.homepage");
let tabs = this._getTabsForHomePage();
function getTabURI(t) {
return t.linkedBrowser.currentURI.spec;
}
// FIXME Bug 244192: using dangerous "|" joiner!
if (tabs.length)
homePage.value = tabs.map(getTabURI).join("|");
},
/**
* Displays a dialog in which the user can select a bookmark to use as home
* page. If the user selects a bookmark, that bookmark's name is displayed in
* UI and the bookmark's address is stored to the home page preference.
*/
setHomePageToBookmark() {
var rv = { urls: null, names: null };
gSubDialog.open("chrome://browser/content/preferences/selectBookmark.xul",
"resizable=yes, modal=yes", rv,
this._setHomePageToBookmarkClosed.bind(this, rv));
},
_setHomePageToBookmarkClosed(rv, aEvent) {
if (aEvent.detail.button != "accept")
return;
if (rv.urls && rv.names) {
var homePage = document.getElementById("browser.startup.homepage");
// XXX still using dangerous "|" joiner!
homePage.value = rv.urls.join("|");
}
},
/**
* Switches the "Use Current Page" button between its singular and plural
* forms.
*/
_updateUseCurrentButton() {
let useCurrent = document.getElementById("useCurrent");
let tabs = this._getTabsForHomePage();
if (tabs.length > 1)
useCurrent.label = useCurrent.getAttribute("label2");
else
useCurrent.label = useCurrent.getAttribute("label1");
// In this case, the button's disabled state is set by preferences.xml.
let prefName = "pref.browser.homepage.disable_button.current_page";
if (document.getElementById(prefName).locked)
return;
useCurrent.disabled = !tabs.length
},
_getTabsForHomePage() {
var win;
var tabs = [];
const Cc = Components.classes, Ci = Components.interfaces;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
win = wm.getMostRecentWindow("navigator:browser");
if (win && win.document.documentElement
.getAttribute("windowtype") == "navigator:browser") {
// We should only include visible & non-pinned tabs
tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs);
tabs = tabs.filter(this.isNotAboutPreferences);
}
return tabs;
},
/**
* Check to see if a tab is not about:preferences
*/
isNotAboutPreferences(aElement, aIndex, aArray) {
return !aElement.linkedBrowser.currentURI.spec.startsWith("about:preferences");
},
/**
* Restores the default home page as the user's home page.
*/
restoreDefaultHomePage() {
var homePage = document.getElementById("browser.startup.homepage");
homePage.value = homePage.defaultValue;
},
updateDefaultPerformanceSettingsPref() {
let defaultPerformancePref =
document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
let processCountPref = document.getElementById("dom.ipc.processCount");
let accelerationPref = document.getElementById("layers.acceleration.disabled");
if (processCountPref.value != processCountPref.defaultValue ||
accelerationPref.value != accelerationPref.defaultValue) {
defaultPerformancePref.value = false;
}
},
updatePerformanceSettingsBox() {
let defaultPerformancePref =
document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
let performanceSettings = document.getElementById("performanceSettings");
if (defaultPerformancePref.value) {
let processCountPref = document.getElementById("dom.ipc.processCount");
let accelerationPref = document.getElementById("layers.acceleration.disabled");
processCountPref.value = processCountPref.defaultValue;
accelerationPref.value = accelerationPref.defaultValue;
performanceSettings.hidden = true;
} else {
performanceSettings.hidden = false;
}
},
buildContentProcessCountMenuList() {
let processCountPref = document.getElementById("dom.ipc.processCount");
let bundlePreferences = document.getElementById("bundlePreferences");
let label = bundlePreferences.getFormattedString("defaultContentProcessCount",
[processCountPref.defaultValue]);
let contentProcessCount =
document.querySelector(`#contentProcessCount > menupopup >
menuitem[value="${processCountPref.defaultValue}"]`);
contentProcessCount.label = label;
},
// DOWNLOADS
/*
* Preferences:
*
* browser.download.useDownloadDir - bool
* True - Save files directly to the folder configured via the
* browser.download.folderList preference.
* False - Always ask the user where to save a file and default to
* browser.download.lastDir when displaying a folder picker dialog.
* browser.download.dir - local file handle
* A local folder the user may have selected for downloaded files to be
* saved. Migration of other browser settings may also set this path.
* This folder is enabled when folderList equals 2.
* browser.download.lastDir - local file handle
* May contain the last folder path accessed when the user browsed
* via the file save-as dialog. (see contentAreaUtils.js)
* browser.download.folderList - int
* Indicates the location users wish to save downloaded files too.
* It is also used to display special file labels when the default
* download location is either the Desktop or the Downloads folder.
* Values:
* 0 - The desktop is the default download location.
* 1 - The system's downloads folder is the default download location.
* 2 - The default download location is elsewhere as specified in
* browser.download.dir.
* browser.download.downloadDir
* deprecated.
* browser.download.defaultFolder
* deprecated.
*/
/**
* Enables/disables the folder field and Browse button based on whether a
* default download directory is being used.
*/
readUseDownloadDir() {
var downloadFolder = document.getElementById("downloadFolder");
var chooseFolder = document.getElementById("chooseFolder");
var preference = document.getElementById("browser.download.useDownloadDir");
downloadFolder.disabled = !preference.value || preference.locked;
chooseFolder.disabled = !preference.value || preference.locked;
// don't override the preference's value in UI
return undefined;
},
/**
* Displays a file picker in which the user can choose the location where
* downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made.
*/
chooseFolder() {
return this.chooseFolderTask().catch(Components.utils.reportError);
},
async chooseFolderTask() {
let bundlePreferences = document.getElementById("bundlePreferences");
let title = bundlePreferences.getString("chooseDownloadFolderTitle");
let folderListPref = document.getElementById("browser.download.folderList");
let currentDirPref = await this._indexToFolder(folderListPref.value);
let defDownloads = await this._indexToFolder(1);
let fp = Components.classes["@mozilla.org/filepicker;1"].
createInstance(Components.interfaces.nsIFilePicker);
fp.init(window, title, Components.interfaces.nsIFilePicker.modeGetFolder);
fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
// First try to open what's currently configured
if (currentDirPref && currentDirPref.exists()) {
fp.displayDirectory = currentDirPref;
} else if (defDownloads && defDownloads.exists()) {
// Try the system's download dir
fp.displayDirectory = defDownloads;
} else {
// Fall back to Desktop
fp.displayDirectory = await this._indexToFolder(0);
}
let result = await new Promise(resolve => fp.open(resolve));
if (result != Components.interfaces.nsIFilePicker.returnOK) {
return;
}
let downloadDirPref = document.getElementById("browser.download.dir");
downloadDirPref.value = fp.file;
folderListPref.value = await this._folderToIndex(fp.file);
// Note, the real prefs will not be updated yet, so dnld manager's
// userDownloadsDirectory may not return the right folder after
// this code executes. displayDownloadDirPref will be called on
// the assignment above to update the UI.
},
/**
* Initializes the download folder display settings based on the user's
* preferences.
*/
displayDownloadDirPref() {
this.displayDownloadDirPrefTask().catch(Components.utils.reportError);
// don't override the preference's value in UI
return undefined;
},
async displayDownloadDirPrefTask() {
var folderListPref = document.getElementById("browser.download.folderList");
var bundlePreferences = document.getElementById("bundlePreferences");
var downloadFolder = document.getElementById("downloadFolder");
var currentDirPref = document.getElementById("browser.download.dir");
// Used in defining the correct path to the folder icon.
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fph = ios.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var iconUrlSpec;
// Display a 'pretty' label or the path in the UI.
if (folderListPref.value == 2) {
// Custom path selected and is configured
downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
} else if (folderListPref.value == 1) {
// 'Downloads'
downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
iconUrlSpec = fph.getURLSpecFromFile(await this._indexToFolder(1));
} else {
// 'Desktop'
downloadFolder.label = bundlePreferences.getString("desktopFolderName");
iconUrlSpec = fph.getURLSpecFromFile(await this._getDownloadsFolder("Desktop"));
}
downloadFolder.image = "moz-icon://" + iconUrlSpec + "?size=16";
},
/**
* Returns the textual path of a folder in readable form.
*/
_getDisplayNameOfFile(aFolder) {
// TODO: would like to add support for 'Downloads on Macintosh HD'
// for OS X users.
return aFolder ? aFolder.path : "";
},
/**
* Returns the Downloads folder. If aFolder is "Desktop", then the Downloads
* folder returned is the desktop folder; otherwise, it is a folder whose name
* indicates that it is a download folder and whose path is as determined by
* the XPCOM directory service via the download manager's attribute
* defaultDownloadsDirectory.
*
* @throws if aFolder is not "Desktop" or "Downloads"
*/
async _getDownloadsFolder(aFolder) {
switch (aFolder) {
case "Desktop":
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
case "Downloads":
let downloadsDir = await Downloads.getSystemDownloadsDirectory();
return new FileUtils.File(downloadsDir);
}
throw "ASSERTION FAILED: folder type should be 'Desktop' or 'Downloads'";
},
/**
* Determines the type of the given folder.
*
* @param aFolder
* the folder whose type is to be determined
* @returns integer
* 0 if aFolder is the Desktop or is unspecified,
* 1 if aFolder is the Downloads folder,
* 2 otherwise
*/
async _folderToIndex(aFolder) {
if (!aFolder || aFolder.equals(await this._getDownloadsFolder("Desktop")))
return 0;
else if (aFolder.equals(await this._getDownloadsFolder("Downloads")))
return 1;
return 2;
},
/**
* Converts an integer into the corresponding folder.
*
* @param aIndex
* an integer
* @returns the Desktop folder if aIndex == 0,
* the Downloads folder if aIndex == 1,
* the folder stored in browser.download.dir
*/
async _indexToFolder(aIndex) {
switch (aIndex) {
case 0:
return await this._getDownloadsFolder("Desktop");
case 1:
return await this._getDownloadsFolder("Downloads");
}
var currentDirPref = document.getElementById("browser.download.dir");
return currentDirPref.value;
},
/**
* Hide/show the "Show my windows and tabs from last time" option based
* on the value of the browser.privatebrowsing.autostart pref.
*/
updateBrowserStartupLastSession() {
let pbAutoStartPref = document.getElementById("browser.privatebrowsing.autostart");
let startupPref = document.getElementById("browser.startup.page");
let menu = document.getElementById("browserStartupPage");
let option = document.getElementById("browserStartupLastSession");
if (pbAutoStartPref.value) {
option.setAttribute("disabled", "true");
if (option.selected) {
menu.selectedItem = document.getElementById("browserStartupHomePage");
}
} else {
option.removeAttribute("disabled");
startupPref.updateElements(); // select the correct index in the startup menulist
}
},
// TABS
/*
* Preferences:
*
* browser.link.open_newwindow - int
* Determines where links targeting new windows should open.
* Values:
* 1 - Open in the current window or tab.
* 2 - Open in a new window.
* 3 - Open in a new tab in the most recent window.
* browser.tabs.loadInBackground - bool
* True - Whether browser should switch to a new tab opened from a link.
* browser.tabs.warnOnClose - bool
* True - If when closing a window with multiple tabs the user is warned and
* allowed to cancel the action, false to just close the window.
* browser.tabs.warnOnOpen - bool
* True - Whether the user should be warned when trying to open a lot of
* tabs at once (e.g. a large folder of bookmarks), allowing to
* cancel the action.
* browser.taskbar.previews.enable - bool
* True - Tabs are to be shown in Windows 7 taskbar.
* False - Only the window is to be shown in Windows 7 taskbar.
*/
/**
* Determines where a link which opens a new window will open.
*
* @returns |true| if such links should be opened in new tabs
*/
readLinkTarget() {
var openNewWindow = document.getElementById("browser.link.open_newwindow");
return openNewWindow.value != 2;
},
/**
* Determines where a link which opens a new window will open.
*
* @returns 2 if such links should be opened in new windows,
* 3 if such links should be opened in new tabs
*/
writeLinkTarget() {
var linkTargeting = document.getElementById("linkTargeting");
return linkTargeting.checked ? 3 : 2;
},
/*
* Preferences:
*
* browser.shell.checkDefault
* - true if a default-browser check (and prompt to make it so if necessary)
* occurs at startup, false otherwise
*/
/**
* Show button for setting browser as default browser or information that
* browser is already the default browser.
*/
updateSetDefaultBrowser() {
if (AppConstants.HAVE_SHELL_SERVICE) {
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
if (!shellSvc) {
defaultBrowserBox.hidden = true;
return;
}
let setDefaultPane = document.getElementById("setDefaultPane");
let isDefault = shellSvc.isDefaultBrowser(false, true);
setDefaultPane.selectedIndex = isDefault ? 1 : 0;
let alwaysCheck = document.getElementById("alwaysCheckDefault");
alwaysCheck.disabled = alwaysCheck.disabled ||
isDefault && alwaysCheck.checked;
}
},
/**
* Set browser as the operating system default browser.
*/
setDefaultBrowser() {
if (AppConstants.HAVE_SHELL_SERVICE) {
let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");
alwaysCheckPref.value = true;
let shellSvc = getShellService();
if (!shellSvc)
return;
try {
shellSvc.setDefaultBrowser(true, false);
} catch (ex) {
Cu.reportError(ex);
return;
}
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
}
},
};

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

@ -1,355 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- General panel -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/main.js"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/>
<preferences id="mainPreferences" hidden="true" data-category="paneGeneral">
#ifdef E10S_TESTING_ONLY
<preference id="browser.tabs.remote.autostart"
name="browser.tabs.remote.autostart"
type="bool"/>
<preference id="e10sTempPref"
name="browser.tabs.remote.autostart.2"
type="bool"/>
<preference id="e10sForceEnable"
name="browser.tabs.remote.force-enable"
type="bool"/>
#endif
<!-- Startup -->
<preference id="browser.startup.page"
name="browser.startup.page"
type="int"/>
<preference id="browser.startup.homepage"
name="browser.startup.homepage"
type="wstring"/>
#ifdef HAVE_SHELL_SERVICE
<preference id="browser.shell.checkDefaultBrowser"
name="browser.shell.checkDefaultBrowser"
type="bool"/>
<preference id="pref.general.disable_button.default_browser"
name="pref.general.disable_button.default_browser"
type="bool"/>
#endif
<preference id="pref.browser.homepage.disable_button.current_page"
name="pref.browser.homepage.disable_button.current_page"
type="bool"/>
<preference id="pref.browser.homepage.disable_button.bookmark_page"
name="pref.browser.homepage.disable_button.bookmark_page"
type="bool"/>
<preference id="pref.browser.homepage.disable_button.restore_default"
name="pref.browser.homepage.disable_button.restore_default"
type="bool"/>
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
type="bool"/>
<!-- Downloads -->
<preference id="browser.download.useDownloadDir"
name="browser.download.useDownloadDir"
type="bool"/>
<preference id="browser.download.folderList"
name="browser.download.folderList"
type="int"/>
<preference id="browser.download.dir"
name="browser.download.dir"
type="file"/>
<!-- Tab preferences
Preferences:
browser.link.open_newwindow
1 opens such links in the most recent window or tab,
2 opens such links in a new window,
3 opens such links in a new tab
browser.tabs.loadInBackground
- true if display should switch to a new tab which has been opened from a
link, false if display shouldn't switch
browser.tabs.warnOnClose
- true if when closing a window with multiple tabs the user is warned and
allowed to cancel the action, false to just close the window
browser.tabs.warnOnOpen
- true if the user should be warned if he attempts to open a lot of tabs at
once (e.g. a large folder of bookmarks), false otherwise
browser.taskbar.previews.enable
- true if tabs are to be shown in the Windows 7 taskbar
-->
<preference id="browser.link.open_newwindow"
name="browser.link.open_newwindow"
type="int"/>
<preference id="browser.tabs.loadInBackground"
name="browser.tabs.loadInBackground"
type="bool"
inverted="true"/>
<preference id="browser.tabs.warnOnClose"
name="browser.tabs.warnOnClose"
type="bool"/>
<preference id="browser.tabs.warnOnOpen"
name="browser.tabs.warnOnOpen"
type="bool"/>
<preference id="browser.sessionstore.restore_on_demand"
name="browser.sessionstore.restore_on_demand"
type="bool"/>
#ifdef XP_WIN
<preference id="browser.taskbar.previews.enable"
name="browser.taskbar.previews.enable"
type="bool"/>
#endif
<preference id="browser.ctrlTab.previews"
name="browser.ctrlTab.previews"
type="bool"/>
<preference id="browser.preferences.defaultPerformanceSettings.enabled"
name="browser.preferences.defaultPerformanceSettings.enabled"
type="bool"/>
<preference id="dom.ipc.processCount"
name="dom.ipc.processCount"
type="int"/>
<preference id="layers.acceleration.disabled"
name="layers.acceleration.disabled"
type="bool"
inverted="true"/>
</preferences>
<hbox id="header-general"
class="header"
hidden="true"
data-category="paneGeneral">
<label class="header-name" flex="1">&paneGeneral.title;</label>
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox>
<!-- Startup -->
<groupbox id="startupGroup"
data-category="paneGeneral"
hidden="true">
<caption><label>&startup.label;</label></caption>
#ifdef MOZ_DEV_EDITION
<vbox id="separateProfileBox">
<checkbox id="separateProfileMode"
label="&separateProfileMode.label;"/>
<hbox align="center" class="indent">
<label id="useFirefoxSync">&useFirefoxSync.label;</label>
<deck id="getStarted">
<label class="text-link">&getStarted.notloggedin.label;</label>
<label class="text-link">&getStarted.configured.label;</label>
</deck>
</hbox>
</vbox>
#endif
#ifdef E10S_TESTING_ONLY
<checkbox id="e10sAutoStart"
label="&e10sEnabled.label;"/>
#endif
#ifdef HAVE_SHELL_SERVICE
<vbox id="defaultBrowserBox">
<hbox align="center">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault2.label;" accesskey="&alwaysCheckDefault2.accesskey;"/>
</hbox>
<deck id="setDefaultPane">
<hbox align="center" class="indent">
<label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
<button id="setDefaultButton"
label="&setAsMyDefaultBrowser2.label;" accesskey="&setAsMyDefaultBrowser2.accesskey;"
preference="pref.general.disable_button.default_browser"/>
</hbox>
<hbox align="center" class="indent">
<label id="isDefaultLabel" flex="1">&isDefault.label;</label>
</hbox>
</deck>
<separator class="thin"/>
</vbox>
#endif
<html:table id="startupTable">
<html:tr>
<html:td class="label-cell">
<label accesskey="&startupPage.accesskey;"
control="browserStartupPage">&startupPage.label;</label>
</html:td>
<html:td class="content-cell">
<menulist id="browserStartupPage"
class="content-cell-item"
preference="browser.startup.page">
<menupopup>
<menuitem label="&startupUserHomePage.label;"
value="1"
id="browserStartupHomePage"/>
<menuitem label="&startupBlankPage.label;"
value="0"
id="browserStartupBlank"/>
<menuitem label="&startupPrevSession.label;"
value="3"
id="browserStartupLastSession"/>
</menupopup>
</menulist>
</html:td>
</html:tr>
<html:tr>
<html:td class="label-cell">
<label accesskey="&homepage.accesskey;"
control="browserHomePage">&homepage.label;</label>
</html:td>
<html:td class="content-cell">
<textbox id="browserHomePage"
class="padded uri-element content-cell-item"
type="autocomplete"
autocompletesearch="unifiedcomplete"
onsyncfrompreference="return gMainPane.syncFromHomePref();"
onsynctopreference="return gMainPane.syncToHomePref(this.value);"
placeholder="&abouthome.pageTitle;"
preference="browser.startup.homepage"/>
</html:td>
</html:tr>
<html:tr>
<html:td class="label-cell" />
<html:td class="content-cell homepage-buttons">
<button id="useCurrent"
class="content-cell-item"
label=""
accesskey="&useCurrentPage.accesskey;"
label1="&useCurrentPage.label;"
label2="&useMultiple.label;"
preference="pref.browser.homepage.disable_button.current_page"/>
<button id="useBookmark"
class="content-cell-item"
label="&chooseBookmark.label;"
accesskey="&chooseBookmark.accesskey;"
preference="pref.browser.homepage.disable_button.bookmark_page"/>
<button id="restoreDefaultHomePage"
class="content-cell-item"
label="&restoreDefault.label;"
accesskey="&restoreDefault.accesskey;"
preference="pref.browser.homepage.disable_button.restore_default"/>
</html:td>
</html:tr>
</html:table>
</groupbox>
<!-- Downloads -->
<groupbox id="downloadsGroup"
data-category="paneGeneral"
hidden="true">
<caption><label>&downloads.label;</label></caption>
<radiogroup id="saveWhere"
preference="browser.download.useDownloadDir"
onsyncfrompreference="return gMainPane.readUseDownloadDir();">
<hbox id="saveToRow">
<radio id="saveTo"
value="true"
label="&saveTo.label;"
accesskey="&saveTo.accesskey;"
aria-labelledby="saveTo downloadFolder"/>
<filefield id="downloadFolder"
flex="1"
preference="browser.download.folderList"
preference-editable="true"
aria-labelledby="saveTo"
onsyncfrompreference="return gMainPane.displayDownloadDirPref();"/>
<button id="chooseFolder"
#ifdef XP_MACOSX
accesskey="&chooseFolderMac.accesskey;"
label="&chooseFolderMac.label;"
#else
accesskey="&chooseFolderWin.accesskey;"
label="&chooseFolderWin.label;"
#endif
/>
</hbox>
<hbox>
<radio id="alwaysAsk"
value="false"
label="&alwaysAskWhere.label;"
accesskey="&alwaysAskWhere.accesskey;"/>
</hbox>
</radiogroup>
</groupbox>
<!-- Tab preferences -->
<groupbox data-category="paneGeneral"
hidden="true" align="start">
<caption><label>&tabsGroup.label;</label></caption>
<checkbox id="ctrlTabRecentlyUsedOrder" label="&ctrlTabRecentlyUsedOrder.label;"
accesskey="&ctrlTabRecentlyUsedOrder.accesskey;"
preference="browser.ctrlTab.previews"/>
<checkbox id="linkTargeting" label="&newWindowsAsTabs.label;"
accesskey="&newWindowsAsTabs.accesskey;"
preference="browser.link.open_newwindow"
onsyncfrompreference="return gMainPane.readLinkTarget();"
onsynctopreference="return gMainPane.writeLinkTarget();"/>
<checkbox id="warnCloseMultiple" label="&warnOnCloseMultipleTabs.label;"
accesskey="&warnOnCloseMultipleTabs.accesskey;"
preference="browser.tabs.warnOnClose"/>
<checkbox id="warnOpenMany" label="&warnOnOpenManyTabs.label;"
accesskey="&warnOnOpenManyTabs.accesskey;"
preference="browser.tabs.warnOnOpen"/>
<checkbox id="switchToNewTabs" label="&switchLinksToNewTabs.label;"
accesskey="&switchLinksToNewTabs.accesskey;"
preference="browser.tabs.loadInBackground"/>
#ifdef XP_WIN
<checkbox id="showTabsInTaskbar" label="&showTabsInTaskbar.label;"
accesskey="&showTabsInTaskbar.accesskey;"
preference="browser.taskbar.previews.enable"/>
#endif
</groupbox>
<!-- Performance -->
<groupbox id="performanceGroup" data-category="paneGeneral" hidden="true">
<caption><label>&performance.label;</label></caption>
<hbox align="center">
<checkbox id="useRecommendedPerformanceSettings"
label="&useRecommendedPerformanceSettings.label;"
accesskey="&useRecommendedPerformanceSettings.accesskey;"
preference="browser.preferences.defaultPerformanceSettings.enabled"/>
<label id="performanceSettingsLearnMore" class="learnMore text-link">&performanceSettingsLearnMore.label;</label>
</hbox>
<description class="indent">&useRecommendedPerformanceSettings.description;</description>
<vbox id="performanceSettings" class="indent" hidden="true">
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.disabled"/>
<hbox align="center">
<label id="limitContentProcess" accesskey="&limitContentProcessOption.accesskey;" control="contentProcessCount">&limitContentProcessOption.label;</label>
<menulist id="contentProcessCount" preference="dom.ipc.processCount">
<menupopup>
<menuitem label="1" value="1"/>
<menuitem label="2" value="2"/>
<menuitem label="3" value="3"/>
<menuitem label="4" value="4"/>
<menuitem label="5" value="5"/>
<menuitem label="6" value="6"/>
<menuitem label="7" value="7"/>
</menupopup>
</menulist>
</hbox>
<description>&limitContentProcessOption.description;</description>
</vbox>
</groupbox>

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

@ -1,696 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from preferences.js */
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
"resource://gre/modules/ContextualIdentityService.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
var gPrivacyPane = {
/**
* Whether the use has selected the auto-start private browsing mode in the UI.
*/
_autoStartPrivateBrowsing: false,
/**
* Whether the prompt to restart Firefox should appear when changing the autostart pref.
*/
_shouldPromptForRestart: true,
/**
* Show the Tracking Protection UI depending on the
* privacy.trackingprotection.ui.enabled pref, and linkify its Learn More link
*/
_initTrackingProtection() {
if (!Services.prefs.getBoolPref("privacy.trackingprotection.ui.enabled")) {
return;
}
let link = document.getElementById("trackingProtectionLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
link.setAttribute("href", url);
this.trackingProtectionReadPrefs();
document.getElementById("trackingprotectionbox").hidden = false;
document.getElementById("trackingprotectionpbmbox").hidden = true;
},
/**
* Linkify the Learn More link of the Private Browsing Mode Tracking
* Protection UI.
*/
_initTrackingProtectionPBM() {
let link = document.getElementById("trackingProtectionPBMLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection-pbm";
link.setAttribute("href", url);
},
/**
* Initialize autocomplete to ensure prefs are in sync.
*/
_initAutocomplete() {
Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Components.interfaces.mozIPlacesAutoComplete);
},
/**
* Show the Containers UI depending on the privacy.userContext.ui.enabled pref.
*/
_initBrowserContainers() {
if (!Services.prefs.getBoolPref("privacy.userContext.ui.enabled")) {
return;
}
let link = document.getElementById("browserContainersLearnMore");
link.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "containers";
document.getElementById("browserContainersbox").hidden = false;
document.getElementById("browserContainersCheckbox").checked =
Services.prefs.getBoolPref("privacy.userContext.enabled");
},
_checkBrowserContainers(event) {
let checkbox = document.getElementById("browserContainersCheckbox");
if (checkbox.checked) {
Services.prefs.setBoolPref("privacy.userContext.enabled", true);
return;
}
let count = ContextualIdentityService.countContainerTabs();
if (count == 0) {
Services.prefs.setBoolPref("privacy.userContext.enabled", false);
return;
}
let bundlePreferences = document.getElementById("bundlePreferences");
let title = bundlePreferences.getString("disableContainersAlertTitle");
let message = PluralForm.get(count, bundlePreferences.getString("disableContainersMsg"))
.replace("#S", count)
let okButton = PluralForm.get(count, bundlePreferences.getString("disableContainersOkButton"))
.replace("#S", count)
let cancelButton = bundlePreferences.getString("disableContainersButton2");
let buttonFlags = (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1);
let rv = Services.prompt.confirmEx(window, title, message, buttonFlags,
okButton, cancelButton, null, null, {});
if (rv == 0) {
ContextualIdentityService.closeContainerTabs();
Services.prefs.setBoolPref("privacy.userContext.enabled", false);
return;
}
checkbox.checked = true;
},
/**
* Sets up the UI for the number of days of history to keep, and updates the
* label of the "Clear Now..." button.
*/
init() {
function setEventListener(aId, aEventType, aCallback) {
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gPrivacyPane));
}
this._updateSanitizeSettingsButton();
this.initializeHistoryMode();
this.updateHistoryModePane();
this.updatePrivacyMicroControls();
this.initAutoStartPrivateBrowsingReverter();
this._initTrackingProtection();
this._initTrackingProtectionPBM();
this._initAutocomplete();
this._initBrowserContainers();
setEventListener("privacy.sanitize.sanitizeOnShutdown", "change",
gPrivacyPane._updateSanitizeSettingsButton);
setEventListener("browser.privatebrowsing.autostart", "change",
gPrivacyPane.updatePrivacyMicroControls);
setEventListener("historyMode", "command", function() {
gPrivacyPane.updateHistoryModePane();
gPrivacyPane.updateHistoryModePrefs();
gPrivacyPane.updatePrivacyMicroControls();
gPrivacyPane.updateAutostart();
});
setEventListener("historyRememberClear", "click", function() {
gPrivacyPane.clearPrivateDataNow(false);
return false;
});
setEventListener("historyRememberCookies", "click", function() {
gPrivacyPane.showCookies();
return false;
});
setEventListener("historyDontRememberClear", "click", function() {
gPrivacyPane.clearPrivateDataNow(true);
return false;
});
setEventListener("doNotTrackSettings", "click", function() {
gPrivacyPane.showDoNotTrackSettings();
return false;
});
setEventListener("privateBrowsingAutoStart", "command",
gPrivacyPane.updateAutostart);
setEventListener("cookieExceptions", "command",
gPrivacyPane.showCookieExceptions);
setEventListener("showCookiesButton", "command",
gPrivacyPane.showCookies);
setEventListener("clearDataSettings", "command",
gPrivacyPane.showClearPrivateDataSettings);
setEventListener("trackingProtectionRadioGroup", "command",
gPrivacyPane.trackingProtectionWritePrefs);
setEventListener("trackingProtectionExceptions", "command",
gPrivacyPane.showTrackingProtectionExceptions);
setEventListener("changeBlockList", "command",
gPrivacyPane.showBlockLists);
setEventListener("changeBlockListPBM", "command",
gPrivacyPane.showBlockLists);
setEventListener("browserContainersCheckbox", "command",
gPrivacyPane._checkBrowserContainers);
setEventListener("browserContainersSettings", "command",
gPrivacyPane.showContainerSettings);
},
// TRACKING PROTECTION MODE
/**
* Selects the right item of the Tracking Protection radiogroup.
*/
trackingProtectionReadPrefs() {
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
// Global enable takes precedence over enabled in Private Browsing.
if (enabledPref.value) {
radiogroup.value = "always";
} else if (pbmPref.value) {
radiogroup.value = "private";
} else {
radiogroup.value = "never";
}
},
/**
* Sets the pref values based on the selected item of the radiogroup.
*/
trackingProtectionWritePrefs() {
let enabledPref = document.getElementById("privacy.trackingprotection.enabled");
let pbmPref = document.getElementById("privacy.trackingprotection.pbmode.enabled");
let radiogroup = document.getElementById("trackingProtectionRadioGroup");
switch (radiogroup.value) {
case "always":
enabledPref.value = true;
pbmPref.value = true;
break;
case "private":
enabledPref.value = false;
pbmPref.value = true;
break;
case "never":
enabledPref.value = false;
pbmPref.value = false;
break;
}
},
// HISTORY MODE
/**
* The list of preferences which affect the initial history mode settings.
* If the auto start private browsing mode pref is active, the initial
* history mode would be set to "Don't remember anything".
* If ALL of these preferences are set to the values that correspond
* to keeping some part of history, and the auto-start
* private browsing mode is not active, the initial history mode would be
* set to "Remember everything".
* Otherwise, the initial history mode would be set to "Custom".
*
* Extensions adding their own preferences can set values here if needed.
*/
prefsForKeepingHistory: {
"places.history.enabled": true, // History is enabled
"browser.formfill.enable": true, // Form information is saved
"network.cookie.cookieBehavior": 0, // All cookies are enabled
"network.cookie.lifetimePolicy": 0, // Cookies use supplied lifetime
"privacy.sanitize.sanitizeOnShutdown": false, // Private date is NOT cleared on shutdown
},
/**
* The list of control IDs which are dependent on the auto-start private
* browsing setting, such that in "Custom" mode they would be disabled if
* the auto-start private browsing checkbox is checked, and enabled otherwise.
*
* Extensions adding their own controls can append their IDs to this array if needed.
*/
dependentControls: [
"rememberHistory",
"rememberForms",
"keepUntil",
"keepCookiesUntil",
"alwaysClear",
"clearDataSettings"
],
/**
* Check whether preferences values are set to keep history
*
* @param aPrefs an array of pref names to check for
* @returns boolean true if all of the prefs are set to keep history,
* false otherwise
*/
_checkHistoryValues(aPrefs) {
for (let pref of Object.keys(aPrefs)) {
if (document.getElementById(pref).value != aPrefs[pref])
return false;
}
return true;
},
/**
* Initialize the history mode menulist based on the privacy preferences
*/
initializeHistoryMode() {
let mode;
let getVal = aPref => document.getElementById(aPref).value;
if (getVal("privacy.history.custom"))
mode = "custom";
else if (this._checkHistoryValues(this.prefsForKeepingHistory)) {
if (getVal("browser.privatebrowsing.autostart"))
mode = "dontremember";
else
mode = "remember";
} else
mode = "custom";
document.getElementById("historyMode").value = mode;
},
/**
* Update the selected pane based on the history mode menulist
*/
updateHistoryModePane() {
let selectedIndex = -1;
switch (document.getElementById("historyMode").value) {
case "remember":
selectedIndex = 0;
break;
case "dontremember":
selectedIndex = 1;
break;
case "custom":
selectedIndex = 2;
break;
}
document.getElementById("historyPane").selectedIndex = selectedIndex;
document.getElementById("privacy.history.custom").value = selectedIndex == 2;
},
/**
* Update the private browsing auto-start pref and the history mode
* micro-management prefs based on the history mode menulist
*/
updateHistoryModePrefs() {
let pref = document.getElementById("browser.privatebrowsing.autostart");
switch (document.getElementById("historyMode").value) {
case "remember":
if (pref.value)
pref.value = false;
// select the remember history option if needed
document.getElementById("places.history.enabled").value = true;
// select the remember forms history option
document.getElementById("browser.formfill.enable").value = true;
// select the allow cookies option
document.getElementById("network.cookie.cookieBehavior").value = 0;
// select the cookie lifetime policy option
document.getElementById("network.cookie.lifetimePolicy").value = 0;
// select the clear on close option
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value = false;
break;
case "dontremember":
if (!pref.value)
pref.value = true;
break;
}
},
/**
* Update the privacy micro-management controls based on the
* value of the private browsing auto-start checkbox.
*/
updatePrivacyMicroControls() {
if (document.getElementById("historyMode").value == "custom") {
let disabled = this._autoStartPrivateBrowsing =
document.getElementById("privateBrowsingAutoStart").checked;
this.dependentControls.forEach(function(aElement) {
let control = document.getElementById(aElement);
let preferenceId = control.getAttribute("preference");
if (!preferenceId) {
let dependentControlId = control.getAttribute("control");
if (dependentControlId) {
let dependentControl = document.getElementById(dependentControlId);
preferenceId = dependentControl.getAttribute("preference");
}
}
let preference = preferenceId ? document.getElementById(preferenceId) : {};
control.disabled = disabled || preference.locked;
});
// adjust the cookie controls status
this.readAcceptCookies();
let lifetimePolicy = document.getElementById("network.cookie.lifetimePolicy").value;
if (lifetimePolicy != Ci.nsICookieService.ACCEPT_NORMALLY &&
lifetimePolicy != Ci.nsICookieService.ACCEPT_SESSION &&
lifetimePolicy != Ci.nsICookieService.ACCEPT_FOR_N_DAYS) {
lifetimePolicy = Ci.nsICookieService.ACCEPT_NORMALLY;
}
document.getElementById("keepCookiesUntil").value = disabled ? 2 : lifetimePolicy;
// adjust the checked state of the sanitizeOnShutdown checkbox
document.getElementById("alwaysClear").checked = disabled ? false :
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value;
// adjust the checked state of the remember history checkboxes
document.getElementById("rememberHistory").checked = disabled ? false :
document.getElementById("places.history.enabled").value;
document.getElementById("rememberForms").checked = disabled ? false :
document.getElementById("browser.formfill.enable").value;
if (!disabled) {
// adjust the Settings button for sanitizeOnShutdown
this._updateSanitizeSettingsButton();
}
}
},
// PRIVATE BROWSING
/**
* Initialize the starting state for the auto-start private browsing mode pref reverter.
*/
initAutoStartPrivateBrowsingReverter() {
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
this._lastMode = mode.selectedIndex;
this._lastCheckState = autoStart.hasAttribute("checked");
},
_lastMode: null,
_lastCheckState: null,
updateAutostart() {
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
let pref = document.getElementById("browser.privatebrowsing.autostart");
if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
(mode.value == "remember" && !this._lastCheckState) ||
(mode.value == "dontremember" && this._lastCheckState)) {
// These are all no-op changes, so we don't need to prompt.
this._lastMode = mode.selectedIndex;
this._lastCheckState = autoStart.hasAttribute("checked");
return;
}
if (!this._shouldPromptForRestart) {
// We're performing a revert. Just let it happen.
return;
}
let buttonIndex = confirmRestartPrompt(autoStart.checked, 1,
true, false);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
pref.value = autoStart.hasAttribute("checked");
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
return;
}
this._shouldPromptForRestart = false;
if (this._lastCheckState) {
autoStart.checked = "checked";
} else {
autoStart.removeAttribute("checked");
}
pref.value = autoStart.hasAttribute("checked");
mode.selectedIndex = this._lastMode;
mode.doCommand();
this._shouldPromptForRestart = true;
},
/**
* Displays fine-grained, per-site preferences for tracking protection.
*/
showTrackingProtectionExceptions() {
let bundlePreferences = document.getElementById("bundlePreferences");
let params = {
permissionType: "trackingprotection",
hideStatusColumn: true,
windowTitle: bundlePreferences.getString("trackingprotectionpermissionstitle"),
introText: bundlePreferences.getString("trackingprotectionpermissionstext"),
};
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
/**
* Displays container panel for customising and adding containers.
*/
showContainerSettings() {
gotoPref("containers");
},
/**
* Displays the available block lists for tracking protection.
*/
showBlockLists() {
var bundlePreferences = document.getElementById("bundlePreferences");
let brandName = document.getElementById("bundleBrand")
.getString("brandShortName");
var params = { brandShortName: brandName,
windowTitle: bundlePreferences.getString("blockliststitle"),
introText: bundlePreferences.getString("blockliststext") };
gSubDialog.open("chrome://browser/content/preferences/blocklists.xul",
null, params);
},
/**
* Displays the Do Not Track settings dialog.
*/
showDoNotTrackSettings() {
gSubDialog.open("chrome://browser/content/preferences/donottrack.xul",
"resizable=no");
},
// HISTORY
/*
* Preferences:
*
* places.history.enabled
* - whether history is enabled or not
* browser.formfill.enable
* - true if entries in forms and the search bar should be saved, false
* otherwise
*/
// COOKIES
/*
* Preferences:
*
* network.cookie.cookieBehavior
* - determines how the browser should handle cookies:
* 0 means enable all cookies
* 1 means reject all third party cookies
* 2 means disable all cookies
* 3 means reject third party cookies unless at least one is already set for the eTLD
* see netwerk/cookie/src/nsCookieService.cpp for details
* network.cookie.lifetimePolicy
* - determines how long cookies are stored:
* 0 means keep cookies until they expire
* 2 means keep cookies until the browser is closed
*/
/**
* Reads the network.cookie.cookieBehavior preference value and
* enables/disables the rest of the cookie UI accordingly, returning true
* if cookies are enabled.
*/
readAcceptCookies() {
var pref = document.getElementById("network.cookie.cookieBehavior");
var acceptThirdPartyLabel = document.getElementById("acceptThirdPartyLabel");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
var keepUntil = document.getElementById("keepUntil");
var menu = document.getElementById("keepCookiesUntil");
// enable the rest of the UI for anything other than "disable all cookies"
var acceptCookies = (pref.value != 2);
acceptThirdPartyLabel.disabled = acceptThirdPartyMenu.disabled = !acceptCookies;
keepUntil.disabled = menu.disabled = this._autoStartPrivateBrowsing || !acceptCookies;
return acceptCookies;
},
/**
* Enables/disables the "keep until" label and menulist in response to the
* "accept cookies" checkbox being checked or unchecked.
*/
writeAcceptCookies() {
var accept = document.getElementById("acceptCookies");
var acceptThirdPartyMenu = document.getElementById("acceptThirdPartyMenu");
// if we're enabling cookies, automatically select 'accept third party always'
if (accept.checked)
acceptThirdPartyMenu.selectedIndex = 0;
return accept.checked ? 0 : 2;
},
/**
* Converts between network.cookie.cookieBehavior and the third-party cookie UI
*/
readAcceptThirdPartyCookies() {
var pref = document.getElementById("network.cookie.cookieBehavior");
switch (pref.value) {
case 0:
return "always";
case 1:
return "never";
case 2:
return "never";
case 3:
return "visited";
default:
return undefined;
}
},
writeAcceptThirdPartyCookies() {
var accept = document.getElementById("acceptThirdPartyMenu").selectedItem;
switch (accept.value) {
case "always":
return 0;
case "visited":
return 3;
case "never":
return 1;
default:
return undefined;
}
},
/**
* Displays fine-grained, per-site preferences for cookies.
*/
showCookieExceptions() {
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: true,
sessionVisible: true,
allowVisible: true,
prefilledHost: "",
permissionType: "cookie",
windowTitle: bundlePreferences.getString("cookiepermissionstitle"),
introText: bundlePreferences.getString("cookiepermissionstext") };
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
/**
* Displays all the user's cookies in a dialog.
*/
showCookies(aCategory) {
gSubDialog.open("chrome://browser/content/preferences/cookies.xul");
},
// CLEAR PRIVATE DATA
/*
* Preferences:
*
* privacy.sanitize.sanitizeOnShutdown
* - true if the user's private data is cleared on startup according to the
* Clear Private Data settings, false otherwise
*/
/**
* Displays the Clear Private Data settings dialog.
*/
showClearPrivateDataSettings() {
gSubDialog.open("chrome://browser/content/preferences/sanitize.xul", "resizable=no");
},
/**
* Displays a dialog from which individual parts of private data may be
* cleared.
*/
clearPrivateDataNow(aClearEverything) {
var ts = document.getElementById("privacy.sanitize.timeSpan");
var timeSpanOrig = ts.value;
if (aClearEverything) {
ts.value = 0;
}
gSubDialog.open("chrome://browser/content/sanitize.xul", "resizable=no", null, () => {
// reset the timeSpan pref
if (aClearEverything) {
ts.value = timeSpanOrig;
}
Services.obs.notifyObservers(null, "clear-private-data");
});
},
/**
* Enables or disables the "Settings..." button depending
* on the privacy.sanitize.sanitizeOnShutdown preference value
*/
_updateSanitizeSettingsButton() {
var settingsButton = document.getElementById("clearDataSettings");
var sanitizeOnShutdownPref = document.getElementById("privacy.sanitize.sanitizeOnShutdown");
settingsButton.disabled = !sanitizeOnShutdownPref.value;
},
// CONTAINERS
/*
* preferences:
*
* privacy.userContext.enabled
* - true if containers is enabled
*/
/**
* Enables/disables the Settings button used to configure containers
*/
readBrowserContainersCheckbox() {
var pref = document.getElementById("privacy.userContext.enabled");
var settings = document.getElementById("browserContainersSettings");
settings.disabled = !pref.value;
}
};

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

@ -1,306 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
<!-- Privacy panel -->
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/privacy.js"/>
<preferences id="privacyPreferences" hidden="true" data-category="panePrivacy">
<!-- Tracking -->
<preference id="privacy.trackingprotection.enabled"
name="privacy.trackingprotection.enabled"
type="bool"/>
<preference id="privacy.trackingprotection.pbmode.enabled"
name="privacy.trackingprotection.pbmode.enabled"
type="bool"/>
<!-- XXX button prefs -->
<preference id="pref.privacy.disable_button.cookie_exceptions"
name="pref.privacy.disable_button.cookie_exceptions"
type="bool"/>
<preference id="pref.privacy.disable_button.view_cookies"
name="pref.privacy.disable_button.view_cookies"
type="bool"/>
<preference id="pref.privacy.disable_button.change_blocklist"
name="pref.privacy.disable_button.change_blocklist"
type="bool"/>
<preference id="pref.privacy.disable_button.tracking_protection_exceptions"
name="pref.privacy.disable_button.tracking_protection_exceptions"
type="bool"/>
<!-- Location Bar -->
<preference id="browser.urlbar.autocomplete.enabled"
name="browser.urlbar.autocomplete.enabled"
type="bool"/>
<preference id="browser.urlbar.suggest.bookmark"
name="browser.urlbar.suggest.bookmark"
type="bool"/>
<preference id="browser.urlbar.suggest.history"
name="browser.urlbar.suggest.history"
type="bool"/>
<preference id="browser.urlbar.suggest.openpage"
name="browser.urlbar.suggest.openpage"
type="bool"/>
<!-- History -->
<preference id="places.history.enabled"
name="places.history.enabled"
type="bool"/>
<preference id="browser.formfill.enable"
name="browser.formfill.enable"
type="bool"/>
<preference id="privacy.history.custom"
name="privacy.history.custom"
type="bool"/>
<!-- Cookies -->
<preference id="network.cookie.cookieBehavior"
name="network.cookie.cookieBehavior"
type="int"/>
<preference id="network.cookie.lifetimePolicy"
name="network.cookie.lifetimePolicy"
type="int"/>
<preference id="network.cookie.blockFutureCookies"
name="network.cookie.blockFutureCookies"
type="bool"/>
<!-- Clear Private Data -->
<preference id="privacy.sanitize.sanitizeOnShutdown"
name="privacy.sanitize.sanitizeOnShutdown"
type="bool"/>
<preference id="privacy.sanitize.timeSpan"
name="privacy.sanitize.timeSpan"
type="int"/>
<!-- Private Browsing -->
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
type="bool"/>
</preferences>
<hbox id="header-privacy"
class="header"
hidden="true"
data-category="panePrivacy">
<label class="header-name" flex="1">&panePrivacy.title;</label>
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox>
<!-- Tracking -->
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
<vbox id="trackingprotectionbox" hidden="true">
<hbox align="start">
<vbox>
<caption><label>&trackingProtectionHeader.label;
<label id="trackingProtectionLearnMore" class="learnMore text-link"
value="&trackingProtectionLearnMore.label;"/>
</label></caption>
<radiogroup id="trackingProtectionRadioGroup">
<radio value="always"
label="&trackingProtectionAlways.label;"
accesskey="&trackingProtectionAlways.accesskey;"/>
<radio value="private"
label="&trackingProtectionPrivate.label;"
accesskey="&trackingProtectionPrivate.accesskey;"/>
<radio value="never"
label="&trackingProtectionNever.label;"
accesskey="&trackingProtectionNever.accesskey;"/>
</radiogroup>
</vbox>
<spacer flex="1" />
<vbox>
<button id="trackingProtectionExceptions"
label="&trackingProtectionExceptions.label;"
accesskey="&trackingProtectionExceptions.accesskey;"
preference="pref.privacy.disable_button.tracking_protection_exceptions"/>
<button id="changeBlockList"
label="&changeBlockList.label;"
accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</vbox>
</hbox>
</vbox>
<vbox id="trackingprotectionpbmbox">
<caption><label>&tracking.label;</label></caption>
<hbox align="center">
<checkbox id="trackingProtectionPBM"
preference="privacy.trackingprotection.pbmode.enabled"
accesskey="&trackingProtectionPBM5.accesskey;"
label="&trackingProtectionPBM5.label;" />
<label id="trackingProtectionPBMLearnMore"
class="learnMore text-link"
value="&trackingProtectionPBMLearnMore.label;"/>
<spacer flex="1" />
<button id="changeBlockListPBM"
label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
preference="pref.privacy.disable_button.change_blocklist"/>
</hbox>
</vbox>
<vbox>
<description>&doNotTrack.pre.label;<label
class="text-link" id="doNotTrackSettings"
>&doNotTrack.settings.label;</label>&doNotTrack.post.label;</description>
</vbox>
</groupbox>
<!-- History -->
<groupbox id="historyGroup" data-category="panePrivacy" hidden="true">
<caption><label>&history.label;</label></caption>
<hbox align="center">
<label id="historyModeLabel"
control="historyMode"
accesskey="&historyHeader.pre.accesskey;">&historyHeader.pre.label;
</label>
<menulist id="historyMode">
<menupopup>
<menuitem label="&historyHeader.remember.label;" value="remember"/>
<menuitem label="&historyHeader.dontremember.label;" value="dontremember"/>
<menuitem label="&historyHeader.custom.label;" value="custom"/>
</menupopup>
</menulist>
<label>&historyHeader.post.label;</label>
</hbox>
<deck id="historyPane">
<vbox id="historyRememberPane">
<hbox align="center" flex="1">
<vbox flex="1">
<description>&rememberDescription.label;</description>
<separator class="thin"/>
<description>&rememberActions.pre.label;<label
class="text-link" id="historyRememberClear"
>&rememberActions.clearHistory.label;</label>&rememberActions.middle.label;<label
class="text-link" id="historyRememberCookies"
>&rememberActions.removeCookies.label;</label>&rememberActions.post.label;</description>
</vbox>
</hbox>
</vbox>
<vbox id="historyDontRememberPane">
<hbox align="center" flex="1">
<vbox flex="1">
<description>&dontrememberDescription.label;</description>
<separator class="thin"/>
<description>&dontrememberActions.pre.label;<label
class="text-link" id="historyDontRememberClear"
>&dontrememberActions.clearHistory.label;</label>&dontrememberActions.post.label;</description>
</vbox>
</hbox>
</vbox>
<vbox id="historyCustomPane">
<separator class="thin"/>
<vbox>
<vbox align="start">
<checkbox id="privateBrowsingAutoStart"
label="&privateBrowsingPermanent2.label;"
accesskey="&privateBrowsingPermanent2.accesskey;"
preference="browser.privatebrowsing.autostart"/>
</vbox>
<vbox class="indent">
<vbox align="start">
<checkbox id="rememberHistory"
label="&rememberHistory2.label;"
accesskey="&rememberHistory2.accesskey;"
preference="places.history.enabled"/>
<checkbox id="rememberForms"
label="&rememberSearchForm.label;"
accesskey="&rememberSearchForm.accesskey;"
preference="browser.formfill.enable"/>
</vbox>
<hbox id="cookiesBox">
<checkbox id="acceptCookies" label="&acceptCookies.label;"
preference="network.cookie.cookieBehavior"
accesskey="&acceptCookies.accesskey;"
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"/>
<spacer flex="1" />
<button id="cookieExceptions"
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
preference="pref.privacy.disable_button.cookie_exceptions"/>
</hbox>
<hbox id="acceptThirdPartyRow"
class="indent"
align="center">
<label id="acceptThirdPartyLabel" control="acceptThirdPartyMenu"
accesskey="&acceptThirdParty.pre.accesskey;">&acceptThirdParty.pre.label;</label>
<menulist id="acceptThirdPartyMenu" preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();">
<menupopup>
<menuitem label="&acceptThirdParty.always.label;" value="always"/>
<menuitem label="&acceptThirdParty.visited.label;" value="visited"/>
<menuitem label="&acceptThirdParty.never.label;" value="never"/>
</menupopup>
</menulist>
</hbox>
<hbox id="keepRow"
class="indent"
align="center">
<label id="keepUntil"
control="keepCookiesUntil"
accesskey="&keepUntil.accesskey;">&keepUntil.label;</label>
<menulist id="keepCookiesUntil"
preference="network.cookie.lifetimePolicy">
<menupopup>
<menuitem label="&expire.label;" value="0"/>
<menuitem label="&close.label;" value="2"/>
</menupopup>
</menulist>
<spacer flex="1"/>
<button id="showCookiesButton"
label="&showCookies.label;" accesskey="&showCookies.accesskey;"
preference="pref.privacy.disable_button.view_cookies"/>
</hbox>
<hbox id="clearDataBox"
align="center">
<checkbox id="alwaysClear"
preference="privacy.sanitize.sanitizeOnShutdown"
label="&clearOnClose.label;"
accesskey="&clearOnClose.accesskey;"/>
<spacer flex="1"/>
<button id="clearDataSettings" label="&clearOnCloseSettings.label;"
accesskey="&clearOnCloseSettings.accesskey;"/>
</hbox>
</vbox>
</vbox>
</vbox>
</deck>
</groupbox>
<!-- Location Bar -->
<groupbox id="locationBarGroup"
data-category="panePrivacy"
hidden="true">
<caption><label>&locationBar.label;</label></caption>
<label id="locationBarSuggestionLabel">&locbar.suggest.label;</label>
<checkbox id="historySuggestion" label="&locbar.history.label;"
accesskey="&locbar.history.accesskey;"
preference="browser.urlbar.suggest.history"/>
<checkbox id="bookmarkSuggestion" label="&locbar.bookmarks.label;"
accesskey="&locbar.bookmarks.accesskey;"
preference="browser.urlbar.suggest.bookmark"/>
<checkbox id="openpageSuggestion" label="&locbar.openpage.label;"
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
<label class="text-link" onclick="gotoPref('search')">
&suggestionSettings.label;
</label>
</groupbox>
<!-- Containers -->
<groupbox id="browserContainersGroup" data-category="panePrivacy" hidden="true">
<vbox id="browserContainersbox" hidden="true">
<caption><label>&browserContainersHeader.label;</label></caption>
<hbox align="center">
<checkbox id="browserContainersCheckbox"
label="&browserContainersEnabled.label;"
accesskey="&browserContainersEnabled.accesskey;"
preference="privacy.userContext.enabled"
onsyncfrompreference="return gPrivacyPane.readBrowserContainersCheckbox();"/>
<label id="browserContainersLearnMore" class="learnMore text-link"
value="&browserContainersLearnMore.label;"/>
<spacer flex="1"/>
<button id="browserContainersSettings"
label="&browserContainersSettings.label;"
accesskey="&browserContainersSettings.accesskey;"/>
</hbox>
</vbox>
</groupbox>

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

@ -1,41 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.preferences.instantApply");
});
add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("paneContent");
is(prefs.selectedPane, "paneContent", "Content pane was selected");
prefs = await openPreferencesViaOpenPreferencesAPI("advanced", "updateTab");
is(prefs.selectedPane, "paneAdvanced", "Advanced pane was selected");
is(prefs.selectedAdvancedTab, "updateTab", "The update tab within the advanced prefs should be selected");
prefs = await openPreferencesViaHash("privacy");
is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected when hash is 'privacy'");
prefs = await openPreferencesViaOpenPreferencesAPI("nonexistant-category");
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default when a nonexistant-category is requested");
prefs = await openPreferencesViaHash("nonexistant-category");
is(prefs.selectedPane, "paneGeneral", "General pane is selected when hash is a nonexistant-category");
prefs = await openPreferencesViaHash();
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
});
function openPreferencesViaHash(aPane) {
return new Promise(resolve => {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:preferences" + (aPane ? "#" + aPane : ""));
let newTabBrowser = gBrowser.selectedBrowser;
newTabBrowser.addEventListener("Initialized", function() {
newTabBrowser.contentWindow.addEventListener("load", function() {
let win = gBrowser.contentWindow;
let selectedPane = win.history.state;
gBrowser.removeCurrentTab();
resolve({selectedPane});
}, {once: true});
}, {capture: true, once: true});
});
}

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

@ -3,16 +3,23 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from preferences.js */ /* import-globals-from preferences.js */
/* import-globals-from ../../../base/content/aboutDialog-appUpdater.js */
// Load DownloadUtils module for convertByteUnits // Load DownloadUtils module for convertByteUnits
Components.utils.import("resource://gre/modules/DownloadUtils.jsm"); Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm"); Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SiteDataManager",
"resource:///modules/SiteDataManager.jsm");
const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
var gAdvancedPane = { var gAdvancedPane = {
_inited: false, _inited: false,
/**
* Brings the appropriate tab to the front and initializes various bits of UI.
*/
init() { init() {
function setEventListener(aId, aEventType, aCallback) { function setEventListener(aId, aEventType, aCallback) {
document.getElementById(aId) document.getElementById(aId)
@ -20,57 +27,13 @@ var gAdvancedPane = {
} }
this._inited = true; this._inited = true;
var advancedPrefs = document.getElementById("advancedPrefs");
let version = AppConstants.MOZ_APP_VERSION_DISPLAY; var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
if (preference.value !== null)
// Include the build ID if this is an "a#" (nightly) build advancedPrefs.selectedIndex = preference.value;
if (/a\d+$/.test(version)) {
let buildID = Services.appinfo.appBuildID;
let year = buildID.slice(0, 4);
let month = buildID.slice(4, 6);
let day = buildID.slice(6, 8);
version += ` (${year}-${month}-${day})`;
}
// Append "(32-bit)" or "(64-bit)" build architecture to the version number:
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let archResource = Services.appinfo.is64Bit
? "aboutDialog.architecture.sixtyFourBit"
: "aboutDialog.architecture.thirtyTwoBit";
let arch = bundle.GetStringFromName(archResource);
version += ` (${arch})`;
document.getElementById("version").textContent = version;
// Show a release notes link if we have a URL.
let relNotesLink = document.getElementById("releasenotes");
let relNotesPrefType = Services.prefs.getPrefType("app.releaseNotesURL");
if (relNotesPrefType != Services.prefs.PREF_INVALID) {
let relNotesURL = Services.urlFormatter.formatURLPref("app.releaseNotesURL");
if (relNotesURL != "about:blank") {
relNotesLink.href = relNotesURL;
relNotesLink.hidden = false;
}
}
let distroId = Services.prefs.getCharPref("distribution.id", "");
if (distroId) {
let distroVersion = Services.prefs.getCharPref("distribution.version");
let distroIdField = document.getElementById("distributionId");
distroIdField.value = distroId + " - " + distroVersion;
distroIdField.hidden = false;
let distroAbout = Services.prefs.getStringPref("distribution.about", "");
if (distroAbout) {
let distroField = document.getElementById("distribution");
distroField.value = distroAbout;
distroField.hidden = false;
}
}
if (AppConstants.MOZ_UPDATER) { if (AppConstants.MOZ_UPDATER) {
gAppUpdater = new appUpdater();
let onUnload = () => { let onUnload = () => {
window.removeEventListener("unload", onUnload); window.removeEventListener("unload", onUnload);
Services.prefs.removeObserver("app.update.", this); Services.prefs.removeObserver("app.update.", this);
@ -78,13 +41,645 @@ var gAdvancedPane = {
window.addEventListener("unload", onUnload); window.addEventListener("unload", onUnload);
Services.prefs.addObserver("app.update.", this); Services.prefs.addObserver("app.update.", this);
this.updateReadPrefs(); this.updateReadPrefs();
}
if (AppConstants.MOZ_CRASHREPORTER) {
this.initSubmitCrashes();
}
this.initTelemetry();
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this.initSubmitHealthReport();
}
this.updateOnScreenKeyboardVisibility();
this.updateCacheSizeInputField();
this.updateActualCacheSize();
if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
Services.obs.addObserver(this, "sitedatamanager:sites-updated");
Services.obs.addObserver(this, "sitedatamanager:updating-sites");
let unload = () => {
window.removeEventListener("unload", unload);
Services.obs.removeObserver(this, "sitedatamanager:sites-updated");
Services.obs.removeObserver(this, "sitedatamanager:updating-sites");
};
window.addEventListener("unload", unload);
SiteDataManager.updateSites();
setEventListener("clearSiteDataButton", "command",
gAdvancedPane.clearSiteData);
setEventListener("siteDataSettings", "command",
gAdvancedPane.showSiteDataSettings);
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
document.getElementById("siteDataLearnMoreLink").setAttribute("href", url);
let siteDataGroup = document.getElementById("siteDataGroup");
siteDataGroup.hidden = false;
}
setEventListener("layers.acceleration.disabled", "change",
gAdvancedPane.updateHardwareAcceleration);
setEventListener("advancedPrefs", "select",
gAdvancedPane.tabSelectionChanged);
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
setEventListener("submitHealthReportBox", "command",
gAdvancedPane.updateSubmitHealthReport);
}
setEventListener("connectionSettings", "command",
gAdvancedPane.showConnections);
setEventListener("clearCacheButton", "command",
gAdvancedPane.clearCache);
if (AppConstants.MOZ_UPDATER) {
setEventListener("updateRadioGroup", "command", setEventListener("updateRadioGroup", "command",
gAdvancedPane.updateWritePrefs); gAdvancedPane.updateWritePrefs);
setEventListener("showUpdateHistory", "command", setEventListener("showUpdateHistory", "command",
gAdvancedPane.showUpdates); gAdvancedPane.showUpdates);
} }
setEventListener("viewCertificatesButton", "command",
gAdvancedPane.showCertificates);
setEventListener("viewSecurityDevicesButton", "command",
gAdvancedPane.showSecurityDevices);
setEventListener("cacheSize", "change",
gAdvancedPane.updateCacheSizePref);
if (Services.prefs.getBoolPref("browser.preferences.offlineGroup.enabled")) {
this.updateOfflineApps();
this.updateActualAppCacheSize();
setEventListener("offlineNotifyExceptions", "command",
gAdvancedPane.showOfflineExceptions);
setEventListener("offlineAppsList", "select",
gAdvancedPane.offlineAppSelected);
setEventListener("offlineAppsListRemove", "command",
gAdvancedPane.removeOfflineApp);
setEventListener("clearOfflineAppCacheButton", "command",
gAdvancedPane.clearOfflineAppCache);
let bundlePrefs = document.getElementById("bundlePreferences");
document.getElementById("offlineAppsList")
.style.height = bundlePrefs.getString("offlineAppsList.height");
let offlineGroup = document.getElementById("offlineGroup");
offlineGroup.hidden = false;
}
if (AppConstants.MOZ_WIDGET_GTK) {
// GTK tabbox' allow the scroll wheel to change the selected tab,
// but we don't want this behavior for the in-content preferences.
let tabsElement = document.getElementById("tabsElement");
tabsElement.addEventListener("DOMMouseScroll", event => {
event.stopPropagation();
}, true);
}
}, },
/**
* Stores the identity of the current tab in preferences so that the selected
* tab can be persisted between openings of the preferences window.
*/
tabSelectionChanged() {
if (!this._inited)
return;
var advancedPrefs = document.getElementById("advancedPrefs");
var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
// tabSelectionChanged gets called twice due to the selectedIndex being set
// by both the selectedItem and selectedPanel callstacks. This guard is used
// to prevent double-counting in Telemetry.
if (preference.valueFromPreferences != advancedPrefs.selectedIndex) {
Services.telemetry
.getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
.add(telemetryBucketForCategory("advanced"));
}
preference.valueFromPreferences = advancedPrefs.selectedIndex;
},
// GENERAL TAB
/*
* Preferences:
*
* accessibility.browsewithcaret
* - true enables keyboard navigation and selection within web pages using a
* visible caret, false uses normal keyboard navigation with no caret
* accessibility.typeaheadfind
* - when set to true, typing outside text areas and input boxes will
* automatically start searching for what's typed within the current
* document; when set to false, no search action happens
* ui.osk.enabled
* - when set to true, subject to other conditions, we may sometimes invoke
* an on-screen keyboard when a text input is focused.
* (Currently Windows-only, and depending on prefs, may be Windows-8-only)
* general.autoScroll
* - when set to true, clicking the scroll wheel on the mouse activates a
* mouse mode where moving the mouse down scrolls the document downward with
* speed correlated with the distance of the cursor from the original
* position at which the click occurred (and likewise with movement upward);
* if false, this behavior is disabled
* general.smoothScroll
* - set to true to enable finer page scrolling than line-by-line on page-up,
* page-down, and other such page movements
* layout.spellcheckDefault
* - an integer:
* 0 disables spellchecking
* 1 enables spellchecking, but only for multiline text fields
* 2 enables spellchecking for all text fields
*/
/**
* Stores the original value of the spellchecking preference to enable proper
* restoration if unchanged (since we're mapping a tristate onto a checkbox).
*/
_storedSpellCheck: 0,
/**
* Returns true if any spellchecking is enabled and false otherwise, caching
* the current value to enable proper pref restoration if the checkbox is
* never changed.
*/
readCheckSpelling() {
var pref = document.getElementById("layout.spellcheckDefault");
this._storedSpellCheck = pref.value;
return (pref.value != 0);
},
/**
* Returns the value of the spellchecking preference represented by UI,
* preserving the preference's "hidden" value if the preference is
* unchanged and represents a value not strictly allowed in UI.
*/
writeCheckSpelling() {
var checkbox = document.getElementById("checkSpelling");
if (checkbox.checked) {
if (this._storedSpellCheck == 2) {
return 2;
}
return 1;
}
return 0;
},
/**
* readEnableOCSP is used by the preferences UI to determine whether or not
* the checkbox for OCSP fetching should be checked (it returns true if it
* should be checked and false otherwise). The about:config preference
* "security.OCSP.enabled" is an integer rather than a boolean, so it can't be
* directly mapped from {true,false} to {checked,unchecked}. The possible
* values for "security.OCSP.enabled" are:
* 0: fetching is disabled
* 1: fetch for all certificates
* 2: fetch only for EV certificates
* Hence, if "security.OCSP.enabled" is non-zero, the checkbox should be
* checked. Otherwise, it should be unchecked.
*/
readEnableOCSP() {
var preference = document.getElementById("security.OCSP.enabled");
// This is the case if the preference is the default value.
if (preference.value === undefined) {
return true;
}
return preference.value != 0;
},
/**
* writeEnableOCSP is used by the preferences UI to map the checked/unchecked
* state of the OCSP fetching checkbox to the value that the preference
* "security.OCSP.enabled" should be set to (it returns that value). See the
* readEnableOCSP documentation for more background. We unfortunately don't
* have enough information to map from {true,false} to all possible values for
* "security.OCSP.enabled", but a reasonable alternative is to map from
* {true,false} to {<the default value>,0}. That is, if the box is checked,
* "security.OCSP.enabled" will be set to whatever default it should be, given
* the platform and channel. If the box is unchecked, the preference will be
* set to 0. Obviously this won't work if the default is 0, so we will have to
* revisit this if we ever set it to 0.
*/
writeEnableOCSP() {
var checkbox = document.getElementById("enableOCSP");
var defaults = Services.prefs.getDefaultBranch(null);
var defaultValue = defaults.getIntPref("security.OCSP.enabled");
return checkbox.checked ? defaultValue : 0;
},
updateHardwareAcceleration() {
// Placeholder for restart
},
// DATA CHOICES TAB
/**
* Set up or hide the Learn More links for various data collection options
*/
_setupLearnMoreLink(pref, element) {
// set up the Learn More link with the correct URL
let url = Services.prefs.getCharPref(pref);
let el = document.getElementById(element);
if (url) {
el.setAttribute("href", url);
} else {
el.setAttribute("hidden", "true");
}
},
/**
*
*/
initSubmitCrashes() {
this._setupLearnMoreLink("toolkit.crashreporter.infoURL",
"crashReporterLearnMore");
},
/**
* The preference/checkbox is configured in XUL.
*
* In all cases, set up the Learn More link sanely.
*/
initTelemetry() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
}
},
/**
* Set the status of the telemetry controls based on the input argument.
* @param {Boolean} aEnabled False disables the controls, true enables them.
*/
setTelemetrySectionEnabled(aEnabled) {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
// If FHR is disabled, additional data sharing should be disabled as well.
let disabled = !aEnabled;
document.getElementById("submitTelemetryBox").disabled = disabled;
if (disabled) {
// If we disable FHR, untick the telemetry checkbox.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
document.getElementById("telemetryDataDesc").disabled = disabled;
}
},
/**
* Initialize the health report service reference and checkbox.
*/
initSubmitHealthReport() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
let checkbox = document.getElementById("submitHealthReportBox");
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
checkbox.setAttribute("disabled", "true");
return;
}
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED);
this.setTelemetrySectionEnabled(checkbox.checked);
}
},
/**
* Update the health report preference with state from checkbox.
*/
updateSubmitHealthReport() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
let checkbox = document.getElementById("submitHealthReportBox");
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
this.setTelemetrySectionEnabled(checkbox.checked);
}
},
updateOnScreenKeyboardVisibility() {
if (AppConstants.platform == "win") {
let minVersion = Services.prefs.getBoolPref("ui.osk.require_win10") ? 10 : 6.2;
if (Services.vc.compare(Services.sysinfo.getProperty("version"), minVersion) >= 0) {
document.getElementById("useOnScreenKeyboard").hidden = false;
}
}
},
// NETWORK TAB
/*
* Preferences:
*
* browser.cache.disk.capacity
* - the size of the browser cache in KB
* - Only used if browser.cache.disk.smart_size.enabled is disabled
*/
/**
* Displays a dialog in which proxy settings may be changed.
*/
showConnections() {
gSubDialog.open("chrome://browser/content/preferences/connection.xul");
},
showSiteDataSettings() {
gSubDialog.open("chrome://browser/content/preferences/siteDataSettings.xul");
},
toggleSiteData(shouldShow) {
let clearButton = document.getElementById("clearSiteDataButton");
let settingsButton = document.getElementById("siteDataSettings");
clearButton.disabled = !shouldShow;
settingsButton.disabled = !shouldShow;
},
updateTotalDataSizeLabel(usage) {
let prefStrBundle = document.getElementById("bundlePreferences");
let totalSiteDataSizeLabel = document.getElementById("totalSiteDataSize");
if (usage < 0) {
totalSiteDataSizeLabel.textContent = prefStrBundle.getString("loadingSiteDataSize");
} else {
let size = DownloadUtils.convertByteUnits(usage);
totalSiteDataSizeLabel.textContent = prefStrBundle.getFormattedString("totalSiteDataSize", size);
}
},
// Retrieves the amount of space currently used by disk cache
updateActualCacheSize() {
var actualSizeLabel = document.getElementById("actualDiskCacheSize");
var prefStrBundle = document.getElementById("bundlePreferences");
// Needs to root the observer since cache service keeps only a weak reference.
this.observer = {
onNetworkCacheDiskConsumption(consumption) {
var size = DownloadUtils.convertByteUnits(consumption);
// The XBL binding for the string bundle may have been destroyed if
// the page was closed before this callback was executed.
if (!prefStrBundle.getFormattedString) {
return;
}
actualSizeLabel.value = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
},
QueryInterface: XPCOMUtils.generateQI([
Components.interfaces.nsICacheStorageConsumptionObserver,
Components.interfaces.nsISupportsWeakReference
])
};
actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
try {
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cacheService.asyncGetDiskConsumption(this.observer);
} catch (e) {}
},
updateCacheSizeUI(smartSizeEnabled) {
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
},
readSmartSizeEnabled() {
// The smart_size.enabled preference element is inverted="true", so its
// value is the opposite of the actual pref value
var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
this.updateCacheSizeUI(!disabled);
},
/**
* Converts the cache size from units of KB to units of MB and stores it in
* the textbox element.
*/
updateCacheSizeInputField() {
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("browser.cache.disk.capacity");
cacheSizeElem.value = cachePref.value / 1024;
if (cachePref.locked)
cacheSizeElem.disabled = true;
},
/**
* Updates the cache size preference once user enters a new value.
* We intentionally do not set preference="browser.cache.disk.capacity"
* onto the textbox directly, as that would update the pref at each keypress
* not only after the final value is entered.
*/
updateCacheSizePref() {
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("browser.cache.disk.capacity");
// Converts the cache size as specified in UI (in MB) to KB.
let intValue = parseInt(cacheSizeElem.value, 10);
cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
},
/**
* Clears the cache.
*/
clearCache() {
try {
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cache.clear();
} catch (ex) {}
this.updateActualCacheSize();
},
clearSiteData() {
let flags =
Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 +
Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1 +
Services.prompt.BUTTON_POS_0_DEFAULT;
let prefStrBundle = document.getElementById("bundlePreferences");
let title = prefStrBundle.getString("clearSiteDataPromptTitle");
let text = prefStrBundle.getString("clearSiteDataPromptText");
let btn0Label = prefStrBundle.getString("clearSiteDataNow");
let result = Services.prompt.confirmEx(
window, title, text, flags, btn0Label, null, null, null, {});
if (result == 0) {
SiteDataManager.removeAll();
}
},
// Methods for Offline Apps(Appcache)
/**
* Clears the application cache.
*/
clearOfflineAppCache() {
Components.utils.import("resource:///modules/offlineAppCache.jsm");
OfflineAppCacheHelper.clear();
this.updateActualAppCacheSize();
this.updateOfflineApps();
},
// Retrieves the amount of space currently used by offline cache
updateActualAppCacheSize() {
var visitor = {
onCacheStorageInfo(aEntryCount, aConsumption, aCapacity, aDiskDirectory) {
var actualSizeLabel = document.getElementById("actualAppCacheSize");
var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
var prefStrBundle = document.getElementById("bundlePreferences");
// The XBL binding for the string bundle may have been destroyed if
// the page was closed before this callback was executed.
if (!prefStrBundle.getFormattedString) {
return;
}
var sizeStr = prefStrBundle.getFormattedString("actualAppCacheSize", sizeStrings);
actualSizeLabel.value = sizeStr;
}
};
try {
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
storage.asyncVisitStorage(visitor, false);
} catch (e) {}
},
readOfflineNotify() {
var pref = document.getElementById("browser.offline-apps.notify");
var button = document.getElementById("offlineNotifyExceptions");
button.disabled = !pref.value;
return pref.value;
},
showOfflineExceptions() {
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: false,
sessionVisible: false,
allowVisible: false,
prefilledHost: "",
permissionType: "offline-app",
manageCapability: Components.interfaces.nsIPermissionManager.DENY_ACTION,
windowTitle: bundlePreferences.getString("offlinepermissionstitle"),
introText: bundlePreferences.getString("offlinepermissionstext") };
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
// XXX: duplicated in browser.js
_getOfflineAppUsage(perm, groups) {
let cacheService = Cc["@mozilla.org/network/application-cache-service;1"].
getService(Ci.nsIApplicationCacheService);
if (!groups) {
try {
groups = cacheService.getGroups();
} catch (ex) {
return 0;
}
}
let usage = 0;
for (let group of groups) {
let uri = Services.io.newURI(group);
if (perm.matchesURI(uri, true)) {
let cache = cacheService.getActiveCache(group);
usage += cache.usage;
}
}
return usage;
},
/**
* Updates the list of offline applications
*/
updateOfflineApps() {
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var list = document.getElementById("offlineAppsList");
while (list.firstChild) {
list.firstChild.remove();
}
var groups;
try {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
groups = cacheService.getGroups();
} catch (e) {
return;
}
var bundle = document.getElementById("bundlePreferences");
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
if (perm.type == "offline-app" &&
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
row.setAttribute("origin", perm.principal.origin);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
list.appendChild(row);
}
}
},
offlineAppSelected() {
var removeButton = document.getElementById("offlineAppsListRemove");
var list = document.getElementById("offlineAppsList");
if (list.selectedItem) {
removeButton.setAttribute("disabled", "false");
} else {
removeButton.setAttribute("disabled", "true");
}
},
removeOfflineApp() {
var list = document.getElementById("offlineAppsList");
var item = list.selectedItem;
var origin = item.getAttribute("origin");
var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
var bundle = document.getElementById("bundlePreferences");
var title = bundle.getString("offlineAppRemoveTitle");
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
var confirm = bundle.getString("offlineAppRemoveConfirm");
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
null, null, null, {});
if (result != 0)
return;
// get the permission
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var perm = pm.getPermissionObject(principal, "offline-app", true);
if (perm) {
// clear offline cache entries
try {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) {
var uri = Services.io.newURI(groups[i]);
if (perm.matchesURI(uri, true)) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
}
}
} catch (e) {}
pm.removePermission(perm);
}
list.removeChild(item);
gAdvancedPane.offlineAppSelected();
this.updateActualAppCacheSize();
},
// Methods for Offline Apps(Appcache) end
// UPDATE TAB
/* /*
* Preferences: * Preferences:
* *
@ -190,13 +785,51 @@ var gAdvancedPane = {
gSubDialog.open("chrome://mozapps/content/update/history.xul"); gSubDialog.open("chrome://mozapps/content/update/history.xul");
}, },
// ENCRYPTION TAB
/*
* Preferences:
*
* security.default_personal_cert
* - a string:
* "Select Automatically" select a certificate automatically when a site
* requests one
* "Ask Every Time" present a dialog to the user so he can select
* the certificate to use on a site which
* requests one
*/
/**
* Displays the user's certificates and associated options.
*/
showCertificates() {
gSubDialog.open("chrome://pippki/content/certManager.xul");
},
/**
* Displays a dialog from which the user can manage his security devices.
*/
showSecurityDevices() {
gSubDialog.open("chrome://pippki/content/device_manager.xul");
},
observe(aSubject, aTopic, aData) { observe(aSubject, aTopic, aData) {
if (AppConstants.MOZ_UPDATER) { switch (aTopic) {
switch (aTopic) { case "nsPref:changed":
case "nsPref:changed": this.updateReadPrefs();
this.updateReadPrefs(); break;
break;
} case "sitedatamanager:updating-sites":
// While updating, we want to disable this section and display loading message until updated
this.toggleSiteData(false);
this.updateTotalDataSizeLabel(-1);
break;
case "sitedatamanager:sites-updated":
this.toggleSiteData(true);
SiteDataManager.getTotalUsage()
.then(this.updateTotalDataSizeLabel.bind(this));
break;
} }
}, },
}; };

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

@ -4,10 +4,6 @@
<!-- Advanced panel --> <!-- Advanced panel -->
#ifdef MOZ_UPDATER
<script type="application/javascript" src="chrome://browser/content/aboutDialog-appUpdater.js"/>
#endif
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content/advanced.js"/> src="chrome://browser/content/preferences/in-content/advanced.js"/>
@ -16,7 +12,59 @@
name="browser.preferences.advanced.selectedTabIndex" name="browser.preferences.advanced.selectedTabIndex"
type="int"/> type="int"/>
<!-- Update tab --> <!-- General tab -->
<preference id="accessibility.browsewithcaret"
name="accessibility.browsewithcaret"
type="bool"/>
<preference id="accessibility.typeaheadfind"
name="accessibility.typeaheadfind"
type="bool"/>
<preference id="accessibility.blockautorefresh"
name="accessibility.blockautorefresh"
type="bool"/>
#ifdef XP_WIN
<preference id="ui.osk.enabled"
name="ui.osk.enabled"
type="bool"/>
#endif
<preference id="general.autoScroll"
name="general.autoScroll"
type="bool"/>
<preference id="general.smoothScroll"
name="general.smoothScroll"
type="bool"/>
<preference id="layout.spellcheckDefault"
name="layout.spellcheckDefault"
type="int"/>
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
#endif
<!-- Data Choices tab -->
#ifdef MOZ_CRASHREPORTER
<preference id="browser.crashReports.unsubmittedCheck.autoSubmit"
name="browser.crashReports.unsubmittedCheck.autoSubmit"
type="bool"/>
#endif
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
type="int"/>
<preference id="browser.offline-apps.notify"
name="browser.offline-apps.notify"
type="bool"/>
<preference id="browser.cache.disk.smart_size.enabled"
name="browser.cache.disk.smart_size.enabled"
inverted="true"
type="bool"/>
<!-- Update tab -->
#ifdef MOZ_UPDATER #ifdef MOZ_UPDATER
<preference id="app.update.enabled" <preference id="app.update.enabled"
name="app.update.enabled" name="app.update.enabled"
@ -39,157 +87,336 @@
<preference id="browser.search.update" <preference id="browser.search.update"
name="browser.search.update" name="browser.search.update"
type="bool"/> type="bool"/>
<!-- Certificates tab -->
<preference id="security.default_personal_cert"
name="security.default_personal_cert"
type="string"/>
<preference id="security.disable_button.openCertManager"
name="security.disable_button.openCertManager"
type="bool"/>
<preference id="security.disable_button.openDeviceManager"
name="security.disable_button.openDeviceManager"
type="bool"/>
<preference id="security.OCSP.enabled"
name="security.OCSP.enabled"
type="int"/>
</preferences> </preferences>
#ifdef HAVE_SHELL_SERVICE #ifdef HAVE_SHELL_SERVICE
<stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/> <stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/> <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
#endif #endif
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences-old/preferences.properties"/>
<hbox id="header-advanced" <hbox id="header-advanced"
class="header" class="header"
hidden="true" hidden="true"
data-category="paneAdvanced"> data-category="paneAdvanced">
<label class="header-name" flex="1">&paneUpdates.title;</label> <label class="header-name" flex="1">&paneAdvanced.title;</label>
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox> </hbox>
<!-- Update --> <tabbox id="advancedPrefs"
<groupbox id="updateApp" data-category="paneAdvanced" hidden="true"> handleCtrlTab="false"
<caption><label>&updateApplication.label;</label></caption> handleCtrlPageUpDown="false"
<hbox align="start"> flex="1"
<vbox flex="1"> data-category="paneAdvanced"
<description> hidden="true">
&updateApplication.version.pre;<label id="version"/>&updateApplication.version.post;
<label id="releasenotes" class="learnMore text-link" hidden="true">&releaseNotes.link;</label> <tabs id="tabsElement">
</description> <tab id="generalTab" label="&generalTab.label;"/>
<description id="distribution" class="text-blurb" hidden="true"/> #ifdef MOZ_DATA_REPORTING
<description id="distributionId" class="text-blurb" hidden="true"/> <tab id="dataChoicesTab" label="&dataChoicesTab.label;"/>
</vbox>
#ifdef MOZ_UPDATER
<spacer flex="1"/>
<vbox>
<button id="showUpdateHistory"
class="accessory-button"
label="&updateHistory2.label;"
accesskey="&updateHistory2.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
searchkeywords="&history.title; &history.intro;"/>
</vbox>
#endif #endif
</hbox> <tab id="networkTab" label="&networkTab.label;"/>
#ifdef MOZ_UPDATER <tab id="updateTab" label="&updateTab.label;"/>
<vbox id="updateBox"> <tab id="encryptionTab" label="&certificateTab.label;"/>
<deck id="updateDeck" orient="vertical"> </tabs>
<hbox id="checkForUpdates" align="center">
<spacer flex="1"/> <tabpanels flex="1">
<button id="checkForUpdatesButton"
label="&update.checkForUpdatesButton.label;" <!-- General -->
accesskey="&update.checkForUpdatesButton.accesskey;" <tabpanel id="generalPanel" orient="vertical">
oncommand="gAppUpdater.checkForUpdates();"/> <!-- Accessibility -->
</hbox> <groupbox id="accessibilityGroup" align="start">
<hbox id="downloadAndInstall" align="center"> <caption><label>&accessibility.label;</label></caption>
<spacer flex="1"/>
<button id="downloadAndInstallButton" #ifdef XP_WIN
oncommand="gAppUpdater.startDownload();"/> <checkbox id="useOnScreenKeyboard"
<!-- label and accesskey will be filled by JS --> hidden="true"
</hbox> label="&useOnScreenKeyboard.label;"
<hbox id="apply" align="center"> accesskey="&useOnScreenKeyboard.accesskey;"
<spacer flex="1"/> preference="ui.osk.enabled"/>
<button id="updateButton" #endif
label="&update.updateButton.label3;" <checkbox id="useCursorNavigation"
accesskey="&update.updateButton.accesskey;" label="&useCursorNavigation.label;"
oncommand="gAppUpdater.buttonRestartAfterDownload();"/> accesskey="&useCursorNavigation.accesskey;"
</hbox> preference="accessibility.browsewithcaret"/>
<hbox id="checkingForUpdates" align="center"> <checkbox id="searchStartTyping"
<image class="update-throbber"/><label>&update.checkingForUpdates;</label> label="&searchOnStartTyping.label;"
<spacer flex="1"/> accesskey="&searchOnStartTyping.accesskey;"
<button label="&update.checkForUpdatesButton.label;" preference="accessibility.typeaheadfind"/>
accesskey="&update.checkForUpdatesButton.accesskey;" <checkbox id="blockAutoRefresh"
disabled="true"/> label="&blockAutoReload.label;"
</hbox> accesskey="&blockAutoReload.accesskey;"
<hbox id="downloading" align="center"> preference="accessibility.blockautorefresh"/>
<image class="update-throbber"/><label>&update.downloading.start;</label><label id="downloadStatus"/><label>&update.downloading.end;</label> </groupbox>
</hbox> <!-- Browsing -->
<hbox id="applying" align="center"> <groupbox id="browsingGroup" align="start">
<image class="update-throbber"/><label>&update.applying;</label> <caption><label>&browsing.label;</label></caption>
</hbox>
<hbox id="downloadFailed" align="center"> <checkbox id="useAutoScroll"
<label>&update.failed.start;</label><label id="failedLink" class="text-link">&update.failed.linkText;</label><label>&update.failed.end;</label> label="&useAutoScroll.label;"
<spacer flex="1"/> accesskey="&useAutoScroll.accesskey;"
<button label="&update.checkForUpdatesButton.label;" preference="general.autoScroll"/>
accesskey="&update.checkForUpdatesButton.accesskey;" <checkbox id="useSmoothScrolling"
oncommand="gAppUpdater.checkForUpdates();"/> label="&useSmoothScrolling.label;"
</hbox> accesskey="&useSmoothScrolling.accesskey;"
<hbox id="adminDisabled" align="center"> preference="general.smoothScroll"/>
<label>&update.adminDisabled;</label> <checkbox id="checkSpelling"
<spacer flex="1"/> label="&checkUserSpelling.label;"
<button label="&update.checkForUpdatesButton.label;" accesskey="&checkUserSpelling.accesskey;"
accesskey="&update.checkForUpdatesButton.accesskey;" onsyncfrompreference="return gAdvancedPane.readCheckSpelling();"
disabled="true"/> onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
</hbox> preference="layout.spellcheckDefault"/>
<hbox id="noUpdatesFound" align="center"> </groupbox>
<label>&update.noUpdatesFound;</label> </tabpanel>
<spacer flex="1"/> #ifdef MOZ_DATA_REPORTING
<button label="&update.checkForUpdatesButton.label;" <!-- Data Choices -->
accesskey="&update.checkForUpdatesButton.accesskey;" <tabpanel id="dataChoicesPanel" orient="vertical">
oncommand="gAppUpdater.checkForUpdates();"/> #ifdef MOZ_TELEMETRY_REPORTING
</hbox> <groupbox>
<hbox id="otherInstanceHandlingUpdates" align="center"> <caption>
<label>&update.otherInstanceHandlingUpdates;</label> <checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
<spacer flex="1"/> accesskey="&enableHealthReport.accesskey;"/>
<button label="&update.checkForUpdatesButton.label;" </caption>
accesskey="&update.checkForUpdatesButton.accesskey;" <vbox>
disabled="true"/> <hbox class="indent" flex="1">
</hbox> <label flex="1">&healthReportDesc.label;</label>
<hbox id="manualUpdate" align="center"> <label id="FHRLearnMore" flex="1"
<label>&update.manual.start;</label><label id="manualLink" class="text-link"/><label>&update.manual.end;</label> class="learnMore text-link">&healthReportLearnMore.label;</label>
<spacer flex="1"/> </hbox>
<button label="&update.checkForUpdatesButton.label;" <hbox class="indent">
accesskey="&update.checkForUpdatesButton.accesskey;" <groupbox flex="1">
disabled="true"/> <caption>
</hbox> <checkbox id="submitTelemetryBox" preference="toolkit.telemetry.enabled"
<hbox id="unsupportedSystem" align="center"> label="&enableTelemetryData.label;"
<label>&update.unsupported.start;</label><label id="unsupportedLink" class="text-link">&update.unsupported.linkText;</label><label>&update.unsupported.end;</label> accesskey="&enableTelemetryData.accesskey;"/>
<spacer flex="1"/> </caption>
<button label="&update.checkForUpdatesButton.label;" <hbox class="indent" flex="1">
accesskey="&update.checkForUpdatesButton.accesskey;" <label id="telemetryDataDesc" flex="1">&telemetryDesc.label;</label>
disabled="true"/> <label id="telemetryLearnMore" flex="1"
</hbox> class="learnMore text-link">&telemetryLearnMore.label;</label>
<hbox id="restarting" align="center"> </hbox>
<image class="update-throbber"/><label>&update.restarting;</label> </groupbox>
<spacer flex="1"/> </hbox>
<button label="&update.updateButton.label3;" </vbox>
accesskey="&update.updateButton.accesskey;" </groupbox>
disabled="true"/> #endif
</hbox> #ifdef MOZ_CRASHREPORTER
</deck> <groupbox>
</vbox> <caption>
<checkbox id="automaticallySubmitCrashesBox"
preference="browser.crashReports.unsubmittedCheck.autoSubmit"
label="&alwaysSubmitCrashReports.label;"
accesskey="&alwaysSubmitCrashReports.accesskey;"/>
</caption>
<hbox class="indent" flex="1">
<label flex="1">&crashReporterDesc2.label;</label>
<label id="crashReporterLearnMore" flex="1"
class="learnMore text-link">&crashReporterLearnMore.label;</label>
</hbox>
</groupbox>
#endif
</tabpanel>
#endif #endif
<separator/> <!-- Network -->
<tabpanel id="networkPanel" orient="vertical">
<!-- Connection -->
<groupbox id="connectionGroup">
<caption><label>&connection.label;</label></caption>
<hbox align="center">
<description flex="1" control="connectionSettings">&connectionDesc.label;</description>
<button id="connectionSettings" icon="network" label="&connectionSettings.label;"
accesskey="&connectionSettings.accesskey;"/>
</hbox>
</groupbox>
<!-- Cache -->
<groupbox id="cacheGroup">
<caption><label>&httpCache.label;</label></caption>
<hbox align="center">
<label id="actualDiskCacheSize" flex="1"/>
<button id="clearCacheButton" icon="clear"
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"/>
</hbox>
<hbox>
<checkbox preference="browser.cache.disk.smart_size.enabled"
id="allowSmartSize"
onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
label="&overrideSmartCacheSize.label;"
accesskey="&overrideSmartCacheSize.accesskey;"/>
</hbox>
<hbox align="center" class="indent">
<label id="useCacheBefore" control="cacheSize"
accesskey="&limitCacheSizeBefore.accesskey;">
&limitCacheSizeBefore.label;
</label>
<textbox id="cacheSize" type="number" size="4" max="1024"
aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
<label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
</hbox>
</groupbox>
<!-- Offline apps -->
<groupbox id="offlineGroup" hidden="true">
<caption><label>&offlineStorage2.label;</label></caption>
<hbox align="center">
<label id="actualAppCacheSize" flex="1"/>
<button id="clearOfflineAppCacheButton" icon="clear"
label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"/>
</hbox>
<hbox align="center">
<checkbox id="offlineNotify"
label="&offlineStorageNotify.label;" accesskey="&offlineStorageNotify.accesskey;"
preference="browser.offline-apps.notify"
onsyncfrompreference="return gAdvancedPane.readOfflineNotify();"/>
<spacer flex="1"/>
<button id="offlineNotifyExceptions"
label="&offlineStorageNotifyExceptions.label;"
accesskey="&offlineStorageNotifyExceptions.accesskey;"/>
</hbox>
<hbox>
<vbox flex="1">
<label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
<listbox id="offlineAppsList"
flex="1"
aria-labelledby="offlineAppsListLabel">
</listbox>
</vbox>
<vbox pack="end">
<button id="offlineAppsListRemove"
disabled="true"
label="&offlineAppsListRemove.label;"
accesskey="&offlineAppsListRemove.accesskey;"/>
</vbox>
</hbox>
</groupbox>
<!-- Site Data -->
<groupbox id="siteDataGroup" hidden="true">
<caption><label>&siteData.label;</label></caption>
<hbox align="baseline">
<label id="totalSiteDataSize"></label>
<label id="siteDataLearnMoreLink" class="learnMore text-link" value="&siteDataLearnMoreLink.label;"></label>
<spacer flex="1" />
<button id="clearSiteDataButton" icon="clear"
label="&clearSiteData.label;" accesskey="&clearSiteData.accesskey;"/>
</hbox>
<vbox align="end">
<button id="siteDataSettings"
label="&siteDataSettings.label;"
accesskey="&siteDataSettings.accesskey;"/>
</vbox>
</groupbox>
</tabpanel>
<!-- Update -->
<tabpanel id="updatePanel" orient="vertical">
#ifdef MOZ_UPDATER #ifdef MOZ_UPDATER
<description>&updateApplication.description;</description> <groupbox id="updateApp" align="start">
<radiogroup id="updateRadioGroup"> <caption><label>&updateApplication.label;</label></caption>
<radio id="autoDesktop" <radiogroup id="updateRadioGroup" align="start">
value="auto" <radio id="autoDesktop"
label="&updateAuto2.label;" value="auto"
accesskey="&updateAuto2.accesskey;"/> label="&updateAuto1.label;"
<radio value="checkOnly" accesskey="&updateAuto1.accesskey;"/>
label="&updateCheckChoose2.label;" <radio value="checkOnly"
accesskey="&updateCheckChoose2.accesskey;"/> label="&updateCheckChoose.label;"
<radio value="manual" accesskey="&updateCheckChoose.accesskey;"/>
label="&updateManual2.label;" <radio value="manual"
accesskey="&updateManual2.accesskey;"/> label="&updateManual.label;"
</radiogroup> accesskey="&updateManual.accesskey;"/>
</radiogroup>
<separator class="thin"/>
<hbox>
<button id="showUpdateHistory"
label="&updateHistory.label;"
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"/>
</hbox>
#ifdef MOZ_MAINTENANCE_SERVICE #ifdef MOZ_MAINTENANCE_SERVICE
<checkbox id="useService" <checkbox id="useService"
label="&useService.label;" label="&useService.label;"
accesskey="&useService.accesskey;" accesskey="&useService.accesskey;"
preference="app.update.service.enabled"/> preference="app.update.service.enabled"/>
#endif #endif
</groupbox>
#endif #endif
<checkbox id="enableSearchUpdate" <groupbox id="updateOthers" align="start">
label="&enableSearchUpdate2.label;" <caption><label>&autoUpdateOthers.label;</label></caption>
accesskey="&enableSearchUpdate2.accesskey;" <checkbox id="enableSearchUpdate"
preference="browser.search.update"/> label="&enableSearchUpdate.label;"
</groupbox> accesskey="&enableSearchUpdate.accesskey;"
preference="browser.search.update"/>
</groupbox>
</tabpanel>
<!-- Certificates -->
<tabpanel id="encryptionPanel" orient="vertical">
<groupbox id="certSelection" align="start">
<caption><label>&certPersonal.label;</label></caption>
<description id="CertSelectionDesc" control="certSelection">&certPersonal.description;</description>
<!--
The values on these radio buttons may look like l12y issues, but
they're not - this preference uses *those strings* as its values.
I KID YOU NOT.
-->
<radiogroup id="certSelection"
preftype="string"
preference="security.default_personal_cert"
aria-labelledby="CertSelectionDesc">
<radio label="&selectCerts.auto;"
accesskey="&selectCerts.auto.accesskey;"
value="Select Automatically"/>
<radio label="&selectCerts.ask;"
accesskey="&selectCerts.ask.accesskey;"
value="Ask Every Time"/>
</radiogroup>
</groupbox>
<separator/>
<checkbox id="enableOCSP"
label="&enableOCSP.label;"
accesskey="&enableOCSP.accesskey;"
onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
preference="security.OCSP.enabled"/>
<separator/>
<hbox>
<button id="viewCertificatesButton"
flex="1"
label="&viewCerts.label;"
accesskey="&viewCerts.accesskey;"
preference="security.disable_button.openCertManager"/>
<button id="viewSecurityDevicesButton"
flex="1"
label="&viewSecurityDevices.label;"
accesskey="&viewSecurityDevices.accesskey;"
preference="security.disable_button.openDeviceManager"/>
<hbox flex="10"/>
</hbox>
</tabpanel>
</tabpanels>
</tabbox>

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

@ -10,7 +10,6 @@
Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/AppConstants.jsm");
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed"; const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
const TYPE_MAYBE_VIDEO_FEED = "application/vnd.mozilla.maybe.video.feed"; const TYPE_MAYBE_VIDEO_FEED = "application/vnd.mozilla.maybe.video.feed";
const TYPE_MAYBE_AUDIO_FEED = "application/vnd.mozilla.maybe.audio.feed"; const TYPE_MAYBE_AUDIO_FEED = "application/vnd.mozilla.maybe.audio.feed";
@ -911,8 +910,6 @@ var gApplicationsPane = {
gApplicationsPane.onSelectionChanged); gApplicationsPane.onSelectionChanged);
setEventListener("typeColumn", "click", gApplicationsPane.sort); setEventListener("typeColumn", "click", gApplicationsPane.sort);
setEventListener("actionColumn", "click", gApplicationsPane.sort); setEventListener("actionColumn", "click", gApplicationsPane.sort);
setEventListener("chooseFolder", "command", gApplicationsPane.chooseFolder);
setEventListener("browser.download.dir", "change", gApplicationsPane.displayDownloadDirPref);
// Listen for window unload so we can remove our preference observers. // Listen for window unload so we can remove our preference observers.
window.addEventListener("unload", this); window.addEventListener("unload", this);
@ -1895,207 +1892,6 @@ var gApplicationsPane = {
// the icon, or if we couldn't retrieve the icon for some other reason, // the icon, or if we couldn't retrieve the icon for some other reason,
// then use a generic icon. // then use a generic icon.
return ICON_URL_APP; return ICON_URL_APP;
},
// DOWNLOADS
/*
* Preferences:
*
* browser.download.useDownloadDir - bool
* True - Save files directly to the folder configured via the
* browser.download.folderList preference.
* False - Always ask the user where to save a file and default to
* browser.download.lastDir when displaying a folder picker dialog.
* browser.download.dir - local file handle
* A local folder the user may have selected for downloaded files to be
* saved. Migration of other browser settings may also set this path.
* This folder is enabled when folderList equals 2.
* browser.download.lastDir - local file handle
* May contain the last folder path accessed when the user browsed
* via the file save-as dialog. (see contentAreaUtils.js)
* browser.download.folderList - int
* Indicates the location users wish to save downloaded files too.
* It is also used to display special file labels when the default
* download location is either the Desktop or the Downloads folder.
* Values:
* 0 - The desktop is the default download location.
* 1 - The system's downloads folder is the default download location.
* 2 - The default download location is elsewhere as specified in
* browser.download.dir.
* browser.download.downloadDir
* deprecated.
* browser.download.defaultFolder
* deprecated.
*/
/**
* Enables/disables the folder field and Browse button based on whether a
* default download directory is being used.
*/
readUseDownloadDir() {
var downloadFolder = document.getElementById("downloadFolder");
var chooseFolder = document.getElementById("chooseFolder");
var preference = document.getElementById("browser.download.useDownloadDir");
downloadFolder.disabled = !preference.value || preference.locked;
chooseFolder.disabled = !preference.value || preference.locked;
// don't override the preference's value in UI
return undefined;
},
/**
* Displays a file picker in which the user can choose the location where
* downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made.
*/
chooseFolder() {
return this.chooseFolderTask().catch(Components.utils.reportError);
},
async chooseFolderTask() {
let bundlePreferences = document.getElementById("bundlePreferences");
let title = bundlePreferences.getString("chooseDownloadFolderTitle");
let folderListPref = document.getElementById("browser.download.folderList");
let currentDirPref = await this._indexToFolder(folderListPref.value);
let defDownloads = await this._indexToFolder(1);
let fp = Components.classes["@mozilla.org/filepicker;1"].
createInstance(Components.interfaces.nsIFilePicker);
fp.init(window, title, Components.interfaces.nsIFilePicker.modeGetFolder);
fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
// First try to open what's currently configured
if (currentDirPref && currentDirPref.exists()) {
fp.displayDirectory = currentDirPref;
} else if (defDownloads && defDownloads.exists()) {
// Try the system's download dir
fp.displayDirectory = defDownloads;
} else {
// Fall back to Desktop
fp.displayDirectory = await this._indexToFolder(0);
}
let result = await new Promise(resolve => fp.open(resolve));
if (result != Components.interfaces.nsIFilePicker.returnOK) {
return;
}
let downloadDirPref = document.getElementById("browser.download.dir");
downloadDirPref.value = fp.file;
folderListPref.value = await this._folderToIndex(fp.file);
// Note, the real prefs will not be updated yet, so dnld manager's
// userDownloadsDirectory may not return the right folder after
// this code executes. displayDownloadDirPref will be called on
// the assignment above to update the UI.
},
/**
* Initializes the download folder display settings based on the user's
* preferences.
*/
displayDownloadDirPref() {
this.displayDownloadDirPrefTask().catch(Components.utils.reportError);
// don't override the preference's value in UI
return undefined;
},
async displayDownloadDirPrefTask() {
var folderListPref = document.getElementById("browser.download.folderList");
var bundlePreferences = document.getElementById("bundlePreferences");
var downloadFolder = document.getElementById("downloadFolder");
var currentDirPref = document.getElementById("browser.download.dir");
// Used in defining the correct path to the folder icon.
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fph = ios.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var iconUrlSpec;
// Display a 'pretty' label or the path in the UI.
if (folderListPref.value == 2) {
// Custom path selected and is configured
downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
} else if (folderListPref.value == 1) {
// 'Downloads'
downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
iconUrlSpec = fph.getURLSpecFromFile(await this._indexToFolder(1));
} else {
// 'Desktop'
downloadFolder.label = bundlePreferences.getString("desktopFolderName");
iconUrlSpec = fph.getURLSpecFromFile(await this._getDownloadsFolder("Desktop"));
}
downloadFolder.image = "moz-icon://" + iconUrlSpec + "?size=16";
},
/**
* Returns the textual path of a folder in readable form.
*/
_getDisplayNameOfFile(aFolder) {
// TODO: would like to add support for 'Downloads on Macintosh HD'
// for OS X users.
return aFolder ? aFolder.path : "";
},
/**
* Returns the Downloads folder. If aFolder is "Desktop", then the Downloads
* folder returned is the desktop folder; otherwise, it is a folder whose name
* indicates that it is a download folder and whose path is as determined by
* the XPCOM directory service via the download manager's attribute
* defaultDownloadsDirectory.
*
* @throws if aFolder is not "Desktop" or "Downloads"
*/
async _getDownloadsFolder(aFolder) {
switch (aFolder) {
case "Desktop":
var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
case "Downloads":
let downloadsDir = await Downloads.getSystemDownloadsDirectory();
return new FileUtils.File(downloadsDir);
}
throw "ASSERTION FAILED: folder type should be 'Desktop' or 'Downloads'";
},
/**
* Determines the type of the given folder.
*
* @param aFolder
* the folder whose type is to be determined
* @returns integer
* 0 if aFolder is the Desktop or is unspecified,
* 1 if aFolder is the Downloads folder,
* 2 otherwise
*/
async _folderToIndex(aFolder) {
if (!aFolder || aFolder.equals(await this._getDownloadsFolder("Desktop")))
return 0;
else if (aFolder.equals(await this._getDownloadsFolder("Downloads")))
return 1;
return 2;
},
/**
* Converts an integer into the corresponding folder.
*
* @param aIndex
* an integer
* @returns the Desktop folder if aIndex == 0,
* the Downloads folder if aIndex == 1,
* the folder stored in browser.download.dir
*/
async _indexToFolder(aIndex) {
switch (aIndex) {
case 0:
return await this._getDownloadsFolder("Desktop");
case 1:
return await this._getDownloadsFolder("Downloads");
}
var currentDirPref = document.getElementById("browser.download.dir");
return currentDirPref.value;
} }
}; };

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

@ -63,69 +63,33 @@
class="header" class="header"
hidden="true" hidden="true"
data-category="paneApplications"> data-category="paneApplications">
<label class="header-name" flex="1">&paneFilesApplications.title;</label> <label class="header-name" flex="1">&paneApplications.title;</label>
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox> </hbox>
<vbox id="applicationsContent" <vbox id="applicationsContent"
data-category="paneApplications" data-category="paneApplications"
hidden="true" hidden="true"
flex="1"> flex="1">
<hbox>
<!--Downloads-->
<groupbox id="downloadsGroup">
<caption><label>&downloads.label;</label></caption>
<radiogroup id="saveWhere"
preference="browser.download.useDownloadDir"
onsyncfrompreference="return gApplicationsPane.readUseDownloadDir();">
<hbox id="saveToRow">
<radio id="saveTo"
value="true"
label="&saveTo.label;"
accesskey="&saveTo.accesskey;"
aria-labelledby="saveTo downloadFolder"/>
<filefield id="downloadFolder"
flex="1"
preference="browser.download.folderList"
preference-editable="true"
aria-labelledby="saveTo"
onsyncfrompreference="return gApplicationsPane.displayDownloadDirPref();"/>
<button id="chooseFolder"
#ifdef XP_MACOSX
accesskey="&chooseFolderMac.accesskey;"
label="&chooseFolderMac.label;"
#else
accesskey="&chooseFolderWin.accesskey;"
label="&chooseFolderWin.label;"
#endif
/>
</hbox>
<radio id="alwaysAsk"
value="false"
label="&alwaysAskWhere.label;"
accesskey="&alwaysAskWhere.accesskey;"/>
</radiogroup>
</groupbox>
<groupbox id="applicationsGroup">
<caption><label>&applications.label;</label></caption>
<description>&applications.description;</description>
<textbox id="filter" flex="1" <textbox id="filter" flex="1"
type="search" type="search"
placeholder="&filter2.emptytext;" placeholder="&filter.emptytext;"
aria-controls="handlersView"/> aria-controls="handlersView"/>
</hbox>
<richlistbox id="handlersView" orient="vertical" persist="lastSelectedType" <separator class="thin"/>
preference="pref.downloads.disable_button.edit_actions"
flex="1"> <richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
<listheader equalsize="always"> preference="pref.downloads.disable_button.edit_actions"
<treecol id="typeColumn" label="&typeColumn.label;" value="type" flex="1">
accesskey="&typeColumn.accesskey;" persist="sortDirection" <listheader equalsize="always">
flex="1" sortDirection="ascending"/> <treecol id="typeColumn" label="&typeColumn.label;" value="type"
<treecol id="actionColumn" label="&actionColumn2.label;" value="action" accesskey="&typeColumn.accesskey;" persist="sortDirection"
accesskey="&actionColumn2.accesskey;" persist="sortDirection" flex="1" sortDirection="ascending"/>
flex="1"/> <treecol id="actionColumn" label="&actionColumn2.label;" value="action"
</listheader> accesskey="&actionColumn2.accesskey;" persist="sortDirection"
</richlistbox> flex="1"/>
</groupbox> </listheader>
</richlistbox>
</vbox> </vbox>

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

@ -7,7 +7,7 @@
Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm"); Components.utils.import("resource://gre/modules/ContextualIdentityService.jsm");
const containersBundle = Services.strings.createBundle("chrome://browser/locale/preferences/containers.properties"); const containersBundle = Services.strings.createBundle("chrome://browser/locale/preferences-old/containers.properties");
const defaultContainerIcon = "fingerprint"; const defaultContainerIcon = "fingerprint";
const defaultContainerColor = "blue"; const defaultContainerColor = "blue";

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

@ -18,7 +18,7 @@
<hbox hidden="true" <hbox hidden="true"
class="container-header-links" class="container-header-links"
data-category="paneContainers"> data-category="paneContainers">
<label class="text-link" id="backContainersLink">&backLink.label;</label> <label class="text-link" id="backContainersLink" value="&backLink.label;" />
</hbox> </hbox>
<hbox id="header-containers" <hbox id="header-containers"
@ -26,6 +26,8 @@
hidden="true" hidden="true"
data-category="paneContainers"> data-category="paneContainers">
<label class="header-name" flex="1">&paneContainers.title;</label> <label class="header-name" flex="1">&paneContainers.title;</label>
<button class="help-button"
aria-label="&helpButton.label;"/>
</hbox> </hbox>
<!-- Containers --> <!-- Containers -->

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

@ -30,7 +30,7 @@
<script type="application/javascript" <script type="application/javascript"
src="chrome://mozapps/content/preferences/fontbuilder.js"/> src="chrome://mozapps/content/preferences/fontbuilder.js"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content-old/content.js"/> src="chrome://browser/content/preferences/in-content/content.js"/>
<hbox id="header-content" <hbox id="header-content"
class="header" class="header"

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

@ -12,5 +12,7 @@ browser.jar:
content/browser/preferences/in-content/containers.js content/browser/preferences/in-content/containers.js
content/browser/preferences/in-content/advanced.js content/browser/preferences/in-content/advanced.js
content/browser/preferences/in-content/applications.js content/browser/preferences/in-content/applications.js
content/browser/preferences/in-content/content.js
content/browser/preferences/in-content/sync.js content/browser/preferences/in-content/sync.js
content/browser/preferences/in-content/findInPage.js content/browser/preferences/in-content/security.js
content/browser/preferences/in-content/search.js

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -7,11 +7,6 @@
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content/main.js"/> src="chrome://browser/content/preferences/in-content/main.js"/>
<script type="application/javascript"
src="chrome://mozapps/content/preferences/fontbuilder.js"/>
<stringbundle id="engineManagerBundle" src="chrome://browser/locale/engineManager.properties"/>
<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/> <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/>
<preferences id="mainPreferences" hidden="true" data-category="paneGeneral"> <preferences id="mainPreferences" hidden="true" data-category="paneGeneral">
@ -60,19 +55,6 @@
name="browser.privatebrowsing.autostart" name="browser.privatebrowsing.autostart"
type="bool"/> type="bool"/>
<!-- Search Engine -->
<preference id="browser.search.suggest.enabled"
name="browser.search.suggest.enabled"
type="bool"/>
<preference id="browser.urlbar.suggest.searches"
name="browser.urlbar.suggest.searches"
type="bool"/>
<preference id="browser.search.hiddenOneOffs"
name="browser.search.hiddenOneOffs"
type="unichar"/>
<!-- Downloads --> <!-- Downloads -->
<preference id="browser.download.useDownloadDir" <preference id="browser.download.useDownloadDir"
name="browser.download.useDownloadDir" name="browser.download.useDownloadDir"
@ -129,66 +111,6 @@
name="browser.ctrlTab.previews" name="browser.ctrlTab.previews"
type="bool"/> type="bool"/>
<!-- Fonts -->
<preference id="font.language.group"
name="font.language.group"
type="wstring"/>
<!-- Languages -->
<preference id="browser.translation.detectLanguage"
name="browser.translation.detectLanguage"
type="bool"/>
<!-- General tab -->
<!-- Accessibility
* accessibility.browsewithcaret
- true enables keyboard navigation and selection within web pages using a
visible caret, false uses normal keyboard navigation with no caret
* accessibility.typeaheadfind
- when set to true, typing outside text areas and input boxes will
automatically start searching for what's typed within the current
document; when set to false, no search action happens -->
<preference id="accessibility.browsewithcaret"
name="accessibility.browsewithcaret"
type="bool"/>
<preference id="accessibility.typeaheadfind"
name="accessibility.typeaheadfind"
type="bool"/>
<preference id="accessibility.blockautorefresh"
name="accessibility.blockautorefresh"
type="bool"/>
#ifdef XP_WIN
<preference id="ui.osk.enabled"
name="ui.osk.enabled"
type="bool"/>
#endif
<!-- Browsing
* general.autoScroll
- when set to true, clicking the scroll wheel on the mouse activates a
mouse mode where moving the mouse down scrolls the document downward with
speed correlated with the distance of the cursor from the original
position at which the click occurred (and likewise with movement upward);
if false, this behavior is disabled
* general.smoothScroll
- set to true to enable finer page scrolling than line-by-line on page-up,
page-down, and other such page movements -->
<preference id="general.autoScroll"
name="general.autoScroll"
type="bool"/>
<preference id="general.smoothScroll"
name="general.smoothScroll"
type="bool"/>
<preference id="layout.spellcheckDefault"
name="layout.spellcheckDefault"
type="int"/>
#ifdef MOZ_TELEMETRY_REPORTING
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
#endif
<preference id="browser.preferences.defaultPerformanceSettings.enabled" <preference id="browser.preferences.defaultPerformanceSettings.enabled"
name="browser.preferences.defaultPerformanceSettings.enabled" name="browser.preferences.defaultPerformanceSettings.enabled"
type="bool"/> type="bool"/>
@ -208,6 +130,7 @@
hidden="true" hidden="true"
data-category="paneGeneral"> data-category="paneGeneral">
<label class="header-name" flex="1">&paneGeneral.title;</label> <label class="header-name" flex="1">&paneGeneral.title;</label>
<html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
</hbox> </hbox>
<!-- Startup --> <!-- Startup -->
@ -237,13 +160,14 @@
#ifdef HAVE_SHELL_SERVICE #ifdef HAVE_SHELL_SERVICE
<vbox id="defaultBrowserBox"> <vbox id="defaultBrowserBox">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser" <hbox align="center">
label="&alwaysCheckDefault2.label;" accesskey="&alwaysCheckDefault2.accesskey;"/> <checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault2.label;" accesskey="&alwaysCheckDefault2.accesskey;"/>
</hbox>
<deck id="setDefaultPane"> <deck id="setDefaultPane">
<hbox align="center" class="indent"> <hbox align="center" class="indent">
<label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label> <label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
<button id="setDefaultButton" <button id="setDefaultButton"
class="accessory-button"
label="&setAsMyDefaultBrowser2.label;" accesskey="&setAsMyDefaultBrowser2.accesskey;" label="&setAsMyDefaultBrowser2.label;" accesskey="&setAsMyDefaultBrowser2.accesskey;"
preference="pref.general.disable_button.default_browser"/> preference="pref.general.disable_button.default_browser"/>
</hbox> </hbox>
@ -258,8 +182,8 @@
<html:table id="startupTable"> <html:table id="startupTable">
<html:tr> <html:tr>
<html:td class="label-cell"> <html:td class="label-cell">
<label accesskey="&startupPage2.accesskey;" <label accesskey="&startupPage.accesskey;"
control="browserStartupPage">&startupPage2.label;</label> control="browserStartupPage">&startupPage.label;</label>
</html:td> </html:td>
<html:td class="content-cell"> <html:td class="content-cell">
<menulist id="browserStartupPage" <menulist id="browserStartupPage"
@ -281,8 +205,8 @@
</html:tr> </html:tr>
<html:tr> <html:tr>
<html:td class="label-cell"> <html:td class="label-cell">
<label accesskey="&homepage2.accesskey;" <label accesskey="&homepage.accesskey;"
control="browserHomePage">&homepage2.label;</label> control="browserHomePage">&homepage.label;</label>
</html:td> </html:td>
<html:td class="content-cell"> <html:td class="content-cell">
<textbox id="browserHomePage" <textbox id="browserHomePage"
@ -309,8 +233,7 @@
class="content-cell-item" class="content-cell-item"
label="&chooseBookmark.label;" label="&chooseBookmark.label;"
accesskey="&chooseBookmark.accesskey;" accesskey="&chooseBookmark.accesskey;"
preference="pref.browser.homepage.disable_button.bookmark_page" preference="pref.browser.homepage.disable_button.bookmark_page"/>
searchkeywords="&selectBookmark.title; &selectBookmark.label;"/>
<button id="restoreDefaultHomePage" <button id="restoreDefaultHomePage"
class="content-cell-item" class="content-cell-item"
label="&restoreDefault.label;" label="&restoreDefault.label;"
@ -321,67 +244,49 @@
</html:table> </html:table>
</groupbox> </groupbox>
<!-- Default Search Engine --> <!-- Downloads -->
<groupbox id="defaultEngineGroup" data-category="paneGeneral" data-subcategory="search"> <groupbox id="downloadsGroup"
<caption label="&defaultSearchEngine.label;"/> data-category="paneGeneral"
<label>&chooseYourDefaultSearchEngine.label;</label> hidden="true">
<box align="start"> <caption><label>&downloads.label;</label></caption>
<menulist id="defaultEngine">
<menupopup/> <radiogroup id="saveWhere"
</menulist> preference="browser.download.useDownloadDir"
</box> onsyncfrompreference="return gMainPane.readUseDownloadDir();">
<checkbox id="suggestionsInSearchFieldsCheckbox" <hbox id="saveToRow">
label="&provideSearchSuggestions.label;" <radio id="saveTo"
accesskey="&provideSearchSuggestions.accesskey;" value="true"
preference="browser.search.suggest.enabled"/> label="&saveTo.label;"
<vbox class="indent"> accesskey="&saveTo.accesskey;"
<checkbox id="urlBarSuggestion" label="&showURLBarSuggestions.label;" aria-labelledby="saveTo downloadFolder"/>
accesskey="&showURLBarSuggestions.accesskey;" <filefield id="downloadFolder"
preference="browser.urlbar.suggest.searches"/> flex="1"
<hbox id="urlBarSuggestionPermanentPBLabel" preference="browser.download.folderList"
align="center" class="indent"> preference-editable="true"
<label flex="1">&urlBarSuggestionsPermanentPB.label;</label> aria-labelledby="saveTo"
onsyncfrompreference="return gMainPane.displayDownloadDirPref();"/>
<button id="chooseFolder"
#ifdef XP_MACOSX
accesskey="&chooseFolderMac.accesskey;"
label="&chooseFolderMac.label;"
#else
accesskey="&chooseFolderWin.accesskey;"
label="&chooseFolderWin.label;"
#endif
/>
</hbox> </hbox>
</vbox> <hbox>
</groupbox> <radio id="alwaysAsk"
value="false"
<groupbox id="oneClickSearchProvidersGroup" data-category="paneGeneral" data-subcategory="search"> label="&alwaysAskWhere.label;"
<caption label="&oneClickSearchEngines.label;"/> accesskey="&alwaysAskWhere.accesskey;"/>
<label>&chooseWhichOneToDisplay.label;</label> </hbox>
</radiogroup>
<tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true"
seltype="single" allowunderflowscroll="true">
<treechildren id="engineChildren" flex="1"/>
<treecols>
<treecol id="engineShown" type="checkbox" editable="true" sortable="false"/>
<treecol id="engineName" flex="4" label="&engineNameColumn.label;" sortable="false"/>
<treecol id="engineKeyword" flex="1" label="&engineKeywordColumn.label;" editable="true"
sortable="false"/>
</treecols>
</tree>
<hbox>
<button id="restoreDefaultSearchEngines"
label="&restoreDefaultSearchEngines.label;"
accesskey="&restoreDefaultSearchEngines.accesskey;"/>
<spacer flex="1"/>
<button id="removeEngineButton"
class="searchEngineAction accessory-button"
label="&removeEngine.label;"
accesskey="&removeEngine.accesskey;"
disabled="true"/>
</hbox>
<separator class="thin"/>
<hbox id="addEnginesBox" pack="start">
<label id="addEngines" class="text-link">&addMoreSearchEngines2.label;</label>
</hbox>
</groupbox> </groupbox>
<!-- Tab preferences --> <!-- Tab preferences -->
<groupbox data-category="paneGeneral" <groupbox data-category="paneGeneral"
hidden="true"> hidden="true" align="start">
<caption><label>&tabsGroup.label;</label></caption> <caption><label>&tabsGroup.label;</label></caption>
<checkbox id="ctrlTabRecentlyUsedOrder" label="&ctrlTabRecentlyUsedOrder.label;" <checkbox id="ctrlTabRecentlyUsedOrder" label="&ctrlTabRecentlyUsedOrder.label;"
@ -413,231 +318,18 @@
#endif #endif
</groupbox> </groupbox>
<!-- Accessibility -->
<groupbox data-category="paneGeneral" id="accessibilityGroup">
<caption><label>&accessibility.label;</label></caption>
#ifdef XP_WIN
<checkbox id="useOnScreenKeyboard"
hidden="true"
label="&useOnScreenKeyboard.label;"
accesskey="&useOnScreenKeyboard.accesskey;"
preference="ui.osk.enabled"/>
#endif
<checkbox id="useCursorNavigation"
label="&useCursorNavigation.label;"
accesskey="&useCursorNavigation.accesskey;"
preference="accessibility.browsewithcaret"/>
<checkbox id="searchStartTyping"
label="&searchOnStartTyping.label;"
accesskey="&searchOnStartTyping.accesskey;"
preference="accessibility.typeaheadfind"/>
<checkbox id="blockAutoRefresh"
label="&blockAutoReload.label;"
accesskey="&blockAutoReload.accesskey;"
preference="accessibility.blockautorefresh"/>
</groupbox>
<!-- Languages -->
<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true">
<caption><label>&languages.label;</label></caption>
<hbox id="languagesBox" align="center">
<description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
<button id="chooseLanguage"
class="accessory-button"
label="&chooseButton.label;"
accesskey="&chooseButton.accesskey;"
searchkeywords="&languages.customize.Header;
&languages.customize.description;
&languages.customize.moveUp.label;
&languages.customize.moveDown.label;
&languages.customize.deleteButton.label;
&languages.customize.selectLanguage.label;
&languages.customize.addButton.label;"/>
</hbox>
<hbox id="translationBox" hidden="true">
<hbox align="center" flex="1">
<checkbox id="translate" preference="browser.translation.detectLanguage"
label="&translateWebPages.label;." accesskey="&translateWebPages.accesskey;"
onsyncfrompreference="return gMainPane.updateButtons('translateButton',
'browser.translation.detectLanguage');"/>
<hbox id="bingAttribution" hidden="true">
<label>&translation.options.attribution.beforeLogo;</label>
<separator orient="vertical" class="thin"/>
<image id="translationAttributionImage" aria-label="Microsoft Translator"
src="chrome://browser/content/microsoft-translator-attribution.png"/>
<separator orient="vertical" class="thin"/>
<label>&translation.options.attribution.afterLogo;</label>
</hbox>
</hbox>
<button id="translateButton"
class="accessory-button"
label="&translateExceptions.label;"
accesskey="&translateExceptions.accesskey;"/>
</hbox>
<checkbox id="checkSpelling"
label="&checkUserSpelling.label;"
accesskey="&checkUserSpelling.accesskey;"
onsyncfrompreference="return gMainPane.readCheckSpelling();"
onsynctopreference="return gMainPane.writeCheckSpelling();"
preference="layout.spellcheckDefault"/>
</groupbox>
<!-- Fonts and Colors -->
<groupbox id="fontsGroup" data-category="paneGeneral" hidden="true">
<caption><label>&fontsAndColors.label;</label></caption>
<vbox>
<hbox id="fontSettings">
<hbox align="center">
<label control="defaultFont" accesskey="&defaultFont2.accesskey;">&defaultFont2.label;</label>
<menulist id="defaultFont" delayprefsave="true" onsyncfrompreference="return FontBuilder.readFontSelection(this);"/>
<label id="defaultFontSizeLabel" control="defaultFontSize" accesskey="&defaultSize2.accesskey;">&defaultSize2.label;</label>
<menulist id="defaultFontSize" delayprefsave="true">
<menupopup>
<menuitem value="9" label="9"/>
<menuitem value="10" label="10"/>
<menuitem value="11" label="11"/>
<menuitem value="12" label="12"/>
<menuitem value="13" label="13"/>
<menuitem value="14" label="14"/>
<menuitem value="15" label="15"/>
<menuitem value="16" label="16"/>
<menuitem value="17" label="17"/>
<menuitem value="18" label="18"/>
<menuitem value="20" label="20"/>
<menuitem value="22" label="22"/>
<menuitem value="24" label="24"/>
<menuitem value="26" label="26"/>
<menuitem value="28" label="28"/>
<menuitem value="30" label="30"/>
<menuitem value="32" label="32"/>
<menuitem value="34" label="34"/>
<menuitem value="36" label="36"/>
<menuitem value="40" label="40"/>
<menuitem value="44" label="44"/>
<menuitem value="48" label="48"/>
<menuitem value="56" label="56"/>
<menuitem value="64" label="64"/>
<menuitem value="72" label="72"/>
</menupopup>
</menulist>
</hbox>
<spacer flex="1" />
<button id="advancedFonts"
class="accessory-button"
icon="select-font"
label="&advancedFonts.label;"
accesskey="&advancedFonts.accesskey;"
searchkeywords="&fontsDialog.title;
&language.label;
&size.label;
&proportional.label;
&serif.label;
&sans-serif.label;
&monospace.label;
&font.langGroup.latin;
&font.langGroup.japanese;
&font.langGroup.trad-chinese;
&font.langGroup.simpl-chinese;
&font.langGroup.trad-chinese-hk;
&font.langGroup.korean;
&font.langGroup.cyrillic;
&font.langGroup.el;
&font.langGroup.other;
&font.langGroup.thai;
&font.langGroup.hebrew;
&font.langGroup.arabic;
&font.langGroup.devanagari;
&font.langGroup.tamil;
&font.langGroup.armenian;
&font.langGroup.bengali;
&font.langGroup.canadian;
&font.langGroup.ethiopic;
&font.langGroup.georgian;
&font.langGroup.gujarati;
&font.langGroup.gurmukhi;
&font.langGroup.khmer;
&font.langGroup.malayalam;
&font.langGroup.math;
&font.langGroup.odia;
&font.langGroup.telugu;
&font.langGroup.kannada;
&font.langGroup.sinhala;
&font.langGroup.tibetan;
&minSize.label;
&minSize.none;
&useDefaultFontSerif.label;
&useDefaultFontSansSerif.label;
&allowPagesToUseOwn.label;
&languages.customize.Fallback2.grouplabel;
&languages.customize.Fallback2.label;
&languages.customize.Fallback2.desc;
&languages.customize.Fallback.auto;
&languages.customize.Fallback.arabic;
&languages.customize.Fallback.baltic;
&languages.customize.Fallback.ceiso;
&languages.customize.Fallback.cewindows;
&languages.customize.Fallback.simplified;
&languages.customize.Fallback.traditional;
&languages.customize.Fallback.cyrillic;
&languages.customize.Fallback.greek;
&languages.customize.Fallback.hebrew;
&languages.customize.Fallback.japanese;
&languages.customize.Fallback.korean;
&languages.customize.Fallback.thai;
&languages.customize.Fallback.turkish;
&languages.customize.Fallback.vietnamese;
&languages.customize.Fallback.other;"/>
</hbox>
<hbox id="colorsSettings">
<spacer flex="1" />
<button id="colors"
class="accessory-button"
icon="select-color"
label="&colors.label;"
accesskey="&colors.accesskey;"
searchkeywords="&overrideDefaultPageColors.label;
&overrideDefaultPageColors.always.label;
&overrideDefaultPageColors.auto.label;
&overrideDefaultPageColors.never.label;
&useSystemColors.label;
&underlineLinks.label;
&linkColor.label;
&visitedLinkColor.label;"/>
</hbox>
</vbox>
</groupbox>
<!-- Browsing -->
<groupbox id="browsingGroup" data-category="paneGeneral">
<caption><label>&browsing.label;</label></caption>
<checkbox id="useAutoScroll"
label="&useAutoScroll.label;"
accesskey="&useAutoScroll.accesskey;"
preference="general.autoScroll"/>
<checkbox id="useSmoothScrolling"
label="&useSmoothScrolling.label;"
accesskey="&useSmoothScrolling.accesskey;"
preference="general.smoothScroll"/>
</groupbox>
<!-- Performance --> <!-- Performance -->
<groupbox id="performanceGroup" data-category="paneGeneral" hidden="true"> <groupbox id="performanceGroup" data-category="paneGeneral" hidden="true">
<caption><label>&performance.label;</label></caption> <caption><label>&performance.label;</label></caption>
<hbox align="center"> <hbox align="center">
<checkbox id="useRecommendedPerformanceSettings" <checkbox id="useRecommendedPerformanceSettings"
label="&useRecommendedPerformanceSettings2.label;" label="&useRecommendedPerformanceSettings.label;"
accesskey="&useRecommendedPerformanceSettings2.accesskey;" accesskey="&useRecommendedPerformanceSettings.accesskey;"
preference="browser.preferences.defaultPerformanceSettings.enabled"/> preference="browser.preferences.defaultPerformanceSettings.enabled"/>
<label id="performanceSettingsLearnMore" class="learnMore text-link">&performanceSettingsLearnMore.label;</label> <label id="performanceSettingsLearnMore" class="learnMore text-link">&performanceSettingsLearnMore.label;</label>
</hbox> </hbox>
<description class="indent">&useRecommendedPerformanceSettings2.description;</description> <description class="indent">&useRecommendedPerformanceSettings.description;</description>
<vbox id="performanceSettings" class="indent" hidden="true"> <vbox id="performanceSettings" class="indent" hidden="true">
<checkbox id="allowHWAccel" <checkbox id="allowHWAccel"

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

@ -6,11 +6,13 @@
/* import-globals-from subdialogs.js */ /* import-globals-from subdialogs.js */
/* import-globals-from advanced.js */ /* import-globals-from advanced.js */
/* import-globals-from main.js */ /* import-globals-from main.js */
/* import-globals-from search.js */
/* import-globals-from containers.js */ /* import-globals-from containers.js */
/* import-globals-from content.js */
/* import-globals-from privacy.js */ /* import-globals-from privacy.js */
/* import-globals-from applications.js */ /* import-globals-from applications.js */
/* import-globals-from security.js */
/* import-globals-from sync.js */ /* import-globals-from sync.js */
/* import-globals-from findInPage.js */
/* import-globals-from ../../../base/content/utilityOverlay.js */ /* import-globals-from ../../../base/content/utilityOverlay.js */
"use strict"; "use strict";
@ -55,13 +57,14 @@ function init_all() {
gSubDialog.init(); gSubDialog.init();
register_module("paneGeneral", gMainPane); register_module("paneGeneral", gMainPane);
register_module("paneSearch", gSearchPane);
register_module("panePrivacy", gPrivacyPane); register_module("panePrivacy", gPrivacyPane);
register_module("paneContainers", gContainersPane); register_module("paneContainers", gContainersPane);
register_module("paneAdvanced", gAdvancedPane); register_module("paneAdvanced", gAdvancedPane);
register_module("paneApplications", gApplicationsPane); register_module("paneApplications", gApplicationsPane);
register_module("paneContent", gContentPane);
register_module("paneSync", gSyncPane); register_module("paneSync", gSyncPane);
register_module("paneSearchResults", gSearchResultsPane); register_module("paneSecurity", gSecurityPane);
gSearchResultsPane.init();
let categories = document.getElementById("categories"); let categories = document.getElementById("categories");
categories.addEventListener("select", event => gotoPref(event.target.value)); categories.addEventListener("select", event => gotoPref(event.target.value));
@ -86,9 +89,13 @@ function init_all() {
}); });
document.dispatchEvent(initFinished); document.dispatchEvent(initFinished);
let helpButton = document.querySelector(".help-button"); categories = categories.querySelectorAll("richlistitem.category");
let helpUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "preferences"; for (let category of categories) {
helpButton.setAttribute("href", helpUrl); let name = internalPrefCategoryNameToFriendlyName(category.value);
let helpSelector = `#header-${name} > .help-button`;
let helpButton = document.querySelector(helpSelector);
helpButton.setAttribute("href", getHelpLinkURL(category.getAttribute("helpTopic")));
}
// Wait until initialization of all preferences are complete before // Wait until initialization of all preferences are complete before
// notifying observers that the UI is now ready. // notifying observers that the UI is now ready.
@ -100,25 +107,11 @@ function init_dynamic_padding() {
let categories = document.getElementById("categories"); let categories = document.getElementById("categories");
let catPadding = Number.parseInt(getComputedStyle(categories) let catPadding = Number.parseInt(getComputedStyle(categories)
.getPropertyValue("padding-top")); .getPropertyValue("padding-top"));
let helpButton = document.querySelector(".help-button"); let fullHeight = categories.lastElementChild.getBoundingClientRect().bottom;
let helpButtonCS = getComputedStyle(helpButton);
let helpHeight = Number.parseInt(helpButtonCS.height);
let helpBottom = Number.parseInt(helpButtonCS.bottom);
// Reduce the padding to account for less space, but due
// to bug 1357841, the status panel will overlap the link.
const reducedHelpButtonBottomFactor = .75;
let reducedHelpButtonBottom = helpBottom * reducedHelpButtonBottomFactor;
let fullHelpHeight = helpHeight + reducedHelpButtonBottom;
let fullHeight = categories.lastElementChild.getBoundingClientRect().bottom +
fullHelpHeight;
let mediaRule = ` let mediaRule = `
@media (max-height: ${fullHeight}px) { @media (max-height: ${fullHeight}px) {
#categories { #categories {
padding-top: calc(100vh - ${fullHeight - catPadding}px); padding-top: calc(100vh - ${fullHeight - catPadding}px);
padding-bottom: ${fullHelpHeight}px;
}
.help-button {
bottom: ${reducedHelpButtonBottom / 2}px;
} }
} }
`; `;
@ -129,16 +122,30 @@ function init_dynamic_padding() {
} }
function telemetryBucketForCategory(category) { function telemetryBucketForCategory(category) {
category = category.toLowerCase();
switch (category) { switch (category) {
case "applications":
case "advanced":
case "containers":
case "general": case "general":
case "search":
case "content":
case "applications":
case "privacy": case "privacy":
case "security":
case "sync": case "sync":
case "searchresults":
return category; return category;
case "advanced":
let advancedPaneTabs = document.getElementById("advancedPrefs");
switch (advancedPaneTabs.selectedTab.id) {
case "generalTab":
return "advancedGeneral";
case "dataChoicesTab":
return "advancedDataChoices";
case "networkTab":
return "advancedNetwork";
case "updateTab":
return "advancedUpdates";
case "encryptionTab":
return "advancedCerts";
}
// fall-through for unknown.
default: default:
return "unknown"; return "unknown";
} }
@ -150,27 +157,14 @@ function onHashChange() {
function gotoPref(aCategory) { function gotoPref(aCategory) {
let categories = document.getElementById("categories"); let categories = document.getElementById("categories");
const kDefaultCategoryInternalName = "paneGeneral"; const kDefaultCategoryInternalName = categories.firstElementChild.value;
let hash = document.location.hash; let hash = document.location.hash;
let category = aCategory || hash.substr(1) || kDefaultCategoryInternalName; let category = aCategory || hash.substr(1) || kDefaultCategoryInternalName;
let breakIndex = category.indexOf("-");
// Subcategories allow for selecting smaller sections of the preferences
// until proper search support is enabled (bug 1353954).
let subcategory = breakIndex != -1 && category.substring(breakIndex + 1);
if (subcategory) {
category = category.substring(0, breakIndex);
}
category = friendlyPrefCategoryNameToInternalName(category); category = friendlyPrefCategoryNameToInternalName(category);
if (category != "paneSearchResults") {
gSearchResultsPane.searchInput.value = "";
gSearchResultsPane.searchResultsCategory.hidden = true;
gSearchResultsPane.findSelection.removeAllRanges();
}
// Updating the hash (below) or changing the selected category // Updating the hash (below) or changing the selected category
// will re-enter gotoPref. // will re-enter gotoPref.
if (gLastHash == category && !subcategory) if (gLastHash == category)
return; return;
let item = categories.querySelector(".category[value=" + category + "]"); let item = categories.querySelector(".category[value=" + category + "]");
if (!item) { if (!item) {
@ -186,7 +180,7 @@ function gotoPref(aCategory) {
} }
let friendlyName = internalPrefCategoryNameToFriendlyName(category); let friendlyName = internalPrefCategoryNameToFriendlyName(category);
if (gLastHash || category != kDefaultCategoryInternalName || subcategory) { if (gLastHash || category != kDefaultCategoryInternalName) {
document.location.hash = friendlyName; document.location.hash = friendlyName;
} }
// Need to set the gLastHash before setting categories.selectedItem since // Need to set the gLastHash before setting categories.selectedItem since
@ -194,38 +188,21 @@ function gotoPref(aCategory) {
gLastHash = category; gLastHash = category;
categories.selectedItem = item; categories.selectedItem = item;
window.history.replaceState(category, document.title); window.history.replaceState(category, document.title);
search(category, "data-category", subcategory, "data-subcategory"); search(category, "data-category");
let mainContent = document.querySelector(".main-content"); let mainContent = document.querySelector(".main-content");
mainContent.scrollTop = 0; mainContent.scrollTop = 0;
Services.telemetry Services.telemetry
.getHistogramById("FX_PREFERENCES_CATEGORY_OPENED_V2") .getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
.add(telemetryBucketForCategory(friendlyName)); .add(telemetryBucketForCategory(friendlyName));
} }
function search(aQuery, aAttribute, aSubquery, aSubAttribute) { function search(aQuery, aAttribute) {
let mainPrefPane = document.getElementById("mainPrefPane"); let mainPrefPane = document.getElementById("mainPrefPane");
let elements = mainPrefPane.children; let elements = mainPrefPane.children;
for (let element of elements) { for (let element of elements) {
// If the "data-hidden-from-search" is "true", the let attributeValue = element.getAttribute(aAttribute);
// element will not get considered during search. This element.hidden = (attributeValue != aQuery);
// should only be used when an element is still under
// development and should not be shown for any reason.
if (element.getAttribute("data-hidden-from-search") != "true") {
let attributeValue = element.getAttribute(aAttribute);
if (attributeValue == aQuery) {
if (!element.classList.contains("header") &&
aSubquery && aSubAttribute) {
let subAttributeValue = element.getAttribute(aSubAttribute);
element.hidden = subAttributeValue != aSubquery;
} else {
element.hidden = false;
}
} else {
element.hidden = true;
}
}
} }
let keysets = mainPrefPane.getElementsByTagName("keyset"); let keysets = mainPrefPane.getElementsByTagName("keyset");

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

@ -19,53 +19,27 @@
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % globalPreferencesDTD SYSTEM "chrome://global/locale/preferences.dtd"> <!ENTITY % globalPreferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
<!ENTITY % preferencesDTD SYSTEM <!ENTITY % preferencesDTD SYSTEM
"chrome://browser/locale/preferences/preferences.dtd"> "chrome://browser/locale/preferences-old/preferences.dtd">
<!ENTITY % selectBookmarkDTD SYSTEM <!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences-old/privacy.dtd">
"chrome://browser/locale/preferences/selectBookmark.dtd"> <!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences-old/tabs.dtd">
<!ENTITY % languagesDTD SYSTEM "chrome://browser/locale/preferences/languages.dtd"> <!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences-old/search.dtd">
<!ENTITY % fontDTD SYSTEM "chrome://browser/locale/preferences/fonts.dtd">
<!ENTITY % colorsDTD SYSTEM "chrome://browser/locale/preferences/colors.dtd">
<!ENTITY % permissionsDTD SYSTEM "chrome://browser/locale/preferences/permissions.dtd">
<!ENTITY % passwordManagerDTD SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd">
<!ENTITY % historyDTD SYSTEM "chrome://mozapps/locale/update/history.dtd">
<!ENTITY % certManagerDTD SYSTEM "chrome://pippki/locale/certManager.dtd">
<!ENTITY % deviceManangerDTD SYSTEM "chrome://pippki/locale/deviceManager.dtd">
<!ENTITY % connectionDTD SYSTEM "chrome://browser/locale/preferences/connection.dtd">
<!ENTITY % siteDataSettingsDTD SYSTEM
"chrome://browser/locale/preferences/siteDataSettings.dtd" >
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
<!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences/tabs.dtd">
<!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences/search.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd"> <!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd"> <!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences-old/sync.dtd">
<!ENTITY % securityDTD SYSTEM <!ENTITY % securityDTD SYSTEM
"chrome://browser/locale/preferences/security.dtd"> "chrome://browser/locale/preferences-old/security.dtd">
<!ENTITY % containersDTD SYSTEM <!ENTITY % containersDTD SYSTEM
"chrome://browser/locale/preferences/containers.dtd"> "chrome://browser/locale/preferences-old/containers.dtd">
<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd"> <!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
<!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences/main.dtd"> <!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences-old/main.dtd">
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd"> <!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
<!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences/content.dtd"> <!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences-old/content.dtd">
<!ENTITY % applicationsDTD SYSTEM <!ENTITY % applicationsDTD SYSTEM
"chrome://browser/locale/preferences/applications.dtd"> "chrome://browser/locale/preferences-old/applications.dtd">
<!ENTITY % advancedDTD SYSTEM <!ENTITY % advancedDTD SYSTEM
"chrome://browser/locale/preferences/advanced.dtd"> "chrome://browser/locale/preferences-old/advanced.dtd">
<!ENTITY % aboutDialogDTD SYSTEM "chrome://browser/locale/aboutDialog.dtd" >
%aboutDialogDTD;
%brandDTD; %brandDTD;
%globalPreferencesDTD; %globalPreferencesDTD;
%preferencesDTD; %preferencesDTD;
%selectBookmarkDTD;
%languagesDTD;
%fontDTD;
%colorsDTD;
%permissionsDTD;
%passwordManagerDTD;
%historyDTD;
%certManagerDTD;
%deviceManangerDTD;
%connectionDTD;
%siteDataSettingsDTD;
%privacyDTD; %privacyDTD;
%tabsDTD; %tabsDTD;
%searchDTD; %searchDTD;
@ -101,17 +75,12 @@
src="chrome://browser/content/utilityOverlay.js"/> src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/preferences/in-content/preferences.js"/> src="chrome://browser/content/preferences/in-content/preferences.js"/>
<script src="chrome://browser/content/preferences/in-content/findInPage.js"/>
<script src="chrome://browser/content/preferences/in-content/subdialogs.js"/> <script src="chrome://browser/content/preferences/in-content/subdialogs.js"/>
<stringbundle id="bundleBrand" <stringbundle id="bundleBrand"
src="chrome://branding/locale/brand.properties"/> src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundlePreferences" <stringbundle id="bundlePreferences"
src="chrome://browser/locale/preferences/preferences.properties"/> src="chrome://browser/locale/preferences-old/preferences.properties"/>
<stringbundle id="pkiBundle"
src="chrome://pippki/locale/pippki.properties"/>
<stringbundle id="browserBundle"
src="chrome://browser/locale/browser.properties"/>
<stringbundleset id="appManagerBundleset"> <stringbundleset id="appManagerBundleset">
<stringbundle id="appManagerBundle" <stringbundle id="appManagerBundle"
@ -123,17 +92,6 @@
<!-- category list --> <!-- category list -->
<richlistbox id="categories"> <richlistbox id="categories">
<richlistitem id="category-search-results"
class="category"
value="paneSearchResults"
helpTopic="prefs-main"
tooltiptext="&paneSearchResults.title;"
align="center"
hidden="true">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneSearchResults.title;</label>
</richlistitem>
<richlistitem id="category-general" <richlistitem id="category-general"
class="category" class="category"
value="paneGeneral" value="paneGeneral"
@ -144,14 +102,44 @@
<label class="category-name" flex="1">&paneGeneral.title;</label> <label class="category-name" flex="1">&paneGeneral.title;</label>
</richlistitem> </richlistitem>
<richlistitem id="category-search"
class="category"
value="paneSearch"
helpTopic="prefs-search"
tooltiptext="&paneSearch.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneSearch.title;</label>
</richlistitem>
<richlistitem id="category-content"
class="category"
value="paneContent"
helpTopic="prefs-content"
tooltiptext="&paneContent.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneContent.title;</label>
</richlistitem>
<richlistitem id="category-application" <richlistitem id="category-application"
class="category" class="category"
value="paneApplications" value="paneApplications"
helpTopic="prefs-applications" helpTopic="prefs-applications"
tooltiptext="&paneFilesApplications.title;" tooltiptext="&paneApplications.title;"
align="center"> align="center">
<image class="category-icon"/> <image class="category-icon"/>
<label class="category-name" flex="1">&paneFilesApplications.title;</label> <label class="category-name" flex="1">&paneApplications.title;</label>
</richlistitem>
<richlistitem id="category-privacy"
class="category"
value="panePrivacy"
helpTopic="prefs-privacy"
tooltiptext="&panePrivacy.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&panePrivacy.title;</label>
</richlistitem> </richlistitem>
<richlistitem id="category-containers" <richlistitem id="category-containers"
@ -160,34 +148,34 @@
helpTopic="prefs-containers" helpTopic="prefs-containers"
hidden="true"/> hidden="true"/>
<richlistitem id="category-security"
class="category"
value="paneSecurity"
helpTopic="prefs-security"
tooltiptext="&paneSecurity.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneSecurity.title;</label>
</richlistitem>
<richlistitem id="category-sync" <richlistitem id="category-sync"
class="category" class="category"
value="paneSync" value="paneSync"
helpTopic="prefs-weave" helpTopic="prefs-weave"
tooltiptext="&paneSync1.title;" tooltiptext="&paneSync.title;"
align="center"> align="center">
<image class="category-icon"/> <image class="category-icon"/>
<label class="category-name" flex="1">&paneSync1.title;</label> <label class="category-name" flex="1">&paneSync.title;</label>
</richlistitem>
<richlistitem id="category-privacy"
class="category"
value="panePrivacy"
helpTopic="prefs-privacy"
tooltiptext="&panePrivacySecurity.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&panePrivacySecurity.title;</label>
</richlistitem> </richlistitem>
<richlistitem id="category-advanced" <richlistitem id="category-advanced"
class="category" class="category"
value="paneAdvanced" value="paneAdvanced"
helpTopic="prefs-advanced-general" helpTopic="prefs-advanced-general"
tooltiptext="&paneUpdates.title;" tooltiptext="&paneAdvanced.title;"
align="center"> align="center">
<image class="category-icon"/> <image class="category-icon"/>
<label class="category-name" flex="1">&paneUpdates.title;</label> <label class="category-name" flex="1">&paneAdvanced.title;</label>
</richlistitem> </richlistitem>
</richlistbox> </richlistbox>
@ -198,23 +186,20 @@
<key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/> <key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/>
</keyset> </keyset>
<html:a class="help-button" target="_blank" aria-label="&helpButton2.label;">&helpButton2.label;</html:a>
<vbox class="main-content" flex="1"> <vbox class="main-content" flex="1">
<hbox pack="end">
<textbox type="search" id="searchInput" placeholder="&searchInput.label;" hidden="true"
clickSelectsAll="true"/>
</hbox>
<prefpane id="mainPrefPane"> <prefpane id="mainPrefPane">
#include searchResults.xul
#include main.xul #include main.xul
#include search.xul
#include privacy.xul #include privacy.xul
#include containers.xul #include containers.xul
#include advanced.xul #include advanced.xul
#include applications.xul #include applications.xul
#include content.xul
#include security.xul
#include sync.xul #include sync.xul
</prefpane> </prefpane>
</vbox> </vbox>
</hbox> </hbox>
<vbox id="dialogOverlay" align="center" pack="center"> <vbox id="dialogOverlay" align="center" pack="center">

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

@ -11,30 +11,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
"resource://gre/modules/ContextualIdentityService.jsm"); "resource://gre/modules/ContextualIdentityService.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm"); "resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
"resource://gre/modules/LoginHelper.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SiteDataManager",
"resource:///modules/SiteDataManager.jsm");
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
XPCOMUtils.defineLazyGetter(this, "AlertsServiceDND", function() {
try {
let alertsService = Cc["@mozilla.org/alerts-service;1"]
.getService(Ci.nsIAlertsService)
.QueryInterface(Ci.nsIAlertsDoNotDisturb);
// This will throw if manualDoNotDisturb isn't implemented.
alertsService.manualDoNotDisturb;
return alertsService;
} catch (ex) {
return undefined;
}
});
var gPrivacyPane = { var gPrivacyPane = {
_pane: null,
/** /**
* Whether the use has selected the auto-start private browsing mode in the UI. * Whether the use has selected the auto-start private browsing mode in the UI.
@ -88,10 +66,6 @@ var gPrivacyPane = {
*/ */
_initBrowserContainers() { _initBrowserContainers() {
if (!Services.prefs.getBoolPref("privacy.userContext.ui.enabled")) { if (!Services.prefs.getBoolPref("privacy.userContext.ui.enabled")) {
// The browserContainersGroup element has its own internal padding that
// is visible even if the browserContainersbox is visible, so hide the whole
// groupbox if the feature is disabled to prevent a gap in the preferences.
document.getElementById("browserContainersGroup").setAttribute("data-hidden-from-search", "true");
return; return;
} }
@ -150,13 +124,6 @@ var gPrivacyPane = {
.addEventListener(aEventType, aCallback.bind(gPrivacyPane)); .addEventListener(aEventType, aCallback.bind(gPrivacyPane));
} }
function appendSearchKeywords(aId, keywords) {
let element = document.getElementById(aId);
let searchKeywords = element.getAttribute("searchkeywords");
searchKeywords && keywords.push(searchKeywords);
element.setAttribute("searchkeywords", keywords.join(" "));
}
this._updateSanitizeSettingsButton(); this._updateSanitizeSettingsButton();
this.initializeHistoryMode(); this.initializeHistoryMode();
this.updateHistoryModePane(); this.updateHistoryModePane();
@ -213,166 +180,6 @@ var gPrivacyPane = {
gPrivacyPane._checkBrowserContainers); gPrivacyPane._checkBrowserContainers);
setEventListener("browserContainersSettings", "command", setEventListener("browserContainersSettings", "command",
gPrivacyPane.showContainerSettings); gPrivacyPane.showContainerSettings);
setEventListener("passwordExceptions", "command",
gPrivacyPane.showPasswordExceptions);
setEventListener("useMasterPassword", "command",
gPrivacyPane.updateMasterPasswordButton);
setEventListener("changeMasterPassword", "command",
gPrivacyPane.changeMasterPassword);
setEventListener("showPasswords", "command",
gPrivacyPane.showPasswords);
setEventListener("addonExceptions", "command",
gPrivacyPane.showAddonExceptions);
setEventListener("viewCertificatesButton", "command",
gPrivacyPane.showCertificates);
setEventListener("viewSecurityDevicesButton", "command",
gPrivacyPane.showSecurityDevices);
setEventListener("connectionSettings", "command",
gPrivacyPane.showConnections);
setEventListener("clearCacheButton", "command",
gPrivacyPane.clearCache);
this._pane = document.getElementById("panePrivacy");
this._initMasterPasswordUI();
this._initSafeBrowsing();
this.updateCacheSizeInputField();
this.updateActualCacheSize();
setEventListener("notificationsPolicyButton", "command",
gPrivacyPane.showNotificationExceptions);
setEventListener("popupPolicyButton", "command",
gPrivacyPane.showPopupExceptions);
setEventListener("notificationsDoNotDisturb", "command",
gPrivacyPane.toggleDoNotDisturbNotifications);
if (AlertsServiceDND) {
let notificationsDoNotDisturbBox =
document.getElementById("notificationsDoNotDisturbBox");
notificationsDoNotDisturbBox.removeAttribute("hidden");
if (AlertsServiceDND.manualDoNotDisturb) {
let notificationsDoNotDisturb =
document.getElementById("notificationsDoNotDisturb");
notificationsDoNotDisturb.setAttribute("checked", true);
}
}
setEventListener("cacheSize", "change",
gPrivacyPane.updateCacheSizePref);
if (Services.prefs.getBoolPref("browser.preferences.offlineGroup.enabled")) {
this.updateOfflineApps();
this.updateActualAppCacheSize();
setEventListener("offlineNotifyExceptions", "command",
gPrivacyPane.showOfflineExceptions);
setEventListener("offlineAppsList", "select",
gPrivacyPane.offlineAppSelected);
setEventListener("offlineAppsListRemove", "command",
gPrivacyPane.removeOfflineApp);
setEventListener("clearOfflineAppCacheButton", "command",
gPrivacyPane.clearOfflineAppCache);
let bundlePrefs = document.getElementById("bundlePreferences");
document.getElementById("offlineAppsList")
.style.height = bundlePrefs.getString("offlineAppsList.height");
let offlineGroup = document.getElementById("offlineGroup");
offlineGroup.hidden = false;
offlineGroup.removeAttribute("data-hidden-from-search");
}
if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
Services.obs.addObserver(this, "sitedatamanager:sites-updated");
Services.obs.addObserver(this, "sitedatamanager:updating-sites");
let unload = () => {
window.removeEventListener("unload", unload);
Services.obs.removeObserver(this, "sitedatamanager:sites-updated");
Services.obs.removeObserver(this, "sitedatamanager:updating-sites");
};
window.addEventListener("unload", unload);
SiteDataManager.updateSites();
setEventListener("clearSiteDataButton", "command",
gPrivacyPane.clearSiteData);
setEventListener("siteDataSettings", "command",
gPrivacyPane.showSiteDataSettings);
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
document.getElementById("siteDataLearnMoreLink").setAttribute("href", url);
let siteDataGroup = document.getElementById("siteDataGroup");
siteDataGroup.hidden = false;
siteDataGroup.removeAttribute("data-hidden-from-search");
}
let notificationInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";
document.getElementById("notificationsPolicyLearnMore").setAttribute("href",
notificationInfoURL);
let drmInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
// Force-disable/hide on WinXP:
if (navigator.platform.toLowerCase().startsWith("win")) {
emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
}
if (!emeUIEnabled) {
// Don't want to rely on .hidden for the toplevel groupbox because
// of the pane hiding/showing code potentially interfering:
document.getElementById("drmGroup").setAttribute("style", "display: none !important");
}
if (AppConstants.MOZ_CRASHREPORTER) {
this.initSubmitCrashes();
}
this.initTelemetry();
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this.initSubmitHealthReport();
setEventListener("submitHealthReportBox", "command",
gPrivacyPane.updateSubmitHealthReport);
}
// Append search keywords into the elements could open subdialogs.
let bundlePrefs = document.getElementById("bundlePreferences");
let signonBundle = document.getElementById("signonBundle");
let pkiBundle = document.getElementById("pkiBundle");
let browserBundle = document.getElementById("browserBundle");
appendSearchKeywords("passwordExceptions", [
bundlePrefs.getString("savedLoginsExceptions_title"),
bundlePrefs.getString("savedLoginsExceptions_desc"),
]);
appendSearchKeywords("showPasswords", [
signonBundle.getString("loginsDescriptionAll"),
]);
appendSearchKeywords("trackingProtectionExceptions", [
bundlePrefs.getString("trackingprotectionpermissionstitle"),
bundlePrefs.getString("trackingprotectionpermissionstext"),
]);
appendSearchKeywords("changeBlockList", [
bundlePrefs.getString("blockliststitle"),
bundlePrefs.getString("blockliststext"),
]);
appendSearchKeywords("popupPolicyButton", [
bundlePrefs.getString("popuppermissionstitle"),
bundlePrefs.getString("popuppermissionstext"),
]);
appendSearchKeywords("notificationsPolicyButton", [
bundlePrefs.getString("notificationspermissionstitle"),
bundlePrefs.getString("notificationspermissionstext4"),
]);
appendSearchKeywords("addonExceptions", [
bundlePrefs.getString("addons_permissions_title"),
bundlePrefs.getString("addonspermissionstext"),
]);
appendSearchKeywords("viewSecurityDevicesButton", [
pkiBundle.getString("enable_fips"),
]);
appendSearchKeywords("browserContainersSettings", [
browserBundle.getString("userContextPersonal.label"),
browserBundle.getString("userContextWork.label"),
browserBundle.getString("userContextBanking.label"),
browserBundle.getString("userContextShopping.label"),
]);
appendSearchKeywords("siteDataSettings", [
bundlePrefs.getString("siteDataSettings.description"),
bundlePrefs.getString("removeAllCookies.label"),
bundlePrefs.getString("removeSelectedCookies.label"),
]);
}, },
// TRACKING PROTECTION MODE // TRACKING PROTECTION MODE
@ -884,779 +691,6 @@ var gPrivacyPane = {
var settings = document.getElementById("browserContainersSettings"); var settings = document.getElementById("browserContainersSettings");
settings.disabled = !pref.value; settings.disabled = !pref.value;
}, }
toggleDoNotDisturbNotifications(event) {
AlertsServiceDND.manualDoNotDisturb = event.target.checked;
},
// NOTIFICATIONS
/**
* Displays the notifications exceptions dialog where specific site notification
* preferences can be set.
*/
showNotificationExceptions() {
let bundlePreferences = document.getElementById("bundlePreferences");
let params = { permissionType: "desktop-notification" };
params.windowTitle = bundlePreferences.getString("notificationspermissionstitle");
params.introText = bundlePreferences.getString("notificationspermissionstext4");
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
"resizable=yes", params);
try {
Services.telemetry
.getHistogramById("WEB_NOTIFICATION_EXCEPTIONS_OPENED").add();
} catch (e) {}
},
// POP-UPS
/**
* Displays the popup exceptions dialog where specific site popup preferences
* can be set.
*/
showPopupExceptions() {
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: false, sessionVisible: false, allowVisible: true,
prefilledHost: "", permissionType: "popup" }
params.windowTitle = bundlePreferences.getString("popuppermissionstitle");
params.introText = bundlePreferences.getString("popuppermissionstext");
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
"resizable=yes", params);
},
// UTILITY FUNCTIONS
/**
* Utility function to enable/disable the button specified by aButtonID based
* on the value of the Boolean preference specified by aPreferenceID.
*/
updateButtons(aButtonID, aPreferenceID) {
var button = document.getElementById(aButtonID);
var preference = document.getElementById(aPreferenceID);
button.disabled = preference.value != true;
return undefined;
},
// BEGIN UI CODE
/*
* Preferences:
*
* dom.disable_open_during_load
* - true if popups are blocked by default, false otherwise
*/
// POP-UPS
/**
* Displays a dialog in which the user can view and modify the list of sites
* where passwords are never saved.
*/
showPasswordExceptions() {
var bundlePrefs = document.getElementById("bundlePreferences");
var params = {
blockVisible: true,
sessionVisible: false,
allowVisible: false,
hideStatusColumn: true,
prefilledHost: "",
permissionType: "login-saving",
windowTitle: bundlePrefs.getString("savedLoginsExceptions_title"),
introText: bundlePrefs.getString("savedLoginsExceptions_desc")
};
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
/**
* Initializes master password UI: the "use master password" checkbox, selects
* the master password button to show, and enables/disables it as necessary.
* The master password is controlled by various bits of NSS functionality, so
* the UI for it can't be controlled by the normal preference bindings.
*/
_initMasterPasswordUI() {
var noMP = !LoginHelper.isMasterPasswordSet();
var button = document.getElementById("changeMasterPassword");
button.disabled = noMP;
var checkbox = document.getElementById("useMasterPassword");
checkbox.checked = !noMP;
},
/**
* Enables/disables the master password button depending on the state of the
* "use master password" checkbox, and prompts for master password removal if
* one is set.
*/
updateMasterPasswordButton() {
var checkbox = document.getElementById("useMasterPassword");
var button = document.getElementById("changeMasterPassword");
button.disabled = !checkbox.checked;
// unchecking the checkbox should try to immediately remove the master
// password, because it's impossible to non-destructively remove the master
// password used to encrypt all the passwords without providing it (by
// design), and it would be extremely odd to pop up that dialog when the
// user closes the prefwindow and saves his settings
if (!checkbox.checked)
this._removeMasterPassword();
else
this.changeMasterPassword();
this._initMasterPasswordUI();
},
/**
* Displays the "remove master password" dialog to allow the user to remove
* the current master password. When the dialog is dismissed, master password
* UI is automatically updated.
*/
_removeMasterPassword() {
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
if (secmodDB.isFIPSEnabled) {
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService);
var bundle = document.getElementById("bundlePreferences");
promptService.alert(window,
bundle.getString("pw_change_failed_title"),
bundle.getString("pw_change2empty_in_fips_mode"));
this._initMasterPasswordUI();
} else {
gSubDialog.open("chrome://mozapps/content/preferences/removemp.xul",
null, null, this._initMasterPasswordUI.bind(this));
}
},
/**
* Displays a dialog in which the master password may be changed.
*/
changeMasterPassword() {
gSubDialog.open("chrome://mozapps/content/preferences/changemp.xul",
"resizable=no", null, this._initMasterPasswordUI.bind(this));
},
/**
* Shows the sites where the user has saved passwords and the associated login
* information.
*/
showPasswords() {
gSubDialog.open("chrome://passwordmgr/content/passwordManager.xul");
},
/**
* Enables/disables the Exceptions button used to configure sites where
* passwords are never saved. When browser is set to start in Private
* Browsing mode, the "Remember passwords" UI is useless, so we disable it.
*/
readSavePasswords() {
var pref = document.getElementById("signon.rememberSignons");
var excepts = document.getElementById("passwordExceptions");
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
document.getElementById("savePasswords").disabled = true;
excepts.disabled = true;
return false;
}
excepts.disabled = !pref.value;
// don't override pref value in UI
return undefined;
},
/**
* Enables/disables the add-ons Exceptions button depending on whether
* or not add-on installation warnings are displayed.
*/
readWarnAddonInstall() {
var warn = document.getElementById("xpinstall.whitelist.required");
var exceptions = document.getElementById("addonExceptions");
exceptions.disabled = !warn.value;
// don't override the preference value
return undefined;
},
_initSafeBrowsing() {
let enableSafeBrowsing = document.getElementById("enableSafeBrowsing");
let blockDownloads = document.getElementById("blockDownloads");
let blockUncommonUnwanted = document.getElementById("blockUncommonUnwanted");
let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
let malwareTable = document.getElementById("urlclassifier.malwareTable");
let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
enableSafeBrowsing.addEventListener("command", function() {
safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
if (enableSafeBrowsing.checked) {
blockDownloads.removeAttribute("disabled");
if (blockDownloads.checked) {
blockUncommonUnwanted.removeAttribute("disabled");
}
} else {
blockDownloads.setAttribute("disabled", "true");
blockUncommonUnwanted.setAttribute("disabled", "true");
}
});
blockDownloads.addEventListener("command", function() {
blockDownloadsPref.value = blockDownloads.checked;
if (blockDownloads.checked) {
blockUncommonUnwanted.removeAttribute("disabled");
} else {
blockUncommonUnwanted.setAttribute("disabled", "true");
}
});
blockUncommonUnwanted.addEventListener("command", function() {
blockUnwantedPref.value = blockUncommonUnwanted.checked;
blockUncommonPref.value = blockUncommonUnwanted.checked;
let malware = malwareTable.value
.split(",")
.filter(x => x !== "goog-unwanted-shavar" && x !== "test-unwanted-simple");
if (blockUncommonUnwanted.checked) {
malware.push("goog-unwanted-shavar");
malware.push("test-unwanted-simple");
}
// sort alphabetically to keep the pref consistent
malware.sort();
malwareTable.value = malware.join(",");
});
// set initial values
enableSafeBrowsing.checked = safeBrowsingPhishingPref.value && safeBrowsingMalwarePref.value;
if (!enableSafeBrowsing.checked) {
blockDownloads.setAttribute("disabled", "true");
blockUncommonUnwanted.setAttribute("disabled", "true");
}
blockDownloads.checked = blockDownloadsPref.value;
if (!blockDownloadsPref.value) {
blockUncommonUnwanted.setAttribute("disabled", "true");
}
blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
},
/**
* Displays the exceptions lists for add-on installation warnings.
*/
showAddonExceptions() {
var bundlePrefs = document.getElementById("bundlePreferences");
var params = this._addonParams;
if (!params.windowTitle || !params.introText) {
params.windowTitle = bundlePrefs.getString("addons_permissions_title");
params.introText = bundlePrefs.getString("addonspermissionstext");
}
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
/**
* Parameters for the add-on install permissions dialog.
*/
_addonParams:
{
blockVisible: false,
sessionVisible: false,
allowVisible: true,
prefilledHost: "",
permissionType: "install"
},
/**
* readEnableOCSP is used by the preferences UI to determine whether or not
* the checkbox for OCSP fetching should be checked (it returns true if it
* should be checked and false otherwise). The about:config preference
* "security.OCSP.enabled" is an integer rather than a boolean, so it can't be
* directly mapped from {true,false} to {checked,unchecked}. The possible
* values for "security.OCSP.enabled" are:
* 0: fetching is disabled
* 1: fetch for all certificates
* 2: fetch only for EV certificates
* Hence, if "security.OCSP.enabled" is non-zero, the checkbox should be
* checked. Otherwise, it should be unchecked.
*/
readEnableOCSP() {
var preference = document.getElementById("security.OCSP.enabled");
// This is the case if the preference is the default value.
if (preference.value === undefined) {
return true;
}
return preference.value != 0;
},
/**
* writeEnableOCSP is used by the preferences UI to map the checked/unchecked
* state of the OCSP fetching checkbox to the value that the preference
* "security.OCSP.enabled" should be set to (it returns that value). See the
* readEnableOCSP documentation for more background. We unfortunately don't
* have enough information to map from {true,false} to all possible values for
* "security.OCSP.enabled", but a reasonable alternative is to map from
* {true,false} to {<the default value>,0}. That is, if the box is checked,
* "security.OCSP.enabled" will be set to whatever default it should be, given
* the platform and channel. If the box is unchecked, the preference will be
* set to 0. Obviously this won't work if the default is 0, so we will have to
* revisit this if we ever set it to 0.
*/
writeEnableOCSP() {
var checkbox = document.getElementById("enableOCSP");
var defaults = Services.prefs.getDefaultBranch(null);
var defaultValue = defaults.getIntPref("security.OCSP.enabled");
return checkbox.checked ? defaultValue : 0;
},
/**
* Displays the user's certificates and associated options.
*/
showCertificates() {
gSubDialog.open("chrome://pippki/content/certManager.xul");
},
/**
* Displays a dialog from which the user can manage his security devices.
*/
showSecurityDevices() {
gSubDialog.open("chrome://pippki/content/device_manager.xul");
},
// NETWORK
/**
* Displays a dialog in which proxy settings may be changed.
*/
showConnections() {
gSubDialog.open("chrome://browser/content/preferences/connection.xul");
},
/**
* Clears the cache.
*/
clearCache() {
try {
var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cache.clear();
} catch (ex) {}
this.updateActualCacheSize();
},
showOfflineExceptions() {
var bundlePreferences = document.getElementById("bundlePreferences");
var params = { blockVisible: false,
sessionVisible: false,
allowVisible: false,
prefilledHost: "",
permissionType: "offline-app",
manageCapability: Components.interfaces.nsIPermissionManager.DENY_ACTION,
windowTitle: bundlePreferences.getString("offlinepermissionstitle"),
introText: bundlePreferences.getString("offlinepermissionstext") };
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
null, params);
},
offlineAppSelected() {
var removeButton = document.getElementById("offlineAppsListRemove");
var list = document.getElementById("offlineAppsList");
if (list.selectedItem) {
removeButton.setAttribute("disabled", "false");
} else {
removeButton.setAttribute("disabled", "true");
}
},
showSiteDataSettings() {
gSubDialog.open("chrome://browser/content/preferences/siteDataSettings.xul");
},
toggleSiteData(shouldShow) {
let clearButton = document.getElementById("clearSiteDataButton");
let settingsButton = document.getElementById("siteDataSettings");
clearButton.disabled = !shouldShow;
settingsButton.disabled = !shouldShow;
},
updateTotalDataSizeLabel(usage) {
let prefStrBundle = document.getElementById("bundlePreferences");
let totalSiteDataSizeLabel = document.getElementById("totalSiteDataSize");
if (usage < 0) {
totalSiteDataSizeLabel.textContent = prefStrBundle.getString("loadingSiteDataSize");
} else {
let size = DownloadUtils.convertByteUnits(usage);
totalSiteDataSizeLabel.textContent = prefStrBundle.getFormattedString("totalSiteDataSize", size);
}
},
// Retrieves the amount of space currently used by disk cache
updateActualCacheSize() {
var actualSizeLabel = document.getElementById("actualDiskCacheSize");
var prefStrBundle = document.getElementById("bundlePreferences");
// Needs to root the observer since cache service keeps only a weak reference.
this.observer = {
onNetworkCacheDiskConsumption(consumption) {
var size = DownloadUtils.convertByteUnits(consumption);
// The XBL binding for the string bundle may have been destroyed if
// the page was closed before this callback was executed.
if (!prefStrBundle.getFormattedString) {
return;
}
actualSizeLabel.value = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
},
QueryInterface: XPCOMUtils.generateQI([
Components.interfaces.nsICacheStorageConsumptionObserver,
Components.interfaces.nsISupportsWeakReference
])
};
actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
try {
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
cacheService.asyncGetDiskConsumption(this.observer);
} catch (e) {}
},
updateCacheSizeUI(smartSizeEnabled) {
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
},
readSmartSizeEnabled() {
// The smart_size.enabled preference element is inverted="true", so its
// value is the opposite of the actual pref value
var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
this.updateCacheSizeUI(!disabled);
},
/**
* Converts the cache size from units of KB to units of MB and stores it in
* the textbox element.
*
* Preferences:
*
* browser.cache.disk.capacity
* - the size of the browser cache in KB
* - Only used if browser.cache.disk.smart_size.enabled is disabled
*/
updateCacheSizeInputField() {
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("browser.cache.disk.capacity");
cacheSizeElem.value = cachePref.value / 1024;
if (cachePref.locked)
cacheSizeElem.disabled = true;
},
/**
* Updates the cache size preference once user enters a new value.
* We intentionally do not set preference="browser.cache.disk.capacity"
* onto the textbox directly, as that would update the pref at each keypress
* not only after the final value is entered.
*/
updateCacheSizePref() {
let cacheSizeElem = document.getElementById("cacheSize");
let cachePref = document.getElementById("browser.cache.disk.capacity");
// Converts the cache size as specified in UI (in MB) to KB.
let intValue = parseInt(cacheSizeElem.value, 10);
cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
},
clearSiteData() {
let flags =
Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 +
Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1 +
Services.prompt.BUTTON_POS_0_DEFAULT;
let prefStrBundle = document.getElementById("bundlePreferences");
let title = prefStrBundle.getString("clearSiteDataPromptTitle");
let text = prefStrBundle.getString("clearSiteDataPromptText");
let btn0Label = prefStrBundle.getString("clearSiteDataNow");
let result = Services.prompt.confirmEx(
window, title, text, flags, btn0Label, null, null, null, {});
if (result == 0) {
SiteDataManager.removeAll();
}
},
initSubmitCrashes() {
this._setupLearnMoreLink("toolkit.crashreporter.infoURL",
"crashReporterLearnMore");
},
/**
* The preference/checkbox is configured in XUL.
*
* In all cases, set up the Learn More link sanely.
*/
initTelemetry() {
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
}
},
/**
* Set up or hide the Learn More links for various data collection options
*/
_setupLearnMoreLink(pref, element) {
// set up the Learn More link with the correct URL
let url = Services.prefs.getCharPref(pref);
let el = document.getElementById(element);
if (url) {
el.setAttribute("href", url);
} else {
el.setAttribute("hidden", "true");
}
},
/**
* Set the status of the telemetry controls based on the input argument.
* @param {Boolean} aEnabled False disables the controls, true enables them.
*/
setTelemetrySectionEnabled(aEnabled) {
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
return;
}
// If FHR is disabled, additional data sharing should be disabled as well.
let disabled = !aEnabled;
document.getElementById("submitTelemetryBox").disabled = disabled;
if (disabled) {
// If we disable FHR, untick the telemetry checkbox.
Services.prefs.setBoolPref("toolkit.telemetry.enabled", false);
}
document.getElementById("telemetryDataDesc").disabled = disabled;
},
/**
* Initialize the health report service reference and checkbox.
*/
initSubmitHealthReport() {
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
return;
}
this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
let checkbox = document.getElementById("submitHealthReportBox");
if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED)) {
checkbox.setAttribute("disabled", "true");
return;
}
checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED);
this.setTelemetrySectionEnabled(checkbox.checked);
},
/**
* Update the health report preference with state from checkbox.
*/
updateSubmitHealthReport() {
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
return;
}
let checkbox = document.getElementById("submitHealthReportBox");
Services.prefs.setBoolPref(PREF_UPLOAD_ENABLED, checkbox.checked);
this.setTelemetrySectionEnabled(checkbox.checked);
},
// Methods for Offline Apps (AppCache)
/**
* Clears the application cache.
*/
clearOfflineAppCache() {
Components.utils.import("resource:///modules/offlineAppCache.jsm");
OfflineAppCacheHelper.clear();
this.updateActualAppCacheSize();
this.updateOfflineApps();
},
// Retrieves the amount of space currently used by offline cache
updateActualAppCacheSize() {
var visitor = {
onCacheStorageInfo(aEntryCount, aConsumption, aCapacity, aDiskDirectory) {
var actualSizeLabel = document.getElementById("actualAppCacheSize");
var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
var prefStrBundle = document.getElementById("bundlePreferences");
// The XBL binding for the string bundle may have been destroyed if
// the page was closed before this callback was executed.
if (!prefStrBundle.getFormattedString) {
return;
}
var sizeStr = prefStrBundle.getFormattedString("actualAppCacheSize", sizeStrings);
actualSizeLabel.value = sizeStr;
}
};
try {
var cacheService =
Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Components.interfaces.nsICacheStorageService);
var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
storage.asyncVisitStorage(visitor, false);
} catch (e) {}
},
readOfflineNotify() {
var pref = document.getElementById("browser.offline-apps.notify");
var button = document.getElementById("offlineNotifyExceptions");
button.disabled = !pref.value;
return pref.value;
},
// XXX: duplicated in browser.js
_getOfflineAppUsage(perm, groups) {
let cacheService = Cc["@mozilla.org/network/application-cache-service;1"].
getService(Ci.nsIApplicationCacheService);
if (!groups) {
try {
groups = cacheService.getGroups();
} catch (ex) {
return 0;
}
}
let usage = 0;
for (let group of groups) {
let uri = Services.io.newURI(group);
if (perm.matchesURI(uri, true)) {
let cache = cacheService.getActiveCache(group);
usage += cache.usage;
}
}
return usage;
},
/**
* Updates the list of offline applications
*/
updateOfflineApps() {
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var list = document.getElementById("offlineAppsList");
while (list.firstChild) {
list.firstChild.remove();
}
var groups;
try {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
groups = cacheService.getGroups();
} catch (e) {
return;
}
var bundle = document.getElementById("bundlePreferences");
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
if (perm.type == "offline-app" &&
perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
row.setAttribute("origin", perm.principal.origin);
var converted = DownloadUtils.
convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
list.appendChild(row);
}
}
},
removeOfflineApp() {
var list = document.getElementById("offlineAppsList");
var item = list.selectedItem;
var origin = item.getAttribute("origin");
var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
var bundle = document.getElementById("bundlePreferences");
var title = bundle.getString("offlineAppRemoveTitle");
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
var confirm = bundle.getString("offlineAppRemoveConfirm");
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
null, null, null, {});
if (result != 0)
return;
// get the permission
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var perm = pm.getPermissionObject(principal, "offline-app", true);
if (perm) {
// clear offline cache entries
try {
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
var groups = cacheService.getGroups();
for (var i = 0; i < groups.length; i++) {
var uri = Services.io.newURI(groups[i]);
if (perm.matchesURI(uri, true)) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
}
}
} catch (e) {}
pm.removePermission(perm);
}
list.removeChild(item);
gPrivacyPane.offlineAppSelected();
this.updateActualAppCacheSize();
},
// Methods for Offline Apps (AppCache) end
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "sitedatamanager:updating-sites":
// While updating, we want to disable this section and display loading message until updated
this.toggleSiteData(false);
this.updateTotalDataSizeLabel(-1);
break;
case "sitedatamanager:sites-updated":
this.toggleSiteData(true);
SiteDataManager.getTotalUsage()
.then(this.updateTotalDataSizeLabel.bind(this));
break;
}
},
}; };

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше