--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -720,19 +720,16 @@ pref("plugins.favorfallback.rules", "nos
pref("browser.preferences.instantApply", false);
#else
pref("browser.preferences.instantApply", true);
#endif
// Toggling Search bar on and off in about:preferences
pref("browser.preferences.search", true);
-// Use the new in-content about:preferences in Nightly only for now
-pref("browser.preferences.useOldOrganization", false);
-
// Once the Storage Management is completed.
// (The Storage Management-related prefs are browser.storageManager.* )
// The Offline(Appcache) Group section in about:preferences will be hidden.
// And the task to clear appcache will be done by Storage Management.
#if defined(NIGHTLY_BUILD)
pref("browser.preferences.offlineGroup.enabled", false);
#else
pref("browser.preferences.offlineGroup.enabled", true);
--- a/browser/base/content/browser-data-submission-info-bar.js
+++ b/browser/base/content/browser-data-submission-info-bar.js
@@ -58,23 +58,17 @@ var gDataNotificationInfoBar = {
this._actionTaken = false;
let buttons = [{
label: gNavigatorBundle.getString("dataReportingNotification.button.label"),
accessKey: gNavigatorBundle.getString("dataReportingNotification.button.accessKey"),
popup: null,
callback: () => {
this._actionTaken = true;
- // The advanced subpanes are only supported in the old organization, which will
- // be removed by bug 1349689.
- if (Services.prefs.getBoolPref("browser.preferences.useOldOrganization")) {
- window.openAdvancedPreferences("dataChoicesTab", {origin: "dataReporting"});
- } else {
- window.openPreferences("privacy-reports", {origin: "dataReporting"});
- }
+ window.openPreferences("privacy-reports", {origin: "dataReporting"});
},
}];
this._log.info("Creating data reporting policy notification.");
this._notificationBox.appendNotification(
message,
this._DATA_REPORTING_NOTIFICATION,
null,
--- a/browser/base/content/browser-media.js
+++ b/browser/base/content/browser-media.js
@@ -164,21 +164,17 @@ var gEMEHandler = {
} else {
document.getElementById(anchorId).removeAttribute("firstplay");
}
let mainAction = {
label: gNavigatorBundle.getString(btnLabelId),
accessKey: gNavigatorBundle.getString(btnAccessKeyId),
callback() {
- if (Services.prefs.getBoolPref("browser.preferences.useOldOrganization")) {
- openPreferences("paneContent", {origin: "browserMedia"});
- } else {
- openPreferences("general-drm", {origin: "browserMedia"});
- }
+ openPreferences("general-drm", {origin: "browserMedia"});
},
dismiss: true
};
let options = {
dismissed: true,
eventCallback: aTopic => aTopic == "swapping",
learnMoreURL: Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content",
};
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -543,21 +543,17 @@ const gStoragePressureObserver = {
msg = prefStrBundle.getFormattedString(descriptionStringID, [brandShortName]);
buttons.push({
label: prefStrBundle.getString(prefButtonLabelStringID),
accessKey: prefStrBundle.getString(prefButtonAccesskeyStringID),
callback(notificationBar, button) {
// The advanced subpanes are only supported in the old organization, which will
// be removed by bug 1349689.
let win = gBrowser.ownerGlobal;
- if (Services.prefs.getBoolPref("browser.preferences.useOldOrganization")) {
- win.openAdvancedPreferences("networkTab", {origin: "storagePressure"});
- } else {
- win.openPreferences("panePrivacy", {origin: "storagePressure"});
- }
+ win.openPreferences("panePrivacy", { origin: "storagePressure" });
}
});
}
notificationBox.appendNotification(
msg, NOTIFICATION_VALUE, null, notificationBox.PRIORITY_WARNING_HIGH, buttons, null);
}
};
@@ -6527,23 +6523,17 @@ var OfflineApps = {
if (browser && browser.messageManager) {
browser.messageManager.sendAsyncMessage("OfflineApps:StartFetching", {
docId,
});
}
},
manage() {
- // The advanced subpanes are only supported in the old organization, which will
- // be removed by bug 1349689.
- if (Services.prefs.getBoolPref("browser.preferences.useOldOrganization")) {
- openAdvancedPreferences("networkTab", {origin: "offlineApps"});
- } else {
- openPreferences("panePrivacy", {origin: "offlineApps"});
- }
+ openPreferences("panePrivacy", { origin: "offlineApps" });
},
receiveMessage(msg) {
switch (msg.name) {
case "OfflineApps:CheckUsage":
let uri = makeURI(msg.data.uri);
if (this._usedMoreThanWarnQuota(uri)) {
this.warnUsage(msg.target, uri);
--- a/browser/base/content/test/alerts/browser_notification_open_settings.js
+++ b/browser/base/content/test/alerts/browser_notification_open_settings.js
@@ -1,58 +1,40 @@
"use strict";
var notificationURL = "http://example.org/browser/browser/base/content/test/alerts/file_dom_notifications.html";
-var useOldPrefs = Services.prefs.getBoolPref("browser.preferences.useOldOrganization");
-var expectedURL = useOldPrefs ? "about:preferences#content"
- : "about:preferences#privacy";
-
+var expectedURL = "about:preferences#privacy";
add_task(async function test_settingsOpen_observer() {
info("Opening a dummy tab so openPreferences=>switchToTabHavingURI doesn't use the blank tab.");
await BrowserTestUtils.withNewTab({
gBrowser,
url: "about:robots"
}, async function dummyTabTask(aBrowser) {
- // Ensure preferences is loaded before removing the tab. In the "new prefs", all categories
- // get initialized on page load since we need to be able to search them. Sync is *very*
- // slow to load and therefore we need to wait for it to load when testing the "new prefs".
- // For "old prefs" we only load the actual visited categories so we don't have this problem,
- // as well, the "sync-pane-loaded" notification is not sent on "old prefs".
- let syncPaneLoadedPromise = useOldPrefs || TestUtils.topicObserved("sync-pane-loaded", () => true);
-
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
info("simulate a notifications-open-settings notification");
let uri = NetUtil.newURI("https://example.com");
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
Services.obs.notifyObservers(principal, "notifications-open-settings");
let tab = await tabPromise;
ok(tab, "The notification settings tab opened");
- await syncPaneLoadedPromise;
await BrowserTestUtils.removeTab(tab);
});
});
add_task(async function test_settingsOpen_button() {
let pm = Services.perms;
info("Adding notification permission");
pm.add(makeURI(notificationURL), "desktop-notification", pm.ALLOW_ACTION);
try {
await BrowserTestUtils.withNewTab({
gBrowser,
url: notificationURL
}, async function tabTask(aBrowser) {
- // Ensure preferences is loaded before removing the tab. In the "new prefs", all categories
- // get initialized on page load since we need to be able to search them. Sync is *very*
- // slow to load and therefore we need to wait for it to load when testing the "new prefs".
- // For "old prefs" we only load the actual visited categories so we don't have this problem,
- // as well, the "sync-pane-loaded" notification is not sent on "old prefs".
- let syncPaneLoadedPromise = useOldPrefs || TestUtils.topicObserved("sync-pane-loaded", () => true);
-
info("Waiting for notification");
await openNotification(aBrowser, "showNotification2");
let alertWindow = Services.wm.getMostRecentWindow("alert:alert");
if (!alertWindow) {
ok(true, "Notifications don't use XUL windows on all platforms.");
await closeNotification(aBrowser);
return;
@@ -62,17 +44,16 @@ add_task(async function test_settingsOpe
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
let openSettingsMenuItem = alertWindow.document.getElementById("openSettingsMenuItem");
openSettingsMenuItem.click();
info("Waiting for notification settings tab");
let tab = await tabPromise;
ok(tab, "The notification settings tab opened");
- await syncPaneLoadedPromise;
await closePromise;
await BrowserTestUtils.removeTab(tab);
});
} finally {
info("Removing notification permission");
pm.remove(makeURI(notificationURL), "desktop-notification");
}
});
--- a/browser/base/content/test/general/browser_datachoices_notification.js
+++ b/browser/base/content/test/general/browser_datachoices_notification.js
@@ -78,25 +78,20 @@ function triggerInfoBar(expectedTimeoutM
}
var checkInfobarButton = async function(aNotification) {
// Check that the button on the data choices infobar does the right thing.
let buttons = aNotification.getElementsByTagName("button");
Assert.equal(buttons.length, 1, "There is 1 button in the data reporting notification.");
let button = buttons[0];
- // Add an observer to ensure the "advanced" pane opened (but don't bother
- // closing it - we close the entire window when done.)
- let paneLoadedPromise = promiseTopicObserved("advanced-pane-loaded");
-
// Click on the button.
button.click();
// Wait for the preferences panel to open.
- await paneLoadedPromise;
await promiseNextTick();
};
add_task(async function setup() {
const bypassNotification = Preferences.get(PREF_BYPASS_NOTIFICATION, true);
const currentPolicyVersion = Preferences.get(PREF_CURRENT_POLICY_VERSION, 1);
// Register a cleanup function to reset our preferences.
--- a/browser/base/content/test/general/browser_offlineQuotaNotification.js
+++ b/browser/base/content/test/general/browser_offlineQuotaNotification.js
@@ -10,17 +10,16 @@ const URL = "http://mochi.test:8888/brow
registerCleanupFunction(function() {
// Clean up after ourself
let uri = Services.io.newURI(URL);
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
Services.perms.removeFromPrincipal(principal, "offline-app");
Services.prefs.clearUserPref("offline-apps.quota.warn");
Services.prefs.clearUserPref("offline-apps.allow_by_default");
- Services.prefs.clearUserPref("browser.preferences.useOldOrganization");
let {OfflineAppCacheHelper} = Components.utils.import("resource:///modules/offlineAppCache.jsm", {});
OfflineAppCacheHelper.clear();
});
// Same as the other one, but for in-content preferences
function checkInContentPreferences(win) {
let doc = win.document;
let sel = doc.getElementById("categories").selectedItems[0].id;
@@ -29,17 +28,16 @@ function checkInContentPreferences(win)
// all good, we are done.
win.close();
finish();
}
function test() {
waitForExplicitFinish();
- Services.prefs.setBoolPref("browser.preferences.useOldOrganization", false);
Services.prefs.setBoolPref("offline-apps.allow_by_default", false);
// Open a new tab.
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, URL);
registerCleanupFunction(() => gBrowser.removeCurrentTab());
Promise.all([
--- a/browser/base/content/test/general/browser_storagePressure_notification.js
+++ b/browser/base/content/test/general/browser_storagePressure_notification.js
@@ -8,50 +8,23 @@ function notifyStoragePressure(usage = 1
let usageWrapper = Cc["@mozilla.org/supports-PRUint64;1"]
.createInstance(Ci.nsISupportsPRUint64);
usageWrapper.data = usage;
Services.obs.notifyObservers(usageWrapper, "QuotaManager::StoragePressure");
return notifyPromise;
}
function openAboutPrefPromise() {
- let useOldOrganization = Services.prefs.getBoolPref("browser.preferences.useOldOrganization");
- let targetURL = useOldOrganization ? "about:preferences#advanced" : "about:preferences#privacy";
let promises = [
- BrowserTestUtils.waitForLocationChange(gBrowser, targetURL),
- TestUtils.topicObserved("advanced-pane-loaded", () => true)
+ BrowserTestUtils.waitForLocationChange(gBrowser, "about:preferences#privacy"),
+ TestUtils.topicObserved("privacy-pane-loaded", () => true)
];
return Promise.all(promises);
}
-async function testOverUsageThresholdNotification() {
- await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
- await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.pressureNotification.minIntervalMS", 0]]});
- let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "https://example.com");
-
- const BYTES_IN_GIGABYTE = 1073741824;
- const USAGE_THRESHOLD_BYTES = BYTES_IN_GIGABYTE *
- Services.prefs.getIntPref("browser.storageManager.pressureNotification.usageThresholdGB");
- await notifyStoragePressure(USAGE_THRESHOLD_BYTES);
- let notificationbox = document.getElementById("high-priority-global-notificationbox");
- let notification = notificationbox.getNotificationWithValue("storage-pressure-notification");
- ok(notification instanceof XULElement, "Should display storage pressure notification");
-
- let prefBtn = notification.getElementsByTagName("button")[1];
- let aboutPrefPromise = openAboutPrefPromise();
- prefBtn.doCommand();
- await aboutPrefPromise;
- let aboutPrefTab = gBrowser.selectedTab;
- let prefDoc = gBrowser.selectedBrowser.contentDocument;
- let siteDataGroup = prefDoc.getElementById("siteDataGroup");
- is_element_visible(siteDataGroup, "Should open to the siteDataGroup section in about:preferences");
- await BrowserTestUtils.removeTab(aboutPrefTab);
- await BrowserTestUtils.removeTab(tab);
-}
-
// Test only displaying notification once within the given interval
add_task(async function() {
const TEST_NOTIFICATION_INTERVAL_MS = 2000;
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.pressureNotification.minIntervalMS", TEST_NOTIFICATION_INTERVAL_MS]]});
await notifyStoragePressure();
let notificationbox = document.getElementById("high-priority-global-notificationbox");
@@ -67,22 +40,38 @@ add_task(async function() {
await notifyStoragePressure();
notification = notificationbox.getNotificationWithValue("storage-pressure-notification");
ok(notification instanceof XULElement, "Should display storage pressure notification after the given interval");
notification.close();
});
// Test guiding user to the about:preferences when usage exceeds the given threshold
add_task(async function() {
- // Test for the old about:preferences
- await SpecialPowers.pushPrefEnv({set: [["browser.preferences.useOldOrganization", true]]});
- await testOverUsageThresholdNotification();
- // Test for the new about:preferences
- await SpecialPowers.pushPrefEnv({set: [["browser.preferences.useOldOrganization", false]]});
- await testOverUsageThresholdNotification();
+ await SpecialPowers.pushPrefEnv({ set: [["browser.storageManager.enabled", true]] });
+ await SpecialPowers.pushPrefEnv({ set: [["browser.storageManager.pressureNotification.minIntervalMS", 0]] });
+ let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "https://example.com");
+
+ const BYTES_IN_GIGABYTE = 1073741824;
+ const USAGE_THRESHOLD_BYTES = BYTES_IN_GIGABYTE *
+ Services.prefs.getIntPref("browser.storageManager.pressureNotification.usageThresholdGB");
+ await notifyStoragePressure(USAGE_THRESHOLD_BYTES);
+ let notificationbox = document.getElementById("high-priority-global-notificationbox");
+ let notification = notificationbox.getNotificationWithValue("storage-pressure-notification");
+ ok(notification instanceof XULElement, "Should display storage pressure notification");
+
+ let prefBtn = notification.getElementsByTagName("button")[1];
+ let aboutPrefPromise = openAboutPrefPromise();
+ prefBtn.doCommand();
+ await aboutPrefPromise;
+ let aboutPrefTab = gBrowser.selectedTab;
+ let prefDoc = gBrowser.selectedBrowser.contentDocument;
+ let siteDataGroup = prefDoc.getElementById("siteDataGroup");
+ is_element_visible(siteDataGroup, "Should open to the siteDataGroup section in about:preferences");
+ await BrowserTestUtils.removeTab(aboutPrefTab);
+ await BrowserTestUtils.removeTab(tab);
});
// Test not displaying the 2nd notification if one is already being displayed
add_task(async function() {
const TEST_NOTIFICATION_INTERVAL_MS = 0;
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.pressureNotification.minIntervalMS", TEST_NOTIFICATION_INTERVAL_MS]]});
--- a/browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
@@ -6,17 +6,17 @@ const {TabStateFlusher} = Cu.import("res
/**
* Test what happens if loading a URL that should clear the
* location bar after a parent process URL.
*/
add_task(async function clearURLBarAfterParentProcessURL() {
let tab = await new Promise(resolve => {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:preferences");
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
- newTabBrowser.addEventListener("Initialized", function() {
+ newTabBrowser.addEventListener("Initialized", async function() {
resolve(gBrowser.selectedTab);
}, {capture: true, once: true});
});
document.getElementById("home-button").click();
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
is(gURLBar.value, "", "URL bar should be empty");
is(tab.linkedBrowser.userTypedValue, null, "The browser should have no recorded userTypedValue");
await BrowserTestUtils.removeTab(tab);
@@ -25,17 +25,17 @@ add_task(async function clearURLBarAfter
/**
* Same as above, but open the tab without passing the URL immediately
* which changes behaviour in tabbrowser.xml.
*/
add_task(async function clearURLBarAfterParentProcessURLInExistingTab() {
let tab = await new Promise(resolve => {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
- newTabBrowser.addEventListener("Initialized", function() {
+ newTabBrowser.addEventListener("Initialized", async function() {
resolve(gBrowser.selectedTab);
}, {capture: true, once: true});
newTabBrowser.loadURI("about:preferences");
});
document.getElementById("home-button").click();
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
is(gURLBar.value, "", "URL bar should be empty");
is(tab.linkedBrowser.userTypedValue, null, "The browser should have no recorded userTypedValue");
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -731,27 +731,16 @@ function openAboutDialog() {
function openPreferences(paneID, extraArgs) {
let histogram = Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA");
if (extraArgs && extraArgs.origin) {
histogram.add(extraArgs.origin);
} else {
histogram.add("other");
}
- function switchToAdvancedSubPane(doc) {
- if (extraArgs && extraArgs.advancedTab) {
- // After the Preferences reorg works in Bug 1335907, no more advancedPrefs element.
- // The old Preference is pref-off behind `browser.preferences.useOldOrganization` on Nightly.
- // During the transition between the old and new Preferences, should do checking before proceeding.
- let advancedPaneTabs = doc.getElementById("advancedPrefs");
- if (advancedPaneTabs) {
- advancedPaneTabs.selectedTab = doc.getElementById(extraArgs.advancedTab);
- }
- }
- }
// This function is duplicated from preferences.js.
function internalPrefCategoryNameToFriendlyName(aName) {
return (aName || "").replace(/^pane./, function(toReplace) { return toReplace[4].toLowerCase(); });
}
let win = Services.wm.getMostRecentWindow("navigator:browser");
let friendlyCategoryName = internalPrefCategoryNameToFriendlyName(paneID);
@@ -761,64 +750,56 @@ function openPreferences(paneID, extraAr
let urlParams = extraArgs.urlParams;
for (let name in urlParams) {
if (urlParams[name] !== undefined) {
params.set(name, urlParams[name]);
}
}
}
let preferencesURL = "about:preferences" + (params ? "?" + params : "") +
- (friendlyCategoryName ? "#" + friendlyCategoryName : "");
+ (friendlyCategoryName ? "#" + friendlyCategoryName : "");
let newLoad = true;
let browser = null;
if (!win) {
const Cc = Components.classes;
const Ci = Components.interfaces;
let windowArguments = Cc["@mozilla.org/array;1"]
- .createInstance(Ci.nsIMutableArray);
+ .createInstance(Ci.nsIMutableArray);
let supportsStringPrefURL = Cc["@mozilla.org/supports-string;1"]
- .createInstance(Ci.nsISupportsString);
+ .createInstance(Ci.nsISupportsString);
supportsStringPrefURL.data = preferencesURL;
windowArguments.appendElement(supportsStringPrefURL);
win = Services.ww.openWindow(null, Services.prefs.getCharPref("browser.chromeURL"),
- "_blank", "chrome,dialog=no,all", windowArguments);
+ "_blank", "chrome,dialog=no,all", windowArguments);
} else {
let shouldReplaceFragment = friendlyCategoryName ? "whenComparingAndReplace" : "whenComparing";
newLoad = !win.switchToTabHavingURI(preferencesURL, true, {
ignoreFragment: shouldReplaceFragment,
replaceQueryString: true,
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
});
browser = win.gBrowser.selectedBrowser;
}
if (newLoad) {
- Services.obs.addObserver(function advancedPaneLoadedObs(prefWin, topic, data) {
+ Services.obs.addObserver(function panesLoadedObs(prefWin, topic, data) {
if (!browser) {
browser = win.gBrowser.selectedBrowser;
}
if (prefWin != browser.contentWindow) {
return;
}
- Services.obs.removeObserver(advancedPaneLoadedObs, "advanced-pane-loaded");
- switchToAdvancedSubPane(browser.contentDocument);
- }, "advanced-pane-loaded");
- } else {
- if (paneID) {
- browser.contentWindow.gotoPref(paneID);
- }
- switchToAdvancedSubPane(browser.contentDocument);
+ Services.obs.removeObserver(panesLoadedObs, "sync-pane-loaded");
+ }, "sync-pane-loaded");
+ } else if (paneID) {
+ browser.contentWindow.gotoPref(paneID);
}
}
-function openAdvancedPreferences(tabID, origin) {
- openPreferences("paneAdvanced", { "advancedTab": tabID, origin });
-}
-
/**
* Opens the troubleshooting information (about:support) page for this version
* of the application.
*/
function openTroubleshootingPage() {
openUILinkIn("about:support", "tab");
}
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -16,17 +16,16 @@
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"
namespace mozilla {
namespace browser {
NS_IMPL_ISUPPORTS(AboutRedirector, nsIAboutModule)
-bool AboutRedirector::sUseOldPreferences = false;
bool AboutRedirector::sActivityStreamEnabled = false;
bool AboutRedirector::sActivityStreamAboutHomeEnabled = false;
struct RedirEntry {
const char* id;
const char* url;
uint32_t flags;
};
@@ -145,38 +144,30 @@ AboutRedirector::NewChannel(nsIURI* aURI
NS_ASSERTION(result, "must not be null");
nsAutoCString path = GetAboutModuleName(aURI);
nsresult rv;
nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
NS_ENSURE_SUCCESS(rv, rv);
- static bool sPrefCacheInited = false;
- if (!sPrefCacheInited) {
- Preferences::AddBoolVarCache(&sUseOldPreferences,
- "browser.preferences.useOldOrganization");
- sPrefCacheInited = true;
- }
LoadActivityStreamPrefs();
for (auto & redir : kRedirMap) {
if (!strcmp(path.get(), redir.id)) {
nsAutoCString url;
if (path.EqualsLiteral("newtab") ||
(path.EqualsLiteral("home") && sActivityStreamEnabled && sActivityStreamAboutHomeEnabled)) {
// let the aboutNewTabService decide where to redirect
nsCOMPtr<nsIAboutNewTabService> aboutNewTabService =
do_GetService("@mozilla.org/browser/aboutnewtab-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = aboutNewTabService->GetDefaultURL(url);
NS_ENSURE_SUCCESS(rv, rv);
- } else if (path.EqualsLiteral("preferences") && !sUseOldPreferences) {
- url.AssignASCII("chrome://browser/content/preferences/in-content-new/preferences.xul");
}
// fall back to the specified url in the map
if (url.IsEmpty()) {
url.AssignASCII(redir.url);
}
nsCOMPtr<nsIChannel> tempChannel;
nsCOMPtr<nsIURI> tempURI;
--- a/browser/components/about/AboutRedirector.h
+++ b/browser/components/about/AboutRedirector.h
@@ -21,17 +21,16 @@ public:
static nsresult
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
protected:
virtual ~AboutRedirector() {}
private:
- static bool sUseOldPreferences;
static bool sActivityStreamEnabled;
static bool sActivityStreamAboutHomeEnabled;
static void LoadActivityStreamPrefs();
};
} // namespace browser
} // namespace mozilla
--- a/browser/components/customizableui/test/browser_1087303_button_preferences.js
+++ b/browser/components/customizableui/test/browser_1087303_button_preferences.js
@@ -39,17 +39,18 @@ add_task(function asyncCleanup() {
function waitForPageLoad(aTab) {
return new Promise((resolve, reject) => {
let timeoutId = setTimeout(() => {
aTab.linkedBrowser.removeEventListener("load", onTabLoad, true);
reject("Page didn't load within " + 20000 + "ms");
}, 20000);
- function onTabLoad(event) {
+ async function onTabLoad(event) {
clearTimeout(timeoutId);
aTab.linkedBrowser.removeEventListener("load", onTabLoad, true);
info("Tab event received: load");
resolve();
- }
+ }
+
aTab.linkedBrowser.addEventListener("load", onTabLoad, true, true);
});
}
--- a/browser/components/customizableui/test/browser_synced_tabs_menu.js
+++ b/browser/components/customizableui/test/browser_synced_tabs_menu.js
@@ -87,17 +87,17 @@ async function openPrefsFromMenuPanel(ex
let subpanel = document.getElementById(expectedPanelId)
ok(!subpanel.hidden, "sync setup element is visible");
// Find and click the "setup" button.
let setupButton = subpanel.querySelector(".PanelUI-remotetabs-prefs-button");
setupButton.click();
await new Promise(resolve => {
- let handler = (e) => {
+ let handler = async(e) => {
if (e.originalTarget != gBrowser.selectedBrowser.contentDocument ||
e.target.location.href == "about:blank") {
info("Skipping spurious 'load' event for " + e.target.location.href);
return;
}
gBrowser.selectedBrowser.removeEventListener("load", handler, true);
resolve();
}
--- a/browser/components/feeds/FeedWriter.js
+++ b/browser/components/feeds/FeedWriter.js
@@ -824,17 +824,17 @@ FeedWriter.prototype = {
// window object.
return;
}
LOG(`received message from parent ${msg.name}`);
switch (msg.name) {
case "FeedWriter:PreferenceUpdated":
// This is called when browser-feeds.js spots a pref change
// This will happen when
- // - about:preferences#applications changes
+ // - about:preferences#general changes
// - another feed reader page changes the preference
// - when this page itself changes the select and there isn't a redirect
// bookmarks and launching an external app means the page stays open after subscribe
const feedType = this._getFeedType();
LOG(`Got prefChange! ${JSON.stringify(msg.data)} current type: ${feedType}`);
let feedTypePref = msg.data.default;
if (feedType in msg.data) {
feedTypePref = msg.data[feedType];
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -296,21 +296,17 @@ BrowserGlue.prototype = {
Cu.import("resource://services-sync/main.js");
Weave.Service.scheduler.delayedAutoConnect(delay);
},
// nsIObserver implementation
observe: function BG_observe(subject, topic, data) {
switch (topic) {
case "notifications-open-settings":
- if (Services.prefs.getBoolPref("browser.preferences.useOldOrganization")) {
- this._openPreferences("content", { origin: "notifOpenSettings" });
- } else {
- this._openPreferences("privacy", { origin: "notifOpenSettings" });
- }
+ this._openPreferences("privacy", { origin: "notifOpenSettings" });
break;
case "prefservice:after-app-defaults":
this._onAppDefaults();
break;
case "final-ui-startup":
this._beforeUIStartup();
break;
case "browser-delayed-startup-finished":
--- a/browser/components/preferences/applicationManager.js
+++ b/browser/components/preferences/applicationManager.js
@@ -1,35 +1,25 @@
// 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 in-content/applications.js */
+/* import-globals-from in-content/main.js */
var Cc = Components.classes;
var Ci = Components.interfaces;
var gAppManagerDialog = {
_removed: [],
init: function appManager_init() {
this.handlerInfo = window.arguments[0];
- // The applicationManager will be used
- // in in-content's gApplicationsPane and in-content-new's gMainPane.
- // Remove this once we use the in-content-new preferences page.
- var pane;
- if (Services.prefs.getBoolPref("browser.preferences.useOldOrganization")) {
- Services.scriptloader.loadSubScript("chrome://browser/content/preferences/in-content/applications.js",
- window);
- pane = gApplicationsPane;
- } else {
- Services.scriptloader.loadSubScript("chrome://browser/content/preferences/in-content-new/main.js",
- window);
- pane = gMainPane;
- }
+ Services.scriptloader.loadSubScript("chrome://browser/content/preferences/in-content/main.js",
+ window);
+ var pane = gMainPane;
var bundle = document.getElementById("appManagerBundle");
var contentText;
if (this.handlerInfo.type == TYPE_MAYBE_FEED)
contentText = bundle.getString("handleWebFeeds");
else {
var description = pane._describeType(this.handlerInfo);
var key =
(this.handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) ? "handleFile"
--- a/browser/components/preferences/handlers.xml
+++ b/browser/components/preferences/handlers.xml
@@ -1,14 +1,14 @@
<?xml version="1.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 in-content/applications.js -->
+<!-- import-globals-from in-content/main.js -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % applicationsDTD SYSTEM "chrome://browser/locale/preferences/applications.dtd">
<!ENTITY % containersDTD SYSTEM "chrome://browser/locale/preferences/containers.dtd">
%brandDTD;
%applicationsDTD;
%containersDTD;
@@ -51,32 +51,26 @@
<xul:hbox flex="1" align="center" xbl:inherits="tooltiptext=typeDescription">
<xul:image src="moz-icon://goat?size=16" class="typeIcon"
xbl:inherits="src=typeIcon" height="16" width="16"/>
<xul:label flex="1" crop="end" xbl:inherits="value=typeDescription"/>
</xul:hbox>
<xul:hbox flex="1">
<xul:menulist class="actionsMenu" flex="1" crop="end" selectedIndex="1"
xbl:inherits="tooltiptext=actionDescription"
- oncommand="Services.prefs.getBoolPref('browser.preferences.useOldOrganization') ?
- gApplicationsPane.onSelectAction(event.originalTarget) :
- gMainPane.onSelectAction(event.originalTarget)">
+ oncommand="gMainPane.onSelectAction(event.originalTarget)">
<xul:menupopup/>
</xul:menulist>
</xul:hbox>
</xul:hbox>
</content>
<implementation>
<constructor>
- if (Services.prefs.getBoolPref("browser.preferences.useOldOrganization")) {
- gApplicationsPane.rebuildActionsMenu();
- } else {
- gMainPane.rebuildActionsMenu();
- }
+ gMainPane.rebuildActionsMenu();
</constructor>
</implementation>
</binding>
<binding id="container">
<content>
<xul:hbox flex="1" equalsize="always">
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/containers.js
+++ /dev/null
@@ -1,99 +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/ContextualIdentityService.jsm");
-
-const containersBundle = Services.strings.createBundle("chrome://browser/locale/preferences/containers.properties");
-
-const defaultContainerIcon = "fingerprint";
-const defaultContainerColor = "blue";
-
-let gContainersPane = {
-
- init() {
- this._list = document.getElementById("containersView");
-
- document.getElementById("backContainersLink").addEventListener("click", function() {
- gotoPref("general");
- });
-
- this._rebuildView();
- },
-
- _rebuildView() {
- const containers = ContextualIdentityService.getPublicIdentities();
- while (this._list.firstChild) {
- this._list.firstChild.remove();
- }
- for (let container of containers) {
- let item = document.createElement("richlistitem");
- item.setAttribute("containerName", ContextualIdentityService.getUserContextLabel(container.userContextId));
- item.setAttribute("containerIcon", container.icon);
- item.setAttribute("containerColor", container.color);
- item.setAttribute("userContextId", container.userContextId);
-
- this._list.appendChild(item);
- }
- },
-
- async onRemoveClick(button) {
- let userContextId = parseInt(button.getAttribute("value"), 10);
-
- let count = ContextualIdentityService.countContainerTabs(userContextId);
- if (count > 0) {
- let bundlePreferences = document.getElementById("bundlePreferences");
-
- let title = bundlePreferences.getString("removeContainerAlertTitle");
- let message = PluralForm.get(count, bundlePreferences.getString("removeContainerMsg"))
- .replace("#S", count)
- let okButton = bundlePreferences.getString("removeContainerOkButton");
- let cancelButton = bundlePreferences.getString("removeContainerButton2");
-
- 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) {
- return;
- }
-
- await ContextualIdentityService.closeContainerTabs(userContextId);
- }
-
- ContextualIdentityService.remove(userContextId);
- this._rebuildView();
- },
-
- onPreferenceClick(button) {
- this.openPreferenceDialog(button.getAttribute("value"));
- },
-
- onAddButtonClick(button) {
- this.openPreferenceDialog(null);
- },
-
- openPreferenceDialog(userContextId) {
- let identity = {
- name: "",
- icon: defaultContainerIcon,
- color: defaultContainerColor
- };
- let title;
- if (userContextId) {
- identity = ContextualIdentityService.getPublicIdentityFromId(userContextId);
- // This is required to get the translation string from defaults
- identity.name = ContextualIdentityService.getUserContextLabel(identity.userContextId);
- title = containersBundle.formatStringFromName("containers.updateContainerTitle", [identity.name], 1);
- }
-
- const params = { userContextId, identity, windowTitle: title };
- gSubDialog.open("chrome://browser/content/preferences/containers.xul",
- null, params);
- }
-
-};
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/containers.xul
+++ /dev/null
@@ -1,45 +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/.
-
-<!-- Containers panel -->
-
-<script type="application/javascript"
- src="chrome://browser/content/preferences/in-content-new/containers.js"/>
-
-<preferences id="containerPreferences" hidden="true" data-category="paneContainer">
- <!-- Containers -->
- <preference id="privacy.userContext.enabled"
- name="privacy.userContext.enabled"
- type="bool"/>
-
-</preferences>
-
-<hbox hidden="true"
- class="container-header-links"
- data-category="paneContainers">
- <label class="text-link" id="backContainersLink">&backLink2.label;</label>
-</hbox>
-
-<hbox id="header-containers"
- class="header"
- hidden="true"
- data-category="paneContainers">
- <label class="header-name" flex="1">&paneContainers.title;</label>
-</hbox>
-
-<!-- Containers -->
-<groupbox id="browserContainersGroupPane" data-category="paneContainers" hidden="true"
- data-hidden-from-search="true" data-subpanel="true">
- <vbox id="browserContainersbox">
-
- <richlistbox id="containersView" orient="vertical" persist="lastSelectedType"
- flex="1">
- </richlistbox>
- </vbox>
- <vbox>
- <hbox flex="1">
- <button onclick="gContainersPane.onAddButtonClick();" accesskey="&addButton.accesskey;" label="&addButton.label;"/>
- </hbox>
- </vbox>
-</groupbox>
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/jar.mn
+++ /dev/null
@@ -1,15 +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-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/search.js
- content/browser/preferences/in-content-new/privacy.js
- content/browser/preferences/in-content-new/containers.js
- content/browser/preferences/in-content-new/sync.js
- content/browser/preferences/in-content-new/findInPage.js
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/main.js
+++ /dev/null
@@ -1,3263 +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 */
-/* import-globals-from ../../../../toolkit/mozapps/preferences/fontbuilder.js */
-/* import-globals-from ../../../base/content/aboutDialog-appUpdater.js */
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-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");
-Components.utils.import("resource://gre/modules/Services.jsm");
-Components.utils.import("resource://gre/modules/AppConstants.jsm");
-Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
-Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "CloudStorage",
- "resource://gre/modules/CloudStorage.jsm");
-
-// Constants & Enumeration Values
-const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.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_PDF = "application/pdf";
-
-const PREF_PDFJS_DISABLED = "pdfjs.disabled";
-const TOPIC_PDFJS_HANDLER_CHANGED = "pdfjs:handlerChanged";
-
-const PREF_DISABLED_PLUGIN_TYPES = "plugin.disable_full_page_plugin_for_types";
-
-// Preferences that affect which entries to show in the list.
-const PREF_SHOW_PLUGINS_IN_LIST = "browser.download.show_plugins_in_list";
-const PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS =
- "browser.download.hide_plugins_without_extensions";
-
-/*
- * Preferences where we store handling information about the feed type.
- *
- * browser.feeds.handler
- * - "bookmarks", "reader" (clarified further using the .default preference),
- * or "ask" -- indicates the default handler being used to process feeds;
- * "bookmarks" is obsolete; to specify that the handler is bookmarks,
- * set browser.feeds.handler.default to "bookmarks";
- *
- * browser.feeds.handler.default
- * - "bookmarks", "client" or "web" -- indicates the chosen feed reader used
- * to display feeds, either transiently (i.e., when the "use as default"
- * checkbox is unchecked, corresponds to when browser.feeds.handler=="ask")
- * or more permanently (i.e., the item displayed in the dropdown in Feeds
- * preferences)
- *
- * browser.feeds.handler.webservice
- * - the URL of the currently selected web service used to read feeds
- *
- * browser.feeds.handlers.application
- * - nsIFile, stores the current client-side feed reading app if one has
- * been chosen
- */
-const PREF_FEED_SELECTED_APP = "browser.feeds.handlers.application";
-const PREF_FEED_SELECTED_WEB = "browser.feeds.handlers.webservice";
-const PREF_FEED_SELECTED_ACTION = "browser.feeds.handler";
-const PREF_FEED_SELECTED_READER = "browser.feeds.handler.default";
-
-const PREF_VIDEO_FEED_SELECTED_APP = "browser.videoFeeds.handlers.application";
-const PREF_VIDEO_FEED_SELECTED_WEB = "browser.videoFeeds.handlers.webservice";
-const PREF_VIDEO_FEED_SELECTED_ACTION = "browser.videoFeeds.handler";
-const PREF_VIDEO_FEED_SELECTED_READER = "browser.videoFeeds.handler.default";
-
-const PREF_AUDIO_FEED_SELECTED_APP = "browser.audioFeeds.handlers.application";
-const PREF_AUDIO_FEED_SELECTED_WEB = "browser.audioFeeds.handlers.webservice";
-const PREF_AUDIO_FEED_SELECTED_ACTION = "browser.audioFeeds.handler";
-const PREF_AUDIO_FEED_SELECTED_READER = "browser.audioFeeds.handler.default";
-
-// The nsHandlerInfoAction enumeration values in nsIHandlerInfo identify
-// the actions the application can take with content of various types.
-// But since nsIHandlerInfo doesn't support plugins, there's no value
-// identifying the "use plugin" action, so we use this constant instead.
-const kActionUsePlugin = 5;
-
-const ICON_URL_APP = AppConstants.platform == "linux" ?
- "moz-icon://dummy.exe?size=16" :
- "chrome://browser/skin/preferences/application.png";
-
-// For CSS. Can be one of "ask", "save", "plugin" or "feed". If absent, the icon URL
-// was set by us to a custom handler icon and CSS should not try to override it.
-const APP_ICON_ATTR_NAME = "appHandlerIcon";
-
-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 = {
- // The set of types the app knows how to handle. A hash of HandlerInfoWrapper
- // objects, indexed by type.
- _handledTypes: {},
-
- // The list of types we can show, sorted by the sort column/direction.
- // An array of HandlerInfoWrapper objects. We build this list when we first
- // load the data and then rebuild it when users change a pref that affects
- // what types we can show or change the sort column/direction.
- // Note: this isn't necessarily the list of types we *will* show; if the user
- // provides a filter string, we'll only show the subset of types in this list
- // that match that string.
- _visibleTypes: [],
-
- // A count of the number of times each visible type description appears.
- // We use these counts to determine whether or not to annotate descriptions
- // with their types to distinguish duplicate descriptions from each other.
- // A hash of integer counts, indexed by string description.
- _visibleTypeDescriptionCount: {},
-
-
- // Convenience & Performance Shortcuts
-
- // These get defined by init().
- _brandShortName: null,
- _prefsBundle: null,
- _list: null,
- _filter: null,
-
- _prefSvc: Cc["@mozilla.org/preferences-service;1"].
- getService(Ci.nsIPrefBranch),
-
- _mimeSvc: Cc["@mozilla.org/mime;1"].
- getService(Ci.nsIMIMEService),
-
- _helperAppSvc: Cc["@mozilla.org/uriloader/external-helper-app-service;1"].
- getService(Ci.nsIExternalHelperAppService),
-
- _handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
- getService(Ci.nsIHandlerService),
-
- _ioSvc: Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService),
-
- _backoffIndex: 0,
-
- /**
- * Initialization of this.
- */
- init() {
- function setEventListener(aId, aEventType, aCallback) {
- document.getElementById(aId)
- .addEventListener(aEventType, aCallback.bind(gMainPane));
- }
-
- if (AppConstants.HAVE_SHELL_SERVICE) {
- this.updateSetDefaultBrowser();
- let win = Services.wm.getMostRecentWindow("navigator:browser");
-
- // Exponential backoff mechanism will delay the polling times if user doesn't
- // trigger SetDefaultBrowser for a long time.
- let backoffTimes = [1000, 1000, 1000, 1000, 2000, 2000, 2000, 5000, 5000, 10000];
-
- let pollForDefaultBrowser = () => {
- let uri = win.gBrowser.currentURI.spec;
-
- if ((uri == "about:preferences" || uri == "about:preferences#general") &&
- document.visibilityState == "visible") {
- this.updateSetDefaultBrowser();
- }
-
- // approximately a "requestIdleInterval"
- window.setTimeout(() => {
- window.requestIdleCallback(pollForDefaultBrowser);
- }, backoffTimes[this._backoffIndex + 1 < backoffTimes.length ?
- this._backoffIndex++ : backoffTimes.length - 1]);
- };
-
- window.setTimeout(() => {
- window.requestIdleCallback(pollForDefaultBrowser);
- }, backoffTimes[this._backoffIndex]);
- }
-
- this.initBrowserContainers();
- this.buildContentProcessCountMenuList();
-
- let performanceSettingsLink = document.getElementById("performanceSettingsLearnMore");
- let performanceSettingsUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "performance";
- performanceSettingsLink.setAttribute("href", performanceSettingsUrl);
-
- this.updateDefaultPerformanceSettingsPref();
-
- let defaultPerformancePref =
- document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
- defaultPerformancePref.addEventListener("change", () => {
- this.updatePerformanceSettingsBox({duringChangeEvent: true});
- });
- this.updatePerformanceSettingsBox({duringChangeEvent: false});
-
- // 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);
- 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("chooseLanguage", "command",
- gMainPane.showLanguages);
- setEventListener("translationAttributionImage", "click",
- gMainPane.openTranslationProviderAttribution);
- setEventListener("translateButton", "command",
- gMainPane.showTranslationExceptions);
- setEventListener("font.language.group", "change",
- gMainPane._rebuildFonts);
- setEventListener("advancedFonts", "command",
- gMainPane.configureFonts);
- setEventListener("colors", "command",
- gMainPane.configureColors);
- setEventListener("layers.acceleration.disabled", "change",
- gMainPane.updateHardwareAcceleration);
- setEventListener("connectionSettings", "command",
- gMainPane.showConnections);
- setEventListener("browserContainersCheckbox", "command",
- gMainPane.checkBrowserContainers);
- setEventListener("browserContainersSettings", "command",
- gMainPane.showContainerSettings);
-
- // Initializes the fonts dropdowns displayed in this pane.
- this._rebuildFonts();
-
- this.updateOnScreenKeyboardVisibility();
-
- // Show translation preferences if we may:
- const prefName = "browser.translation.ui.show";
- if (Services.prefs.getBoolPref(prefName)) {
- let row = document.getElementById("translationBox");
- row.removeAttribute("hidden");
- // Showing attribution only for Bing Translator.
- Components.utils.import("resource:///modules/translation/Translation.jsm");
- if (Translation.translationEngine == "bing") {
- document.getElementById("bingAttribution").removeAttribute("hidden");
- }
- }
-
- 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;
- })
- .catch(Cu.reportError);
- }
-
- // Initialize the Firefox Updates section.
- 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",
- gMainPane.updateWritePrefs);
- setEventListener("showUpdateHistory", "command",
- gMainPane.showUpdates);
- }
-
- // Initilize Application section.
- // Initialize shortcuts to some commonly accessed elements & values.
- this._brandShortName =
- document.getElementById("bundleBrand").getString("brandShortName");
- this._prefsBundle = document.getElementById("bundlePreferences");
- this._list = document.getElementById("handlersView");
- this._filter = document.getElementById("filter");
-
- // Observe preferences that influence what we display so we can rebuild
- // the view when they change.
- this._prefSvc.addObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
- this._prefSvc.addObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
- this._prefSvc.addObserver(PREF_FEED_SELECTED_APP, this);
- this._prefSvc.addObserver(PREF_FEED_SELECTED_WEB, this);
- this._prefSvc.addObserver(PREF_FEED_SELECTED_ACTION, this);
- this._prefSvc.addObserver(PREF_FEED_SELECTED_READER, this);
-
- this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_APP, this);
- this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_WEB, this);
- this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this);
- this._prefSvc.addObserver(PREF_VIDEO_FEED_SELECTED_READER, this);
-
- this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_APP, this);
- this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
- this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
- this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
-
- setEventListener("filter", "command", gMainPane.filter);
- setEventListener("handlersView", "select",
- gMainPane.onSelectionChanged);
- setEventListener("typeColumn", "click", gMainPane.sort);
- setEventListener("actionColumn", "click", gMainPane.sort);
- setEventListener("chooseFolder", "command", gMainPane.chooseFolder);
- setEventListener("browser.download.dir", "change", gMainPane.displayDownloadDirPref);
- setEventListener("saveWhere", "command", gMainPane.handleSaveToCommand);
-
- // Listen for window unload so we can remove our preference observers.
- window.addEventListener("unload", this);
-
- // Figure out how we should be sorting the list. We persist sort settings
- // across sessions, so we can't assume the default sort column/direction.
- // XXX should we be using the XUL sort service instead?
- if (document.getElementById("actionColumn").hasAttribute("sortDirection")) {
- this._sortColumn = document.getElementById("actionColumn");
- // The typeColumn element always has a sortDirection attribute,
- // either because it was persisted or because the default value
- // from the xul file was used. If we are sorting on the other
- // column, we should remove it.
- document.getElementById("typeColumn").removeAttribute("sortDirection");
- } else {
- this._sortColumn = document.getElementById("typeColumn");
- }
-
- // Load the data and build the list of handlers.
- // By doing this in a timeout, we let the preferences dialog resize itself
- // to an appropriate size before we add a bunch of items to the list.
- // Otherwise, if there are many items, and the Applications prefpane
- // is the one that gets displayed when the user first opens the dialog,
- // the dialog might stretch too much in an attempt to fit them all in.
- // XXX Shouldn't we perhaps just set a max-height on the richlistbox?
- var _delayedPaneLoad = function(self) {
- self._loadData();
- self._rebuildVisibleTypes();
- self._sortVisibleTypes();
- self._rebuildView();
- }
- setTimeout(_delayedPaneLoad, 0, this);
-
- let browserBundle = document.getElementById("browserBundle");
- appendSearchKeywords("browserContainersSettings", [
- browserBundle.getString("userContextPersonal.label"),
- browserBundle.getString("userContextWork.label"),
- browserBundle.getString("userContextBanking.label"),
- browserBundle.getString("userContextShopping.label"),
- ]);
-
- // Notify observers that the UI is now ready
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .notifyObservers(window, "main-pane-loaded");
- },
-
- /**
- * Show the Containers UI depending on the privacy.userContext.ui.enabled pref.
- */
- initBrowserContainers() {
- 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("browserContainersbox").setAttribute("data-hidden-from-search", "true");
- 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");
- },
-
- isE10SEnabled() {
- let e10sEnabled;
- try {
- let e10sStatus = Components.classes["@mozilla.org/supports-PRUint64;1"]
- .createInstance(Ci.nsISupportsPRUint64);
- let appinfo = Services.appinfo.QueryInterface(Ci.nsIObserver);
- appinfo.observe(e10sStatus, "getE10SBlocked", "");
- e10sEnabled = e10sStatus.data < 2;
- } catch (e) {
- e10sEnabled = false;
- }
-
- return e10sEnabled;
- },
-
- 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;
- },
-
- /**
- * 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;
- },
-
- /**
- * 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 group = document.getElementById("browserStartupPage");
- let option = document.getElementById("browserStartupLastSession");
- if (pbAutoStartPref.value) {
- option.setAttribute("disabled", "true");
- if (option.selected) {
- group.selectedItem = document.getElementById("browserStartupHomePage");
- }
- } else {
- option.removeAttribute("disabled");
- startupPref.updateElements(); // select the correct radio in the startup group
- }
- },
-
- // 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;
-
- // Reset exponential backoff delay time in order to do visual update in pollForDefaultBrowser.
- this._backoffIndex = 0;
-
- 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;
- }
- },
-
- /**
- * Shows a dialog in which the preferred language for web content may be set.
- */
- showLanguages() {
- gSubDialog.open("chrome://browser/content/preferences/languages.xul");
- },
-
- /**
- * Displays the translation exceptions dialog where specific site and language
- * translation preferences can be set.
- */
- showTranslationExceptions() {
- gSubDialog.open("chrome://browser/content/preferences/translation.xul");
- },
-
- openTranslationProviderAttribution() {
- Components.utils.import("resource:///modules/translation/Translation.jsm");
- Translation.openProviderAttribution();
- },
-
- /**
- * Displays the fonts dialog, where web page font names and sizes can be
- * configured.
- */
- configureFonts() {
- gSubDialog.open("chrome://browser/content/preferences/fonts.xul", "resizable=no");
- },
-
- /**
- * Displays the colors dialog, where default web page/link/etc. colors can be
- * configured.
- */
- configureColors() {
- gSubDialog.open("chrome://browser/content/preferences/colors.xul", "resizable=no");
- },
-
- // NETWORK
- /**
- * Displays a dialog in which proxy settings may be changed.
- */
- showConnections() {
- gSubDialog.open("chrome://browser/content/preferences/connection.xul");
- },
-
- 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) {
- Services.prefs.setBoolPref("privacy.userContext.enabled", false);
- return;
- }
-
- checkbox.checked = true;
- },
-
- /**
- * Displays container panel for customising and adding containers.
- */
- showContainerSettings() {
- gotoPref("containers");
- },
-
- /**
- * 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)
- */
- 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;
- }
- }
- },
-
- updateHardwareAcceleration() {
- // Placeholder for restart on change
- },
-
- // FONTS
-
- /**
- * Populates the default font list in UI.
- */
- _rebuildFonts() {
- var preferences = document.getElementById("mainPreferences");
- // Ensure preferences are "visible" to ensure bindings work.
- preferences.hidden = false;
- // Force flush:
- preferences.clientHeight;
- var langGroupPref = document.getElementById("font.language.group");
- this._selectDefaultLanguageGroup(langGroupPref.value,
- this._readDefaultFontTypeForLanguage(langGroupPref.value) == "serif");
- },
-
- /**
- * Returns the type of the current default font for the language denoted by
- * aLanguageGroup.
- */
- _readDefaultFontTypeForLanguage(aLanguageGroup) {
- const kDefaultFontType = "font.default.%LANG%";
- var defaultFontTypePref = kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
- var preference = document.getElementById(defaultFontTypePref);
- if (!preference) {
- preference = document.createElement("preference");
- preference.id = defaultFontTypePref;
- preference.setAttribute("name", defaultFontTypePref);
- preference.setAttribute("type", "string");
- preference.setAttribute("onchange", "gMainPane._rebuildFonts();");
- document.getElementById("mainPreferences").appendChild(preference);
- }
- return preference.value;
- },
-
- _selectDefaultLanguageGroup(aLanguageGroup, aIsSerif) {
- const kFontNameFmtSerif = "font.name.serif.%LANG%";
- const kFontNameFmtSansSerif = "font.name.sans-serif.%LANG%";
- const kFontNameListFmtSerif = "font.name-list.serif.%LANG%";
- const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
- const kFontSizeFmtVariable = "font.size.variable.%LANG%";
-
- var preferences = document.getElementById("mainPreferences");
- var prefs = [{ format: aIsSerif ? kFontNameFmtSerif : kFontNameFmtSansSerif,
- type: "fontname",
- element: "defaultFont",
- fonttype: aIsSerif ? "serif" : "sans-serif" },
- { format: aIsSerif ? kFontNameListFmtSerif : kFontNameListFmtSansSerif,
- type: "unichar",
- element: null,
- fonttype: aIsSerif ? "serif" : "sans-serif" },
- { format: kFontSizeFmtVariable,
- type: "int",
- element: "defaultFontSize",
- fonttype: null }];
- for (var i = 0; i < prefs.length; ++i) {
- var preference = document.getElementById(prefs[i].format.replace(/%LANG%/, aLanguageGroup));
- if (!preference) {
- preference = document.createElement("preference");
- var name = prefs[i].format.replace(/%LANG%/, aLanguageGroup);
- preference.id = name;
- preference.setAttribute("name", name);
- preference.setAttribute("type", prefs[i].type);
- preferences.appendChild(preference);
- }
-
- if (!prefs[i].element)
- continue;
-
- var element = document.getElementById(prefs[i].element);
- if (element) {
- element.setAttribute("preference", preference.id);
-
- if (prefs[i].fonttype)
- FontBuilder.buildFontList(aLanguageGroup, prefs[i].fonttype, element);
-
- preference.setElementValue(element);
- }
- }
- },
-
- /**
- * 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.
- *
- * layout.spellcheckDefault
- * - an integer:
- * 0 disables spellchecking
- * 1 enables spellchecking, but only for multiline text fields
- * 2 enables spellchecking for all text fields
- */
- 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;
- },
-
- 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({duringChangeEvent}) {
- let defaultPerformancePref =
- document.getElementById("browser.preferences.defaultPerformanceSettings.enabled");
- let performanceSettings = document.getElementById("performanceSettings");
- let processCountPref = document.getElementById("dom.ipc.processCount");
- if (defaultPerformancePref.value) {
- let accelerationPref = document.getElementById("layers.acceleration.disabled");
- // Unset the value so process count will be decided by e10s rollout.
- processCountPref.value = processCountPref.defaultValue;
- accelerationPref.value = accelerationPref.defaultValue;
- performanceSettings.hidden = true;
- } else {
- let e10sRolloutProcessCountPref =
- document.getElementById("dom.ipc.processCount.web");
- // Take the e10s rollout value as the default value (if it exists),
- // but don't overwrite the user set value.
- if (duringChangeEvent &&
- e10sRolloutProcessCountPref.value &&
- processCountPref.value == processCountPref.defaultValue) {
- processCountPref.value = e10sRolloutProcessCountPref.value;
- }
- performanceSettings.hidden = false;
- }
- },
-
- buildContentProcessCountMenuList() {
- if (gMainPane.isE10SEnabled()) {
- let processCountPref = document.getElementById("dom.ipc.processCount");
- let e10sRolloutProcessCountPref =
- document.getElementById("dom.ipc.processCount.web");
- let defaultProcessCount =
- e10sRolloutProcessCountPref.value || processCountPref.defaultValue;
- let bundlePreferences = document.getElementById("bundlePreferences");
- let label = bundlePreferences.getFormattedString("defaultContentProcessCount",
- [defaultProcessCount]);
- let contentProcessCount =
- document.querySelector(`#contentProcessCount > menupopup >
- menuitem[value="${defaultProcessCount}"]`);
- contentProcessCount.label = label;
-
- document.getElementById("limitContentProcess").disabled = false;
- document.getElementById("contentProcessCount").disabled = false;
- document.getElementById("contentProcessCountEnabledDescription").hidden = false;
- document.getElementById("contentProcessCountDisabledDescription").hidden = true;
- } else {
- document.getElementById("limitContentProcess").disabled = true;
- document.getElementById("contentProcessCount").disabled = true;
- document.getElementById("contentProcessCountEnabledDescription").hidden = true;
- document.getElementById("contentProcessCountDisabledDescription").hidden = false;
- }
- },
-
- /*
- * 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");
- },
-
- destroy() {
- window.removeEventListener("unload", this);
- this._prefSvc.removeObserver(PREF_SHOW_PLUGINS_IN_LIST, this);
- this._prefSvc.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
- this._prefSvc.removeObserver(PREF_FEED_SELECTED_APP, this);
- this._prefSvc.removeObserver(PREF_FEED_SELECTED_WEB, this);
- this._prefSvc.removeObserver(PREF_FEED_SELECTED_ACTION, this);
- this._prefSvc.removeObserver(PREF_FEED_SELECTED_READER, this);
-
- this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_APP, this);
- this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_WEB, this);
- this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_ACTION, this);
- this._prefSvc.removeObserver(PREF_VIDEO_FEED_SELECTED_READER, this);
-
- this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_APP, this);
- this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_WEB, this);
- this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
- this._prefSvc.removeObserver(PREF_AUDIO_FEED_SELECTED_READER, this);
- },
-
-
- // nsISupports
-
- QueryInterface(aIID) {
- if (aIID.equals(Ci.nsIObserver) ||
- aIID.equals(Ci.nsIDOMEventListener ||
- aIID.equals(Ci.nsISupports)))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
-
- // nsIObserver
-
- observe(aSubject, aTopic, aData) {
- if (aTopic == "nsPref:changed") {
- // Rebuild the list when there are changes to preferences that influence
- // whether or not to show certain entries in the list.
- if (!this._storingAction) {
- // These two prefs alter the list of visible types, so we have to rebuild
- // that list when they change.
- if (aData == PREF_SHOW_PLUGINS_IN_LIST ||
- aData == PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS) {
- this._rebuildVisibleTypes();
- this._sortVisibleTypes();
- }
-
- // All the prefs we observe can affect what we display, so we rebuild
- // the view when any of them changes.
- this._rebuildView();
- }
- if (AppConstants.MOZ_UPDATER) {
- this.updateReadPrefs();
- }
- }
- },
-
-
- // nsIDOMEventListener
-
- handleEvent(aEvent) {
- if (aEvent.type == "unload") {
- this.destroy();
- }
- },
-
-
- // Composed Model Construction
-
- _loadData() {
- this._loadFeedHandler();
- this._loadInternalHandlers();
- this._loadPluginHandlers();
- this._loadApplicationHandlers();
- },
-
- _loadFeedHandler() {
- this._handledTypes[TYPE_MAYBE_FEED] = feedHandlerInfo;
- feedHandlerInfo.handledOnlyByPlugin = false;
-
- this._handledTypes[TYPE_MAYBE_VIDEO_FEED] = videoFeedHandlerInfo;
- videoFeedHandlerInfo.handledOnlyByPlugin = false;
-
- this._handledTypes[TYPE_MAYBE_AUDIO_FEED] = audioFeedHandlerInfo;
- audioFeedHandlerInfo.handledOnlyByPlugin = false;
- },
-
- /**
- * Load higher level internal handlers so they can be turned on/off in the
- * applications menu.
- */
- _loadInternalHandlers() {
- var internalHandlers = [pdfHandlerInfo];
- for (let internalHandler of internalHandlers) {
- if (internalHandler.enabled) {
- this._handledTypes[internalHandler.type] = internalHandler;
- }
- }
- },
-
- /**
- * Load the set of handlers defined by plugins.
- *
- * Note: if there's more than one plugin for a given MIME type, we assume
- * the last one is the one that the application will use. That may not be
- * correct, but it's how we've been doing it for years.
- *
- * Perhaps we should instead query navigator.mimeTypes for the set of types
- * supported by the application and then get the plugin from each MIME type's
- * enabledPlugin property. But if there's a plugin for a type, we need
- * to know about it even if it isn't enabled, since we're going to give
- * the user an option to enable it.
- *
- * Also note that enabledPlugin does not get updated when
- * plugin.disable_full_page_plugin_for_types changes, so even if we could use
- * enabledPlugin to get the plugin that would be used, we'd still need to
- * check the pref ourselves to find out if it's enabled.
- */
- _loadPluginHandlers() {
- "use strict";
-
- let mimeTypes = navigator.mimeTypes;
-
- for (let mimeType of mimeTypes) {
- let handlerInfoWrapper;
- if (mimeType.type in this._handledTypes) {
- handlerInfoWrapper = this._handledTypes[mimeType.type];
- } else {
- let wrappedHandlerInfo =
- this._mimeSvc.getFromTypeAndExtension(mimeType.type, null);
- handlerInfoWrapper = new HandlerInfoWrapper(mimeType.type, wrappedHandlerInfo);
- handlerInfoWrapper.handledOnlyByPlugin = true;
- this._handledTypes[mimeType.type] = handlerInfoWrapper;
- }
- handlerInfoWrapper.pluginName = mimeType.enabledPlugin.name;
- }
- },
-
- /**
- * Load the set of handlers defined by the application datastore.
- */
- _loadApplicationHandlers() {
- var wrappedHandlerInfos = this._handlerSvc.enumerate();
- while (wrappedHandlerInfos.hasMoreElements()) {
- let wrappedHandlerInfo =
- wrappedHandlerInfos.getNext().QueryInterface(Ci.nsIHandlerInfo);
- let type = wrappedHandlerInfo.type;
-
- let handlerInfoWrapper;
- if (type in this._handledTypes)
- handlerInfoWrapper = this._handledTypes[type];
- else {
- handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
- this._handledTypes[type] = handlerInfoWrapper;
- }
-
- handlerInfoWrapper.handledOnlyByPlugin = false;
- }
- },
-
-
- // View Construction
-
- _rebuildVisibleTypes() {
- // Reset the list of visible types and the visible type description counts.
- this._visibleTypes = [];
- this._visibleTypeDescriptionCount = {};
-
- // Get the preferences that help determine what types to show.
- var showPlugins = this._prefSvc.getBoolPref(PREF_SHOW_PLUGINS_IN_LIST);
- var hidePluginsWithoutExtensions =
- this._prefSvc.getBoolPref(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS);
-
- for (let type in this._handledTypes) {
- let handlerInfo = this._handledTypes[type];
-
- // Hide plugins without associated extensions if so prefed so we don't
- // show a whole bunch of obscure types handled by plugins on Mac.
- // Note: though protocol types don't have extensions, we still show them;
- // the pref is only meant to be applied to MIME types, since plugins are
- // only associated with MIME types.
- // FIXME: should we also check the "suffixes" property of the plugin?
- // Filed as bug 395135.
- if (hidePluginsWithoutExtensions && handlerInfo.handledOnlyByPlugin &&
- handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
- !handlerInfo.primaryExtension)
- continue;
-
- // Hide types handled only by plugins if so prefed.
- if (handlerInfo.handledOnlyByPlugin && !showPlugins)
- continue;
-
- // We couldn't find any reason to exclude the type, so include it.
- this._visibleTypes.push(handlerInfo);
-
- if (handlerInfo.description in this._visibleTypeDescriptionCount)
- this._visibleTypeDescriptionCount[handlerInfo.description]++;
- else
- this._visibleTypeDescriptionCount[handlerInfo.description] = 1;
- }
- },
-
- _rebuildView() {
- // Clear the list of entries.
- while (this._list.childNodes.length > 1)
- this._list.removeChild(this._list.lastChild);
-
- var visibleTypes = this._visibleTypes;
-
- // If the user is filtering the list, then only show matching types.
- if (this._filter.value)
- visibleTypes = visibleTypes.filter(this._matchesFilter, this);
-
- for (let visibleType of visibleTypes) {
- let item = document.createElement("richlistitem");
- item.setAttribute("type", visibleType.type);
- item.setAttribute("typeDescription", this._describeType(visibleType));
- if (visibleType.smallIcon)
- item.setAttribute("typeIcon", visibleType.smallIcon);
- item.setAttribute("actionDescription",
- this._describePreferredAction(visibleType));
-
- if (!this._setIconClassForPreferredAction(visibleType, item)) {
- item.setAttribute("actionIcon",
- this._getIconURLForPreferredAction(visibleType));
- }
-
- this._list.appendChild(item);
- }
-
- this._selectLastSelectedType();
- },
-
- _matchesFilter(aType) {
- var filterValue = this._filter.value.toLowerCase();
- return this._describeType(aType).toLowerCase().indexOf(filterValue) != -1 ||
- this._describePreferredAction(aType).toLowerCase().indexOf(filterValue) != -1;
- },
-
- /**
- * Describe, in a human-readable fashion, the type represented by the given
- * handler info object. Normally this is just the description provided by
- * the info object, but if more than one object presents the same description,
- * then we annotate the duplicate descriptions with the type itself to help
- * users distinguish between those types.
- *
- * @param aHandlerInfo {nsIHandlerInfo} the type being described
- * @returns {string} a description of the type
- */
- _describeType(aHandlerInfo) {
- if (this._visibleTypeDescriptionCount[aHandlerInfo.description] > 1)
- return this._prefsBundle.getFormattedString("typeDescriptionWithType",
- [aHandlerInfo.description,
- aHandlerInfo.type]);
-
- return aHandlerInfo.description;
- },
-
- /**
- * Describe, in a human-readable fashion, the preferred action to take on
- * the type represented by the given handler info object.
- *
- * XXX Should this be part of the HandlerInfoWrapper interface? It would
- * violate the separation of model and view, but it might make more sense
- * nonetheless (f.e. it would make sortTypes easier).
- *
- * @param aHandlerInfo {nsIHandlerInfo} the type whose preferred action
- * is being described
- * @returns {string} a description of the action
- */
- _describePreferredAction(aHandlerInfo) {
- // alwaysAskBeforeHandling overrides the preferred action, so if that flag
- // is set, then describe that behavior instead. For most types, this is
- // the "alwaysAsk" string, but for the feed type we show something special.
- if (aHandlerInfo.alwaysAskBeforeHandling) {
- if (isFeedType(aHandlerInfo.type))
- return this._prefsBundle.getFormattedString("previewInApp",
- [this._brandShortName]);
- return this._prefsBundle.getString("alwaysAsk");
- }
-
- switch (aHandlerInfo.preferredAction) {
- case Ci.nsIHandlerInfo.saveToDisk:
- return this._prefsBundle.getString("saveFile");
-
- case Ci.nsIHandlerInfo.useHelperApp:
- var preferredApp = aHandlerInfo.preferredApplicationHandler;
- var name;
- if (preferredApp instanceof Ci.nsILocalHandlerApp)
- name = getFileDisplayName(preferredApp.executable);
- else
- name = preferredApp.name;
- return this._prefsBundle.getFormattedString("useApp", [name]);
-
- case Ci.nsIHandlerInfo.handleInternally:
- // For the feed type, handleInternally means live bookmarks.
- if (isFeedType(aHandlerInfo.type)) {
- return this._prefsBundle.getFormattedString("addLiveBookmarksInApp",
- [this._brandShortName]);
- }
-
- if (aHandlerInfo instanceof InternalHandlerInfoWrapper) {
- return this._prefsBundle.getFormattedString("previewInApp",
- [this._brandShortName]);
- }
-
- // For other types, handleInternally looks like either useHelperApp
- // or useSystemDefault depending on whether or not there's a preferred
- // handler app.
- if (this.isValidHandlerApp(aHandlerInfo.preferredApplicationHandler))
- return aHandlerInfo.preferredApplicationHandler.name;
-
- return aHandlerInfo.defaultDescription;
-
- // XXX Why don't we say the app will handle the type internally?
- // Is it because the app can't actually do that? But if that's true,
- // then why would a preferredAction ever get set to this value
- // in the first place?
-
- case Ci.nsIHandlerInfo.useSystemDefault:
- return this._prefsBundle.getFormattedString("useDefault",
- [aHandlerInfo.defaultDescription]);
-
- case kActionUsePlugin:
- return this._prefsBundle.getFormattedString("usePluginIn",
- [aHandlerInfo.pluginName,
- this._brandShortName]);
- default:
- throw new Error(`Unexpected preferredAction: ${aHandlerInfo.preferredAction}`);
- }
- },
-
- _selectLastSelectedType() {
- // If the list is disabled by the pref.downloads.disable_button.edit_actions
- // preference being locked, then don't select the type, as that would cause
- // it to appear selected, with a different background and an actions menu
- // that makes it seem like you can choose an action for the type.
- if (this._list.disabled)
- return;
-
- var lastSelectedType = this._list.getAttribute("lastSelectedType");
- if (!lastSelectedType)
- return;
-
- var item = this._list.getElementsByAttribute("type", lastSelectedType)[0];
- if (!item)
- return;
-
- this._list.selectedItem = item;
- },
-
- /**
- * Whether or not the given handler app is valid.
- *
- * @param aHandlerApp {nsIHandlerApp} the handler app in question
- *
- * @returns {boolean} whether or not it's valid
- */
- isValidHandlerApp(aHandlerApp) {
- if (!aHandlerApp)
- return false;
-
- if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
- return this._isValidHandlerExecutable(aHandlerApp.executable);
-
- if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
- return aHandlerApp.uriTemplate;
-
- if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
- return aHandlerApp.uri;
-
- return false;
- },
-
- _isValidHandlerExecutable(aExecutable) {
- let leafName;
- if (AppConstants.platform == "win") {
- leafName = `${AppConstants.MOZ_APP_NAME}.exe`;
- } else if (AppConstants.platform == "macosx") {
- leafName = AppConstants.MOZ_MACBUNDLE_NAME;
- } else {
- leafName = `${AppConstants.MOZ_APP_NAME}-bin`;
- }
- return aExecutable &&
- aExecutable.exists() &&
- aExecutable.isExecutable() &&
-// XXXben - we need to compare this with the running instance executable
-// just don't know how to do that via script...
-// XXXmano TBD: can probably add this to nsIShellService
- aExecutable.leafName != leafName;
- },
-
- /**
- * Rebuild the actions menu for the selected entry. Gets called by
- * the richlistitem constructor when an entry in the list gets selected.
- */
- rebuildActionsMenu() {
- var typeItem = this._list.selectedItem;
- var handlerInfo = this._handledTypes[typeItem.type];
- var menu =
- document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
- var menuPopup = menu.menupopup;
-
- // Clear out existing items.
- while (menuPopup.hasChildNodes())
- menuPopup.removeChild(menuPopup.lastChild);
-
- let internalMenuItem;
- // Add the "Preview in Firefox" option for optional internal handlers.
- if (handlerInfo instanceof InternalHandlerInfoWrapper) {
- internalMenuItem = document.createElement("menuitem");
- internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
- let label = this._prefsBundle.getFormattedString("previewInApp",
- [this._brandShortName]);
- internalMenuItem.setAttribute("label", label);
- internalMenuItem.setAttribute("tooltiptext", label);
- internalMenuItem.setAttribute(APP_ICON_ATTR_NAME, "ask");
- menuPopup.appendChild(internalMenuItem);
- }
-
- {
- var askMenuItem = document.createElement("menuitem");
- askMenuItem.setAttribute("action", Ci.nsIHandlerInfo.alwaysAsk);
- let label;
- if (isFeedType(handlerInfo.type))
- label = this._prefsBundle.getFormattedString("previewInApp",
- [this._brandShortName]);
- else
- label = this._prefsBundle.getString("alwaysAsk");
- askMenuItem.setAttribute("label", label);
- askMenuItem.setAttribute("tooltiptext", label);
- askMenuItem.setAttribute(APP_ICON_ATTR_NAME, "ask");
- menuPopup.appendChild(askMenuItem);
- }
-
- // Create a menu item for saving to disk.
- // Note: this option isn't available to protocol types, since we don't know
- // what it means to save a URL having a certain scheme to disk, nor is it
- // available to feeds, since the feed code doesn't implement the capability.
- if ((handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) &&
- !isFeedType(handlerInfo.type)) {
- var saveMenuItem = document.createElement("menuitem");
- saveMenuItem.setAttribute("action", Ci.nsIHandlerInfo.saveToDisk);
- let label = this._prefsBundle.getString("saveFile");
- saveMenuItem.setAttribute("label", label);
- saveMenuItem.setAttribute("tooltiptext", label);
- saveMenuItem.setAttribute(APP_ICON_ATTR_NAME, "save");
- menuPopup.appendChild(saveMenuItem);
- }
-
- // If this is the feed type, add a Live Bookmarks item.
- if (isFeedType(handlerInfo.type)) {
- internalMenuItem = document.createElement("menuitem");
- internalMenuItem.setAttribute("action", Ci.nsIHandlerInfo.handleInternally);
- let label = this._prefsBundle.getFormattedString("addLiveBookmarksInApp",
- [this._brandShortName]);
- internalMenuItem.setAttribute("label", label);
- internalMenuItem.setAttribute("tooltiptext", label);
- internalMenuItem.setAttribute(APP_ICON_ATTR_NAME, "feed");
- menuPopup.appendChild(internalMenuItem);
- }
-
- // Add a separator to distinguish these items from the helper app items
- // that follow them.
- let menuseparator = document.createElement("menuseparator");
- menuPopup.appendChild(menuseparator);
-
- // Create a menu item for the OS default application, if any.
- if (handlerInfo.hasDefaultHandler) {
- var defaultMenuItem = document.createElement("menuitem");
- defaultMenuItem.setAttribute("action", Ci.nsIHandlerInfo.useSystemDefault);
- let label = this._prefsBundle.getFormattedString("useDefault",
- [handlerInfo.defaultDescription]);
- defaultMenuItem.setAttribute("label", label);
- defaultMenuItem.setAttribute("tooltiptext", handlerInfo.defaultDescription);
- defaultMenuItem.setAttribute("image", this._getIconURLForSystemDefault(handlerInfo));
-
- menuPopup.appendChild(defaultMenuItem);
- }
-
- // Create menu items for possible handlers.
- let preferredApp = handlerInfo.preferredApplicationHandler;
- let possibleApps = handlerInfo.possibleApplicationHandlers.enumerate();
- var possibleAppMenuItems = [];
- while (possibleApps.hasMoreElements()) {
- let possibleApp = possibleApps.getNext();
- if (!this.isValidHandlerApp(possibleApp))
- continue;
-
- let menuItem = document.createElement("menuitem");
- menuItem.setAttribute("action", Ci.nsIHandlerInfo.useHelperApp);
- let label;
- if (possibleApp instanceof Ci.nsILocalHandlerApp)
- label = getFileDisplayName(possibleApp.executable);
- else
- label = possibleApp.name;
- label = this._prefsBundle.getFormattedString("useApp", [label]);
- menuItem.setAttribute("label", label);
- menuItem.setAttribute("tooltiptext", label);
- menuItem.setAttribute("image", this._getIconURLForHandlerApp(possibleApp));
-
- // Attach the handler app object to the menu item so we can use it
- // to make changes to the datastore when the user selects the item.
- menuItem.handlerApp = possibleApp;
-
- menuPopup.appendChild(menuItem);
- possibleAppMenuItems.push(menuItem);
- }
-
- // Create a menu item for the plugin.
- if (handlerInfo.pluginName) {
- var pluginMenuItem = document.createElement("menuitem");
- pluginMenuItem.setAttribute("action", kActionUsePlugin);
- let label = this._prefsBundle.getFormattedString("usePluginIn",
- [handlerInfo.pluginName,
- this._brandShortName]);
- pluginMenuItem.setAttribute("label", label);
- pluginMenuItem.setAttribute("tooltiptext", label);
- pluginMenuItem.setAttribute(APP_ICON_ATTR_NAME, "plugin");
- menuPopup.appendChild(pluginMenuItem);
- }
-
- // Create a menu item for selecting a local application.
- let canOpenWithOtherApp = true;
- if (AppConstants.platform == "win") {
- // On Windows, selecting an application to open another application
- // would be meaningless so we special case executables.
- let executableType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService)
- .getTypeFromExtension("exe");
- canOpenWithOtherApp = handlerInfo.type != executableType;
- }
- if (canOpenWithOtherApp) {
- let menuItem = document.createElement("menuitem");
- menuItem.className = "choose-app-item";
- menuItem.addEventListener("command", function(e) {
- gMainPane.chooseApp(e);
- });
- let label = this._prefsBundle.getString("useOtherApp");
- menuItem.setAttribute("label", label);
- menuItem.setAttribute("tooltiptext", label);
- menuPopup.appendChild(menuItem);
- }
-
- // Create a menu item for managing applications.
- if (possibleAppMenuItems.length) {
- let menuItem = document.createElement("menuseparator");
- menuPopup.appendChild(menuItem);
- menuItem = document.createElement("menuitem");
- menuItem.className = "manage-app-item";
- menuItem.addEventListener("command", function(e) {
- gMainPane.manageApp(e);
- });
- menuItem.setAttribute("label", this._prefsBundle.getString("manageApp"));
- menuPopup.appendChild(menuItem);
- }
-
- // Select the item corresponding to the preferred action. If the always
- // ask flag is set, it overrides the preferred action. Otherwise we pick
- // the item identified by the preferred action (when the preferred action
- // is to use a helper app, we have to pick the specific helper app item).
- if (handlerInfo.alwaysAskBeforeHandling)
- menu.selectedItem = askMenuItem;
- else switch (handlerInfo.preferredAction) {
- case Ci.nsIHandlerInfo.handleInternally:
- if (internalMenuItem) {
- menu.selectedItem = internalMenuItem;
- } else {
- Cu.reportError("No menu item defined to set!")
- }
- break;
- case Ci.nsIHandlerInfo.useSystemDefault:
- menu.selectedItem = defaultMenuItem;
- break;
- case Ci.nsIHandlerInfo.useHelperApp:
- if (preferredApp)
- menu.selectedItem =
- possibleAppMenuItems.filter(v => v.handlerApp.equals(preferredApp))[0];
- break;
- case kActionUsePlugin:
- menu.selectedItem = pluginMenuItem;
- break;
- case Ci.nsIHandlerInfo.saveToDisk:
- menu.selectedItem = saveMenuItem;
- break;
- }
- },
-
-
- // Sorting & Filtering
-
- _sortColumn: null,
-
- /**
- * Sort the list when the user clicks on a column header.
- */
- sort(event) {
- var column = event.target;
-
- // If the user clicked on a new sort column, remove the direction indicator
- // from the old column.
- if (this._sortColumn && this._sortColumn != column)
- this._sortColumn.removeAttribute("sortDirection");
-
- this._sortColumn = column;
-
- // Set (or switch) the sort direction indicator.
- if (column.getAttribute("sortDirection") == "ascending")
- column.setAttribute("sortDirection", "descending");
- else
- column.setAttribute("sortDirection", "ascending");
-
- this._sortVisibleTypes();
- this._rebuildView();
- },
-
- /**
- * Sort the list of visible types by the current sort column/direction.
- */
- _sortVisibleTypes() {
- if (!this._sortColumn)
- return;
-
- var t = this;
-
- function sortByType(a, b) {
- return t._describeType(a).toLowerCase().
- localeCompare(t._describeType(b).toLowerCase());
- }
-
- function sortByAction(a, b) {
- return t._describePreferredAction(a).toLowerCase().
- localeCompare(t._describePreferredAction(b).toLowerCase());
- }
-
- switch (this._sortColumn.getAttribute("value")) {
- case "type":
- this._visibleTypes.sort(sortByType);
- break;
- case "action":
- this._visibleTypes.sort(sortByAction);
- break;
- }
-
- if (this._sortColumn.getAttribute("sortDirection") == "descending")
- this._visibleTypes.reverse();
- },
-
- /**
- * Filter the list when the user enters a filter term into the filter field.
- */
- filter() {
- this._rebuildView();
- },
-
- focusFilterBox() {
- this._filter.focus();
- this._filter.select();
- },
-
-
- // Changes
-
- onSelectAction(aActionItem) {
- this._storingAction = true;
-
- try {
- this._storeAction(aActionItem);
- } finally {
- this._storingAction = false;
- }
- },
-
- _storeAction(aActionItem) {
- var typeItem = this._list.selectedItem;
- var handlerInfo = this._handledTypes[typeItem.type];
-
- let action = parseInt(aActionItem.getAttribute("action"));
-
- // Set the plugin state if we're enabling or disabling a plugin.
- if (action == kActionUsePlugin)
- handlerInfo.enablePluginType();
- else if (handlerInfo.pluginName && !handlerInfo.isDisabledPluginType)
- handlerInfo.disablePluginType();
-
- // Set the preferred application handler.
- // We leave the existing preferred app in the list when we set
- // the preferred action to something other than useHelperApp so that
- // legacy datastores that don't have the preferred app in the list
- // of possible apps still include the preferred app in the list of apps
- // the user can choose to handle the type.
- if (action == Ci.nsIHandlerInfo.useHelperApp)
- handlerInfo.preferredApplicationHandler = aActionItem.handlerApp;
-
- // Set the "always ask" flag.
- if (action == Ci.nsIHandlerInfo.alwaysAsk)
- handlerInfo.alwaysAskBeforeHandling = true;
- else
- handlerInfo.alwaysAskBeforeHandling = false;
-
- // Set the preferred action.
- handlerInfo.preferredAction = action;
-
- handlerInfo.store();
-
- // Make sure the handler info object is flagged to indicate that there is
- // now some user configuration for the type.
- handlerInfo.handledOnlyByPlugin = false;
-
- // Update the action label and image to reflect the new preferred action.
- typeItem.setAttribute("actionDescription",
- this._describePreferredAction(handlerInfo));
- if (!this._setIconClassForPreferredAction(handlerInfo, typeItem)) {
- typeItem.setAttribute("actionIcon",
- this._getIconURLForPreferredAction(handlerInfo));
- }
- },
-
- manageApp(aEvent) {
- // Don't let the normal "on select action" handler get this event,
- // as we handle it specially ourselves.
- aEvent.stopPropagation();
-
- var typeItem = this._list.selectedItem;
- var handlerInfo = this._handledTypes[typeItem.type];
-
- let onComplete = () => {
- // Rebuild the actions menu so that we revert to the previous selection,
- // or "Always ask" if the previous default application has been removed
- this.rebuildActionsMenu();
-
- // update the richlistitem too. Will be visible when selecting another row
- typeItem.setAttribute("actionDescription",
- this._describePreferredAction(handlerInfo));
- if (!this._setIconClassForPreferredAction(handlerInfo, typeItem)) {
- typeItem.setAttribute("actionIcon",
- this._getIconURLForPreferredAction(handlerInfo));
- }
- };
-
- gSubDialog.open("chrome://browser/content/preferences/applicationManager.xul",
- "resizable=no", handlerInfo, onComplete);
-
- },
-
- chooseApp(aEvent) {
- // Don't let the normal "on select action" handler get this event,
- // as we handle it specially ourselves.
- aEvent.stopPropagation();
-
- var handlerApp;
- let chooseAppCallback = aHandlerApp => {
- // Rebuild the actions menu whether the user picked an app or canceled.
- // If they picked an app, we want to add the app to the menu and select it.
- // If they canceled, we want to go back to their previous selection.
- this.rebuildActionsMenu();
-
- // If the user picked a new app from the menu, select it.
- if (aHandlerApp) {
- let typeItem = this._list.selectedItem;
- let actionsMenu =
- document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
- let menuItems = actionsMenu.menupopup.childNodes;
- for (let i = 0; i < menuItems.length; i++) {
- let menuItem = menuItems[i];
- if (menuItem.handlerApp && menuItem.handlerApp.equals(aHandlerApp)) {
- actionsMenu.selectedIndex = i;
- this.onSelectAction(menuItem);
- break;
- }
- }
- }
- };
-
- if (AppConstants.platform == "win") {
- var params = {};
- var handlerInfo = this._handledTypes[this._list.selectedItem.type];
-
- if (isFeedType(handlerInfo.type)) {
- // MIME info will be null, create a temp object.
- params.mimeInfo = this._mimeSvc.getFromTypeAndExtension(handlerInfo.type,
- handlerInfo.primaryExtension);
- } else {
- params.mimeInfo = handlerInfo.wrappedHandlerInfo;
- }
-
- params.title = this._prefsBundle.getString("fpTitleChooseApp");
- params.description = handlerInfo.description;
- params.filename = null;
- params.handlerApp = null;
-
- let onAppSelected = () => {
- if (this.isValidHandlerApp(params.handlerApp)) {
- handlerApp = params.handlerApp;
-
- // Add the app to the type's list of possible handlers.
- handlerInfo.addPossibleApplicationHandler(handlerApp);
- }
-
- chooseAppCallback(handlerApp);
- };
-
- gSubDialog.open("chrome://global/content/appPicker.xul",
- null, params, onAppSelected);
- } else {
- let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
- let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
- let fpCallback = aResult => {
- if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
- this._isValidHandlerExecutable(fp.file)) {
- handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
- createInstance(Ci.nsILocalHandlerApp);
- handlerApp.name = getFileDisplayName(fp.file);
- handlerApp.executable = fp.file;
-
- // Add the app to the type's list of possible handlers.
- let handler = this._handledTypes[this._list.selectedItem.type];
- handler.addPossibleApplicationHandler(handlerApp);
-
- chooseAppCallback(handlerApp);
- }
- };
-
- // Prompt the user to pick an app. If they pick one, and it's a valid
- // selection, then add it to the list of possible handlers.
- fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
- fp.appendFilters(Ci.nsIFilePicker.filterApps);
- fp.open(fpCallback);
- }
- },
-
- // Mark which item in the list was last selected so we can reselect it
- // when we rebuild the list or when the user returns to the prefpane.
- onSelectionChanged() {
- if (this._list.selectedItem)
- this._list.setAttribute("lastSelectedType",
- this._list.selectedItem.getAttribute("type"));
- },
-
- _setIconClassForPreferredAction(aHandlerInfo, aElement) {
- // If this returns true, the attribute that CSS sniffs for was set to something
- // so you shouldn't manually set an icon URI.
- // This removes the existing actionIcon attribute if any, even if returning false.
- aElement.removeAttribute("actionIcon");
-
- if (aHandlerInfo.alwaysAskBeforeHandling) {
- aElement.setAttribute(APP_ICON_ATTR_NAME, "ask");
- return true;
- }
-
- switch (aHandlerInfo.preferredAction) {
- case Ci.nsIHandlerInfo.saveToDisk:
- aElement.setAttribute(APP_ICON_ATTR_NAME, "save");
- return true;
-
- case Ci.nsIHandlerInfo.handleInternally:
- if (isFeedType(aHandlerInfo.type)) {
- aElement.setAttribute(APP_ICON_ATTR_NAME, "feed");
- return true;
- } else if (aHandlerInfo instanceof InternalHandlerInfoWrapper) {
- aElement.setAttribute(APP_ICON_ATTR_NAME, "ask");
- return true;
- }
- break;
-
- case kActionUsePlugin:
- aElement.setAttribute(APP_ICON_ATTR_NAME, "plugin");
- return true;
- }
- aElement.removeAttribute(APP_ICON_ATTR_NAME);
- return false;
- },
-
- _getIconURLForPreferredAction(aHandlerInfo) {
- switch (aHandlerInfo.preferredAction) {
- case Ci.nsIHandlerInfo.useSystemDefault:
- return this._getIconURLForSystemDefault(aHandlerInfo);
-
- case Ci.nsIHandlerInfo.useHelperApp:
- let preferredApp = aHandlerInfo.preferredApplicationHandler;
- if (this.isValidHandlerApp(preferredApp))
- return this._getIconURLForHandlerApp(preferredApp);
- // Explicit fall-through
-
- // This should never happen, but if preferredAction is set to some weird
- // value, then fall back to the generic application icon.
- default:
- return ICON_URL_APP;
- }
- },
-
- _getIconURLForHandlerApp(aHandlerApp) {
- if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
- return this._getIconURLForFile(aHandlerApp.executable);
-
- if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
- return this._getIconURLForWebApp(aHandlerApp.uriTemplate);
-
- if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
- return this._getIconURLForWebApp(aHandlerApp.uri)
-
- // We know nothing about other kinds of handler apps.
- return "";
- },
-
- _getIconURLForFile(aFile) {
- var fph = this._ioSvc.getProtocolHandler("file").
- QueryInterface(Ci.nsIFileProtocolHandler);
- var urlSpec = fph.getURLSpecFromFile(aFile);
-
- return "moz-icon://" + urlSpec + "?size=16";
- },
-
- _getIconURLForWebApp(aWebAppURITemplate) {
- var uri = this._ioSvc.newURI(aWebAppURITemplate);
-
- // Unfortunately we can't use the favicon service to get the favicon,
- // because the service looks in the annotations table for a record with
- // the exact URL we give it, and users won't have such records for URLs
- // they don't visit, and users won't visit the web app's URL template,
- // they'll only visit URLs derived from that template (i.e. with %s
- // in the template replaced by the URL of the content being handled).
-
- if (/^https?$/.test(uri.scheme) && this._prefSvc.getBoolPref("browser.chrome.favicons"))
- return uri.prePath + "/favicon.ico";
-
- return "";
- },
-
- _getIconURLForSystemDefault(aHandlerInfo) {
- // Handler info objects for MIME types on some OSes implement a property bag
- // interface from which we can get an icon for the default app, so if we're
- // dealing with a MIME type on one of those OSes, then try to get the icon.
- if ("wrappedHandlerInfo" in aHandlerInfo) {
- let wrappedHandlerInfo = aHandlerInfo.wrappedHandlerInfo;
-
- if (wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
- wrappedHandlerInfo instanceof Ci.nsIPropertyBag) {
- try {
- let url = wrappedHandlerInfo.getProperty("defaultApplicationIconURL");
- if (url)
- return url + "?size=16";
- } catch (ex) {}
- }
- }
-
- // If this isn't a MIME type object on an OS that supports retrieving
- // the icon, or if we couldn't retrieve the icon for some other reason,
- // then use a generic icon.
- 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.
- * 3 - The default download location is elsewhere as specified by
- * cloud storage API getDownloadFolder
- * 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;
-
- this.readCloudStorage().catch(Components.utils.reportError);
- // don't override the preference's value in UI
- return undefined;
- },
-
- /**
- * Show/Hide the cloud storage radio button with provider name as label if
- * cloud storage provider is in use.
- * Select cloud storage radio button if browser.download.useDownloadDir is true
- * and browser.download.folderList has value 3. Enables/disables the folder field
- * and Browse button if cloud storage radio button is selected.
- *
- */
- async readCloudStorage() {
- // Get preferred provider in use display name
- let providerDisplayName = await CloudStorage.getProviderIfInUse();
- if (providerDisplayName) {
- // Show cloud storage radio button with provider name in label
- let saveToCloudRadio = document.getElementById("saveToCloud");
- let cloudStrings = Services.strings.createBundle("resource://cloudstorage/preferences.properties");
- saveToCloudRadio.label = cloudStrings.formatStringFromName("saveFilesToCloudStorage",
- [providerDisplayName], 1);
- saveToCloudRadio.hidden = false;
-
- let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir");
- let folderListPref = document.getElementById("browser.download.folderList");
-
- // Check if useDownloadDir is true and folderListPref is set to Cloud Storage value 3
- // before selecting cloudStorageradio button. Disable folder field and Browse button if
- // 'Save to Cloud Storage Provider' radio option is selected
- if (useDownloadDirPref.value && folderListPref.value === 3) {
- document.getElementById("saveWhere").selectedItem = saveToCloudRadio;
- document.getElementById("downloadFolder").disabled = true;
- document.getElementById("chooseFolder").disabled = true;
- }
- }
- },
-
- /**
- * Handle clicks to 'Save To <custom path> or <system default downloads>' and
- * 'Save to <cloud storage provider>' if cloud storage radio button is displayed in UI.
- * Sets browser.download.folderList value and Enables/disables the folder field and Browse
- * button based on option selected.
- */
- handleSaveToCommand(event) {
- return this.handleSaveToCommandTask(event).catch(Components.utils.reportError);
- },
- async handleSaveToCommandTask(event) {
- if (event.target.id !== "saveToCloud" && event.target.id !== "saveTo") {
- return;
- }
- // Check if Save To Cloud Storage Provider radio option is displayed in UI
- // before continuing.
- let saveToCloudRadio = document.getElementById("saveToCloud");
- if (!saveToCloudRadio.hidden) {
- // When switching between SaveTo and SaveToCloud radio button
- // with useDownloadDirPref value true, if selectedIndex is other than
- // SaveTo radio button disable downloadFolder filefield and chooseFolder button
- let saveWhere = document.getElementById("saveWhere");
- let useDownloadDirPref = document.getElementById("browser.download.useDownloadDir");
- if (useDownloadDirPref.value) {
- let downloadFolder = document.getElementById("downloadFolder");
- let chooseFolder = document.getElementById("chooseFolder");
- downloadFolder.disabled = saveWhere.selectedIndex || useDownloadDirPref.locked;
- chooseFolder.disabled = saveWhere.selectedIndex || useDownloadDirPref.locked;
- }
-
- // Set folderListPref value depending on radio option
- // selected. folderListPref should be set to 3 if Save To Cloud Storage Provider
- // option is selected. If user switch back to 'Save To' custom path or system
- // default Downloads, check pref 'browser.download.dir' before setting respective
- // folderListPref value. If currentDirPref is unspecified folderList should
- // default to 1
- let folderListPref = document.getElementById("browser.download.folderList");
- let saveTo = document.getElementById("saveTo");
- if (saveWhere.selectedItem == saveToCloudRadio) {
- folderListPref.value = 3;
- } else if (saveWhere.selectedItem == saveTo) {
- let currentDirPref = document.getElementById("browser.download.dir");
- folderListPref.value = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1;
- }
- }
- },
-
- /**
- * 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;
-
- let folderIndex = folderListPref.value;
- if (folderIndex == 3) {
- // When user has selected cloud storage, use value in currentDirPref to
- // compute index to display download folder label and icon to avoid
- // displaying blank downloadFolder label and icon on load of preferences UI
- // Set folderIndex to 1 if currentDirPref is unspecified
- folderIndex = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1;
- }
-
- // Display a 'pretty' label or the path in the UI.
- if (folderIndex == 2) {
- // Custom path selected and is configured
- downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
- iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
- } else if (folderIndex == 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.nsIFile);
- 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
- */
- _indexToFolder(aIndex) {
- switch (aIndex) {
- case 0:
- return this._getDownloadsFolder("Desktop");
- case 1:
- return this._getDownloadsFolder("Downloads");
- }
- var currentDirPref = document.getElementById("browser.download.dir");
- return currentDirPref.value;
- }
-};
-
-// Utilities
-
-function getFileDisplayName(file) {
- if (AppConstants.platform == "win") {
- if (file instanceof Ci.nsILocalFileWin) {
- try {
- return file.getVersionInfoField("FileDescription");
- } catch (e) {}
- }
- }
- if (AppConstants.platform == "macosx") {
- if (file instanceof Ci.nsILocalFileMac) {
- try {
- return file.bundleDisplayName;
- } catch (e) {}
- }
- }
- return file.leafName;
-}
-
-function getLocalHandlerApp(aFile) {
- var localHandlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
- createInstance(Ci.nsILocalHandlerApp);
- localHandlerApp.name = getFileDisplayName(aFile);
- localHandlerApp.executable = aFile;
-
- return localHandlerApp;
-}
-
-/**
- * An enumeration of items in a JS array.
- *
- * FIXME: use ArrayConverter once it lands (bug 380839).
- *
- * @constructor
- */
-function ArrayEnumerator(aItems) {
- this._index = 0;
- this._contents = aItems;
-}
-
-ArrayEnumerator.prototype = {
- _index: 0,
-
- hasMoreElements() {
- return this._index < this._contents.length;
- },
-
- getNext() {
- return this._contents[this._index++];
- }
-};
-
-function isFeedType(t) {
- return t == TYPE_MAYBE_FEED || t == TYPE_MAYBE_VIDEO_FEED || t == TYPE_MAYBE_AUDIO_FEED;
-}
-
-// HandlerInfoWrapper
-
-/**
- * This object wraps nsIHandlerInfo with some additional functionality
- * the Applications prefpane needs to display and allow modification of
- * the list of handled types.
- *
- * We create an instance of this wrapper for each entry we might display
- * in the prefpane, and we compose the instances from various sources,
- * including plugins and the handler service.
- *
- * We don't implement all the original nsIHandlerInfo functionality,
- * just the stuff that the prefpane needs.
- *
- * In theory, all of the custom functionality in this wrapper should get
- * pushed down into nsIHandlerInfo eventually.
- */
-function HandlerInfoWrapper(aType, aHandlerInfo) {
- this._type = aType;
- this.wrappedHandlerInfo = aHandlerInfo;
-}
-
-HandlerInfoWrapper.prototype = {
- // The wrapped nsIHandlerInfo object. In general, this object is private,
- // but there are a couple cases where callers access it directly for things
- // we haven't (yet?) implemented, so we make it a public property.
- wrappedHandlerInfo: null,
-
-
- // Convenience Utils
-
- _handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
- getService(Ci.nsIHandlerService),
-
- _prefSvc: Cc["@mozilla.org/preferences-service;1"].
- getService(Ci.nsIPrefBranch),
-
- _categoryMgr: Cc["@mozilla.org/categorymanager;1"].
- getService(Ci.nsICategoryManager),
-
- element(aID) {
- return document.getElementById(aID);
- },
-
-
- // nsIHandlerInfo
-
- // The MIME type or protocol scheme.
- _type: null,
- get type() {
- return this._type;
- },
-
- get description() {
- if (this.wrappedHandlerInfo.description)
- return this.wrappedHandlerInfo.description;
-
- if (this.primaryExtension) {
- var extension = this.primaryExtension.toUpperCase();
- return this.element("bundlePreferences").getFormattedString("fileEnding",
- [extension]);
- }
-
- return this.type;
- },
-
- get preferredApplicationHandler() {
- return this.wrappedHandlerInfo.preferredApplicationHandler;
- },
-
- set preferredApplicationHandler(aNewValue) {
- this.wrappedHandlerInfo.preferredApplicationHandler = aNewValue;
-
- // Make sure the preferred handler is in the set of possible handlers.
- if (aNewValue)
- this.addPossibleApplicationHandler(aNewValue)
- },
-
- get possibleApplicationHandlers() {
- return this.wrappedHandlerInfo.possibleApplicationHandlers;
- },
-
- addPossibleApplicationHandler(aNewHandler) {
- var possibleApps = this.possibleApplicationHandlers.enumerate();
- while (possibleApps.hasMoreElements()) {
- if (possibleApps.getNext().equals(aNewHandler))
- return;
- }
- this.possibleApplicationHandlers.appendElement(aNewHandler);
- },
-
- removePossibleApplicationHandler(aHandler) {
- var defaultApp = this.preferredApplicationHandler;
- if (defaultApp && aHandler.equals(defaultApp)) {
- // If the app we remove was the default app, we must make sure
- // it won't be used anymore
- this.alwaysAskBeforeHandling = true;
- this.preferredApplicationHandler = null;
- }
-
- var handlers = this.possibleApplicationHandlers;
- for (var i = 0; i < handlers.length; ++i) {
- var handler = handlers.queryElementAt(i, Ci.nsIHandlerApp);
- if (handler.equals(aHandler)) {
- handlers.removeElementAt(i);
- break;
- }
- }
- },
-
- get hasDefaultHandler() {
- return this.wrappedHandlerInfo.hasDefaultHandler;
- },
-
- get defaultDescription() {
- return this.wrappedHandlerInfo.defaultDescription;
- },
-
- // What to do with content of this type.
- get preferredAction() {
- // If we have an enabled plugin, then the action is to use that plugin.
- if (this.pluginName && !this.isDisabledPluginType)
- return kActionUsePlugin;
-
- // If the action is to use a helper app, but we don't have a preferred
- // handler app, then switch to using the system default, if any; otherwise
- // fall back to saving to disk, which is the default action in nsMIMEInfo.
- // Note: "save to disk" is an invalid value for protocol info objects,
- // but the alwaysAskBeforeHandling getter will detect that situation
- // and always return true in that case to override this invalid value.
- if (this.wrappedHandlerInfo.preferredAction == Ci.nsIHandlerInfo.useHelperApp &&
- !gMainPane.isValidHandlerApp(this.preferredApplicationHandler)) {
- if (this.wrappedHandlerInfo.hasDefaultHandler)
- return Ci.nsIHandlerInfo.useSystemDefault;
- return Ci.nsIHandlerInfo.saveToDisk;
- }
-
- return this.wrappedHandlerInfo.preferredAction;
- },
-
- set preferredAction(aNewValue) {
- // If the action is to use the plugin,
- // we must set the preferred action to "save to disk".
- // But only if it's not currently the preferred action.
- if ((aNewValue == kActionUsePlugin) &&
- (this.preferredAction != Ci.nsIHandlerInfo.saveToDisk)) {
- aNewValue = Ci.nsIHandlerInfo.saveToDisk;
- }
-
- // We don't modify the preferred action if the new action is to use a plugin
- // because handler info objects don't understand our custom "use plugin"
- // value. Also, leaving it untouched means that we can automatically revert
- // to the old setting if the user ever removes the plugin.
-
- if (aNewValue != kActionUsePlugin)
- this.wrappedHandlerInfo.preferredAction = aNewValue;
- },
-
- get alwaysAskBeforeHandling() {
- // If this type is handled only by a plugin, we can't trust the value
- // in the handler info object, since it'll be a default based on the absence
- // of any user configuration, and the default in that case is to always ask,
- // even though we never ask for content handled by a plugin, so special case
- // plugin-handled types by returning false here.
- if (this.pluginName && this.handledOnlyByPlugin)
- return false;
-
- // If this is a protocol type and the preferred action is "save to disk",
- // which is invalid for such types, then return true here to override that
- // action. This could happen when the preferred action is to use a helper
- // app, but the preferredApplicationHandler is invalid, and there isn't
- // a default handler, so the preferredAction getter returns save to disk
- // instead.
- if (!(this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) &&
- this.preferredAction == Ci.nsIHandlerInfo.saveToDisk)
- return true;
-
- return this.wrappedHandlerInfo.alwaysAskBeforeHandling;
- },
-
- set alwaysAskBeforeHandling(aNewValue) {
- this.wrappedHandlerInfo.alwaysAskBeforeHandling = aNewValue;
- },
-
-
- // nsIMIMEInfo
-
- // The primary file extension associated with this type, if any.
- //
- // XXX Plugin objects contain an array of MimeType objects with "suffixes"
- // properties; if this object has an associated plugin, shouldn't we check
- // those properties for an extension?
- get primaryExtension() {
- try {
- if (this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
- this.wrappedHandlerInfo.primaryExtension)
- return this.wrappedHandlerInfo.primaryExtension
- } catch (ex) {}
-
- return null;
- },
-
-
- // Plugin Handling
-
- // A plugin that can handle this type, if any.
- //
- // Note: just because we have one doesn't mean it *will* handle the type.
- // That depends on whether or not the type is in the list of types for which
- // plugin handling is disabled.
- plugin: null,
-
- // Whether or not this type is only handled by a plugin or is also handled
- // by some user-configured action as specified in the handler info object.
- //
- // Note: we can't just check if there's a handler info object for this type,
- // because OS and user configuration is mixed up in the handler info object,
- // so we always need to retrieve it for the OS info and can't tell whether
- // it represents only OS-default information or user-configured information.
- //
- // FIXME: once handler info records are broken up into OS-provided records
- // and user-configured records, stop using this boolean flag and simply
- // check for the presence of a user-configured record to determine whether
- // or not this type is only handled by a plugin. Filed as bug 395142.
- handledOnlyByPlugin: undefined,
-
- get isDisabledPluginType() {
- return this._getDisabledPluginTypes().indexOf(this.type) != -1;
- },
-
- _getDisabledPluginTypes() {
- var types = "";
-
- if (this._prefSvc.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES))
- types = this._prefSvc.getCharPref(PREF_DISABLED_PLUGIN_TYPES);
-
- // Only split if the string isn't empty so we don't end up with an array
- // containing a single empty string.
- if (types != "")
- return types.split(",");
-
- return [];
- },
-
- disablePluginType() {
- var disabledPluginTypes = this._getDisabledPluginTypes();
-
- if (disabledPluginTypes.indexOf(this.type) == -1)
- disabledPluginTypes.push(this.type);
-
- this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
- disabledPluginTypes.join(","));
-
- // Update the category manager so existing browser windows update.
- this._categoryMgr.deleteCategoryEntry("Gecko-Content-Viewers",
- this.type,
- false);
- },
-
- enablePluginType() {
- var disabledPluginTypes = this._getDisabledPluginTypes();
-
- var type = this.type;
- disabledPluginTypes = disabledPluginTypes.filter(v => v != type);
-
- this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
- disabledPluginTypes.join(","));
-
- // Update the category manager so existing browser windows update.
- this._categoryMgr.
- addCategoryEntry("Gecko-Content-Viewers",
- this.type,
- "@mozilla.org/content/plugin/document-loader-factory;1",
- false,
- true);
- },
-
-
- // Storage
-
- store() {
- this._handlerSvc.store(this.wrappedHandlerInfo);
- },
-
-
- // Icons
-
- get smallIcon() {
- return this._getIcon(16);
- },
-
- _getIcon(aSize) {
- if (this.primaryExtension)
- return "moz-icon://goat." + this.primaryExtension + "?size=" + aSize;
-
- if (this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo)
- return "moz-icon://goat?size=" + aSize + "&contentType=" + this.type;
-
- // FIXME: consider returning some generic icon when we can't get a URL for
- // one (for example in the case of protocol schemes). Filed as bug 395141.
- return null;
- }
-
-};
-
-
-// Feed Handler Info
-
-/**
- * This object implements nsIHandlerInfo for the feed types. It's a separate
- * object because we currently store handling information for the feed type
- * in a set of preferences rather than the nsIHandlerService-managed datastore.
- *
- * This object inherits from HandlerInfoWrapper in order to get functionality
- * that isn't special to the feed type.
- *
- * XXX Should we inherit from HandlerInfoWrapper? After all, we override
- * most of that wrapper's properties and methods, and we have to dance around
- * the fact that the wrapper expects to have a wrappedHandlerInfo, which we
- * don't provide.
- */
-
-function FeedHandlerInfo(aMIMEType) {
- HandlerInfoWrapper.call(this, aMIMEType, null);
-}
-
-FeedHandlerInfo.prototype = {
- __proto__: HandlerInfoWrapper.prototype,
-
- // Convenience Utils
-
- _converterSvc:
- Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"].
- getService(Ci.nsIWebContentConverterService),
-
- _shellSvc: AppConstants.HAVE_SHELL_SERVICE ? getShellService() : null,
-
- // nsIHandlerInfo
-
- get description() {
- return this.element("bundlePreferences").getString(this._appPrefLabel);
- },
-
- get preferredApplicationHandler() {
- switch (this.element(this._prefSelectedReader).value) {
- case "client":
- var file = this.element(this._prefSelectedApp).value;
- if (file)
- return getLocalHandlerApp(file);
-
- return null;
-
- case "web":
- var uri = this.element(this._prefSelectedWeb).value;
- if (!uri)
- return null;
- return this._converterSvc.getWebContentHandlerByURI(this.type, uri);
-
- case "bookmarks":
- default:
- // When the pref is set to bookmarks, we handle feeds internally,
- // we don't forward them to a local or web handler app, so there is
- // no preferred handler.
- return null;
- }
- },
-
- set preferredApplicationHandler(aNewValue) {
- if (aNewValue instanceof Ci.nsILocalHandlerApp) {
- this.element(this._prefSelectedApp).value = aNewValue.executable;
- this.element(this._prefSelectedReader).value = "client";
- } else if (aNewValue instanceof Ci.nsIWebContentHandlerInfo) {
- this.element(this._prefSelectedWeb).value = aNewValue.uri;
- this.element(this._prefSelectedReader).value = "web";
- // Make the web handler be the new "auto handler" for feeds.
- // Note: we don't have to unregister the auto handler when the user picks
- // a non-web handler (local app, Live Bookmarks, etc.) because the service
- // only uses the "auto handler" when the selected reader is a web handler.
- // We also don't have to unregister it when the user turns on "always ask"
- // (i.e. preview in browser), since that also overrides the auto handler.
- this._converterSvc.setAutoHandler(this.type, aNewValue);
- }
- },
-
- _possibleApplicationHandlers: null,
-
- get possibleApplicationHandlers() {
- if (this._possibleApplicationHandlers)
- return this._possibleApplicationHandlers;
-
- // A minimal implementation of nsIMutableArray. It only supports the two
- // methods its callers invoke, namely appendElement and nsIArray::enumerate.
- this._possibleApplicationHandlers = {
- _inner: [],
- _removed: [],
-
- QueryInterface(aIID) {
- if (aIID.equals(Ci.nsIMutableArray) ||
- aIID.equals(Ci.nsIArray) ||
- aIID.equals(Ci.nsISupports))
- return this;
-
- throw Cr.NS_ERROR_NO_INTERFACE;
- },
-
- get length() {
- return this._inner.length;
- },
-
- enumerate() {
- return new ArrayEnumerator(this._inner);
- },
-
- appendElement(aHandlerApp, aWeak) {
- this._inner.push(aHandlerApp);
- },
-
- removeElementAt(aIndex) {
- this._removed.push(this._inner[aIndex]);
- this._inner.splice(aIndex, 1);
- },
-
- queryElementAt(aIndex, aInterface) {
- return this._inner[aIndex].QueryInterface(aInterface);
- }
- };
-
- // Add the selected local app if it's different from the OS default handler.
- // Unlike for other types, we can store only one local app at a time for the
- // feed type, since we store it in a preference that historically stores
- // only a single path. But we display all the local apps the user chooses
- // while the prefpane is open, only dropping the list when the user closes
- // the prefpane, for maximum usability and consistency with other types.
- var preferredAppFile = this.element(this._prefSelectedApp).value;
- if (preferredAppFile) {
- let preferredApp = getLocalHandlerApp(preferredAppFile);
- let defaultApp = this._defaultApplicationHandler;
- if (!defaultApp || !defaultApp.equals(preferredApp))
- this._possibleApplicationHandlers.appendElement(preferredApp);
- }
-
- // Add the registered web handlers. There can be any number of these.
- var webHandlers = this._converterSvc.getContentHandlers(this.type);
- for (let webHandler of webHandlers)
- this._possibleApplicationHandlers.appendElement(webHandler);
-
- return this._possibleApplicationHandlers;
- },
-
- __defaultApplicationHandler: undefined,
- get _defaultApplicationHandler() {
- if (typeof this.__defaultApplicationHandler != "undefined")
- return this.__defaultApplicationHandler;
-
- var defaultFeedReader = null;
- if (AppConstants.HAVE_SHELL_SERVICE) {
- try {
- defaultFeedReader = this._shellSvc.defaultFeedReader;
- } catch (ex) {
- // no default reader or _shellSvc is null
- }
- }
-
- if (defaultFeedReader) {
- let handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
- createInstance(Ci.nsIHandlerApp);
- handlerApp.name = getFileDisplayName(defaultFeedReader);
- handlerApp.QueryInterface(Ci.nsILocalHandlerApp);
- handlerApp.executable = defaultFeedReader;
-
- this.__defaultApplicationHandler = handlerApp;
- } else {
- this.__defaultApplicationHandler = null;
- }
-
- return this.__defaultApplicationHandler;
- },
-
- get hasDefaultHandler() {
- if (AppConstants.HAVE_SHELL_SERVICE) {
- try {
- if (this._shellSvc.defaultFeedReader)
- return true;
- } catch (ex) {
- // no default reader or _shellSvc is null
- }
- }
-
- return false;
- },
-
- get defaultDescription() {
- if (this.hasDefaultHandler)
- return this._defaultApplicationHandler.name;
-
- // Should we instead return null?
- return "";
- },
-
- // What to do with content of this type.
- get preferredAction() {
- switch (this.element(this._prefSelectedAction).value) {
-
- case "bookmarks":
- return Ci.nsIHandlerInfo.handleInternally;
-
- case "reader": {
- let preferredApp = this.preferredApplicationHandler;
- let defaultApp = this._defaultApplicationHandler;
-
- // If we have a valid preferred app, return useSystemDefault if it's
- // the default app; otherwise return useHelperApp.
- if (gMainPane.isValidHandlerApp(preferredApp)) {
- if (defaultApp && defaultApp.equals(preferredApp))
- return Ci.nsIHandlerInfo.useSystemDefault;
-
- return Ci.nsIHandlerInfo.useHelperApp;
- }
-
- // The pref is set to "reader", but we don't have a valid preferred app.
- // What do we do now? Not sure this is the best option (perhaps we
- // should direct the user to the default app, if any), but for now let's
- // direct the user to live bookmarks.
- return Ci.nsIHandlerInfo.handleInternally;
- }
-
- // If the action is "ask", then alwaysAskBeforeHandling will override
- // the action, so it doesn't matter what we say it is, it just has to be
- // something that doesn't cause the controller to hide the type.
- case "ask":
- default:
- return Ci.nsIHandlerInfo.handleInternally;
- }
- },
-
- set preferredAction(aNewValue) {
- switch (aNewValue) {
-
- case Ci.nsIHandlerInfo.handleInternally:
- this.element(this._prefSelectedReader).value = "bookmarks";
- break;
-
- case Ci.nsIHandlerInfo.useHelperApp:
- this.element(this._prefSelectedAction).value = "reader";
- // The controller has already set preferredApplicationHandler
- // to the new helper app.
- break;
-
- case Ci.nsIHandlerInfo.useSystemDefault:
- this.element(this._prefSelectedAction).value = "reader";
- this.preferredApplicationHandler = this._defaultApplicationHandler;
- break;
- }
- },
-
- get alwaysAskBeforeHandling() {
- return this.element(this._prefSelectedAction).value == "ask";
- },
-
- set alwaysAskBeforeHandling(aNewValue) {
- if (aNewValue == true)
- this.element(this._prefSelectedAction).value = "ask";
- else
- this.element(this._prefSelectedAction).value = "reader";
- },
-
- // Whether or not we are currently storing the action selected by the user.
- // We use this to suppress notification-triggered updates to the list when
- // we make changes that may spawn such updates, specifically when we change
- // the action for the feed type, which results in feed preference updates,
- // which spawn "pref changed" notifications that would otherwise cause us
- // to rebuild the view unnecessarily.
- _storingAction: false,
-
-
- // nsIMIMEInfo
-
- get primaryExtension() {
- return "xml";
- },
-
-
- // Storage
-
- // Changes to the preferred action and handler take effect immediately
- // (we write them out to the preferences right as they happen),
- // so we when the controller calls store() after modifying the handlers,
- // the only thing we need to store is the removal of possible handlers
- // XXX Should we hold off on making the changes until this method gets called?
- store() {
- for (let app of this._possibleApplicationHandlers._removed) {
- if (app instanceof Ci.nsILocalHandlerApp) {
- let pref = this.element(PREF_FEED_SELECTED_APP);
- var preferredAppFile = pref.value;
- if (preferredAppFile) {
- let preferredApp = getLocalHandlerApp(preferredAppFile);
- if (app.equals(preferredApp))
- pref.reset();
- }
- } else {
- app.QueryInterface(Ci.nsIWebContentHandlerInfo);
- this._converterSvc.removeContentHandler(app.contentType, app.uri);
- }
- }
- this._possibleApplicationHandlers._removed = [];
- },
-
-
- // Icons
-
- get smallIcon() {
- return this._smallIcon;
- }
-
-};
-
-var feedHandlerInfo = {
- __proto__: new FeedHandlerInfo(TYPE_MAYBE_FEED),
- _prefSelectedApp: PREF_FEED_SELECTED_APP,
- _prefSelectedWeb: PREF_FEED_SELECTED_WEB,
- _prefSelectedAction: PREF_FEED_SELECTED_ACTION,
- _prefSelectedReader: PREF_FEED_SELECTED_READER,
- _smallIcon: "chrome://browser/skin/feeds/feedIcon16.png",
- _appPrefLabel: "webFeed"
-}
-
-var videoFeedHandlerInfo = {
- __proto__: new FeedHandlerInfo(TYPE_MAYBE_VIDEO_FEED),
- _prefSelectedApp: PREF_VIDEO_FEED_SELECTED_APP,
- _prefSelectedWeb: PREF_VIDEO_FEED_SELECTED_WEB,
- _prefSelectedAction: PREF_VIDEO_FEED_SELECTED_ACTION,
- _prefSelectedReader: PREF_VIDEO_FEED_SELECTED_READER,
- _smallIcon: "chrome://browser/skin/feeds/videoFeedIcon16.png",
- _appPrefLabel: "videoPodcastFeed"
-}
-
-var audioFeedHandlerInfo = {
- __proto__: new FeedHandlerInfo(TYPE_MAYBE_AUDIO_FEED),
- _prefSelectedApp: PREF_AUDIO_FEED_SELECTED_APP,
- _prefSelectedWeb: PREF_AUDIO_FEED_SELECTED_WEB,
- _prefSelectedAction: PREF_AUDIO_FEED_SELECTED_ACTION,
- _prefSelectedReader: PREF_AUDIO_FEED_SELECTED_READER,
- _smallIcon: "chrome://browser/skin/feeds/audioFeedIcon16.png",
- _appPrefLabel: "audioPodcastFeed"
-}
-
-/**
- * InternalHandlerInfoWrapper provides a basic mechanism to create an internal
- * mime type handler that can be enabled/disabled in the applications preference
- * menu.
- */
-function InternalHandlerInfoWrapper(aMIMEType) {
- var mimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
- var handlerInfo = mimeSvc.getFromTypeAndExtension(aMIMEType, null);
-
- HandlerInfoWrapper.call(this, aMIMEType, handlerInfo);
-}
-
-InternalHandlerInfoWrapper.prototype = {
- __proto__: HandlerInfoWrapper.prototype,
-
- // Override store so we so we can notify any code listening for registration
- // or unregistration of this handler.
- store() {
- HandlerInfoWrapper.prototype.store.call(this);
- Services.obs.notifyObservers(null, this._handlerChanged);
- },
-
- get enabled() {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
- },
-
- get description() {
- return this.element("bundlePreferences").getString(this._appPrefLabel);
- }
-};
-
-var pdfHandlerInfo = {
- __proto__: new InternalHandlerInfoWrapper(TYPE_PDF),
- _handlerChanged: TOPIC_PDFJS_HANDLER_CHANGED,
- _appPrefLabel: "portableDocumentFormat",
- get enabled() {
- return !Services.prefs.getBoolPref(PREF_PDFJS_DISABLED);
- },
-};
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/main.xul
+++ /dev/null
@@ -1,1017 +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-new/main.js"/>
-
-#ifdef MOZ_UPDATER
- <script type="application/javascript" src="chrome://browser/content/aboutDialog-appUpdater.js"/>
-#endif
-
-<script type="application/javascript"
- src="chrome://mozapps/content/preferences/fontbuilder.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"/>
-
- <!-- 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"/>
-
- <preference id="toolkit.telemetry.enabled"
- name="toolkit.telemetry.enabled"
- 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="dom.ipc.processCount.web"
- name="dom.ipc.processCount.web"
- type="int"/>
-
- <preference id="layers.acceleration.disabled"
- name="layers.acceleration.disabled"
- type="bool"
- inverted="true"/>
-
- <!-- Files and Applications -->
- <preference id="browser.feeds.handler"
- name="browser.feeds.handler"
- type="string"/>
- <preference id="browser.feeds.handler.default"
- name="browser.feeds.handler.default"
- type="string"/>
- <preference id="browser.feeds.handlers.application"
- name="browser.feeds.handlers.application"
- type="file"/>
- <preference id="browser.feeds.handlers.webservice"
- name="browser.feeds.handlers.webservice"
- type="string"/>
-
- <preference id="browser.videoFeeds.handler"
- name="browser.videoFeeds.handler"
- type="string"/>
- <preference id="browser.videoFeeds.handler.default"
- name="browser.videoFeeds.handler.default"
- type="string"/>
- <preference id="browser.videoFeeds.handlers.application"
- name="browser.videoFeeds.handlers.application"
- type="file"/>
- <preference id="browser.videoFeeds.handlers.webservice"
- name="browser.videoFeeds.handlers.webservice"
- type="string"/>
-
- <preference id="browser.audioFeeds.handler"
- name="browser.audioFeeds.handler"
- type="string"/>
- <preference id="browser.audioFeeds.handler.default"
- name="browser.audioFeeds.handler.default"
- type="string"/>
- <preference id="browser.audioFeeds.handlers.application"
- name="browser.audioFeeds.handlers.application"
- type="file"/>
- <preference id="browser.audioFeeds.handlers.webservice"
- name="browser.audioFeeds.handlers.webservice"
- type="string"/>
-
- <preference id="pref.downloads.disable_button.edit_actions"
- name="pref.downloads.disable_button.edit_actions"
- type="bool"/>
-
- <!-- DRM content -->
- <preference id="media.eme.enabled"
- name="media.eme.enabled"
- type="bool"/>
-
- <!-- Update -->
- <preference id="browser.preferences.advanced.selectedTabIndex"
- name="browser.preferences.advanced.selectedTabIndex"
- type="int"/>
-
-#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>
-
-<hbox id="generalCategory"
- class="subcategory"
- 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">
- <image class="face-sad"/>
- <label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
- <button id="setDefaultButton"
- class="accessory-button"
- label="&setAsMyDefaultBrowser3.label;" accesskey="&setAsMyDefaultBrowser3.accesskey;"
- preference="pref.general.disable_button.default_browser"/>
- </hbox>
- <hbox align="center" class="indent">
- <image class="face-smile"/>
- <label id="isDefaultLabel" flex="1">&isDefault.label;</label>
- </hbox>
- </deck>
- </vbox>
-#endif
-
- <vbox id="startupPageBox">
- <label accesskey="&startupPage2.accesskey;"
- control="browserStartupPage">&startupPage2.label;</label>
- <radiogroup id="browserStartupPage"
- preference="browser.startup.page">
- <radio label="&startupUserHomePage.label;"
- value="1"
- id="browserStartupHomePage"/>
- <radio label="&startupBlankPage.label;"
- value="0"
- id="browserStartupBlank"/>
- <radio label="&startupPrevSession.label;"
- value="3"
- id="browserStartupLastSession"/>
- </radiogroup>
- </vbox>
-</groupbox>
-
-<!-- Home Page -->
-<groupbox id="homepageGroup"
- data-category="paneGeneral"
- hidden="true">
- <caption><label>&homepage2.label;</label></caption>
-
- <vbox>
- <textbox id="browserHomePage"
- class="uri-element"
- type="autocomplete"
- autocompletesearch="unifiedcomplete"
- onsyncfrompreference="return gMainPane.syncFromHomePref();"
- onsynctopreference="return gMainPane.syncToHomePref(this.value);"
- placeholder="&abouthome.pageTitle;"
- preference="browser.startup.homepage"/>
- </vbox>
-
- <hbox class="homepage-buttons">
- <button id="useCurrent"
- flex="1"
- class="homepage-button"
- label=""
- accesskey="&useCurrentPage.accesskey;"
- label1="&useCurrentPage.label;"
- label2="&useMultiple.label;"
- preference="pref.browser.homepage.disable_button.current_page"/>
- <button id="useBookmark"
- flex="1"
- class="homepage-button"
- label="&chooseBookmark.label;"
- accesskey="&chooseBookmark.accesskey;"
- preference="pref.browser.homepage.disable_button.bookmark_page"
- searchkeywords="&selectBookmark.title; &selectBookmark.label;"/>
- <button id="restoreDefaultHomePage"
- flex="1"
- class="homepage-button"
- label="&restoreDefault.label;"
- accesskey="&restoreDefault.accesskey;"
- preference="pref.browser.homepage.disable_button.restore_default"/>
- </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
-
- <hbox id="browserContainersbox" hidden="true" 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"/>
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <hbox>
- <button id="browserContainersSettings"
- class="accessory-button"
- label="&browserContainersSettings.label;"
- accesskey="&browserContainersSettings.accesskey;"
- searchkeywords="&addButton.label;
- &preferencesButton.label;
- &removeButton.label;"/>
- </hbox>
- </hbox>
-</groupbox>
-
-<hbox id="languageAndAppearanceCategory"
- class="subcategory"
- hidden="true"
- data-category="paneGeneral">
- <label class="header-name" flex="1">&languageAndAppearance.label;</label>
-</hbox>
-
-<!-- Fonts and Colors -->
-<groupbox id="fontsGroup" data-category="paneGeneral" hidden="true">
- <caption><label>&fontsAndColors.label;</label></caption>
-
- <vbox>
- <hbox id="fontSettings">
- <hbox align="center" flex="1">
- <label control="defaultFont" accesskey="&defaultFont2.accesskey;">&defaultFont2.label;</label>
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <hbox flex="1">
- <menulist id="defaultFont" flex="1" delayprefsave="true" onsyncfrompreference="return FontBuilder.readFontSelection(this);"/>
- </hbox>
- <label id="defaultFontSizeLabel" control="defaultFontSize" accesskey="&defaultSize2.accesskey;">&defaultSize2.label;</label>
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <hbox>
- <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>
- </hbox>
- <spacer flex="1" />
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <hbox>
- <button id="advancedFonts"
- class="accessory-button"
- icon="select-font"
- label="&advancedFonts.label;"
- accesskey="&advancedFonts.accesskey;"
- searchkeywords="&fontsDialog.title;
- &fonts.label;
- &size2.label;
- &proportional2.label;
- &serif2.label;
- &sans-serif2.label;
- &monospace2.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;
- &minSize2.label;
- &minSize.none;
- &useDefaultFontSerif.label;
- &useDefaultFontSansSerif.label;
- &allowPagesToUseOwn.label;
- &languages.customize.Fallback2.grouplabel;
- &languages.customize.Fallback3.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>
- <hbox id="colorsSettings">
- <spacer flex="1" />
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <hbox>
- <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;
- &color;
- &textColor2.label;
- &backgroundColor2.label;
- &useSystemColors.label;
- &underlineLinks.label;
- &linkColor2.label;
- &visitedLinkColor2.label;"/>
- </hbox>
- </hbox>
- </vbox>
-</groupbox>
-
-<!-- Languages -->
-<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true">
- <caption><label>&language2.label;</label></caption>
-
- <hbox id="languagesBox" align="center">
- <description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <hbox>
- <button id="chooseLanguage"
- class="accessory-button"
- label="&chooseButton.label;"
- accesskey="&chooseButton.accesskey;"
- searchkeywords="&languages.customize.Header;
- &languages.customize2.description;
- &languages.customize.moveUp.label;
- &languages.customize.moveDown.label;
- &languages.customize.deleteButton.label;
- &languages.customize.selectLanguage.label;
- &languages.customize.addButton.label;"/>
- </hbox>
- </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>
-
-<!-- Files and Applications -->
-<hbox id="filesAndApplicationsCategory"
- class="subcategory"
- hidden="true"
- data-category="paneGeneral">
- <label class="header-name" flex="1">&filesAndApplications.label;</label>
-</hbox>
-
-<!--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>
- <!-- Additional radio button added to support CloudStorage - Bug 1357171 -->
- <radio id="saveToCloud"
- value="true"
- hidden="true"/>
- <radio id="alwaysAsk"
- value="false"
- label="&alwaysAskWhere.label;"
- accesskey="&alwaysAskWhere.accesskey;"/>
- </radiogroup>
-</groupbox>
-
-<groupbox id="applicationsGroup" data-category="paneGeneral" hidden="true">
- <caption><label>&applications.label;</label></caption>
- <description>&applications.description;</description>
- <textbox id="filter" flex="1"
- type="search"
- placeholder="&filter2.emptytext;"
- aria-controls="handlersView"/>
-
- <richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
- preference="pref.downloads.disable_button.edit_actions"
- flex="1">
- <listheader equalsize="always">
- <treecol id="typeColumn" label="&typeColumn.label;" value="type"
- accesskey="&typeColumn.accesskey;" persist="sortDirection"
- flex="1" sortDirection="ascending"/>
- <treecol id="actionColumn" label="&actionColumn2.label;" value="action"
- accesskey="&actionColumn2.accesskey;" persist="sortDirection"
- flex="1"/>
- </listheader>
- </richlistbox>
-</groupbox>
-
-
-<!-- DRM Content -->
-<groupbox id="drmGroup" data-category="paneGeneral" data-subcategory="drm" hidden="true">
- <caption><label>&drmContent2.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="&playDRMContent2.label;" accesskey="&playDRMContent2.accesskey;"/>
- <label id="playDRMContentLink" class="learnMore text-link">
- &playDRMContent.learnMore.label;
- </label>
- </hbox>
- </row>
- </rows>
- </grid>
-</groupbox>
-
-#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="updatesCategory"
- class="subcategory"
- hidden="true"
- data-category="paneGeneral">
- <label class="header-name" flex="1">&updateApplication.label;</label>
-</hbox>
-
-<!-- Update -->
-<groupbox id="updateApp" data-category="paneGeneral" hidden="true">
- <caption class="search-header" hidden="true"><label>&updateApplication.label;</label></caption>
-
- <label>&updateApplicationDescription.label;</label>
- <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"/>
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <vbox>
- <button id="showUpdateHistory"
- class="accessory-button"
- label="&updateHistory2.label;"
- accesskey="&updateHistory2.accesskey;"
- preference="app.update.disable_button.showUpdateHistory"
- searchkeywords="&history.title; &history2.intro;"/>
- </vbox>
-#endif
- </hbox>
-#ifdef MOZ_UPDATER
- <vbox id="updateBox">
- <deck id="updateDeck" orient="vertical">
- <hbox id="checkForUpdates" align="start">
- <spacer flex="1"/>
- <button id="checkForUpdatesButton"
- label="&update.checkForUpdatesButton.label;"
- accesskey="&update.checkForUpdatesButton.accesskey;"
- oncommand="gAppUpdater.checkForUpdates();"/>
- </hbox>
- <hbox id="downloadAndInstall" align="start">
- <spacer flex="1"/>
- <button id="downloadAndInstallButton"
- oncommand="gAppUpdater.startDownload();"/>
- <!-- label and accesskey will be filled by JS -->
- </hbox>
- <hbox id="apply" align="start">
- <spacer flex="1"/>
- <button id="updateButton"
- label="&update.updateButton.label3;"
- accesskey="&update.updateButton.accesskey;"
- oncommand="gAppUpdater.buttonRestartAfterDownload();"/>
- </hbox>
- <hbox id="checkingForUpdates" align="start">
- <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="start">
- <image class="update-throbber"/><label>&update.downloading.start;</label><label id="downloadStatus"/><label>&update.downloading.end;</label>
- </hbox>
- <hbox id="applying" align="start">
- <image class="update-throbber"/><label>&update.applying;</label>
- </hbox>
- <hbox id="downloadFailed" align="start">
- <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="start">
- <label>&update.adminDisabled;</label>
- <spacer flex="1"/>
- <button label="&update.checkForUpdatesButton.label;"
- accesskey="&update.checkForUpdatesButton.accesskey;"
- disabled="true"/>
- </hbox>
- <hbox id="noUpdatesFound" align="start">
- <image class="face-smile"/>
- <label>&update.noUpdatesFound;</label>
- <spacer flex="1"/>
- <button label="&update.checkForUpdatesButton.label;"
- accesskey="&update.checkForUpdatesButton.accesskey;"
- oncommand="gAppUpdater.checkForUpdates();"/>
- </hbox>
- <hbox id="otherInstanceHandlingUpdates" align="start">
- <label>&update.otherInstanceHandlingUpdates;</label>
- <spacer flex="1"/>
- <button label="&update.checkForUpdatesButton.label;"
- accesskey="&update.checkForUpdatesButton.accesskey;"
- disabled="true"/>
- </hbox>
- <hbox id="manualUpdate" align="start">
- <image class="face-sad"/>
- <description flex="1">
- <label>&update.manual.start;</label><label id="manualLink" class="text-link"/><label>&update.manual.end;</label>
- </description>
- <spacer flex="1"/>
- <button label="&update.checkForUpdatesButton.label;"
- accesskey="&update.checkForUpdatesButton.accesskey;"
- disabled="true"/>
- </hbox>
- <hbox id="unsupportedSystem" align="start">
- <description flex="1">
- <label>&update.unsupported.start;</label><label id="unsupportedLink" class="learnMore text-link">&update.unsupported.linkText;</label><label>&update.unsupported.end;</label>
- </description>
- <spacer flex="1"/>
- <button label="&update.checkForUpdatesButton.label;"
- accesskey="&update.checkForUpdatesButton.accesskey;"
- disabled="true"/>
- </hbox>
- <hbox id="restarting" align="start">
- <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
-
-#ifdef MOZ_UPDATER
- <description>&updateApplication.description;</description>
- <radiogroup id="updateRadioGroup">
- <radio id="autoDesktop"
- value="auto"
- label="&updateAuto3.label;"
- accesskey="&updateAuto3.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>
-
-<hbox id="performanceCategory"
- class="subcategory"
- hidden="true"
- data-category="paneGeneral">
- <label class="header-name" flex="1">&performance.label;</label>
-</hbox>
-
-<!-- Performance -->
-<groupbox id="performanceGroup" data-category="paneGeneral" hidden="true">
- <caption class="search-header" hidden="true"><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 id="contentProcessCountEnabledDescription">&limitContentProcessOption.description;</description>
- <description id="contentProcessCountDisabledDescription">&limitContentProcessOption.disabledDescription;<label class="text-link" href="https://wiki.mozilla.org/Electrolysis">&limitContentProcessOption.disabledDescriptionLink;</label></description>
- </vbox>
-</groupbox>
-
-<hbox id="browsingCategory"
- class="subcategory"
- hidden="true"
- data-category="paneGeneral">
- <label class="header-name" flex="1">&browsing.label;</label>
-</hbox>
-
-<!-- Browsing -->
-<groupbox id="browsingGroup" data-category="paneGeneral" hidden="true">
- <caption class="search-header" hidden="true"><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"/>
-
-#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"/>
-</groupbox>
-
-<hbox id="networkProxyCategory"
- class="subcategory"
- hidden="true"
- data-category="paneGeneral">
- <label class="header-name" flex="1">&networkProxy.label;</label>
-</hbox>
-
-<!-- Network Proxy-->
-<groupbox id="connectionGroup" data-category="paneGeneral" hidden="true">
- <caption class="search-header" hidden="true"><label>&networkProxy.label;</label></caption>
-
- <hbox align="center">
- <description flex="1" control="connectionSettings">&connectionDesc.label;</description>
- <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
- <hbox>
- <button id="connectionSettings"
- class="accessory-button"
- icon="network"
- label="&connectionSettings.label;"
- accesskey="&connectionSettings.accesskey;"
- searchkeywords="&connectionsDialog.title;
- &noProxyTypeRadio.label;
- &WPADTypeRadio.label;
- &systemTypeRadio.label;
- &manualTypeRadio2.label;
- &http2.label;
- &ssl2.label;
- &ftp2.label;
- &port2.label;
- &socks2.label;
- &socks4.label;
- &socks5.label;
- &noproxy2.label;
- &noproxyExplain.label;
- &shareproxy.label;
- &autoTypeRadio2.label;
- &reload.label;
- &autologinproxy.label;
- &socksRemoteDNS.label2;"/>
- </hbox>
- </hbox>
-</groupbox>
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/moz.build
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'):
- DEFINES[var] = CONFIG[var]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):
- DEFINES['HAVE_SHELL_SERVICE'] = 1
-
-JAR_MANIFESTS += ['jar.mn']
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/preferences.js
+++ /dev/null
@@ -1,363 +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 the files imported by the .xul files.
-/* import-globals-from subdialogs.js */
-/* import-globals-from main.js */
-/* import-globals-from search.js */
-/* import-globals-from containers.js */
-/* import-globals-from privacy.js */
-/* import-globals-from sync.js */
-/* import-globals-from findInPage.js */
-/* import-globals-from ../../../base/content/utilityOverlay.js */
-
-"use strict";
-
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-var Cu = Components.utils;
-var Cr = Components.results;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
-
-var gLastHash = "";
-
-var gCategoryInits = new Map();
-function init_category_if_required(category) {
- let categoryInfo = gCategoryInits.get(category);
- if (!categoryInfo) {
- throw "Unknown in-content prefs category! Can't init " + category;
- }
- if (categoryInfo.inited) {
- return;
- }
- categoryInfo.init();
-}
-
-function register_module(categoryName, categoryObject) {
- gCategoryInits.set(categoryName, {
- inited: false,
- init() {
- categoryObject.init();
- this.inited = true;
- }
- });
-}
-
-document.addEventListener("DOMContentLoaded", init_all, {once: true});
-
-function init_all() {
- document.documentElement.instantApply = true;
-
- gSubDialog.init();
- register_module("paneGeneral", gMainPane);
- register_module("paneSearch", gSearchPane);
- register_module("panePrivacy", gPrivacyPane);
- register_module("paneContainers", gContainersPane);
- register_module("paneSync", gSyncPane);
- register_module("paneSearchResults", gSearchResultsPane);
- gSearchResultsPane.init();
-
- let categories = document.getElementById("categories");
- categories.addEventListener("select", event => gotoPref(event.target.value));
-
- document.documentElement.addEventListener("keydown", function(event) {
- if (event.keyCode == KeyEvent.DOM_VK_TAB) {
- categories.setAttribute("keyboard-navigation", "true");
- }
- });
- categories.addEventListener("mousedown", function() {
- this.removeAttribute("keyboard-navigation");
- });
-
- window.addEventListener("hashchange", onHashChange);
- gotoPref();
-
- init_dynamic_padding();
-
- var initFinished = new CustomEvent("Initialized", {
- "bubbles": true,
- "cancelable": true
- });
- document.dispatchEvent(initFinished);
-
- let helpButton = document.querySelector(".help-button");
- let helpUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "preferences";
- helpButton.setAttribute("href", helpUrl);
-
- // Wait until initialization of all preferences are complete before
- // notifying observers that the UI is now ready.
- Services.obs.notifyObservers(window, "advanced-pane-loaded");
-}
-
-// Make the space above the categories list shrink on low window heights
-function init_dynamic_padding() {
- let categories = document.getElementById("categories");
- let catPadding = Number.parseInt(getComputedStyle(categories)
- .getPropertyValue("padding-top"));
- 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 = `
- @media (max-height: ${fullHeight}px) {
- #categories {
- padding-top: calc(100vh - ${fullHeight - catPadding}px);
- padding-bottom: ${fullHelpHeight}px;
- }
- .help-button {
- bottom: ${reducedHelpButtonBottom / 2}px;
- }
- }
- `;
- let mediaStyle = document.createElementNS("http://www.w3.org/1999/xhtml", "html:style");
- mediaStyle.setAttribute("type", "text/css");
- mediaStyle.appendChild(document.createCDATASection(mediaRule));
- document.documentElement.appendChild(mediaStyle);
-}
-
-function telemetryBucketForCategory(category) {
- category = category.toLowerCase();
- switch (category) {
- case "containers":
- case "general":
- case "privacy":
- case "search":
- case "sync":
- case "searchresults":
- return category;
- default:
- return "unknown";
- }
-}
-
-function onHashChange() {
- gotoPref();
-}
-
-function gotoPref(aCategory) {
- let categories = document.getElementById("categories");
- const kDefaultCategoryInternalName = "paneGeneral";
- const kDefaultCategory = "general";
- let hash = document.location.hash;
-
- 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);
- if (category != "paneSearchResults") {
- gSearchResultsPane.searchInput.value = "";
- gSearchResultsPane.getFindSelection(window).removeAllRanges();
- gSearchResultsPane.removeAllSearchTooltips();
- gSearchResultsPane.removeAllSearchMenuitemIndicators();
- } else if (!gSearchResultsPane.searchInput.value) {
- // Something tried to send us to the search results pane without
- // a query string. Default to the General pane instead.
- category = kDefaultCategoryInternalName;
- document.location.hash = kDefaultCategory;
- gSearchResultsPane.query = null;
- }
-
- // Updating the hash (below) or changing the selected category
- // will re-enter gotoPref.
- if (gLastHash == category && !subcategory)
- return;
-
- let item;
- if (category != "paneSearchResults") {
- item = categories.querySelector(".category[value=" + category + "]");
- if (!item) {
- category = kDefaultCategoryInternalName;
- item = categories.querySelector(".category[value=" + category + "]");
- }
- }
-
- try {
- init_category_if_required(category);
- } catch (ex) {
- Cu.reportError("Error initializing preference category " + category + ": " + ex);
- throw ex;
- }
-
- let friendlyName = internalPrefCategoryNameToFriendlyName(category);
- if (gLastHash || category != kDefaultCategoryInternalName || subcategory) {
- document.location.hash = friendlyName;
- }
- // Need to set the gLastHash before setting categories.selectedItem since
- // the categories 'select' event will re-enter the gotoPref codepath.
- gLastHash = category;
- if (item) {
- categories.selectedItem = item;
- } else {
- categories.clearSelection();
- }
- window.history.replaceState(category, document.title);
- search(category, "data-category", subcategory, "data-subcategory");
-
- let mainContent = document.querySelector(".main-content");
- mainContent.scrollTop = 0;
-
- Services.telemetry
- .getHistogramById("FX_PREFERENCES_CATEGORY_OPENED_V2")
- .add(telemetryBucketForCategory(friendlyName));
-}
-
-function search(aQuery, aAttribute, aSubquery, aSubAttribute) {
- let mainPrefPane = document.getElementById("mainPrefPane");
- let elements = mainPrefPane.children;
- for (let element of elements) {
- // If the "data-hidden-from-search" is "true", the
- // 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" ||
- element.getAttribute("data-subpanel") == "true") {
- let attributeValue = element.getAttribute(aAttribute);
- if (attributeValue == aQuery) {
- if (!element.classList.contains("header") &&
- element.localName !== "preferences" &&
- aSubquery && aSubAttribute) {
- let subAttributeValue = element.getAttribute(aSubAttribute);
- element.hidden = subAttributeValue != aSubquery;
- } else {
- element.hidden = false;
- }
- } else {
- element.hidden = true;
- }
- }
- element.classList.remove("visually-hidden");
- }
-
- let keysets = mainPrefPane.getElementsByTagName("keyset");
- for (let element of keysets) {
- let attributeValue = element.getAttribute(aAttribute);
- if (attributeValue == aQuery)
- element.removeAttribute("disabled");
- else
- element.setAttribute("disabled", true);
- }
-}
-
-function helpButtonCommand() {
- let pane = history.state;
- let categories = document.getElementById("categories");
- let helpTopic = categories.querySelector(".category[value=" + pane + "]")
- .getAttribute("helpTopic");
- openHelpLink(helpTopic);
-}
-
-function friendlyPrefCategoryNameToInternalName(aName) {
- if (aName.startsWith("pane"))
- return aName;
- return "pane" + aName.substring(0, 1).toUpperCase() + aName.substr(1);
-}
-
-// This function is duplicated inside of utilityOverlay.js's openPreferences.
-function internalPrefCategoryNameToFriendlyName(aName) {
- return (aName || "").replace(/^pane./, function(toReplace) { return toReplace[4].toLowerCase(); });
-}
-
-// Put up a confirm dialog with "ok to restart", "revert without restarting"
-// and "restart later" buttons and returns the index of the button chosen.
-// We can choose not to display the "restart later", or "revert" buttons,
-// altough the later still lets us revert by using the escape key.
-//
-// The constants are useful to interpret the return value of the function.
-const CONFIRM_RESTART_PROMPT_RESTART_NOW = 0;
-const CONFIRM_RESTART_PROMPT_CANCEL = 1;
-const CONFIRM_RESTART_PROMPT_RESTART_LATER = 2;
-function confirmRestartPrompt(aRestartToEnable, aDefaultButtonIndex,
- aWantRevertAsCancelButton,
- aWantRestartLaterButton) {
- let brandName = document.getElementById("bundleBrand").getString("brandShortName");
- let bundle = document.getElementById("bundlePreferences");
- let msg = bundle.getFormattedString(aRestartToEnable ?
- "featureEnableRequiresRestart" :
- "featureDisableRequiresRestart",
- [brandName]);
- let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);
- let prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
-
- // Set up the first (index 0) button:
- let button0Text = bundle.getFormattedString("okToRestartButton", [brandName]);
- let buttonFlags = (Services.prompt.BUTTON_POS_0 *
- Services.prompt.BUTTON_TITLE_IS_STRING);
-
-
- // Set up the second (index 1) button:
- let button1Text = null;
- if (aWantRevertAsCancelButton) {
- button1Text = bundle.getString("revertNoRestartButton");
- buttonFlags += (Services.prompt.BUTTON_POS_1 *
- Services.prompt.BUTTON_TITLE_IS_STRING);
- } else {
- buttonFlags += (Services.prompt.BUTTON_POS_1 *
- Services.prompt.BUTTON_TITLE_CANCEL);
- }
-
- // Set up the third (index 2) button:
- let button2Text = null;
- if (aWantRestartLaterButton) {
- button2Text = bundle.getString("restartLater");
- buttonFlags += (Services.prompt.BUTTON_POS_2 *
- Services.prompt.BUTTON_TITLE_IS_STRING);
- }
-
- switch (aDefaultButtonIndex) {
- case 0:
- buttonFlags += Services.prompt.BUTTON_POS_0_DEFAULT;
- break;
- case 1:
- buttonFlags += Services.prompt.BUTTON_POS_1_DEFAULT;
- break;
- case 2:
- buttonFlags += Services.prompt.BUTTON_POS_2_DEFAULT;
- break;
- default:
- break;
- }
-
- let buttonIndex = prompts.confirmEx(window, title, msg, buttonFlags,
- button0Text, button1Text, button2Text,
- null, {});
-
- // If we have the second confirmation dialog for restart, see if the user
- // cancels out at that point.
- if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
- let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Ci.nsISupportsPRBool);
- Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
- "restart");
- if (cancelQuit.data) {
- buttonIndex = CONFIRM_RESTART_PROMPT_CANCEL;
- }
- }
- return buttonIndex;
-}
-
-// This function is used to append search keywords found
-// in the related subdialog to the button that will activate the subdialog.
-function appendSearchKeywords(aId, keywords) {
- let element = document.getElementById(aId);
- let searchKeywords = element.getAttribute("searchkeywords");
- if (searchKeywords) {
- keywords.push(searchKeywords);
- }
- element.setAttribute("searchkeywords", keywords.join(" "));
-}
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/preferences.xul
+++ /dev/null
@@ -1,215 +0,0 @@
-<?xml version="1.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/. -->
-
-<?xml-stylesheet href="chrome://global/skin/global.css"?>
-
-<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
-<?xml-stylesheet href="chrome://global/skin/in-content/common.css"?>
-<?xml-stylesheet
- href="chrome://browser/skin/preferences/in-content-new/preferences.css"?>
-<?xml-stylesheet
- href="chrome://browser/content/preferences/handlers.css"?>
-<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
-<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/search.css"?>
-<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/containers.css"?>
-<?xml-stylesheet href="chrome://browser/skin/preferences/in-content-new/privacy.css"?>
-
-<!DOCTYPE page [
-<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
-<!ENTITY % globalPreferencesDTD SYSTEM "chrome://global/locale/preferences.dtd">
-<!ENTITY % preferencesDTD SYSTEM
- "chrome://browser/locale/preferences/preferences.dtd">
-<!ENTITY % selectBookmarkDTD SYSTEM
- "chrome://browser/locale/preferences/selectBookmark.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 % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
-<!ENTITY % securityDTD SYSTEM
- "chrome://browser/locale/preferences/security.dtd">
-<!ENTITY % containersDTD SYSTEM
- "chrome://browser/locale/preferences/containers.dtd">
-<!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
-<!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences/main.dtd">
-<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
-<!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences/content.dtd">
-<!ENTITY % applicationsDTD SYSTEM
- "chrome://browser/locale/preferences/applications.dtd">
-<!ENTITY % advancedDTD SYSTEM
- "chrome://browser/locale/preferences/advanced.dtd">
-<!ENTITY % aboutDialogDTD SYSTEM "chrome://browser/locale/aboutDialog.dtd" >
-%aboutDialogDTD;
-%brandDTD;
-%globalPreferencesDTD;
-%preferencesDTD;
-%selectBookmarkDTD;
-%languagesDTD;
-%fontDTD;
-%colorsDTD;
-%permissionsDTD;
-%passwordManagerDTD;
-%historyDTD;
-%certManagerDTD;
-%deviceManangerDTD;
-%connectionDTD;
-%siteDataSettingsDTD;
-%privacyDTD;
-%tabsDTD;
-%searchDTD;
-%syncBrandDTD;
-%syncDTD;
-%securityDTD;
-%containersDTD;
-%sanitizeDTD;
-%mainDTD;
-%aboutHomeDTD;
-%contentDTD;
-%applicationsDTD;
-%advancedDTD;
-]>
-
-#ifdef XP_WIN
-#define USE_WIN_TITLE_STYLE
-#endif
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:html="http://www.w3.org/1999/xhtml"
- disablefastfind="true"
-#ifdef USE_WIN_TITLE_STYLE
- title="&prefWindow.titleWin;">
-#else
- title="&prefWindow.title;">
-#endif
-
- <html:link rel="shortcut icon"
- href="chrome://browser/skin/settings.svg"/>
-
- <script type="application/javascript"
- src="chrome://browser/content/utilityOverlay.js"/>
- <script type="application/javascript"
- src="chrome://browser/content/preferences/in-content-new/preferences.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"
- src="chrome://branding/locale/brand.properties"/>
- <stringbundle id="bundlePreferences"
- 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">
- <stringbundle id="appManagerBundle"
- src="chrome://browser/locale/preferences/applicationManager.properties"/>
- </stringbundleset>
-
- <stack flex="1">
- <hbox flex="1">
-
- <!-- category list -->
- <richlistbox id="categories">
- <richlistitem id="category-general"
- class="category"
- value="paneGeneral"
- helpTopic="prefs-main"
- tooltiptext="&paneGeneral.title;"
- align="center">
- <image class="category-icon"/>
- <label class="category-name" flex="1">&paneGeneral.title;</label>
- </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-containers"
- class="category"
- value="paneContainers"
- helpTopic="prefs-containers"
- hidden="true"/>
-
- <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 id="category-sync"
- class="category"
- value="paneSync"
- helpTopic="prefs-weave"
- tooltiptext="&paneSync1.title;"
- align="center">
- <image class="category-icon"/>
- <label class="category-name" flex="1">&paneSync1.title;</label>
- </richlistitem>
- </richlistbox>
-
- <keyset>
- <key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand="gSearchResultsPane.searchInput.focus();"/>
- </keyset>
-
- <html:a class="help-button" target="_blank" aria-label="&helpButton2.label;">&helpButton2.label;</html:a>
-
- <vbox class="main-content" flex="1" align="start">
- <vbox class="pane-container">
- <hbox class="search-container" pack="end">
- <textbox type="search" id="searchInput" hidden="true" clickSelectsAll="true"/>
- </hbox>
- <prefpane id="mainPrefPane">
-#include searchResults.xul
-#include main.xul
-#include search.xul
-#include privacy.xul
-#include containers.xul
-#include sync.xul
- </prefpane>
- </vbox>
- </vbox>
- </hbox>
-
- <stack id="dialogStack" hidden="true"/>
- <vbox id="dialogTemplate" class="dialogOverlay" align="center" pack="center" topmost="true" hidden="true">
- <groupbox class="dialogBox"
- orient="vertical"
- pack="end"
- role="dialog"
- aria-labelledby="dialogTitle">
- <caption flex="1" align="center">
- <label class="dialogTitle" flex="1"></label>
- <button class="dialogClose close-icon"
- aria-label="&preferencesCloseButton.label;"/>
- </caption>
- <browser class="dialogFrame"
- autoscroll="false"
- disablehistory="true"/>
- </groupbox>
- </vbox>
- </stack>
-</page>
deleted file mode 100644
--- a/browser/components/preferences/in-content-new/privacy.js
+++ /dev/null
@@ -1,1635 +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, "PluralForm",
- "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 = {
- _pane: null,
-
- /**
- * 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("trackingProtectionExceptions").hidden = false;
- 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);
- },
-
- /**
- * 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();
-
- 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("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("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("clearCacheButton", "command",
- gPrivacyPane.clearCache);
-
- this._pane = document.getElementById("panePrivacy");
- this._initMasterPasswordUI();
- this._initSafeBrowsing();
- this.updateCacheSizeInputField();
- this.updateActualCacheSize();
-
- setEventListener("notificationSettingsButton", "command",
- gPrivacyPane.showNotificationExceptions);
- setEventListener("locationSettingsButton", "command",
- gPrivacyPane.showLocationExceptions);
- setEventListener("cameraSettingsButton", "command",
- gPrivacyPane.showCameraExceptions);
- setEventListener("microphoneSettingsButton", "command",
- gPrivacyPane.showMicrophoneExceptions);
- 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.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.removeAttribute("data-hidden-from-search");
- }
-
- let notificationInfoURL =
- Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";
- document.getElementById("notificationPermissionsLearnMore").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");
- }
-
- this.initDataCollection();
- if (AppConstants.MOZ_CRASHREPORTER) {
- this.initSubmitCrashes();
- }
- this.initSubmitHealthReport();
- setEventListener("submitHealthReportBox", "command",
- gPrivacyPane.updateSubmitHealthReport);
- this._initA11yState();
- let bundlePrefs = document.getElementById("bundlePreferences");
- let signonBundle = document.getElementById("signonBundle");
- let pkiBundle = document.getElementById("pkiBundle");
- appendSearchKeywords("passwordExceptions", [
- bundlePrefs.getString("savedLoginsExceptions_title"),
- bundlePrefs.getString("savedLoginsExceptions_desc2"),
- ]);
- appendSearchKeywords("showPasswords", [
- signonBundle.getString("loginsDescriptionAll2"),
- ]);
- appendSearchKeywords("trackingProtectionExceptions", [
- bundlePrefs.getString("trackingprotectionpermissionstitle"),
- bundlePrefs.getString("trackingprotectionpermissionstext2"),
- ]);
- appendSearchKeywords("changeBlockList", [
- bundlePrefs.getString("blockliststitle"),
- bundlePrefs.getString("blockliststext"),
- ]);
- appendSearchKeywords("popupPolicyButton", [
- bundlePrefs.getString("popuppermissionstitle2"),
- bundlePrefs.getString("popuppermissionstext"),
- ]);
- appendSearchKeywords("notificationSettingsButton", [
- bundlePrefs.getString("notificationspermissionstitle2"),
- bundlePrefs.getString("notificationspermissionstext5"),
- ]);
- appendSearchKeywords("locationSettingsButton", [
- bundlePrefs.getString("locationpermissionstitle"),
- bundlePrefs.getString("locationpermissionstext"),
- ]);
- appendSearchKeywords("cameraSettingsButton", [
- bundlePrefs.getString("camerapermissionstitle"),
- bundlePrefs.getString("camerapermissionstext"),
- ]);
- appendSearchKeywords("microphoneSettingsButton", [
- bundlePrefs.getString("microphonepermissionstitle"),
- bundlePrefs.getString("microphonepermissionstext"),
- ]);
- appendSearchKeywords("addonExceptions", [
- bundlePrefs.getString("addons_permissions_title2"),
- bundlePrefs.getString("addonspermissionstext"),
- ]);
- appendSearchKeywords("viewSecurityDevicesButton", [
- pkiBundle.getString("enable_fips"),
- ]);
- appendSearchKeywords("siteDataSettings", [
- bundlePrefs.getString("siteDataSettings2.description"),
- bundlePrefs.getString("removeAllCookies.label"),
- bundlePrefs.getString("removeSelectedCookies.label"),
- ]);
-
- // Notify observers that the UI is now ready
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .notifyObservers(window, "privacy-pane-loaded");
- },
-
- // 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("trackingprotectionpermissionstext2"),
- };
- gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
- null, params);
- },
-
- /**
- * 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;
- },
-
- toggleDoNotDisturbNotifications(event) {
- AlertsServiceDND.manualDoNotDisturb = event.target.checked;
- },
-
- // GEOLOCATION
-
- /**
- * Displays the location exceptions dialog where specific site location
- * preferences can be set.
- */
- showLocationExceptions() {
- let bundlePreferences = document.getElementById("bundlePreferences");
- let params = { permissionType: "geo"};
- params.windowTitle = bundlePreferences.getString("locationpermissionstitle");
- params.introText = bundlePreferences.getString("locationpermissionstext");
-
- gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
- "resizable=yes", params);
- },
-
- // CAMERA
-
- /**
- * Displays the camera exceptions dialog where specific site camera
- * preferences can be set.
- */
- showCameraExceptions() {
- let bundlePreferences = document.getElementById("bundlePreferences");
- let params = { permissionType: "camera"};
- params.windowTitle = bundlePreferences.getString("camerapermissionstitle");
- params.introText = bundlePreferences.getString("camerapermissionstext");
-
- gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
- "resizable=yes", params);
- },
-
- // MICROPHONE
-
- /**
- * Displays the microphone exceptions dialog where specific site microphone
- * preferences can be set.
- */
- showMicrophoneExceptions() {
- let bundlePreferences = document.getElementById("bundlePreferences");
- let params = { permissionType: "microphone"};
- params.windowTitle = bundlePreferences.getString("microphonepermissionstitle");
- params.introText = bundlePreferences.getString("microphonepermissionstext");
-
- gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
- "resizable=yes", params);
- },
-
- // 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("notificationspermissionstitle2");
- params.introText = bundlePreferences.getString("notificationspermissionstext5");
-
- gSubDialog.open("chrome://browser/content/preferences/sitePermissions.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("popuppermissionstitle2");
- 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_desc2")
- };
-
- 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-proto" &&
- x !== "goog-unwanted-shavar" &&
- x !== "test-unwanted-simple");
-
- if (blockUncommonUnwanted.checked) {
- if (malware.indexOf("goog-malware-shavar") != -1) {
- malware.push("goog-unwanted-shavar");
- } else {
- malware.push("goog-unwanted-proto");
- }
-
- 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_title2");
- 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");
- },
-
- /**
- * 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.textContent = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
- },
-
- QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsICacheStorageConsumptionObserver,
- Components.interfaces.nsISupportsWeakReference
- ])
- };
-
- actualSizeLabel.textContent = 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();
- }
- },
-
- initDataCollection() {
- this._setupLearnMoreLink("toolkit.datacollection.infoURL",
- "dataCollectionPrivacyNotice");
- },
-
- initSubmitCrashes() {
- this._setupLearnMoreLink("toolkit.crashreporter.infoURL",
- "crashReporterLearnMore");
- },
-
- /**
- * 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");
- }
- },
-
- /**
- * Initialize the health report service reference and checkbox.
- */
- initSubmitHealthReport() {
- this._setupLearnMoreLink("datareporting.healthreport.infoURL", "FHRLearnMore");
-
- let checkbox = document.getElementById("submitHealthReportBox");
-
- // Telemetry is only sending data if MOZ_TELEMETRY_REPORTING is defined.
- // We still want to display the preferences panel if that's not the case, but
- // we want it to be disabled and unchecked.
- if (Services.prefs.prefIsLocked(PREF_UPLOAD_ENABLED) ||
- !AppConstants.MOZ_TELEMETRY_REPORTING) {
- checkbox.setAttribute("disabled", "true");
- return;
- }
-
- checkbox.checked = Services.prefs.getBoolPref(PREF_UPLOAD_ENABLED) &&
-