Bug 1335907 - Pref Reorg. Rebased on top of central (8d967436d696) and killswitch (bug 1343682). draft
authorZack Herrick <herrickz@msu.edu>
Wed, 22 Mar 2017 17:59:33 -0400
changeset 503131 7f0f26041fd83dae32a2470c4002d6be4d4a09a6
parent 501548 26271846ef767eb705941c73acc4115355c56131
child 550365 b4a5a38469c056fcf5d32791f4c4eb7e33d8cd7c
push id50511
push userbmo:lzylong@gmail.com
push dateWed, 22 Mar 2017 22:01:04 +0000
bugs1335907, 1343682
milestone55.0a1
Bug 1335907 - Pref Reorg. Rebased on top of central (8d967436d696) and killswitch (bug 1343682). MozReview-Commit-ID: 1sx0Wj15yM7
browser/base/content/test/general/browser_offlineQuotaNotification.js
browser/base/content/utilityOverlay.js
browser/components/preferences/in-content/advanced.js
browser/components/preferences/in-content/advanced.xul
browser/components/preferences/in-content/applications.js
browser/components/preferences/in-content/applications.xul
browser/components/preferences/in-content/content.js
browser/components/preferences/in-content/content.xul
browser/components/preferences/in-content/jar.mn
browser/components/preferences/in-content/main.js
browser/components/preferences/in-content/main.xul
browser/components/preferences/in-content/preferences.js
browser/components/preferences/in-content/preferences.xul
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/privacy.xul
browser/components/preferences/in-content/search.js
browser/components/preferences/in-content/search.xul
browser/components/preferences/in-content/security.js
browser/components/preferences/in-content/security.xul
browser/components/preferences/in-content/sync.xul
browser/components/preferences/in-content/tests/browser_advanced_siteData.js
browser/components/preferences/in-content/tests/browser_advanced_update.js
browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js
browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js
browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
browser/components/preferences/in-content/tests/browser_bug731866.js
browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js
browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js
browser/components/preferences/in-content/tests/browser_security.js
browser/locales/en-US/chrome/browser/preferences/advanced.dtd
browser/locales/en-US/chrome/browser/preferences/preferences.dtd
browser/locales/en-US/chrome/browser/preferences/privacy.dtd
browser/locales/en-US/chrome/browser/preferences/security.dtd
browser/locales/en-US/chrome/browser/preferences/sync.dtd
browser/themes/shared/incontentprefs/icons.svg
browser/themes/shared/incontentprefs/preferences.inc.css
toolkit/components/telemetry/Histograms.json
--- a/browser/base/content/test/general/browser_offlineQuotaNotification.js
+++ b/browser/base/content/test/general/browser_offlineQuotaNotification.js
@@ -20,20 +20,18 @@ registerCleanupFunction(function() {
   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;
-  let tab = doc.getElementById("advancedPrefs").selectedTab.id;
   is(gBrowser.currentURI.spec, "about:preferences#advanced", "about:preferences loaded");
   is(sel, "category-advanced", "Advanced pane was selected");
-  is(tab, "networkTab", "Network tab is selected");
   // all good, we are done.
   win.close();
   finish();
 }
 
 function test() {
   waitForExplicitFinish();
 
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -706,22 +706,16 @@ function openAboutDialog() {
   } else {
     features += "centerscreen,dependent,dialog=no";
   }
 
   window.openDialog("chrome://browser/content/aboutDialog.xul", "", features);
 }
 
 function openPreferences(paneID, extraArgs) {
-  function switchToAdvancedSubPane(doc) {
-    if (extraArgs && extraArgs["advancedTab"]) {
-      let advancedPaneTabs = doc.getElementById("advancedPrefs");
-      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,23 +755,23 @@ function openPreferences(paneID, extraAr
     Services.obs.addObserver(function advancedPaneLoadedObs(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", false);
   } else {
     if (paneID) {
       browser.contentWindow.gotoPref(paneID);
     }
-    switchToAdvancedSubPane(browser.contentDocument);
+
   }
 }
 
 function openAdvancedPreferences(tabID) {
   openPreferences("paneAdvanced", { "advancedTab" : tabID });
 }
 
 /**
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/advanced.js
+++ b/browser/components/preferences/in-content/advanced.js
@@ -22,129 +22,50 @@ var gAdvancedPane = {
    */
   init() {
     function setEventListener(aId, aEventType, aCallback) {
       document.getElementById(aId)
               .addEventListener(aEventType, aCallback.bind(gAdvancedPane));
     }
 
     this._inited = true;
-    var advancedPrefs = document.getElementById("advancedPrefs");
-
-    var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
-    if (preference.value !== null)
-        advancedPrefs.selectedIndex = preference.value;
 
     if (AppConstants.MOZ_UPDATER) {
       let onUnload = function() {
         window.removeEventListener("unload", onUnload);
         Services.prefs.removeObserver("app.update.", this);
       }.bind(this);
       window.addEventListener("unload", onUnload);
       Services.prefs.addObserver("app.update.", this, false);
       this.updateReadPrefs();
     }
-    this.updateOfflineApps();
     if (AppConstants.MOZ_CRASHREPORTER) {
       this.initSubmitCrashes();
     }
     this.initTelemetry();
     if (AppConstants.MOZ_TELEMETRY_REPORTING) {
       this.initSubmitHealthReport();
     }
     this.updateOnScreenKeyboardVisibility();
-    this.updateCacheSizeInputField();
-    this.updateActualCacheSize();
-    this.updateActualAppCacheSize();
-
-    if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
-      Services.obs.addObserver(this, "sitedatamanager:sites-updated", false);
-      let unload = () => {
-        window.removeEventListener("unload", unload);
-        Services.obs.removeObserver(this, "sitedatamanager:sites-updated");
-      };
-      window.addEventListener("unload", unload);
-      SiteDataManager.updateSites();
-      setEventListener("clearSiteDataButton", "command",
-                       gAdvancedPane.clearSiteData);
-      setEventListener("siteDataSettings", "command",
-                       gAdvancedPane.showSiteDataSettings);
-
-      let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
-      document.getElementById("siteDataLearnMoreLink").setAttribute("href", url);
-    }
 
     setEventListener("layers.acceleration.disabled", "change",
                      gAdvancedPane.updateHardwareAcceleration);
-    setEventListener("advancedPrefs", "select",
-                     gAdvancedPane.tabSelectionChanged);
     if (AppConstants.MOZ_TELEMETRY_REPORTING) {
       setEventListener("submitHealthReportBox", "command",
                        gAdvancedPane.updateSubmitHealthReport);
     }
 
-    setEventListener("connectionSettings", "command",
-                     gAdvancedPane.showConnections);
-    setEventListener("clearCacheButton", "command",
-                     gAdvancedPane.clearCache);
-    setEventListener("clearOfflineAppCacheButton", "command",
-                     gAdvancedPane.clearOfflineAppCache);
-    setEventListener("offlineNotifyExceptions", "command",
-                     gAdvancedPane.showOfflineExceptions);
-    setEventListener("offlineAppsList", "select",
-                     gAdvancedPane.offlineAppSelected);
-    let bundlePrefs = document.getElementById("bundlePreferences");
-    document.getElementById("offlineAppsList")
-            .style.height = bundlePrefs.getString("offlineAppsList.height");
-    setEventListener("offlineAppsListRemove", "command",
-                     gAdvancedPane.removeOfflineApp);
     if (AppConstants.MOZ_UPDATER) {
       setEventListener("updateRadioGroup", "command",
                        gAdvancedPane.updateWritePrefs);
       setEventListener("showUpdateHistory", "command",
                        gAdvancedPane.showUpdates);
     }
-    setEventListener("viewCertificatesButton", "command",
-                     gAdvancedPane.showCertificates);
-    setEventListener("viewSecurityDevicesButton", "command",
-                     gAdvancedPane.showSecurityDevices);
-    setEventListener("cacheSize", "change",
-                     gAdvancedPane.updateCacheSizePref);
-
-    if (AppConstants.MOZ_WIDGET_GTK) {
-      // GTK tabbox' allow the scroll wheel to change the selected tab,
-      // but we don't want this behavior for the in-content preferences.
-      let tabsElement = document.getElementById("tabsElement");
-      tabsElement.addEventListener("DOMMouseScroll", event => {
-        event.stopPropagation();
-      }, true);
-    }
   },
 
-  /**
-   * Stores the identity of the current tab in preferences so that the selected
-   * tab can be persisted between openings of the preferences window.
-   */
-  tabSelectionChanged() {
-    if (!this._inited)
-      return;
-    var advancedPrefs = document.getElementById("advancedPrefs");
-    var preference = document.getElementById("browser.preferences.advanced.selectedTabIndex");
-
-    // tabSelectionChanged gets called twice due to the selectedIndex being set
-    // by both the selectedItem and selectedPanel callstacks. This guard is used
-    // to prevent double-counting in Telemetry.
-    if (preference.valueFromPreferences != advancedPrefs.selectedIndex) {
-      Services.telemetry
-              .getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
-              .add(telemetryBucketForCategory("advanced"));
-    }
-
-    preference.valueFromPreferences = advancedPrefs.selectedIndex;
-  },
 
   // GENERAL TAB
 
   /*
    * Preferences:
    *
    * accessibility.browsewithcaret
    * - true enables keyboard navigation and selection within web pages using a
@@ -202,36 +123,16 @@ var gAdvancedPane = {
       if (this._storedSpellCheck == 2) {
         return 2;
       }
       return 1;
     }
     return 0;
   },
 
-  /**
-   * security.OCSP.enabled is an integer value for legacy reasons.
-   * A value of 1 means OCSP is enabled. Any other value means it is disabled.
-   */
-  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 == 1;
-  },
-
-  /**
-   * See documentation for readEnableOCSP.
-   */
-  writeEnableOCSP() {
-    var checkbox = document.getElementById("enableOCSP");
-    return checkbox.checked ? 1 : 0;
-  },
 
   /**
    * When the user toggles the layers.acceleration.disabled pref,
    * sync its new value to the gfx.direct2d.disabled pref too.
    */
   updateHardwareAcceleration() {
     if (AppConstants.platform == "win") {
       var fromPref = document.getElementById("layers.acceleration.disabled");
@@ -337,321 +238,16 @@ var gAdvancedPane = {
   /*
    * Preferences:
    *
    * browser.cache.disk.capacity
    * - the size of the browser cache in KB
    * - Only used if browser.cache.disk.smart_size.enabled is disabled
    */
 
-  /**
-   * Displays a dialog in which proxy settings may be changed.
-   */
-  showConnections() {
-    gSubDialog.open("chrome://browser/content/preferences/connection.xul");
-  },
-
-  showSiteDataSettings() {
-    gSubDialog.open("chrome://browser/content/preferences/siteDataSettings.xul");
-  },
-
-  updateTotalSiteDataSize() {
-    SiteDataManager.getTotalUsage()
-      .then(usage => {
-        let size = DownloadUtils.convertByteUnits(usage);
-        let prefStrBundle = document.getElementById("bundlePreferences");
-        let totalSiteDataSizeLabel = document.getElementById("totalSiteDataSize");
-        totalSiteDataSizeLabel.textContent = prefStrBundle.getFormattedString("totalSiteDataSize", size);
-        let siteDataGroup = document.getElementById("siteDataGroup");
-        siteDataGroup.hidden = false;
-      });
-  },
-
-  // Retrieves the amount of space currently used by disk cache
-  updateActualCacheSize() {
-    var actualSizeLabel = document.getElementById("actualDiskCacheSize");
-    var prefStrBundle = document.getElementById("bundlePreferences");
-
-    // Needs to root the observer since cache service keeps only a weak reference.
-    this.observer = {
-      onNetworkCacheDiskConsumption(consumption) {
-        var size = DownloadUtils.convertByteUnits(consumption);
-        // The XBL binding for the string bundle may have been destroyed if
-        // the page was closed before this callback was executed.
-        if (!prefStrBundle.getFormattedString) {
-          return;
-        }
-        actualSizeLabel.value = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
-      },
-
-      QueryInterface: XPCOMUtils.generateQI([
-        Components.interfaces.nsICacheStorageConsumptionObserver,
-        Components.interfaces.nsISupportsWeakReference
-      ])
-    };
-
-    actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
-
-    try {
-      var cacheService =
-        Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
-                  .getService(Components.interfaces.nsICacheStorageService);
-      cacheService.asyncGetDiskConsumption(this.observer);
-    } catch (e) {}
-  },
-
-  // Retrieves the amount of space currently used by offline cache
-  updateActualAppCacheSize() {
-    var visitor = {
-      onCacheStorageInfo(aEntryCount, aConsumption, aCapacity, aDiskDirectory) {
-        var actualSizeLabel = document.getElementById("actualAppCacheSize");
-        var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
-        var prefStrBundle = document.getElementById("bundlePreferences");
-        // The XBL binding for the string bundle may have been destroyed if
-        // the page was closed before this callback was executed.
-        if (!prefStrBundle.getFormattedString) {
-          return;
-        }
-        var sizeStr = prefStrBundle.getFormattedString("actualAppCacheSize", sizeStrings);
-        actualSizeLabel.value = sizeStr;
-      }
-    };
-
-    try {
-      var cacheService =
-        Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
-                  .getService(Components.interfaces.nsICacheStorageService);
-      var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
-      storage.asyncVisitStorage(visitor, false);
-    } catch (e) {}
-  },
-
-  updateCacheSizeUI(smartSizeEnabled) {
-    document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
-    document.getElementById("cacheSize").disabled = smartSizeEnabled;
-    document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
-  },
-
-  readSmartSizeEnabled() {
-    // The smart_size.enabled preference element is inverted="true", so its
-    // value is the opposite of the actual pref value
-    var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
-    this.updateCacheSizeUI(!disabled);
-  },
-
-  /**
-   * Converts the cache size from units of KB to units of MB and stores it in
-   * the textbox element.
-   */
-  updateCacheSizeInputField() {
-    let cacheSizeElem = document.getElementById("cacheSize");
-    let cachePref = document.getElementById("browser.cache.disk.capacity");
-    cacheSizeElem.value = cachePref.value / 1024;
-    if (cachePref.locked)
-      cacheSizeElem.disabled = true;
-  },
-
-  /**
-   * Updates the cache size preference once user enters a new value.
-   * We intentionally do not set preference="browser.cache.disk.capacity"
-   * onto the textbox directly, as that would update the pref at each keypress
-   * not only after the final value is entered.
-   */
-  updateCacheSizePref() {
-    let cacheSizeElem = document.getElementById("cacheSize");
-    let cachePref = document.getElementById("browser.cache.disk.capacity");
-    // Converts the cache size as specified in UI (in MB) to KB.
-    let intValue = parseInt(cacheSizeElem.value, 10);
-    cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
-  },
-
-  /**
-   * Clears the cache.
-   */
-  clearCache() {
-    try {
-      var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
-                            .getService(Components.interfaces.nsICacheStorageService);
-      cache.clear();
-    } catch (ex) {}
-    this.updateActualCacheSize();
-  },
-
-  /**
-   * Clears the application cache.
-   */
-  clearOfflineAppCache() {
-    Components.utils.import("resource:///modules/offlineAppCache.jsm");
-    OfflineAppCacheHelper.clear();
-
-    this.updateActualAppCacheSize();
-    this.updateOfflineApps();
-  },
-
-  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();
-    }
-  },
-
-  readOfflineNotify() {
-    var pref = document.getElementById("browser.offline-apps.notify");
-    var button = document.getElementById("offlineNotifyExceptions");
-    button.disabled = !pref.value;
-    return pref.value;
-  },
-
-  showOfflineExceptions() {
-    var bundlePreferences = document.getElementById("bundlePreferences");
-    var params = { blockVisible     : false,
-                   sessionVisible   : false,
-                   allowVisible     : false,
-                   prefilledHost    : "",
-                   permissionType   : "offline-app",
-                   manageCapability : Components.interfaces.nsIPermissionManager.DENY_ACTION,
-                   windowTitle      : bundlePreferences.getString("offlinepermissionstitle"),
-                   introText        : bundlePreferences.getString("offlinepermissionstext") };
-    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
-                    null, params);
-  },
-
-  // XXX: duplicated in browser.js
-  _getOfflineAppUsage(perm, groups) {
-    let cacheService = Cc["@mozilla.org/network/application-cache-service;1"].
-                       getService(Ci.nsIApplicationCacheService);
-    if (!groups) {
-      try {
-        groups = cacheService.getGroups();
-      } catch (ex) {
-        return 0;
-      }
-    }
-
-    let usage = 0;
-    for (let group of groups) {
-      let uri = Services.io.newURI(group);
-      if (perm.matchesURI(uri, true)) {
-        let cache = cacheService.getActiveCache(group);
-        usage += cache.usage;
-      }
-    }
-
-    return usage;
-  },
-
-  /**
-   * Updates the list of offline applications
-   */
-  updateOfflineApps() {
-    var pm = Components.classes["@mozilla.org/permissionmanager;1"]
-                       .getService(Components.interfaces.nsIPermissionManager);
-
-    var list = document.getElementById("offlineAppsList");
-    while (list.firstChild) {
-      list.firstChild.remove();
-    }
-
-    var groups;
-    try {
-      var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
-                         getService(Components.interfaces.nsIApplicationCacheService);
-      groups = cacheService.getGroups();
-    } catch (e) {
-      return;
-    }
-
-    var bundle = document.getElementById("bundlePreferences");
-
-    var enumerator = pm.enumerator;
-    while (enumerator.hasMoreElements()) {
-      var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
-      if (perm.type == "offline-app" &&
-          perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
-          perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
-        var row = document.createElement("listitem");
-        row.id = "";
-        row.className = "offlineapp";
-        row.setAttribute("origin", perm.principal.origin);
-        var converted = DownloadUtils.
-                        convertByteUnits(this._getOfflineAppUsage(perm, groups));
-        row.setAttribute("usage",
-                         bundle.getFormattedString("offlineAppUsage",
-                                                   converted));
-        list.appendChild(row);
-      }
-    }
-  },
-
-  offlineAppSelected() {
-    var removeButton = document.getElementById("offlineAppsListRemove");
-    var list = document.getElementById("offlineAppsList");
-    if (list.selectedItem) {
-      removeButton.setAttribute("disabled", "false");
-    } else {
-      removeButton.setAttribute("disabled", "true");
-    }
-  },
-
-  removeOfflineApp() {
-    var list = document.getElementById("offlineAppsList");
-    var item = list.selectedItem;
-    var origin = item.getAttribute("origin");
-    var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
-
-    var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-                            .getService(Components.interfaces.nsIPromptService);
-    var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
-                prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
-
-    var bundle = document.getElementById("bundlePreferences");
-    var title = bundle.getString("offlineAppRemoveTitle");
-    var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
-    var confirm = bundle.getString("offlineAppRemoveConfirm");
-    var result = prompts.confirmEx(window, title, prompt, flags, confirm,
-                                   null, null, null, {});
-    if (result != 0)
-      return;
-
-    // get the permission
-    var pm = Components.classes["@mozilla.org/permissionmanager;1"]
-                       .getService(Components.interfaces.nsIPermissionManager);
-    var perm = pm.getPermissionObject(principal, "offline-app", true);
-    if (perm) {
-      // clear offline cache entries
-      try {
-        var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
-                           getService(Components.interfaces.nsIApplicationCacheService);
-        var groups = cacheService.getGroups();
-        for (var i = 0; i < groups.length; i++) {
-          var uri = Services.io.newURI(groups[i]);
-          if (perm.matchesURI(uri, true)) {
-            var cache = cacheService.getActiveCache(groups[i]);
-            cache.discard();
-          }
-        }
-      } catch (e) {}
-
-      pm.removePermission(perm);
-    }
-    list.removeChild(item);
-    gAdvancedPane.offlineAppSelected();
-    this.updateActualAppCacheSize();
-  },
-
   // UPDATE TAB
 
   /*
    * Preferences:
    *
    * app.update.enabled
    * - true if updates to the application are enabled, false otherwise
    * app.update.auto
@@ -763,29 +359,16 @@ var gAdvancedPane = {
    * - a string:
    *     "Select Automatically"   select a certificate automatically when a site
    *                              requests one
    *     "Ask Every Time"         present a dialog to the user so he can select
    *                              the certificate to use on a site which
    *                              requests one
    */
 
-  /**
-   * Displays the user's certificates and associated options.
-   */
-  showCertificates() {
-    gSubDialog.open("chrome://pippki/content/certManager.xul");
-  },
-
-  /**
-   * Displays a dialog from which the user can manage his security devices.
-   */
-  showSecurityDevices() {
-    gSubDialog.open("chrome://pippki/content/device_manager.xul");
-  },
 
   observe(aSubject, aTopic, aData) {
     if (AppConstants.MOZ_UPDATER) {
       switch (aTopic) {
         case "nsPref:changed":
           this.updateReadPrefs();
           break;
 
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/advanced.xul
+++ b/browser/components/preferences/in-content/advanced.xul
@@ -7,79 +7,24 @@
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/advanced.js"/>
 
 <preferences id="advancedPreferences" hidden="true" data-category="paneAdvanced">
   <preference id="browser.preferences.advanced.selectedTabIndex"
               name="browser.preferences.advanced.selectedTabIndex"
               type="int"/>
 
-  <!-- General tab -->
-  <preference id="accessibility.browsewithcaret"
-              name="accessibility.browsewithcaret"
-              type="bool"/>
-  <preference id="accessibility.typeaheadfind"
-              name="accessibility.typeaheadfind"
-              type="bool"/>
-  <preference id="accessibility.blockautorefresh"
-              name="accessibility.blockautorefresh"
-              type="bool"/>
-#ifdef XP_WIN
-  <preference id="ui.osk.enabled"
-              name="ui.osk.enabled"
-              type="bool"/>
-#endif
-
-  <preference id="general.autoScroll"
-              name="general.autoScroll"
-              type="bool"/>
-  <preference id="general.smoothScroll"
-              name="general.smoothScroll"
-              type="bool"/>
-  <preference id="layers.acceleration.disabled"
-              name="layers.acceleration.disabled"
-              type="bool"
-              inverted="true"/>
-#ifdef XP_WIN
-  <preference id="gfx.direct2d.disabled"
-              name="gfx.direct2d.disabled"
-              type="bool"
-              inverted="true"/>
-#endif
-  <preference id="layout.spellcheckDefault"
-              name="layout.spellcheckDefault"
-              type="int"/>
-
-#ifdef MOZ_TELEMETRY_REPORTING
-  <preference id="toolkit.telemetry.enabled"
-              name="toolkit.telemetry.enabled"
-              type="bool"/>
-#endif
-
   <!-- Data Choices tab -->
 #ifdef MOZ_CRASHREPORTER
   <preference id="browser.crashReports.unsubmittedCheck.autoSubmit"
               name="browser.crashReports.unsubmittedCheck.autoSubmit"
               type="bool"/>
 #endif
 
-  <!-- Network tab -->
-  <preference id="browser.cache.disk.capacity"
-              name="browser.cache.disk.capacity"
-              type="int"/>
-  <preference id="browser.offline-apps.notify"
-              name="browser.offline-apps.notify"
-              type="bool"/>
-
-  <preference id="browser.cache.disk.smart_size.enabled"
-              name="browser.cache.disk.smart_size.enabled"
-              inverted="true"
-              type="bool"/>
-
- <!-- Update tab -->
+ <!-- Update tab-->
 #ifdef MOZ_UPDATER
   <preference id="app.update.enabled"
               name="app.update.enabled"
               type="bool"/>
   <preference id="app.update.auto"
               name="app.update.auto"
               type="bool"/>
 
@@ -92,268 +37,35 @@
               name="app.update.service.enabled"
               type="bool"/>
 #endif
 #endif
 
   <preference id="browser.search.update"
               name="browser.search.update"
               type="bool"/>
-
-  <!-- Certificates tab -->
-  <preference id="security.default_personal_cert"
-              name="security.default_personal_cert"
-              type="string"/>
-
-  <preference id="security.disable_button.openCertManager"
-              name="security.disable_button.openCertManager"
-              type="bool"/>
-
-  <preference id="security.disable_button.openDeviceManager"
-              name="security.disable_button.openDeviceManager"
-              type="bool"/>
-
-  <preference id="security.OCSP.enabled"
-              name="security.OCSP.enabled"
-              type="int"/>
 </preferences>
 
 #ifdef HAVE_SHELL_SERVICE
   <stringbundle id="bundleShell" src="chrome://browser/locale/shellservice.properties"/>
   <stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
 #endif
-  <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
 
 <hbox id="header-advanced"
       class="header"
       hidden="true"
       data-category="paneAdvanced">
-  <label class="header-name" flex="1">&paneAdvanced.title;</label>
+  <label class="header-name" flex="1">&paneUpdates.title;</label>
   <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
 </hbox>
 
-<tabbox id="advancedPrefs"
-        handleCtrlTab="false"
-        handleCtrlPageUpDown="false"
-        flex="1"
-        data-category="paneAdvanced"
-        hidden="true">
-
-  <tabs id="tabsElement">
-    <tab id="generalTab" label="&generalTab.label;"/>
-#ifdef MOZ_DATA_REPORTING
-    <tab id="dataChoicesTab" label="&dataChoicesTab.label;"/>
-#endif
-    <tab id="networkTab" label="&networkTab.label;"/>
-    <tab id="updateTab" label="&updateTab.label;"/>
-    <tab id="encryptionTab" label="&certificateTab.label;"/>
-  </tabs>
-
-  <tabpanels flex="1">
-
-    <!-- General -->
-    <tabpanel id="generalPanel" orient="vertical">
-      <!-- Accessibility -->
-      <groupbox id="accessibilityGroup" align="start">
-        <caption><label>&accessibility.label;</label></caption>
-
-#ifdef XP_WIN
-        <checkbox id="useOnScreenKeyboard"
-                  hidden="true"
-                  label="&useOnScreenKeyboard.label;"
-                  accesskey="&useOnScreenKeyboard.accesskey;"
-                  preference="ui.osk.enabled"/>
-#endif
-        <checkbox id="useCursorNavigation"
-                  label="&useCursorNavigation.label;"
-                  accesskey="&useCursorNavigation.accesskey;"
-                  preference="accessibility.browsewithcaret"/>
-        <checkbox id="searchStartTyping"
-                  label="&searchOnStartTyping.label;"
-                  accesskey="&searchOnStartTyping.accesskey;"
-                  preference="accessibility.typeaheadfind"/>
-        <checkbox id="blockAutoRefresh"
-                  label="&blockAutoReload.label;"
-                  accesskey="&blockAutoReload.accesskey;"
-                  preference="accessibility.blockautorefresh"/>
-      </groupbox>
-      <!-- Browsing -->
-      <groupbox id="browsingGroup" align="start">
-        <caption><label>&browsing.label;</label></caption>
+    <!-- Update-->
 
-        <checkbox id="useAutoScroll"
-                  label="&useAutoScroll.label;"
-                  accesskey="&useAutoScroll.accesskey;"
-                  preference="general.autoScroll"/>
-        <checkbox id="useSmoothScrolling"
-                  label="&useSmoothScrolling.label;"
-                  accesskey="&useSmoothScrolling.accesskey;"
-                  preference="general.smoothScroll"/>
-        <checkbox id="allowHWAccel"
-                  label="&allowHWAccel.label;"
-                  accesskey="&allowHWAccel.accesskey;"
-                  preference="layers.acceleration.disabled"/>
-        <checkbox id="checkSpelling"
-                  label="&checkUserSpelling.label;"
-                  accesskey="&checkUserSpelling.accesskey;"
-                  onsyncfrompreference="return gAdvancedPane.readCheckSpelling();"
-                  onsynctopreference="return gAdvancedPane.writeCheckSpelling();"
-                  preference="layout.spellcheckDefault"/>
-      </groupbox>
-    </tabpanel>
-#ifdef MOZ_DATA_REPORTING
-    <!-- Data Choices -->
-    <tabpanel id="dataChoicesPanel" orient="vertical">
-#ifdef MOZ_TELEMETRY_REPORTING
-      <groupbox>
-        <caption>
-          <checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
-                    accesskey="&enableHealthReport.accesskey;"/>
-        </caption>
-        <vbox>
-          <hbox class="indent" flex="1">
-            <label flex="1">&healthReportDesc.label;</label>
-            <label id="FHRLearnMore" flex="1"
-                   class="learnMore text-link">&healthReportLearnMore.label;</label>
-          </hbox>
-          <hbox class="indent">
-            <groupbox flex="1">
-              <caption>
-                <checkbox id="submitTelemetryBox" preference="toolkit.telemetry.enabled"
-                          label="&enableTelemetryData.label;"
-                          accesskey="&enableTelemetryData.accesskey;"/>
-              </caption>
-              <hbox class="indent" flex="1">
-                <label id="telemetryDataDesc" flex="1">&telemetryDesc.label;</label>
-                <label id="telemetryLearnMore" flex="1"
-                       class="learnMore text-link">&telemetryLearnMore.label;</label>
-              </hbox>
-            </groupbox>
-          </hbox>
-        </vbox>
-      </groupbox>
-#endif
-#ifdef MOZ_CRASHREPORTER
-      <groupbox>
-        <caption>
-          <checkbox id="automaticallySubmitCrashesBox"
-                    preference="browser.crashReports.unsubmittedCheck.autoSubmit"
-                    label="&alwaysSubmitCrashReports.label;"
-                    accesskey="&alwaysSubmitCrashReports.accesskey;"/>
-        </caption>
-        <hbox class="indent" flex="1">
-          <label flex="1">&crashReporterDesc2.label;</label>
-          <label id="crashReporterLearnMore" flex="1"
-                 class="learnMore text-link">&crashReporterLearnMore.label;</label>
-        </hbox>
-      </groupbox>
-#endif
-    </tabpanel>
-#endif
-
-    <!-- Network -->
-    <tabpanel id="networkPanel" orient="vertical">
-
-      <!-- Connection -->
-      <groupbox id="connectionGroup">
-        <caption><label>&connection.label;</label></caption>
-
-        <hbox align="center">
-          <description flex="1" control="connectionSettings">&connectionDesc.label;</description>
-          <button id="connectionSettings" icon="network" label="&connectionSettings.label;"
-                  accesskey="&connectionSettings.accesskey;"/>
-        </hbox>
-      </groupbox>
-
-      <!-- Cache -->
-      <groupbox id="cacheGroup">
-        <caption><label>&httpCache.label;</label></caption>
-
-        <hbox align="center">
-          <label id="actualDiskCacheSize" flex="1"/>
-          <button id="clearCacheButton" icon="clear"
-                  label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"/>
-        </hbox>
-        <hbox>
-          <checkbox preference="browser.cache.disk.smart_size.enabled"
-                    id="allowSmartSize"
-                    onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
-                    label="&overrideSmartCacheSize.label;"
-                    accesskey="&overrideSmartCacheSize.accesskey;"/>
-        </hbox>
-        <hbox align="center" class="indent">
-          <label id="useCacheBefore" control="cacheSize"
-                 accesskey="&limitCacheSizeBefore.accesskey;">
-            &limitCacheSizeBefore.label;
-          </label>
-          <textbox id="cacheSize" type="number" size="4" max="1024"
-                   aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
-          <label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
-        </hbox>
-      </groupbox>
-
-      <!-- Offline apps -->
-      <groupbox id="offlineGroup">
-        <caption><label>&offlineStorage2.label;</label></caption>
-
-        <hbox align="center">
-          <label id="actualAppCacheSize" flex="1"/>
-          <button id="clearOfflineAppCacheButton" icon="clear"
-                  label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"/>
-        </hbox>
-        <hbox align="center">
-          <checkbox id="offlineNotify"
-                    label="&offlineStorageNotify.label;" accesskey="&offlineStorageNotify.accesskey;"
-                    preference="browser.offline-apps.notify"
-                    onsyncfrompreference="return gAdvancedPane.readOfflineNotify();"/>
-          <spacer flex="1"/>
-          <button id="offlineNotifyExceptions"
-                  label="&offlineStorageNotifyExceptions.label;"
-                  accesskey="&offlineStorageNotifyExceptions.accesskey;"/>
-        </hbox>
-        <hbox>
-          <vbox flex="1">
-            <label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
-            <listbox id="offlineAppsList"
-                    flex="1"
-                    aria-labelledby="offlineAppsListLabel">
-            </listbox>
-          </vbox>
-          <vbox pack="end">
-            <button id="offlineAppsListRemove"
-                    disabled="true"
-                    label="&offlineAppsListRemove.label;"
-                    accesskey="&offlineAppsListRemove.accesskey;"/>
-          </vbox>
-        </hbox>
-      </groupbox>
-
-      <!-- Site Data -->
-      <groupbox id="siteDataGroup" hidden="true">
-        <caption><label>&siteData.label;</label></caption>
-
-        <hbox align="baseline">
-          <label id="totalSiteDataSize"></label>
-          <label id="siteDataLearnMoreLink" class="learnMore text-link" value="&siteDataLearnMoreLink.label;"></label>
-          <spacer flex="1" />
-          <button id="clearSiteDataButton" icon="clear"
-                  label="&clearSiteData.label;" accesskey="&clearSiteData.accesskey;"/>
-        </hbox>
-        <vbox align="end">
-          <button id="siteDataSettings"
-                  label="&siteDataSettings.label;"
-                  accesskey="&siteDataSettings.accesskey;"/>
-        </vbox>
-      </groupbox>
-    </tabpanel>
-
-    <!-- Update -->
-    <tabpanel id="updatePanel" orient="vertical">
 #ifdef MOZ_UPDATER
-      <groupbox id="updateApp" align="start">
+      <groupbox id="updateApp" align="start" data-category="paneAdvanced" hidden="true">
         <caption><label>&updateApplication.label;</label></caption>
         <radiogroup id="updateRadioGroup" align="start">
           <radio id="autoDesktop"
                  value="auto"
                  label="&updateAuto1.label;"
                  accesskey="&updateAuto1.accesskey;"/>
           <radio value="checkOnly"
                 label="&updateCheckChoose.label;"
@@ -373,64 +85,66 @@
 #ifdef MOZ_MAINTENANCE_SERVICE
         <checkbox id="useService"
                   label="&useService.label;"
                   accesskey="&useService.accesskey;"
                   preference="app.update.service.enabled"/>
 #endif
       </groupbox>
 #endif
-      <groupbox id="updateOthers" align="start">
+      <groupbox id="updateOthers" align="start" data-category="paneAdvanced" hidden="true">
         <caption><label>&autoUpdateOthers.label;</label></caption>
         <checkbox id="enableSearchUpdate"
                   label="&enableSearchUpdate.label;"
                   accesskey="&enableSearchUpdate.accesskey;"
                   preference="browser.search.update"/>
       </groupbox>
-    </tabpanel>
 
-    <!-- Certificates -->
-    <tabpanel id="encryptionPanel" orient="vertical">
-      <groupbox id="certSelection" align="start">
-        <caption><label>&certPersonal.label;</label></caption>
-        <description id="CertSelectionDesc" control="certSelection">&certPersonal.description;</description>
-
-        <!--
-          The values on these radio buttons may look like l12y issues, but
-          they're not - this preference uses *those strings* as its values.
-          I KID YOU NOT.
-        -->
-        <radiogroup id="certSelection"
-                    preftype="string"
-                    preference="security.default_personal_cert"
-                    aria-labelledby="CertSelectionDesc">
-          <radio label="&selectCerts.auto;"
-                 accesskey="&selectCerts.auto.accesskey;"
-                 value="Select Automatically"/>
-          <radio label="&selectCerts.ask;"
-                 accesskey="&selectCerts.ask.accesskey;"
-                 value="Ask Every Time"/>
-        </radiogroup>
+<!-- Data Choices -->
+#ifdef MOZ_TELEMETRY_REPORTING
+      <groupbox id="historyGroup" data-category="paneAdvanced" hidden="true">
+      <caption><label>&reports.label;</label></caption>
+        <vbox>
+          <caption>
+          <checkbox id="submitHealthReportBox" label="&enableHealthReport.label;"
+                    accesskey="&enableHealthReport.accesskey;"/>
+        </caption>
+          <hbox class="indent">
+            <label>&healthReportDesc.label;</label>
+            <label id="FHRLearnMore"
+                   class="learnMore text-link">&healthReportLearnMore.label;</label>
+          </hbox>
+          <hbox class="indent">
+            <groupbox flex="1">
+              <caption>
+                <checkbox id="submitTelemetryBox" preference="toolkit.telemetry.enabled"
+                          label="&enableTelemetryData.label;"
+                          accesskey="&enableTelemetryData.accesskey;"/>
+              </caption>
+              <hbox class="indent">
+                <label id="telemetryDataDesc">&telemetryDesc.label;</label>
+                <label id="telemetryLearnMore"
+                       class="learnMore text-link">&telemetryLearnMore.label;</label>
+              </hbox>
+            </groupbox>
+          </hbox>
+        </vbox>
       </groupbox>
-      <separator/>
-      <checkbox id="enableOCSP"
-                label="&enableOCSP.label;"
-                accesskey="&enableOCSP.accesskey;"
-                onsyncfrompreference="return gAdvancedPane.readEnableOCSP();"
-                onsynctopreference="return gAdvancedPane.writeEnableOCSP();"
-                preference="security.OCSP.enabled"/>
-      <separator/>
-      <hbox>
-        <button id="viewCertificatesButton"
-                flex="1"
-                label="&viewCerts.label;"
-                accesskey="&viewCerts.accesskey;"
-                preference="security.disable_button.openCertManager"/>
-        <button id="viewSecurityDevicesButton"
-                flex="1"
-                label="&viewSecurityDevices.label;"
-                accesskey="&viewSecurityDevices.accesskey;"
-                preference="security.disable_button.openDeviceManager"/>
-        <hbox flex="10"/>
-      </hbox>
-    </tabpanel>
-  </tabpanels>
-</tabbox>
+#endif
+
+#ifdef MOZ_DATA_REPORTING
+#ifdef MOZ_CRASHREPORTER
+      <groupbox data-category="paneAdvanced" hidden="true">
+        <caption>
+          <checkbox id="automaticallySubmitCrashesBox"
+                    preference="browser.crashReports.unsubmittedCheck.autoSubmit"
+                    label="&alwaysSubmitCrashReports.label;"
+                    accesskey="&alwaysSubmitCrashReports.accesskey;"/>
+        </caption>
+        <hbox class="indent">
+          <label>&crashReporterDesc2.label;</label>
+          <label id="crashReporterLearnMore"
+                 class="learnMore text-link">&crashReporterLearnMore.label;</label>
+        </hbox>
+      </groupbox>
+
+#endif
+#endif
\ No newline at end of file
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/applications.js
+++ b/browser/components/preferences/in-content/applications.js
@@ -905,16 +905,18 @@ var gApplicationsPane = {
 
     setEventListener("focusSearch1", "command", gApplicationsPane.focusFilterBox);
     setEventListener("focusSearch2", "command", gApplicationsPane.focusFilterBox);
     setEventListener("filter", "command", gApplicationsPane.filter);
     setEventListener("handlersView", "select",
       gApplicationsPane.onSelectionChanged);
     setEventListener("typeColumn", "click", gApplicationsPane.sort);
     setEventListener("actionColumn", "click", gApplicationsPane.sort);
+    setEventListener("chooseFolder", "command", gApplicationsPane.chooseFolder);
+    setEventListener("browser.download.dir", "change", gApplicationsPane.displayDownloadDirPref);
 
     // Listen for window unload so we can remove our preference observers.
     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")) {
@@ -1887,11 +1889,221 @@ var gApplicationsPane = {
         } 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.
+   * browser.download.downloadDir
+   *   deprecated.
+   * browser.download.defaultFolder
+   *   deprecated.
+   */
+
+  /**
+   * Enables/disables the folder field and Browse button based on whether a
+   * default download directory is being used.
+   */
+  readUseDownloadDir() {
+    var downloadFolder = document.getElementById("downloadFolder");
+    var chooseFolder = document.getElementById("chooseFolder");
+    var preference = document.getElementById("browser.download.useDownloadDir");
+    downloadFolder.disabled = !preference.value || preference.locked;
+    chooseFolder.disabled = !preference.value || preference.locked;
+
+    // don't override the preference's value in UI
+    return undefined;
+  },
+
+  /**
+   * Displays a file picker in which the user can choose the location where
+   * downloads are automatically saved, updating preferences and UI in
+   * response to the choice, if one is made.
+   */
+  chooseFolder() {
+    return this.chooseFolderTask().catch(Components.utils.reportError);
+  },
+  chooseFolderTask: Task.async(function* () {
+    let bundlePreferences = document.getElementById("bundlePreferences");
+    let title = bundlePreferences.getString("chooseDownloadFolderTitle");
+    let folderListPref = document.getElementById("browser.download.folderList");
+    let currentDirPref = yield this._indexToFolder(folderListPref.value);
+    let defDownloads = yield 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 = yield this._indexToFolder(0);
+    }
+
+    let result = yield 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 = yield 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;
+  },
+
+  displayDownloadDirPrefTask: Task.async(function* () {
+    var folderListPref = document.getElementById("browser.download.folderList");
+    var bundlePreferences = document.getElementById("bundlePreferences");
+    var downloadFolder = document.getElementById("downloadFolder");
+    var currentDirPref = document.getElementById("browser.download.dir");
+
+    // Used in defining the correct path to the folder icon.
+    var ios = Components.classes["@mozilla.org/network/io-service;1"]
+                        .getService(Components.interfaces.nsIIOService);
+    var fph = ios.getProtocolHandler("file")
+                 .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+    var iconUrlSpec;
+
+    // Display a 'pretty' label or the path in the UI.
+    if (folderListPref.value == 2) {
+      // Custom path selected and is configured
+      downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
+      iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
+    } else if (folderListPref.value == 1) {
+      // 'Downloads'
+      // In 1.5, this pointed to a folder we created called 'My Downloads'
+      // and was available as an option in the 1.5 drop down. On XP this
+      // was in My Documents, on OSX it was in User Docs. In 2.0, we did
+      // away with the drop down option, although the special label was
+      // still supported for the folder if it existed. Because it was
+      // not exposed it was rarely used.
+      // With 3.0, a new desktop folder - 'Downloads' was introduced for
+      // platforms and versions that don't support a default system downloads
+      // folder. See nsDownloadManager for details.
+      downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
+      iconUrlSpec = fph.getURLSpecFromFile(yield this._indexToFolder(1));
+    } else {
+      // 'Desktop'
+      downloadFolder.label = bundlePreferences.getString("desktopFolderName");
+      iconUrlSpec = fph.getURLSpecFromFile(yield 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"
+   */
+  _getDownloadsFolder: Task.async(function* (aFolder) {
+    switch (aFolder) {
+      case "Desktop":
+        var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
+                                    .getService(Components.interfaces.nsIProperties);
+        return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
+      case "Downloads":
+        let downloadsDir = yield 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
+   */
+  _folderToIndex: Task.async(function* (aFolder) {
+    if (!aFolder || aFolder.equals(yield this._getDownloadsFolder("Desktop")))
+      return 0;
+    else if (aFolder.equals(yield 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: Task.async(function* (aIndex) {
+    switch (aIndex) {
+      case 0:
+        return yield this._getDownloadsFolder("Desktop");
+      case 1:
+        return yield this._getDownloadsFolder("Downloads");
+    }
+    var currentDirPref = document.getElementById("browser.download.dir");
+    return currentDirPref.value;
+  })
 
 };
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/applications.xul
+++ b/browser/components/preferences/in-content/applications.xul
@@ -58,24 +58,64 @@
   <key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/>
   <key key="&focusSearch2.key;" modifiers="accel" id="focusSearch2" oncommand=";"/>
 </keyset>
 
 <hbox id="header-applications"
       class="header"
       hidden="true"
       data-category="paneApplications">
-  <label class="header-name" flex="1">&paneApplications.title;</label>
+  <label class="header-name" flex="1">&paneDownloadLinks.title;</label>
   <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
 </hbox>
 
 <vbox id="applicationsContent"
       data-category="paneApplications"
       hidden="true"
       flex="1">
+
+  <!--Downloads-->
+  <groupbox id="downloadsGroup"
+            data-category="paneApplications"
+            hidden="false">
+    <caption><label>&downloads.label;</label></caption>
+
+    <radiogroup id="saveWhere"
+                preference="browser.download.useDownloadDir"
+                onsyncfrompreference="return gApplicationsPane.readUseDownloadDir();">
+      <hbox id="saveToRow">
+        <radio id="saveTo"
+              value="true"
+              label="&saveTo.label;"
+              accesskey="&saveTo.accesskey;"
+              aria-labelledby="saveTo downloadFolder"/>
+        <filefield id="downloadFolder"
+                  flex="1"
+                  preference="browser.download.folderList"
+                  preference-editable="true"
+                  aria-labelledby="saveTo"
+                  onsyncfrompreference="return gApplicationsPane.displayDownloadDirPref();"/>
+        <button id="chooseFolder"
+#ifdef XP_MACOSX
+                accesskey="&chooseFolderMac.accesskey;"
+                label="&chooseFolderMac.label;"
+#else
+                accesskey="&chooseFolderWin.accesskey;"
+                label="&chooseFolderWin.label;"
+#endif
+        />
+      </hbox>
+      <hbox>
+        <radio id="alwaysAsk"
+              value="false"
+              label="&alwaysAskWhere.label;"
+              accesskey="&alwaysAskWhere.accesskey;"/>
+      </hbox>
+    </radiogroup>
+  </groupbox>
   <hbox>
     <textbox id="filter" flex="1"
              type="search"
              placeholder="&filter.emptytext;"
              aria-controls="handlersView"/>
   </hbox>
 
   <separator class="thin"/>
deleted file mode 100644
--- a/browser/components/preferences/in-content/content.js
+++ /dev/null
@@ -1,283 +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 */
-
-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 gContentPane = {
-  init() {
-    function setEventListener(aId, aEventType, aCallback) {
-      document.getElementById(aId)
-              .addEventListener(aEventType, aCallback.bind(gContentPane));
-    }
-
-    // Initializes the fonts dropdowns displayed in this pane.
-    this._rebuildFonts();
-    var menulist = document.getElementById("defaultFont");
-    if (menulist.selectedIndex == -1) {
-      menulist.value = FontBuilder.readFontSelection(menulist);
-    }
-
-    // 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 (AlertsServiceDND) {
-      let notificationsDoNotDisturbRow =
-        document.getElementById("notificationsDoNotDisturbRow");
-      notificationsDoNotDisturbRow.removeAttribute("hidden");
-      if (AlertsServiceDND.manualDoNotDisturb) {
-        let notificationsDoNotDisturb =
-          document.getElementById("notificationsDoNotDisturb");
-        notificationsDoNotDisturb.setAttribute("checked", true);
-      }
-    }
-
-    setEventListener("font.language.group", "change",
-      gContentPane._rebuildFonts);
-    setEventListener("notificationsPolicyButton", "command",
-      gContentPane.showNotificationExceptions);
-    setEventListener("popupPolicyButton", "command",
-      gContentPane.showPopupExceptions);
-    setEventListener("advancedFonts", "command",
-      gContentPane.configureFonts);
-    setEventListener("colors", "command",
-      gContentPane.configureColors);
-    setEventListener("chooseLanguage", "command",
-      gContentPane.showLanguages);
-    setEventListener("translationAttributionImage", "click",
-      gContentPane.openTranslationProviderAttribution);
-    setEventListener("translateButton", "command",
-      gContentPane.showTranslationExceptions);
-    setEventListener("notificationsDoNotDisturb", "command",
-      gContentPane.toggleDoNotDisturbNotifications);
-
-    let notificationInfoURL =
-      Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";
-    document.getElementById("notificationsPolicyLearnMore").setAttribute("href",
-                                                                         notificationInfoURL);
-
-    let drmInfoURL =
-      Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
-    document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
-    let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
-    // Force-disable/hide on WinXP:
-    if (navigator.platform.toLowerCase().startsWith("win")) {
-      emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
-    }
-    if (!emeUIEnabled) {
-      // Don't want to rely on .hidden for the toplevel groupbox because
-      // of the pane hiding/showing code potentially interfering:
-      document.getElementById("drmGroup").setAttribute("style", "display: none !important");
-    }
-  },
-
-  // 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
-   */
-
-  // NOTIFICATIONS
-
-  /**
-   * Displays the notifications exceptions dialog where specific site notification
-   * preferences can be set.
-   */
-  showNotificationExceptions() {
-    let bundlePreferences = document.getElementById("bundlePreferences");
-    let params = { permissionType: "desktop-notification" };
-    params.windowTitle = bundlePreferences.getString("notificationspermissionstitle");
-    params.introText = bundlePreferences.getString("notificationspermissionstext4");
-
-    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
-                    "resizable=yes", params);
-
-    try {
-      Services.telemetry
-              .getHistogramById("WEB_NOTIFICATION_EXCEPTIONS_OPENED").add();
-    } catch (e) {}
-  },
-
-
-  // POP-UPS
-
-  /**
-   * Displays the popup exceptions dialog where specific site popup preferences
-   * can be set.
-   */
-  showPopupExceptions() {
-    var bundlePreferences = document.getElementById("bundlePreferences");
-    var params = { blockVisible: false, sessionVisible: false, allowVisible: true,
-                   prefilledHost: "", permissionType: "popup" }
-    params.windowTitle = bundlePreferences.getString("popuppermissionstitle");
-    params.introText = bundlePreferences.getString("popuppermissionstext");
-
-    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
-                    "resizable=yes", params);
-  },
-
-  // FONTS
-
-  /**
-   * Populates the default font list in UI.
-   */
-  _rebuildFonts() {
-    var preferences = document.getElementById("contentPreferences");
-    // 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");
-  },
-
-  /**
-   *
-   */
-  _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("contentPreferences");
-    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);
-      }
-    }
-  },
-
-  /**
-   * 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", "gContentPane._rebuildFonts();");
-      document.getElementById("contentPreferences").appendChild(preference);
-    }
-    return preference.value;
-  },
-
-  /**
-   * 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");
-  },
-
-  // LANGUAGES
-
-  /**
-   * 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();
-  },
-
-  toggleDoNotDisturbNotifications(event) {
-    AlertsServiceDND.manualDoNotDisturb = event.target.checked;
-  },
-};
deleted file mode 100644
--- a/browser/components/preferences/in-content/content.xul
+++ /dev/null
@@ -1,207 +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/.
-
-<!-- Content panel -->
-
-<preferences id="contentPreferences" hidden="true" data-category="paneContent">
-
-  <!-- DRM content -->
-  <preference id="media.eme.enabled"
-              name="media.eme.enabled"
-              type="bool"/>
-
-  <!-- Popups -->
-  <preference id="dom.disable_open_during_load"
-              name="dom.disable_open_during_load"
-              type="bool"/>
-
-  <!-- Fonts -->
-  <preference id="font.language.group"
-              name="font.language.group"
-              type="wstring"/>
-
-  <!-- Languages -->
-  <preference id="browser.translation.detectLanguage"
-              name="browser.translation.detectLanguage"
-              type="bool"/>
-</preferences>
-
-<script type="application/javascript"
-        src="chrome://mozapps/content/preferences/fontbuilder.js"/>
-<script type="application/javascript"
-        src="chrome://browser/content/preferences/in-content/content.js"/>
-
-<hbox id="header-content"
-      class="header"
-      hidden="true"
-      data-category="paneContent">
-  <label class="header-name" flex="1">&paneContent.title;</label>
-  <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
-</hbox>
-
-<groupbox id="drmGroup" data-category="paneContent" hidden="true">
-  <caption><label>&drmContent.label;</label></caption>
-  <grid id="contentGrid2">
-    <columns>
-      <column flex="1"/>
-      <column/>
-    </columns>
-    <rows id="contentRows-2">
-      <row id="playDRMContentRow">
-        <hbox align="center">
-          <checkbox id="playDRMContent" preference="media.eme.enabled"
-                    label="&playDRMContent.label;" accesskey="&playDRMContent.accesskey;"/>
-          <label id="playDRMContentLink" class="learnMore text-link" value="&playDRMContent.learnMore.label;"/>
-        </hbox>
-      </row>
-    </rows>
-  </grid>
-</groupbox>
-
-<groupbox id="notificationsGroup" data-category="paneContent" hidden="true">
-  <caption><label>&notificationsPolicy.label;</label></caption>
-  <grid>
-    <columns>
-      <column flex="1"/>
-      <column/>
-    </columns>
-    <rows>
-      <row id="notificationsPolicyRow" align="center">
-        <hbox align="start">
-          <label id="notificationsPolicy">&notificationsPolicyDesc3.label;</label>
-          <label id="notificationsPolicyLearnMore"
-                 class="learnMore text-link"
-                 value="&notificationsPolicyLearnMore.label;"/>
-        </hbox>
-        <hbox pack="end">
-          <button id="notificationsPolicyButton" label="&notificationsPolicyButton.label;"
-                  accesskey="&notificationsPolicyButton.accesskey;"/>
-        </hbox>
-      </row>
-      <row id="notificationsDoNotDisturbRow" hidden="true">
-        <vbox align="start">
-          <checkbox id="notificationsDoNotDisturb" label="&notificationsDoNotDisturb.label;"
-                    accesskey="&notificationsDoNotDisturb.accesskey;"/>
-          <label id="notificationsDoNotDisturbDetails"
-                 class="indent"
-                 value="&notificationsDoNotDisturbDetails.value;"/>
-        </vbox>
-      </row>
-    </rows>
-  </grid>
-</groupbox>
-
-<groupbox id="miscGroup" data-category="paneContent" hidden="true">
-  <caption><label>&popups.label;</label></caption>
-  <grid id="contentGrid">
-    <columns>
-      <column flex="1"/>
-      <column/>
-    </columns>
-    <rows id="contentRows-1">
-      <row id="popupPolicyRow">
-        <vbox align="start">
-          <checkbox id="popupPolicy" preference="dom.disable_open_during_load"
-                    label="&blockPopups.label;" accesskey="&blockPopups.accesskey;"
-                    onsyncfrompreference="return gContentPane.updateButtons('popupPolicyButton',
-                                                                        'dom.disable_open_during_load');"/>
-        </vbox>
-        <hbox pack="end">
-          <button id="popupPolicyButton" label="&popupExceptions.label;"
-                  accesskey="&popupExceptions.accesskey;"/>
-        </hbox>
-      </row>
-    </rows>
-  </grid>
-</groupbox>
-
-<!-- Fonts and Colors -->
-<groupbox id="fontsGroup" data-category="paneContent" hidden="true">
-  <caption><label>&fontsAndColors.label;</label></caption>
-
-  <grid id="fontsGrid">
-    <columns>
-      <column flex="1"/>
-      <column/>
-    </columns>
-    <rows id="fontsRows">
-      <row id="fontRow">
-        <hbox align="center">
-          <label control="defaultFont" accesskey="&defaultFont.accesskey;">&defaultFont.label;</label>
-          <menulist id="defaultFont" delayprefsave="true"/>
-          <label id="defaultFontSizeLabel" control="defaultFontSize" accesskey="&defaultSize.accesskey;">&defaultSize.label;</label>
-          <menulist id="defaultFontSize" delayprefsave="true">
-            <menupopup>
-              <menuitem value="9" label="9"/>
-              <menuitem value="10" label="10"/>
-              <menuitem value="11" label="11"/>
-              <menuitem value="12" label="12"/>
-              <menuitem value="13" label="13"/>
-              <menuitem value="14" label="14"/>
-              <menuitem value="15" label="15"/>
-              <menuitem value="16" label="16"/>
-              <menuitem value="17" label="17"/>
-              <menuitem value="18" label="18"/>
-              <menuitem value="20" label="20"/>
-              <menuitem value="22" label="22"/>
-              <menuitem value="24" label="24"/>
-              <menuitem value="26" label="26"/>
-              <menuitem value="28" label="28"/>
-              <menuitem value="30" label="30"/>
-              <menuitem value="32" label="32"/>
-              <menuitem value="34" label="34"/>
-              <menuitem value="36" label="36"/>
-              <menuitem value="40" label="40"/>
-              <menuitem value="44" label="44"/>
-              <menuitem value="48" label="48"/>
-              <menuitem value="56" label="56"/>
-              <menuitem value="64" label="64"/>
-              <menuitem value="72" label="72"/>
-            </menupopup>
-          </menulist>
-        </hbox>
-        <button id="advancedFonts" icon="select-font"
-                label="&advancedFonts.label;"
-                accesskey="&advancedFonts.accesskey;"/>
-      </row>
-      <row id="colorsRow">
-        <hbox/>
-        <button id="colors" icon="select-color"
-                label="&colors.label;"
-                accesskey="&colors.accesskey;"/>
-      </row>
-    </rows>
-  </grid>
-</groupbox>
-
-<!-- Languages -->
-<groupbox id="languagesGroup" data-category="paneContent" hidden="true">
-  <caption><label>&languages.label;</label></caption>
-
-  <hbox id="languagesBox" align="center">
-    <description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
-    <button id="chooseLanguage"
-            label="&chooseButton.label;"
-            accesskey="&chooseButton.accesskey;"/>
-  </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 gContentPane.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" label="&translateExceptions.label;"
-            accesskey="&translateExceptions.accesskey;"/>
-  </hbox>
-</groupbox>
--- a/browser/components/preferences/in-content/jar.mn
+++ b/browser/components/preferences/in-content/jar.mn
@@ -7,12 +7,9 @@ browser.jar:
 *  content/browser/preferences/in-content/preferences.xul
    content/browser/preferences/in-content/subdialogs.js
 
    content/browser/preferences/in-content/main.js
    content/browser/preferences/in-content/privacy.js
    content/browser/preferences/in-content/containers.js
    content/browser/preferences/in-content/advanced.js
    content/browser/preferences/in-content/applications.js
-   content/browser/preferences/in-content/content.js
    content/browser/preferences/in-content/sync.js
-   content/browser/preferences/in-content/security.js
-   content/browser/preferences/in-content/search.js
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -12,18 +12,36 @@ Components.utils.import("resource:///mod
 
 XPCOMUtils.defineLazyModuleGetter(this, "OS",
                                   "resource://gre/modules/osfile.jsm");
 
 if (AppConstants.E10S_TESTING_ONLY) {
   XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
                                     "resource://gre/modules/UpdateUtils.jsm");
 }
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
+                                  "resource://gre/modules/PlacesUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task",
+                                  "resource://gre/modules/Task.jsm");
+
+const ENGINE_FLAVOR = "text/x-moz-search-engine";
+
+var gEngineView = null;
 
 var gMainPane = {
+
+
+  /**
+   * Initialize autocomplete to ensure prefs are in sync.
+   */
+  _initAutocomplete() {
+    Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
+              .getService(Components.interfaces.mozIPlacesAutoComplete);
+  },
+
   /**
    * Initialization of this.
    */
   init() {
     function setEventListener(aId, aEventType, aCallback) {
       document.getElementById(aId)
               .addEventListener(aEventType, aCallback.bind(gMainPane));
     }
@@ -33,18 +51,49 @@ var gMainPane = {
       if (AppConstants.platform == "win") {
         // In Windows 8 we launch the control panel since it's the only
         // way to get all file type association prefs. So we don't know
         // when the user will select the default.  We refresh here periodically
         // in case the default changes. On other Windows OS's defaults can also
         // be set while the prefs are open.
         window.setInterval(this.updateSetDefaultBrowser.bind(this), 1000);
       }
+
     }
 
+    gEngineView = new EngineView(new EngineStore());
+    document.getElementById("engineList").view = gEngineView;
+    this.buildDefaultEngineDropDown();
+
+    let addEnginesLink = document.getElementById("addEngines");
+    let searchEnginesURL = Services.wm.getMostRecentWindow("navigator:browser")
+                                      .BrowserSearch.searchEnginesURL;
+    addEnginesLink.setAttribute("href", searchEnginesURL);
+
+    window.addEventListener("click", this);
+    window.addEventListener("command", this);
+    window.addEventListener("dragstart", this);
+    window.addEventListener("keypress", this);
+    window.addEventListener("select", this);
+    window.addEventListener("blur", this, true);
+
+    Services.obs.addObserver(this, "browser-search-engine-modified", false);
+    window.addEventListener("unload", () => {
+      Services.obs.removeObserver(this, "browser-search-engine-modified");
+    });
+
+    this._initAutocomplete();
+
+    let suggestsPref =
+      document.getElementById("browser.search.suggest.enabled");
+    suggestsPref.addEventListener("change", () => {
+      this.updateSuggestsCheckbox();
+    });
+    this.updateSuggestsCheckbox();
+
     // 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.
@@ -63,30 +112,57 @@ var gMainPane = {
     // re-enable the warnings.
     if (!TransientPrefs.prefShouldBeVisible("browser.tabs.warnOnClose"))
       document.getElementById("warnCloseMultiple").hidden = true;
     if (!TransientPrefs.prefShouldBeVisible("browser.tabs.warnOnOpen"))
       document.getElementById("warnOpenMany").hidden = true;
 
     setEventListener("browser.privatebrowsing.autostart", "change",
                      gMainPane.updateBrowserStartupLastSession);
-    setEventListener("browser.download.dir", "change",
-                     gMainPane.displayDownloadDirPref);
     if (AppConstants.HAVE_SHELL_SERVICE) {
       setEventListener("setDefaultButton", "command",
                        gMainPane.setDefaultBrowser);
     }
     setEventListener("useCurrent", "command",
                      gMainPane.setHomePageToCurrent);
     setEventListener("useBookmark", "command",
                      gMainPane.setHomePageToBookmark);
     setEventListener("restoreDefaultHomePage", "command",
                      gMainPane.restoreDefaultHomePage);
-    setEventListener("chooseFolder", "command",
-                     gMainPane.chooseFolder);
+    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);
+
+    // Initializes the fonts dropdowns displayed in this pane.
+    this._rebuildFonts();
+    var menulist = document.getElementById("defaultFont");
+    if (menulist.selectedIndex == -1) {
+      menulist.value = FontBuilder.readFontSelection(menulist);
+    }
+
+    // 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");
@@ -365,226 +441,27 @@ var gMainPane = {
   /**
    * Restores the default home page as the user's home page.
    */
   restoreDefaultHomePage() {
     var homePage = document.getElementById("browser.startup.homepage");
     homePage.value = homePage.defaultValue;
   },
 
-  // DOWNLOADS
-
-  /*
-   * Preferences:
-   *
-   * browser.download.useDownloadDir - bool
-   *   True - Save files directly to the folder configured via the
-   *   browser.download.folderList preference.
-   *   False - Always ask the user where to save a file and default to
-   *   browser.download.lastDir when displaying a folder picker dialog.
-   * browser.download.dir - local file handle
-   *   A local folder the user may have selected for downloaded files to be
-   *   saved. Migration of other browser settings may also set this path.
-   *   This folder is enabled when folderList equals 2.
-   * browser.download.lastDir - local file handle
-   *   May contain the last folder path accessed when the user browsed
-   *   via the file save-as dialog. (see contentAreaUtils.js)
-   * browser.download.folderList - int
-   *   Indicates the location users wish to save downloaded files too.
-   *   It is also used to display special file labels when the default
-   *   download location is either the Desktop or the Downloads folder.
-   *   Values:
-   *     0 - The desktop is the default download location.
-   *     1 - The system's downloads folder is the default download location.
-   *     2 - The default download location is elsewhere as specified in
-   *         browser.download.dir.
-   * browser.download.downloadDir
-   *   deprecated.
-   * browser.download.defaultFolder
-   *   deprecated.
-   */
-
   /**
-   * Enables/disables the folder field and Browse button based on whether a
-   * default download directory is being used.
+   * Utility function to enable/disable the button specified by aButtonID based
+   * on the value of the Boolean preference specified by aPreferenceID.
    */
-  readUseDownloadDir() {
-    var downloadFolder = document.getElementById("downloadFolder");
-    var chooseFolder = document.getElementById("chooseFolder");
-    var preference = document.getElementById("browser.download.useDownloadDir");
-    downloadFolder.disabled = !preference.value || preference.locked;
-    chooseFolder.disabled = !preference.value || preference.locked;
-
-    // don't override the preference's value in UI
-    return undefined;
-  },
-
-  /**
-   * Displays a file picker in which the user can choose the location where
-   * downloads are automatically saved, updating preferences and UI in
-   * response to the choice, if one is made.
-   */
-  chooseFolder() {
-    return this.chooseFolderTask().catch(Components.utils.reportError);
-  },
-  chooseFolderTask: Task.async(function* () {
-    let bundlePreferences = document.getElementById("bundlePreferences");
-    let title = bundlePreferences.getString("chooseDownloadFolderTitle");
-    let folderListPref = document.getElementById("browser.download.folderList");
-    let currentDirPref = yield this._indexToFolder(folderListPref.value);
-    let defDownloads = yield 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 = yield this._indexToFolder(0);
-    }
-
-    let result = yield 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 = yield 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
+  updateButtons(aButtonID, aPreferenceID) {
+    var button = document.getElementById(aButtonID);
+    var preference = document.getElementById(aPreferenceID);
+    button.disabled = preference.value != true;
     return undefined;
   },
 
-  displayDownloadDirPrefTask: Task.async(function* () {
-    var folderListPref = document.getElementById("browser.download.folderList");
-    var bundlePreferences = document.getElementById("bundlePreferences");
-    var downloadFolder = document.getElementById("downloadFolder");
-    var currentDirPref = document.getElementById("browser.download.dir");
-
-    // Used in defining the correct path to the folder icon.
-    var ios = Components.classes["@mozilla.org/network/io-service;1"]
-                        .getService(Components.interfaces.nsIIOService);
-    var fph = ios.getProtocolHandler("file")
-                 .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
-    var iconUrlSpec;
-
-    // Display a 'pretty' label or the path in the UI.
-    if (folderListPref.value == 2) {
-      // Custom path selected and is configured
-      downloadFolder.label = this._getDisplayNameOfFile(currentDirPref.value);
-      iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
-    } else if (folderListPref.value == 1) {
-      // 'Downloads'
-      // In 1.5, this pointed to a folder we created called 'My Downloads'
-      // and was available as an option in the 1.5 drop down. On XP this
-      // was in My Documents, on OSX it was in User Docs. In 2.0, we did
-      // away with the drop down option, although the special label was
-      // still supported for the folder if it existed. Because it was
-      // not exposed it was rarely used.
-      // With 3.0, a new desktop folder - 'Downloads' was introduced for
-      // platforms and versions that don't support a default system downloads
-      // folder. See nsDownloadManager for details.
-      downloadFolder.label = bundlePreferences.getString("downloadsFolderName");
-      iconUrlSpec = fph.getURLSpecFromFile(yield this._indexToFolder(1));
-    } else {
-      // 'Desktop'
-      downloadFolder.label = bundlePreferences.getString("desktopFolderName");
-      iconUrlSpec = fph.getURLSpecFromFile(yield 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"
-   */
-  _getDownloadsFolder: Task.async(function* (aFolder) {
-    switch (aFolder) {
-      case "Desktop":
-        var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"]
-                                    .getService(Components.interfaces.nsIProperties);
-        return fileLoc.get("Desk", Components.interfaces.nsILocalFile);
-      case "Downloads":
-        let downloadsDir = yield 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
-   */
-  _folderToIndex: Task.async(function* (aFolder) {
-    if (!aFolder || aFolder.equals(yield this._getDownloadsFolder("Desktop")))
-      return 0;
-    else if (aFolder.equals(yield 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: Task.async(function* (aIndex) {
-    switch (aIndex) {
-      case 0:
-        return yield this._getDownloadsFolder("Desktop");
-      case 1:
-        return yield this._getDownloadsFolder("Downloads");
-    }
-    var currentDirPref = document.getElementById("browser.download.dir");
-    return currentDirPref.value;
-  }),
-
   /**
    * Hide/show the "Show my windows and tabs from last time" option based
    * on the value of the browser.privatebrowsing.autostart pref.
    */
   updateBrowserStartupLastSession() {
     let pbAutoStartPref = document.getElementById("browser.privatebrowsing.autostart");
     let startupPref = document.getElementById("browser.startup.page");
     let menu = document.getElementById("browserStartupPage");
@@ -691,9 +568,700 @@ var gMainPane = {
         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");
+  },
+
+  // 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);
+      }
+    }
+  },
+
+  /**
+   * Returns true if any spellchecking is enabled and false otherwise, caching
+   * the current value to enable proper pref restoration if the checkbox is
+   * never changed.
+   */
+  readCheckSpelling() {
+    var pref = document.getElementById("layout.spellcheckDefault");
+    this._storedSpellCheck = pref.value;
+
+    return (pref.value != 0);
+  },
+
+  /**
+   * Returns the value of the spellchecking preference represented by UI,
+   * preserving the preference's "hidden" value if the preference is
+   * unchanged and represents a value not strictly allowed in UI.
+   */
+  writeCheckSpelling() {
+    var checkbox = document.getElementById("checkSpelling");
+    if (checkbox.checked) {
+      if (this._storedSpellCheck == 2) {
+        return 2;
+      }
+      return 1;
+    }
+    return 0;
+  },
+
+  updateSuggestsCheckbox() {
+    let suggestsPref =
+      document.getElementById("browser.search.suggest.enabled");
+    let permanentPB =
+      Services.prefs.getBoolPref("browser.privatebrowsing.autostart");
+    let urlbarSuggests = document.getElementById("urlBarSuggestion");
+    urlbarSuggests.disabled = !suggestsPref.value || permanentPB;
+
+    let urlbarSuggestsPref =
+      document.getElementById("browser.urlbar.suggest.searches");
+    urlbarSuggests.checked = urlbarSuggestsPref.value;
+    if (urlbarSuggests.disabled) {
+      urlbarSuggests.checked = false;
+    }
+
+    let permanentPBLabel =
+      document.getElementById("urlBarSuggestionPermanentPBLabel");
+    permanentPBLabel.hidden = urlbarSuggests.hidden || !permanentPB;
+  },
+
+  buildDefaultEngineDropDown() {
+    // This is called each time something affects the list of engines.
+    let list = document.getElementById("defaultEngine");
+    // Set selection to the current default engine.
+    let currentEngine = Services.search.currentEngine.name;
+
+    // If the current engine isn't in the list any more, select the first item.
+    let engines = gEngineView._engineStore._engines;
+    if (!engines.some(e => e.name == currentEngine))
+      currentEngine = engines[0].name;
+
+    // Now clean-up and rebuild the list.
+    list.removeAllItems();
+    gEngineView._engineStore._engines.forEach(e => {
+      let item = list.appendItem(e.name);
+      item.setAttribute("class", "menuitem-iconic searchengine-menuitem menuitem-with-favicon");
+      if (e.iconURI) {
+        item.setAttribute("image", e.iconURI.spec);
+      }
+      item.engine = e;
+      if (e.name == currentEngine)
+        list.selectedItem = item;
+    });
+  },
+
+  handleEvent(aEvent) {
+    switch (aEvent.type) {
+      case "click":
+        if (aEvent.target.id != "engineChildren" &&
+            !aEvent.target.classList.contains("searchEngineAction")) {
+          let engineList = document.getElementById("engineList");
+          // We don't want to toggle off selection while editing keyword
+          // so proceed only when the input field is hidden.
+          // We need to check that engineList.view is defined here
+          // because the "click" event listener is on <window> and the
+          // view might have been destroyed if the pane has been navigated
+          // away from.
+          if (engineList.inputField.hidden && engineList.view) {
+            let selection = engineList.view.selection;
+            if (selection.count > 0) {
+              selection.toggleSelect(selection.currentIndex);
+            }
+            engineList.blur();
+          }
+        }
+        break;
+      case "command":
+        switch (aEvent.target.id) {
+          case "":
+            if (aEvent.target.parentNode &&
+                aEvent.target.parentNode.parentNode &&
+                aEvent.target.parentNode.parentNode.id == "defaultEngine") {
+              gMainPane.setDefaultEngine();
+            }
+            break;
+          case "restoreDefaultSearchEngines":
+            gMainPane.onRestoreDefaults();
+            break;
+          case "removeEngineButton":
+            Services.search.removeEngine(gEngineView.selectedEngine.originalEngine);
+            break;
+        }
+        break;
+      case "dragstart":
+        if (aEvent.target.id == "engineChildren") {
+          onDragEngineStart(aEvent);
+        }
+        break;
+      case "keypress":
+        if (aEvent.target.id == "engineList") {
+          gMainPane.onTreeKeyPress(aEvent);
+        }
+        break;
+      case "select":
+        if (aEvent.target.id == "engineList") {
+          gMainPane.onTreeSelect();
+        }
+        break;
+      case "blur":
+        if (aEvent.target.id == "engineList" &&
+            aEvent.target.inputField == document.getBindingParent(aEvent.originalTarget)) {
+          gMainPane.onInputBlur();
+        }
+        break;
+    }
+  },
+
+  observe(aEngine, aTopic, aVerb) {
+    if (aTopic == "browser-search-engine-modified") {
+      aEngine.QueryInterface(Components.interfaces.nsISearchEngine);
+      switch (aVerb) {
+      case "engine-added":
+        gEngineView._engineStore.addEngine(aEngine);
+        gEngineView.rowCountChanged(gEngineView.lastIndex, 1);
+        gMainPane.buildDefaultEngineDropDown();
+        break;
+      case "engine-changed":
+        gEngineView._engineStore.reloadIcons();
+        gEngineView.invalidate();
+        break;
+      case "engine-removed":
+        gMainPane.remove(aEngine);
+        break;
+      case "engine-current":
+        // If the user is going through the drop down using up/down keys, the
+        // dropdown may still be open (eg. on Windows) when engine-current is
+        // fired, so rebuilding the list unconditionally would get in the way.
+        let selectedEngine =
+          document.getElementById("defaultEngine").selectedItem.engine;
+        if (selectedEngine.name != aEngine.name)
+          gMainPane.buildDefaultEngineDropDown();
+        break;
+      case "engine-default":
+        // Not relevant
+        break;
+      }
+    }
+  },
+
+  onInputBlur(aEvent) {
+    let tree = document.getElementById("engineList");
+    if (!tree.hasAttribute("editing"))
+      return;
+
+    // Accept input unless discarded.
+    let accept = aEvent.charCode != KeyEvent.DOM_VK_ESCAPE;
+    tree.stopEditing(accept);
+  },
+
+  onTreeSelect() {
+    document.getElementById("removeEngineButton").disabled =
+      !gEngineView.isEngineSelectedAndRemovable();
+  },
+
+  onTreeKeyPress(aEvent) {
+    let index = gEngineView.selectedIndex;
+    let tree = document.getElementById("engineList");
+    if (tree.hasAttribute("editing"))
+      return;
+
+    if (aEvent.charCode == KeyEvent.DOM_VK_SPACE) {
+      // Space toggles the checkbox.
+      let newValue = !gEngineView._engineStore.engines[index].shown;
+      gEngineView.setCellValue(index, tree.columns.getFirstColumn(),
+                               newValue.toString());
+      // Prevent page from scrolling on the space key.
+      aEvent.preventDefault();
+    } else {
+      let isMac = Services.appinfo.OS == "Darwin";
+      if ((isMac && aEvent.keyCode == KeyEvent.DOM_VK_RETURN) ||
+          (!isMac && aEvent.keyCode == KeyEvent.DOM_VK_F2)) {
+        tree.startEditing(index, tree.columns.getLastColumn());
+      } else if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE ||
+                 (isMac && aEvent.shiftKey &&
+                  aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE &&
+                  gEngineView.isEngineSelectedAndRemovable())) {
+        // Delete and Shift+Backspace (Mac) removes selected engine.
+        Services.search.removeEngine(gEngineView.selectedEngine.originalEngine);
+     }
+    }
+  },
+
+  onRestoreDefaults() {
+    let num = gEngineView._engineStore.restoreDefaultEngines();
+    gEngineView.rowCountChanged(0, num);
+    gEngineView.invalidate();
+  },
+
+  showRestoreDefaults(aEnable) {
+    document.getElementById("restoreDefaultSearchEngines").disabled = !aEnable;
+  },
+
+  remove(aEngine) {
+    let index = gEngineView._engineStore.removeEngine(aEngine);
+    gEngineView.rowCountChanged(index, -1);
+    gEngineView.invalidate();
+    gEngineView.selection.select(Math.min(index, gEngineView.lastIndex));
+    gEngineView.ensureRowIsVisible(gEngineView.currentIndex);
+    document.getElementById("engineList").focus();
+  },
+
+  editKeyword: Task.async(function* (aEngine, aNewKeyword) {
+    let keyword = aNewKeyword.trim();
+    if (keyword) {
+      let eduplicate = false;
+      let dupName = "";
+
+      // Check for duplicates in Places keywords.
+      let bduplicate = !!(yield PlacesUtils.keywords.fetch(keyword));
+
+      // Check for duplicates in changes we haven't committed yet
+      let engines = gEngineView._engineStore.engines;
+      for (let engine of engines) {
+        if (engine.alias == keyword &&
+            engine.name != aEngine.name) {
+          eduplicate = true;
+          dupName = engine.name;
+          break;
+        }
+      }
+
+      // Notify the user if they have chosen an existing engine/bookmark keyword
+      if (eduplicate || bduplicate) {
+        let strings = document.getElementById("engineManagerBundle");
+        let dtitle = strings.getString("duplicateTitle");
+        let bmsg = strings.getString("duplicateBookmarkMsg");
+        let emsg = strings.getFormattedString("duplicateEngineMsg", [dupName]);
+
+        Services.prompt.alert(window, dtitle, eduplicate ? emsg : bmsg);
+        return false;
+      }
+    }
+
+    gEngineView._engineStore.changeEngine(aEngine, "alias", keyword);
+    gEngineView.invalidate();
+    return true;
+  }),
+
+  saveOneClickEnginesList() {
+    let hiddenList = [];
+    for (let engine of gEngineView._engineStore.engines) {
+      if (!engine.shown)
+        hiddenList.push(engine.name);
+    }
+    document.getElementById("browser.search.hiddenOneOffs").value =
+      hiddenList.join(",");
+  },
+
+  setDefaultEngine() {
+    Services.search.currentEngine =
+      document.getElementById("defaultEngine").selectedItem.engine;
+  }
 };
+
+function onDragEngineStart(event) {
+  var selectedIndex = gEngineView.selectedIndex;
+  var tree = document.getElementById("engineList");
+  var row = { }, col = { }, child = { };
+  tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);
+  if (selectedIndex >= 0 && !gEngineView.isCheckBox(row.value, col.value)) {
+    event.dataTransfer.setData(ENGINE_FLAVOR, selectedIndex.toString());
+    event.dataTransfer.effectAllowed = "move";
+  }
+}
+
+
+function EngineStore() {
+  let pref = document.getElementById("browser.search.hiddenOneOffs").value;
+  this.hiddenList = pref ? pref.split(",") : [];
+
+  this._engines = Services.search.getVisibleEngines().map(this._cloneEngine, this);
+  this._defaultEngines = Services.search.getDefaultEngines().map(this._cloneEngine, this);
+
+  // check if we need to disable the restore defaults button
+  var someHidden = this._defaultEngines.some(e => e.hidden);
+  gMainPane.showRestoreDefaults(someHidden);
+}
+EngineStore.prototype = {
+  _engines: null,
+  _defaultEngines: null,
+
+  get engines() {
+    return this._engines;
+  },
+  set engines(val) {
+    this._engines = val;
+    return val;
+  },
+
+  _getIndexForEngine(aEngine) {
+    return this._engines.indexOf(aEngine);
+  },
+
+  _getEngineByName(aName) {
+    return this._engines.find(engine => engine.name == aName);
+  },
+
+  _cloneEngine(aEngine) {
+    var clonedObj = {};
+    for (var i in aEngine)
+      clonedObj[i] = aEngine[i];
+    clonedObj.originalEngine = aEngine;
+    clonedObj.shown = this.hiddenList.indexOf(clonedObj.name) == -1;
+    return clonedObj;
+  },
+
+  // Callback for Array's some(). A thisObj must be passed to some()
+  _isSameEngine(aEngineClone) {
+    return aEngineClone.originalEngine == this.originalEngine;
+  },
+
+  addEngine(aEngine) {
+    this._engines.push(this._cloneEngine(aEngine));
+  },
+
+  moveEngine(aEngine, aNewIndex) {
+    if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
+      throw new Error("ES_moveEngine: invalid aNewIndex!");
+    var index = this._getIndexForEngine(aEngine);
+    if (index == -1)
+      throw new Error("ES_moveEngine: invalid engine?");
+
+    if (index == aNewIndex)
+      return; // nothing to do
+
+    // Move the engine in our internal store
+    var removedEngine = this._engines.splice(index, 1)[0];
+    this._engines.splice(aNewIndex, 0, removedEngine);
+
+    Services.search.moveEngine(aEngine.originalEngine, aNewIndex);
+  },
+
+  removeEngine(aEngine) {
+    if (this._engines.length == 1) {
+      throw new Error("Cannot remove last engine!");
+    }
+
+    let engineName = aEngine.name;
+    let index = this._engines.findIndex(element => element.name == engineName);
+
+    if (index == -1)
+      throw new Error("invalid engine?");
+
+    this._engines.splice(index, 1);
+
+    if (this._defaultEngines.some(this._isSameEngine, this._engines[index]))
+      gMainPane.showRestoreDefaults(true);
+    gMainPane.buildDefaultEngineDropDown();
+    return index;
+  },
+
+  restoreDefaultEngines() {
+    var added = 0;
+
+    for (var i = 0; i < this._defaultEngines.length; ++i) {
+      var e = this._defaultEngines[i];
+
+      // If the engine is already in the list, just move it.
+      if (this._engines.some(this._isSameEngine, e)) {
+        this.moveEngine(this._getEngineByName(e.name), i);
+      } else {
+        // Otherwise, add it back to our internal store
+
+        // The search service removes the alias when an engine is hidden,
+        // so clear any alias we may have cached before unhiding the engine.
+        e.alias = "";
+
+        this._engines.splice(i, 0, e);
+        let engine = e.originalEngine;
+        engine.hidden = false;
+        Services.search.moveEngine(engine, i);
+        added++;
+      }
+    }
+    Services.search.resetToOriginalDefaultEngine();
+    gMainPane.showRestoreDefaults(false);
+    gMainPane.buildDefaultEngineDropDown();
+    return added;
+  },
+
+  changeEngine(aEngine, aProp, aNewValue) {
+    var index = this._getIndexForEngine(aEngine);
+    if (index == -1)
+      throw new Error("invalid engine?");
+
+    this._engines[index][aProp] = aNewValue;
+    aEngine.originalEngine[aProp] = aNewValue;
+  },
+
+  reloadIcons() {
+    this._engines.forEach(function(e) {
+      e.uri = e.originalEngine.uri;
+    });
+  }
+};
+
+function EngineView(aEngineStore) {
+  this._engineStore = aEngineStore;
+}
+EngineView.prototype = {
+  _engineStore: null,
+  tree: null,
+
+  get lastIndex() {
+    return this.rowCount - 1;
+  },
+  get selectedIndex() {
+    var seln = this.selection;
+    if (seln.getRangeCount() > 0) {
+      var min = {};
+      seln.getRangeAt(0, min, {});
+      return min.value;
+    }
+    return -1;
+  },
+  get selectedEngine() {
+    return this._engineStore.engines[this.selectedIndex];
+  },
+
+  // Helpers
+  rowCountChanged(index, count) {
+    this.tree.rowCountChanged(index, count);
+  },
+
+  invalidate() {
+    this.tree.invalidate();
+  },
+
+  ensureRowIsVisible(index) {
+    this.tree.ensureRowIsVisible(index);
+  },
+
+  getSourceIndexFromDrag(dataTransfer) {
+    return parseInt(dataTransfer.getData(ENGINE_FLAVOR));
+  },
+
+  isCheckBox(index, column) {
+    return column.id == "engineShown";
+  },
+
+  isEngineSelectedAndRemovable() {
+    return this.selectedIndex != -1 && this.lastIndex != 0;
+  },
+
+  // nsITreeView
+  get rowCount() {
+    return this._engineStore.engines.length;
+  },
+
+  getImageSrc(index, column) {
+    if (column.id == "engineName") {
+      if (this._engineStore.engines[index].iconURI)
+        return this._engineStore.engines[index].iconURI.spec;
+
+      if (window.devicePixelRatio > 1)
+        return "chrome://browser/skin/search-engine-placeholder@2x.png";
+      return "chrome://browser/skin/search-engine-placeholder.png";
+    }
+
+    return "";
+  },
+
+  getCellText(index, column) {
+    if (column.id == "engineName")
+      return this._engineStore.engines[index].name;
+    else if (column.id == "engineKeyword")
+      return this._engineStore.engines[index].alias;
+    return "";
+  },
+
+  setTree(tree) {
+    this.tree = tree;
+  },
+
+  canDrop(targetIndex, orientation, dataTransfer) {
+    var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
+    return (sourceIndex != -1 &&
+            sourceIndex != targetIndex &&
+            sourceIndex != targetIndex + orientation);
+  },
+
+  drop(dropIndex, orientation, dataTransfer) {
+    var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
+    var sourceEngine = this._engineStore.engines[sourceIndex];
+
+    const nsITreeView = Components.interfaces.nsITreeView;
+    if (dropIndex > sourceIndex) {
+      if (orientation == nsITreeView.DROP_BEFORE)
+        dropIndex--;
+    } else if (orientation == nsITreeView.DROP_AFTER) {
+      dropIndex++;
+    }
+
+    this._engineStore.moveEngine(sourceEngine, dropIndex);
+    gMainPane.showRestoreDefaults(true);
+    gMainPane.buildDefaultEngineDropDown();
+
+    // Redraw, and adjust selection
+    this.invalidate();
+    this.selection.select(dropIndex);
+  },
+
+  selection: null,
+  getRowProperties(index) { return ""; },
+  getCellProperties(index, column) { return ""; },
+  getColumnProperties(column) { return ""; },
+  isContainer(index) { return false; },
+  isContainerOpen(index) { return false; },
+  isContainerEmpty(index) { return false; },
+  isSeparator(index) { return false; },
+  isSorted(index) { return false; },
+  getParentIndex(index) { return -1; },
+  hasNextSibling(parentIndex, index) { return false; },
+  getLevel(index) { return 0; },
+  getProgressMode(index, column) { },
+  getCellValue(index, column) {
+    if (column.id == "engineShown")
+      return this._engineStore.engines[index].shown;
+    return undefined;
+  },
+  toggleOpenState(index) { },
+  cycleHeader(column) { },
+  selectionChanged() { },
+  cycleCell(row, column) { },
+  isEditable(index, column) { return column.id != "engineName"; },
+  isSelectable(index, column) { return false; },
+  setCellValue(index, column, value) {
+    if (column.id == "engineShown") {
+      this._engineStore.engines[index].shown = value == "true";
+      gEngineView.invalidate();
+      gMainPane.saveOneClickEnginesList();
+    }
+  },
+  setCellText(index, column, value) {
+    if (column.id == "engineKeyword") {
+      gMainPane.editKeyword(this._engineStore.engines[index], value)
+                 .then(valid => {
+        if (!valid)
+          document.getElementById("engineList").startEditing(index, column);
+      });
+    }
+  },
+  performAction(action) { },
+  performActionOnRow(action, index) { },
+  performActionOnCell(action, index, column) { }
+};
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -2,16 +2,21 @@
 # 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/main.js"/>
 
+<script type="application/javascript"
+        src="chrome://mozapps/content/preferences/fontbuilder.js"/>
+
+<stringbundle id="engineManagerBundle" src="chrome://browser/locale/engineManager.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"
@@ -48,16 +53,29 @@
     <preference id="pref.browser.homepage.disable_button.restore_default"
                 name="pref.browser.homepage.disable_button.restore_default"
                 type="bool"/>
 
     <preference id="browser.privatebrowsing.autostart"
                 name="browser.privatebrowsing.autostart"
                 type="bool"/>
 
+    <!-- Search Engine -->
+    <preference id="browser.search.suggest.enabled"
+                  name="browser.search.suggest.enabled"
+                  type="bool"/>
+
+    <preference id="browser.urlbar.suggest.searches"
+                name="browser.urlbar.suggest.searches"
+                type="bool"/>
+
+    <preference id="browser.search.hiddenOneOffs"
+                name="browser.search.hiddenOneOffs"
+                type="unichar"/>
+
     <!-- Downloads -->
     <preference id="browser.download.useDownloadDir"
                 name="browser.download.useDownloadDir"
                 type="bool"/>
 
     <preference id="browser.download.folderList"
                 name="browser.download.folderList"
                 type="int"/>
@@ -103,16 +121,70 @@
 #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 -->
+  <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 -->
+  <preference id="general.autoScroll"
+              name="general.autoScroll"
+              type="bool"/>
+  <preference id="general.smoothScroll"
+              name="general.smoothScroll"
+              type="bool"/>
+  <preference id="layers.acceleration.disabled"
+              name="layers.acceleration.disabled"
+              type="bool"
+              inverted="true"/>
+#ifdef XP_WIN
+  <preference id="gfx.direct2d.disabled"
+              name="gfx.direct2d.disabled"
+              type="bool"
+              inverted="true"/>
+#endif
+  <preference id="layout.spellcheckDefault"
+              name="layout.spellcheckDefault"
+              type="int"/>
+
+#ifdef MOZ_TELEMETRY_REPORTING
+  <preference id="toolkit.telemetry.enabled"
+              name="toolkit.telemetry.enabled"
+              type="bool"/>
+#endif
 </preferences>
 
 <hbox id="header-general"
       class="header"
       hidden="true"
       data-category="paneGeneral">
   <label class="header-name" flex="1">&paneGeneral.title;</label>
   <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
@@ -221,54 +293,72 @@
                 label="&restoreDefault.label;"
                 accesskey="&restoreDefault.accesskey;"
                 preference="pref.browser.homepage.disable_button.restore_default"/>
       </html:td>
     </html:tr>
   </html:table>
 </groupbox>
 
-<!-- Downloads -->
-<groupbox id="downloadsGroup"
-          data-category="paneGeneral"
-          hidden="true">
-  <caption><label>&downloads.label;</label></caption>
+<!-- Default Search Engine -->
+<groupbox id="defaultEngineGroup" align="start" data-category="paneGeneral">
+  <caption label="&defaultSearchEngine.label;"/>
+  <label>&chooseYourDefaultSearchEngine.label;</label>
+  <menulist id="defaultEngine">
+    <menupopup/>
+  </menulist>
+  <checkbox id="suggestionsInSearchFieldsCheckbox"
+            label="&provideSearchSuggestions.label;"
+            accesskey="&provideSearchSuggestions.accesskey;"
+            preference="browser.search.suggest.enabled"/>
+  <vbox class="indent">
+    <checkbox id="urlBarSuggestion" label="&showURLBarSuggestions.label;"
+              accesskey="&showURLBarSuggestions.accesskey;"
+              preference="browser.urlbar.suggest.searches"/>
+    <hbox id="urlBarSuggestionPermanentPBLabel"
+          align="center" class="indent">
+      <label flex="1">&urlBarSuggestionsPermanentPB.label;</label>
+    </hbox>
+  </vbox>
+</groupbox>
+
+<groupbox id="oneClickSearchProvidersGroup" data-category="paneGeneral">
+  <caption label="&oneClickSearchEngines.label;"/>
+  <label>&chooseWhichOneToDisplay.label;</label>
 
-  <radiogroup id="saveWhere"
-              preference="browser.download.useDownloadDir"
-              onsyncfrompreference="return gMainPane.readUseDownloadDir();">
-    <hbox id="saveToRow">
-      <radio id="saveTo"
-             value="true"
-             label="&saveTo.label;"
-             accesskey="&saveTo.accesskey;"
-             aria-labelledby="saveTo downloadFolder"/>
-      <filefield id="downloadFolder"
-                 flex="1"
-                 preference="browser.download.folderList"
-                 preference-editable="true"
-                 aria-labelledby="saveTo"
-                 onsyncfrompreference="return gMainPane.displayDownloadDirPref();"/>
-      <button id="chooseFolder"
-#ifdef XP_MACOSX
-              accesskey="&chooseFolderMac.accesskey;"
-              label="&chooseFolderMac.label;"
-#else
-              accesskey="&chooseFolderWin.accesskey;"
-              label="&chooseFolderWin.label;"
-#endif
-      />
-    </hbox>
-    <hbox>
-      <radio id="alwaysAsk"
-             value="false"
-             label="&alwaysAskWhere.label;"
-             accesskey="&alwaysAskWhere.accesskey;"/>
-    </hbox>
-  </radiogroup>
+  <tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true"
+        seltype="single">
+    <treechildren id="engineChildren" flex="1"/>
+    <treecols>
+      <treecol id="engineShown" type="checkbox" editable="true" sortable="false"/>
+      <treecol id="engineName" flex="4" label="&engineNameColumn.label;" sortable="false"/>
+      <treecol id="engineKeyword" flex="1" label="&engineKeywordColumn.label;" editable="true"
+                sortable="false"/>
+    </treecols>
+  </tree>
+
+  <hbox>
+    <button id="restoreDefaultSearchEngines"
+            label="&restoreDefaultSearchEngines.label;"
+            accesskey="&restoreDefaultSearchEngines.accesskey;"
+            />
+    <spacer flex="1"/>
+    <button id="removeEngineButton"
+            class="searchEngineAction"
+            label="&removeEngine.label;"
+            accesskey="&removeEngine.accesskey;"
+            disabled="true"
+            />
+  </hbox>
+
+  <separator class="thin"/>
+
+  <hbox id="addEnginesBox" pack="start">
+    <label id="addEngines" class="text-link" value="&addMoreSearchEngines.label;"/>
+  </hbox>
 </groupbox>
 
 <!-- Tab preferences -->
 <groupbox data-category="paneGeneral"
           hidden="true" align="start">
     <caption><label>&tabsGroup.label;</label></caption>
 
     <checkbox id="ctrlTabRecentlyUsedOrder" label="&ctrlTabRecentlyUsedOrder.label;"
@@ -294,8 +384,150 @@
               preference="browser.tabs.loadInBackground"/>
 
 #ifdef XP_WIN
     <checkbox id="showTabsInTaskbar" label="&showTabsInTaskbar.label;"
               accesskey="&showTabsInTaskbar.accesskey;"
               preference="browser.taskbar.previews.enable"/>
 #endif
 </groupbox>
+
+<!-- Accessibility -->
+<groupbox data-category="paneGeneral" id="accessibilityGroup" align="start">
+  <caption><label>&accessibility.label;</label></caption>
+
+#ifdef XP_WIN
+  <checkbox id="useOnScreenKeyboard"
+            hidden="true"
+            label="&useOnScreenKeyboard.label;"
+            accesskey="&useOnScreenKeyboard.accesskey;"
+            preference="ui.osk.enabled"/>
+#endif
+  <checkbox id="useCursorNavigation"
+            label="&useCursorNavigation.label;"
+            accesskey="&useCursorNavigation.accesskey;"
+            preference="accessibility.browsewithcaret"/>
+  <checkbox id="searchStartTyping"
+            label="&searchOnStartTyping.label;"
+            accesskey="&searchOnStartTyping.accesskey;"
+            preference="accessibility.typeaheadfind"/>
+  <checkbox id="blockAutoRefresh"
+            label="&blockAutoReload.label;"
+            accesskey="&blockAutoReload.accesskey;"
+            preference="accessibility.blockautorefresh"/>
+</groupbox>
+
+<!-- Languages -->
+<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true">
+  <caption><label>&languages.label;</label></caption>
+
+  <hbox id="languagesBox" align="center">
+    <description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
+    <button id="chooseLanguage"
+            label="&chooseButton.label;"
+            accesskey="&chooseButton.accesskey;"/>
+  </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" label="&translateExceptions.label;"
+            accesskey="&translateExceptions.accesskey;"/>
+  </hbox>
+  <hbox>
+    <checkbox id="checkSpelling"
+            label="&checkUserSpelling.label;"
+            accesskey="&checkUserSpelling.accesskey;"
+            onsyncfrompreference="return gMainPane.readCheckSpelling();"
+            onsynctopreference="return gMainPane.writeCheckSpelling();"
+            preference="layout.spellcheckDefault"/>
+  </hbox>
+</groupbox>
+
+
+<!-- Fonts and Colors -->
+<groupbox id="fontsGroup" data-category="paneGeneral" hidden="true">
+  <caption><label>&fontsAndColors.label;</label></caption>
+
+  <grid id="fontsGrid">
+    <columns>
+      <column flex="1"/>
+      <column/>
+    </columns>
+    <rows id="fontsRows">
+      <row id="fontRow">
+        <hbox align="center">
+          <label control="defaultFont" accesskey="&defaultFont.accesskey;">&defaultFont.label;</label>
+          <menulist id="defaultFont" delayprefsave="true"/>
+          <label id="defaultFontSizeLabel" control="defaultFontSize" accesskey="&defaultSize.accesskey;">&defaultSize.label;</label>
+          <menulist id="defaultFontSize" delayprefsave="true">
+            <menupopup>
+              <menuitem value="9" label="9"/>
+              <menuitem value="10" label="10"/>
+              <menuitem value="11" label="11"/>
+              <menuitem value="12" label="12"/>
+              <menuitem value="13" label="13"/>
+              <menuitem value="14" label="14"/>
+              <menuitem value="15" label="15"/>
+              <menuitem value="16" label="16"/>
+              <menuitem value="17" label="17"/>
+              <menuitem value="18" label="18"/>
+              <menuitem value="20" label="20"/>
+              <menuitem value="22" label="22"/>
+              <menuitem value="24" label="24"/>
+              <menuitem value="26" label="26"/>
+              <menuitem value="28" label="28"/>
+              <menuitem value="30" label="30"/>
+              <menuitem value="32" label="32"/>
+              <menuitem value="34" label="34"/>
+              <menuitem value="36" label="36"/>
+              <menuitem value="40" label="40"/>
+              <menuitem value="44" label="44"/>
+              <menuitem value="48" label="48"/>
+              <menuitem value="56" label="56"/>
+              <menuitem value="64" label="64"/>
+              <menuitem value="72" label="72"/>
+            </menupopup>
+          </menulist>
+        </hbox>
+        <button id="advancedFonts" icon="select-font"
+                label="&advancedFonts.label;"
+                accesskey="&advancedFonts.accesskey;"/>
+      </row>
+      <row id="colorsRow">
+        <hbox/>
+        <button id="colors" icon="select-color"
+                label="&colors.label;"
+                accesskey="&colors.accesskey;"/>
+      </row>
+    </rows>
+  </grid>
+</groupbox>
+
+<!-- Browsing -->
+<groupbox id="browsingGroup" align="start" data-category="paneGeneral">
+  <caption><label>&browsing.label;</label></caption>
+
+  <checkbox id="useAutoScroll"
+            label="&useAutoScroll.label;"
+            accesskey="&useAutoScroll.accesskey;"
+            preference="general.autoScroll"/>
+  <checkbox id="useSmoothScrolling"
+            label="&useSmoothScrolling.label;"
+            accesskey="&useSmoothScrolling.accesskey;"
+            preference="general.smoothScroll"/>
+  <checkbox id="allowHWAccel"
+            label="&allowHWAccel.label;"
+            accesskey="&allowHWAccel.accesskey;"
+            preference="layers.acceleration.disabled"/>
+</groupbox>
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/preferences.js
+++ b/browser/components/preferences/in-content/preferences.js
@@ -1,22 +1,19 @@
 /* - 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 advanced.js */
 /* import-globals-from main.js */
-/* import-globals-from search.js */
 /* import-globals-from containers.js */
-/* import-globals-from content.js */
 /* import-globals-from privacy.js */
 /* import-globals-from applications.js */
-/* import-globals-from security.js */
 /* import-globals-from sync.js */
 /* import-globals-from ../../../base/content/utilityOverlay.js */
 
 "use strict";
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
@@ -55,24 +52,21 @@ addEventListener("DOMContentLoaded", fun
   init_all();
 });
 
 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("paneAdvanced", gAdvancedPane);
   register_module("paneApplications", gApplicationsPane);
-  register_module("paneContent", gContentPane);
   register_module("paneSync", gSyncPane);
-  register_module("paneSecurity", gSecurityPane);
 
   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");
     }
@@ -127,33 +121,20 @@ function init_dynamic_padding() {
 function telemetryBucketForCategory(category) {
   switch (category) {
     case "general":
     case "search":
     case "content":
     case "applications":
     case "privacy":
     case "security":
+    case "advanced":
+      return "advanced";
     case "sync":
       return category;
-    case "advanced":
-      let advancedPaneTabs = document.getElementById("advancedPrefs");
-      switch (advancedPaneTabs.selectedTab.id) {
-        case "generalTab":
-          return "advancedGeneral";
-        case "dataChoicesTab":
-          return "advancedDataChoices";
-        case "networkTab":
-          return "advancedNetwork";
-        case "updateTab":
-          return "advancedUpdates";
-        case "encryptionTab":
-          return "advancedCerts";
-      }
-      // fall-through for unknown.
     default:
       return "unknown";
   }
 }
 
 function onHashChange() {
   gotoPref();
 }
@@ -191,17 +172,17 @@ function gotoPref(aCategory) {
   gLastHash = category;
   categories.selectedItem = item;
   window.history.replaceState(category, document.title);
   search(category, "data-category");
   let mainContent = document.querySelector(".main-content");
   mainContent.scrollTop = 0;
 
   Services.telemetry
-          .getHistogramById("FX_PREFERENCES_CATEGORY_OPENED")
+          .getHistogramById("FX_PREFERENCES_CATEGORY_OPENED_V2")
           .add(telemetryBucketForCategory(friendlyName));
 }
 
 function search(aQuery, aAttribute) {
   let mainPrefPane = document.getElementById("mainPrefPane");
   let elements = mainPrefPane.children;
   for (let element of elements) {
     let attributeValue = element.getAttribute(aAttribute);
old mode 100644
new mode 100755
--- a/browser/components/preferences/in-content/preferences.xul
+++ b/browser/components/preferences/in-content/preferences.xul
@@ -97,110 +97,77 @@
                     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-content"
-                    class="category"
-                    value="paneContent"
-                    helpTopic="prefs-content"
-                    tooltiptext="&paneContent.title;"
-                    align="center">
-        <image class="category-icon"/>
-        <label class="category-name" flex="1">&paneContent.title;</label>
-      </richlistitem>
-
       <richlistitem id="category-application"
                     class="category"
                     value="paneApplications"
                     helpTopic="prefs-applications"
-                    tooltiptext="&paneApplications.title;"
+                    tooltiptext="&paneDownloadLinks.title;"
                     align="center">
         <image class="category-icon"/>
-        <label class="category-name" flex="1">&paneApplications.title;</label>
-      </richlistitem>
-
-      <richlistitem id="category-privacy"
-                    class="category"
-                    value="panePrivacy"
-                    helpTopic="prefs-privacy"
-                    tooltiptext="&panePrivacy.title;"
-                    align="center">
-        <image class="category-icon"/>
-        <label class="category-name" flex="1">&panePrivacy.title;</label>
+        <label class="category-name" flex="1">&paneDownloadLinks.title;</label>
       </richlistitem>
 
       <richlistitem id="category-containers"
                     class="category"
                     value="paneContainers"
                     helpTopic="prefs-containers"
                     hidden="true"/>
 
-      <richlistitem id="category-security"
-                    class="category"
-                    value="paneSecurity"
-                    helpTopic="prefs-security"
-                    tooltiptext="&paneSecurity.title;"
-                    align="center">
-        <image class="category-icon"/>
-        <label class="category-name" flex="1">&paneSecurity.title;</label>
-      </richlistitem>
-
       <richlistitem id="category-sync"
                     class="category"
                     value="paneSync"
                     helpTopic="prefs-weave"
-                    tooltiptext="&paneSync.title;"
+                    tooltiptext="&paneSync1.title;"
                     align="center">
         <image class="category-icon"/>
-        <label class="category-name" flex="1">&paneSync.title;</label>
+        <label class="category-name" flex="1">&paneSync1.title;</label>
+      </richlistitem>
+
+      <richlistitem id="category-privacy"
+                    class="category"
+                    value="panePrivacy"
+                    helpTopic="prefs-privacy"
+                    tooltiptext="&panePrivacySecurity.title;"
+                    align="center">
+        <image class="category-icon"/>
+        <label class="category-name" flex="1">&panePrivacySecurity.title;</label>
       </richlistitem>
 
       <richlistitem id="category-advanced"
                     class="category"
                     value="paneAdvanced"
                     helpTopic="prefs-advanced-general"
-                    tooltiptext="&paneAdvanced.title;"
+                    tooltiptext="&paneUpdates.title;"
                     align="center">
         <image class="category-icon"/>
-        <label class="category-name" flex="1">&paneAdvanced.title;</label>
+        <label class="category-name" flex="1">&paneUpdates.title;</label>
       </richlistitem>
     </richlistbox>
 
     <keyset>
       <!-- Disable the findbar because it doesn't work properly.
            Remove this keyset once bug 1094240 ("disablefastfind" attribute
            broken in e10s mode) is fixed. -->
       <key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1" oncommand=";"/>
     </keyset>
 
     <vbox class="main-content" flex="1">
       <prefpane id="mainPrefPane">
 #include main.xul
-#include search.xul
 #include privacy.xul
 #include containers.xul
 #include advanced.xul
 #include applications.xul
-#include content.xul
-#include security.xul
 #include sync.xul
       </prefpane>
     </vbox>
 
   </hbox>
 
     <vbox id="dialogOverlay" align="center" pack="center">
       <groupbox id="dialogBox"
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -6,19 +6,38 @@
 
 Components.utils.import("resource://gre/modules/AppConstants.jsm");
 Components.utils.import("resource://gre/modules/PluralForm.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "ContextualIdentityService",
                                   "resource://gre/modules/ContextualIdentityService.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
                                   "resource://gre/modules/PluralForm.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
+                                  "resource://gre/modules/LoginHelper.jsm");
+
+Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
+
+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.
    */
@@ -175,16 +194,109 @@ var gPrivacyPane = {
     setEventListener("changeBlockList", "command",
                      gPrivacyPane.showBlockLists);
     setEventListener("changeBlockListPBM", "command",
                      gPrivacyPane.showBlockLists);
     setEventListener("browserContainersCheckbox", "command",
                      gPrivacyPane._checkBrowserContainers);
     setEventListener("browserContainersSettings", "command",
                      gPrivacyPane.showContainerSettings);
+    setEventListener("passwordExceptions", "command",
+      gPrivacyPane.showPasswordExceptions);
+    setEventListener("useMasterPassword", "command",
+      gPrivacyPane.updateMasterPasswordButton);
+    setEventListener("changeMasterPassword", "command",
+      gPrivacyPane.changeMasterPassword);
+    setEventListener("showPasswords", "command",
+      gPrivacyPane.showPasswords);
+    setEventListener("addonExceptions", "command",
+      gPrivacyPane.showAddonExceptions);
+    setEventListener("viewCertificatesButton", "command",
+                     gPrivacyPane.showCertificates);
+    setEventListener("viewSecurityDevicesButton", "command",
+                     gPrivacyPane.showSecurityDevices);
+    setEventListener("connectionSettings", "command",
+                     gPrivacyPane.showConnections);
+    setEventListener("clearCacheButton", "command",
+                     gPrivacyPane.clearCache);
+    setEventListener("clearOfflineAppCacheButton", "command",
+                     gPrivacyPane.clearOfflineAppCache);
+    setEventListener("offlineNotifyExceptions", "command",
+                     gPrivacyPane.showOfflineExceptions);
+    setEventListener("offlineAppsList", "select",
+                     gPrivacyPane.offlineAppSelected);
+
+    this._pane = document.getElementById("panePrivacy");
+    this._initMasterPasswordUI();
+    this._initSafeBrowsing();
+    this.updateOfflineApps();
+    this.updateCacheSizeInputField();
+    this.updateActualCacheSize();
+    this.updateActualAppCacheSize();
+
+    let bundlePrefs = document.getElementById("bundlePreferences");
+    document.getElementById("offlineAppsList")
+            .style.height = bundlePrefs.getString("offlineAppsList.height");
+    setEventListener("offlineAppsListRemove", "command",
+                     gPrivacyPane.removeOfflineApp);
+    setEventListener("notificationsPolicyButton", "command",
+      gPrivacyPane.showNotificationExceptions);
+    setEventListener("popupPolicyButton", "command",
+      gPrivacyPane.showPopupExceptions);
+    setEventListener("notificationsDoNotDisturb", "command",
+      gPrivacyPane.toggleDoNotDisturbNotifications);
+
+    if (AlertsServiceDND) {
+      let notificationsDoNotDisturbRow =
+        document.getElementById("notificationsDoNotDisturbRow");
+      notificationsDoNotDisturbRow.removeAttribute("hidden");
+      if (AlertsServiceDND.manualDoNotDisturb) {
+        let notificationsDoNotDisturb =
+          document.getElementById("notificationsDoNotDisturb");
+        notificationsDoNotDisturb.setAttribute("checked", true);
+        }
+    }
+
+    setEventListener("cacheSize", "change",
+                     gPrivacyPane.updateCacheSizePref);
+
+    if (Services.prefs.getBoolPref("browser.storageManager.enabled")) {
+      Services.obs.addObserver(this, "sitedatamanager:sites-updated", false);
+      let unload = () => {
+        window.removeEventListener("unload", unload);
+        Services.obs.removeObserver(this, "sitedatamanager:sites-updated");
+      };
+      window.addEventListener("unload", unload);
+      SiteDataManager.updateSites();
+      setEventListener("clearSiteDataButton", "command",
+                       gPrivacyPane.clearSiteData);
+      setEventListener("siteDataSettings", "command",
+                       gPrivacyPane.showSiteDataSettings);
+    }
+
+
+    let notificationInfoURL =
+      Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";
+    document.getElementById("notificationsPolicyLearnMore").setAttribute("href",
+                                                                         notificationInfoURL);
+
+    let drmInfoURL =
+      Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
+    document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
+    let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
+    // Force-disable/hide on WinXP:
+    if (navigator.platform.toLowerCase().startsWith("win")) {
+      emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
+    }
+    if (!emeUIEnabled) {
+      // Don't want to rely on .hidden for the toplevel groupbox because
+      // of the pane hiding/showing code potentially interfering:
+      document.getElementById("drmGroup").setAttribute("style", "display: none !important");
+    }
+
   },
 
   // TRACKING PROTECTION MODE
 
   /**
    * Selects the right item of the Tracking Protection radiogroup.
    */
   trackingProtectionReadPrefs() {
@@ -680,19 +792,640 @@ var gPrivacyPane = {
 
   /*
    * 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;
+   },
+
+  // NOTIFICATIONS
+
+  /**
+   * Displays the notifications exceptions dialog where specific site notification
+   * preferences can be set.
+   */
+  showNotificationExceptions() {
+    let bundlePreferences = document.getElementById("bundlePreferences");
+    let params = { permissionType: "desktop-notification" };
+    params.windowTitle = bundlePreferences.getString("notificationspermissionstitle");
+    params.introText = bundlePreferences.getString("notificationspermissionstext4");
+
+    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
+                    "resizable=yes", params);
+
+    try {
+      Services.telemetry
+              .getHistogramById("WEB_NOTIFICATION_EXCEPTIONS_OPENED").add();
+    } catch (e) {}
+  },
+
+
+  // POP-UPS
+
+  /**
+   * Displays the popup exceptions dialog where specific site popup preferences
+   * can be set.
+   */
+  showPopupExceptions() {
+    var bundlePreferences = document.getElementById("bundlePreferences");
+    var params = { blockVisible: false, sessionVisible: false, allowVisible: true,
+                   prefilledHost: "", permissionType: "popup" }
+    params.windowTitle = bundlePreferences.getString("popuppermissionstitle");
+    params.introText = bundlePreferences.getString("popuppermissionstext");
+
+    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
+                    "resizable=yes", params);
+  },
+
+   // UTILITY FUNCTIONS
+
+  /**
+   * Utility function to enable/disable the button specified by aButtonID based
+   * on the value of the Boolean preference specified by aPreferenceID.
+   */
+  updateButtons(aButtonID, aPreferenceID) {
+    var button = document.getElementById(aButtonID);
+    var preference = document.getElementById(aPreferenceID);
+    button.disabled = preference.value != true;
+    return undefined;
+  },
+
+  // BEGIN UI CODE
+
+  /*
+   * Preferences:
+   *
+   * dom.disable_open_during_load
+   * - true if popups are blocked by default, false otherwise
+   */
+
+  // POP-UPS
+
+  /**
+   * Displays a dialog in which the user can view and modify the list of sites
+   * where passwords are never saved.
+   */
+  showPasswordExceptions() {
+    var bundlePrefs = document.getElementById("bundlePreferences");
+    var params = {
+      blockVisible: true,
+      sessionVisible: false,
+      allowVisible: false,
+      hideStatusColumn: true,
+      prefilledHost: "",
+      permissionType: "login-saving",
+      windowTitle: bundlePrefs.getString("savedLoginsExceptions_title"),
+      introText: bundlePrefs.getString("savedLoginsExceptions_desc")
+    };
+
+    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
+                    null, params);
+  },
+
+  /**
+   * Initializes master password UI: the "use master password" checkbox, selects
+   * the master password button to show, and enables/disables it as necessary.
+   * The master password is controlled by various bits of NSS functionality, so
+   * the UI for it can't be controlled by the normal preference bindings.
+   */
+  _initMasterPasswordUI() {
+    var noMP = !LoginHelper.isMasterPasswordSet();
+
+    var button = document.getElementById("changeMasterPassword");
+    button.disabled = noMP;
+
+    var checkbox = document.getElementById("useMasterPassword");
+    checkbox.checked = !noMP;
+  },
+
+  /**
+   * Enables/disables the master password button depending on the state of the
+   * "use master password" checkbox, and prompts for master password removal if
+   * one is set.
+   */
+  updateMasterPasswordButton() {
+    var checkbox = document.getElementById("useMasterPassword");
+    var button = document.getElementById("changeMasterPassword");
+    button.disabled = !checkbox.checked;
+
+    // unchecking the checkbox should try to immediately remove the master
+    // password, because it's impossible to non-destructively remove the master
+    // password used to encrypt all the passwords without providing it (by
+    // design), and it would be extremely odd to pop up that dialog when the
+    // user closes the prefwindow and saves his settings
+    if (!checkbox.checked)
+      this._removeMasterPassword();
+    else
+      this.changeMasterPassword();
+
+    this._initMasterPasswordUI();
+  },
+
+
+  /**
+   * Displays a dialog in which the master password may be changed.
+   */
+  changeMasterPassword() {
+    gSubDialog.open("chrome://mozapps/content/preferences/changemp.xul",
+                    "resizable=no", null, this._initMasterPasswordUI.bind(this));
+  },
+
+    /**
+   * Shows the sites where the user has saved passwords and the associated login
+   * information.
+   */
+  showPasswords() {
+    gSubDialog.open("chrome://passwordmgr/content/passwordManager.xul");
+  },
+
+  /**
+   * Enables/disables the Exceptions button used to configure sites where
+   * passwords are never saved. When browser is set to start in Private
+   * Browsing mode, the "Remember passwords" UI is useless, so we disable it.
+   */
+  readSavePasswords() {
+    var pref = document.getElementById("signon.rememberSignons");
+    var excepts = document.getElementById("passwordExceptions");
+
+    if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
+      document.getElementById("savePasswords").disabled = true;
+      excepts.disabled = true;
+      return false;
+    }
+    excepts.disabled = !pref.value;
+    // don't override pref value in UI
+    return undefined;
+  },
+
+  /**
+   * Enables/disables the add-ons Exceptions button depending on whether
+   * or not add-on installation warnings are displayed.
+   */
+  readWarnAddonInstall() {
+    var warn = document.getElementById("xpinstall.whitelist.required");
+    var exceptions = document.getElementById("addonExceptions");
+
+    exceptions.disabled = !warn.value;
+
+    // don't override the preference value
+    return undefined;
+  },
+
+  _initSafeBrowsing() {
+    let enableSafeBrowsing = document.getElementById("enableSafeBrowsing");
+    let blockDownloads = document.getElementById("blockDownloads");
+    let blockUncommonUnwanted = document.getElementById("blockUncommonUnwanted");
+
+    let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
+    let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
+
+    let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
+    let malwareTable = document.getElementById("urlclassifier.malwareTable");
+
+    let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
+    let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
+
+    enableSafeBrowsing.addEventListener("command", function() {
+      safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
+      safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
+
+      if (enableSafeBrowsing.checked) {
+        blockDownloads.removeAttribute("disabled");
+        if (blockDownloads.checked) {
+          blockUncommonUnwanted.removeAttribute("disabled");
+        }
+      } else {
+        blockDownloads.setAttribute("disabled", "true");
+        blockUncommonUnwanted.setAttribute("disabled", "true");
+      }
+    });
+
+    blockDownloads.addEventListener("command", function() {
+      blockDownloadsPref.value = blockDownloads.checked;
+      if (blockDownloads.checked) {
+        blockUncommonUnwanted.removeAttribute("disabled");
+      } else {
+        blockUncommonUnwanted.setAttribute("disabled", "true");
+      }
+    });
+
+    blockUncommonUnwanted.addEventListener("command", function() {
+      blockUnwantedPref.value = blockUncommonUnwanted.checked;
+      blockUncommonPref.value = blockUncommonUnwanted.checked;
+
+      let malware = malwareTable.value
+        .split(",")
+        .filter(x => x !== "goog-unwanted-shavar" && x !== "test-unwanted-simple");
+
+      if (blockUncommonUnwanted.checked) {
+        malware.push("goog-unwanted-shavar");
+        malware.push("test-unwanted-simple");
+      }
+
+      // sort alphabetically to keep the pref consistent
+      malware.sort();
+
+      malwareTable.value = malware.join(",");
+    });
+
+    // set initial values
+
+    enableSafeBrowsing.checked = safeBrowsingPhishingPref.value && safeBrowsingMalwarePref.value;
+    if (!enableSafeBrowsing.checked) {
+      blockDownloads.setAttribute("disabled", "true");
+      blockUncommonUnwanted.setAttribute("disabled", "true");
+    }
+
+    blockDownloads.checked = blockDownloadsPref.value;
+    if (!blockDownloadsPref.value) {
+      blockUncommonUnwanted.setAttribute("disabled", "true");
+    }
+
+    blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
+  },
+
+  /**
+   * Displays the exceptions lists for add-on installation warnings.
+   */
+  showAddonExceptions() {
+    var bundlePrefs = document.getElementById("bundlePreferences");
+
+    var params = this._addonParams;
+    if (!params.windowTitle || !params.introText) {
+      params.windowTitle = bundlePrefs.getString("addons_permissions_title");
+      params.introText = bundlePrefs.getString("addonspermissionstext");
+    }
+
+    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
+                    null, params);
+  },
+
+  /**
+   * Parameters for the add-on install permissions dialog.
+   */
+  _addonParams:
+    {
+      blockVisible: false,
+      sessionVisible: false,
+      allowVisible: true,
+      prefilledHost: "",
+      permissionType: "install"
+    },
+
+
+  /**
+   * security.OCSP.enabled is an integer value for legacy reasons.
+   * A value of 1 means OCSP is enabled. Any other value means it is disabled.
+   */
+  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 == 1;
+  },
+
+  /**
+   * See documentation for readEnableOCSP.
+   */
+  writeEnableOCSP() {
+    var checkbox = document.getElementById("enableOCSP");
+    return checkbox.checked ? 1 : 0;
+  },
+
+  /**
+   * Displays the user's certificates and associated options.
+   */
+  showCertificates() {
+    gSubDialog.open("chrome://pippki/content/certManager.xul");
+  },
+
+  /**
+   * Displays a dialog from which the user can manage his security devices.
+   */
+  showSecurityDevices() {
+    gSubDialog.open("chrome://pippki/content/device_manager.xul");
+  },
+
+  // NETWORK
+  /**
+   * Displays a dialog in which proxy settings may be changed.
+   */
+  showConnections() {
+    gSubDialog.open("chrome://browser/content/preferences/connection.xul");
+  },
+
+  /**
+   * Clears the cache.
+   */
+  clearCache() {
+    try {
+      var cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
+                            .getService(Components.interfaces.nsICacheStorageService);
+      cache.clear();
+    } catch (ex) {}
+    this.updateActualCacheSize();
+  },
+
+  /**
+   * Clears the application cache.
+   */
+  clearOfflineAppCache() {
+    Components.utils.import("resource:///modules/offlineAppCache.jsm");
+    OfflineAppCacheHelper.clear();
+
+    this.updateActualAppCacheSize();
+    this.updateOfflineApps();
+  },
+
+  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");
+  },
+
+  updateTotalSiteDataSize() {
+    SiteDataManager.getTotalUsage()
+      .then(usage => {
+        let size = DownloadUtils.convertByteUnits(usage);
+        let prefStrBundle = document.getElementById("bundlePreferences");
+        let totalSiteDataSizeLabel = document.getElementById("totalSiteDataSize");
+        totalSiteDataSizeLabel.textContent = prefStrBundle.getFormattedString("totalSiteDataSize", size);
+        let siteDataGroup = document.getElementById("siteDataGroup");
+        siteDataGroup.hidden = false;
+      });
+  },
+
+  // Retrieves the amount of space currently used by disk cache
+  updateActualCacheSize() {
+    var actualSizeLabel = document.getElementById("actualDiskCacheSize");
+    var prefStrBundle = document.getElementById("bundlePreferences");
+
+    // Needs to root the observer since cache service keeps only a weak reference.
+    this.observer = {
+      onNetworkCacheDiskConsumption(consumption) {
+        var size = DownloadUtils.convertByteUnits(consumption);
+        // The XBL binding for the string bundle may have been destroyed if
+        // the page was closed before this callback was executed.
+        if (!prefStrBundle.getFormattedString) {
+          return;
+        }
+        actualSizeLabel.value = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
+      },
+
+      QueryInterface: XPCOMUtils.generateQI([
+        Components.interfaces.nsICacheStorageConsumptionObserver,
+        Components.interfaces.nsISupportsWeakReference
+      ])
+    };
+
+    actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
+
+    try {
+      var cacheService =
+        Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
+                  .getService(Components.interfaces.nsICacheStorageService);
+      cacheService.asyncGetDiskConsumption(this.observer);
+    } catch (e) {}
+  },
+
+  // Retrieves the amount of space currently used by offline cache
+  updateActualAppCacheSize() {
+    var visitor = {
+      onCacheStorageInfo(aEntryCount, aConsumption, aCapacity, aDiskDirectory) {
+        var actualSizeLabel = document.getElementById("actualAppCacheSize");
+        var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
+        var prefStrBundle = document.getElementById("bundlePreferences");
+        // The XBL binding for the string bundle may have been destroyed if
+        // the page was closed before this callback was executed.
+        if (!prefStrBundle.getFormattedString) {
+          return;
+        }
+        var sizeStr = prefStrBundle.getFormattedString("actualAppCacheSize", sizeStrings);
+        actualSizeLabel.value = sizeStr;
+      }
+    };
+
+    try {
+      var cacheService =
+        Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
+                  .getService(Components.interfaces.nsICacheStorageService);
+      var storage = cacheService.appCacheStorage(LoadContextInfo.default, null);
+      storage.asyncVisitStorage(visitor, false);
+    } catch (e) {}
+  },
+
+  updateCacheSizeUI(smartSizeEnabled) {
+    document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
+    document.getElementById("cacheSize").disabled = smartSizeEnabled;
+    document.getElementById("useCacheAfter").disabled = smartSizeEnabled;
+  },
+
+  readSmartSizeEnabled() {
+    // The smart_size.enabled preference element is inverted="true", so its
+    // value is the opposite of the actual pref value
+    var disabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
+    this.updateCacheSizeUI(!disabled);
+  },
+
+  /**
+   * Converts the cache size from units of KB to units of MB and stores it in
+   * the textbox element.
+   */
+  updateCacheSizeInputField() {
+    let cacheSizeElem = document.getElementById("cacheSize");
+    let cachePref = document.getElementById("browser.cache.disk.capacity");
+    cacheSizeElem.value = cachePref.value / 1024;
+    if (cachePref.locked)
+      cacheSizeElem.disabled = true;
+  },
+
+  /**
+   * Updates the cache size preference once user enters a new value.
+   * We intentionally do not set preference="browser.cache.disk.capacity"
+   * onto the textbox directly, as that would update the pref at each keypress
+   * not only after the final value is entered.
+   */
+  updateCacheSizePref() {
+    let cacheSizeElem = document.getElementById("cacheSize");
+    let cachePref = document.getElementById("browser.cache.disk.capacity");
+    // Converts the cache size as specified in UI (in MB) to KB.
+    let intValue = parseInt(cacheSizeElem.value, 10);
+    cachePref.value = isNaN(intValue) ? 0 : intValue * 1024;
+  },
+
+  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();
+    }
+  },
+
+  readOfflineNotify() {
+    var pref = document.getElementById("browser.offline-apps.notify");
+    var button = document.getElementById("offlineNotifyExceptions");
+    button.disabled = !pref.value;
+    return pref.value;
+  },
+
+  // XXX: duplicated in browser.js
+  _getOfflineAppUsage(perm, groups) {
+    let cacheService = Cc["@mozilla.org/network/application-cache-service;1"].
+                       getService(Ci.nsIApplicationCacheService);
+    if (!groups) {
+      try {
+        groups = cacheService.getGroups();
+      } catch (ex) {
+        return 0;
+      }
+    }
+
+    let usage = 0;
+    for (let group of groups) {
+      let uri = Services.io.newURI(group);
+      if (perm.matchesURI(uri, true)) {
+        let cache = cacheService.getActiveCache(group);
+        usage += cache.usage;
+      }
+    }
+
+    return usage;
+  },
+
+  /**
+   * Updates the list of offline applications
+   */
+  updateOfflineApps() {
+    var pm = Components.classes["@mozilla.org/permissionmanager;1"]
+                       .getService(Components.interfaces.nsIPermissionManager);
+
+    var list = document.getElementById("offlineAppsList");
+    while (list.firstChild) {
+      list.removeChild(list.firstChild);
+    }
+
+    var groups;
+    try {
+      var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
+                         getService(Components.interfaces.nsIApplicationCacheService);
+      groups = cacheService.getGroups();
+    } catch (e) {
+      return;
+    }
+
+    var bundle = document.getElementById("bundlePreferences");
+
+    var enumerator = pm.enumerator;
+    while (enumerator.hasMoreElements()) {
+      var perm = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
+      if (perm.type == "offline-app" &&
+          perm.capability != Components.interfaces.nsIPermissionManager.DEFAULT_ACTION &&
+          perm.capability != Components.interfaces.nsIPermissionManager.DENY_ACTION) {
+        var row = document.createElement("listitem");
+        row.id = "";
+        row.className = "offlineapp";
+        row.setAttribute("origin", perm.principal.origin);
+        var converted = DownloadUtils.
+                        convertByteUnits(this._getOfflineAppUsage(perm, groups));
+        row.setAttribute("usage",
+                         bundle.getFormattedString("offlineAppUsage",
+                                                   converted));
+        list.appendChild(row);
+      }
+    }
+  },
+
+  removeOfflineApp() {
+    var list = document.getElementById("offlineAppsList");
+    var item = list.selectedItem;
+    var origin = item.getAttribute("origin");
+    var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
+
+    var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+                            .getService(Components.interfaces.nsIPromptService);
+    var flags = prompts.BUTTON_TITLE_IS_STRING * prompts.BUTTON_POS_0 +
+                prompts.BUTTON_TITLE_CANCEL * prompts.BUTTON_POS_1;
+
+    var bundle = document.getElementById("bundlePreferences");
+    var title = bundle.getString("offlineAppRemoveTitle");
+    var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
+    var confirm = bundle.getString("offlineAppRemoveConfirm");
+    var result = prompts.confirmEx(window, title, prompt, flags, confirm,
+                                   null, null, null, {});
+    if (result != 0)
+      return;
+
+    // get the permission
+    var pm = Components.classes["@mozilla.org/permissionmanager;1"]
+                       .getService(Components.interfaces.nsIPermissionManager);
+    var perm = pm.getPermissionObject(principal, "offline-app", true);
+    if (perm) {
+      // clear offline cache entries
+      try {
+        var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
+                           getService(Components.interfaces.nsIApplicationCacheService);
+        var groups = cacheService.getGroups();
+        for (var i = 0; i < groups.length; i++) {
+          var uri = Services.io.newURI(groups[i]);
+          if (perm.matchesURI(uri, true)) {
+            var cache = cacheService.getActiveCache(groups[i]);
+            cache.discard();
+          }
+        }
+      } catch (e) {}
+
+      pm.removePermission(perm);
+    }
+    list.removeChild(item);
+    gPrivacyPane.offlineAppSelected();
+    this.updateActualAppCacheSize();
+  },
 
 };
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -71,82 +71,106 @@
               type="bool"/>
   <preference id="privacy.sanitize.timeSpan"
               name="privacy.sanitize.timeSpan"
               type="int"/>
   <!-- Private Browsing -->
   <preference id="browser.privatebrowsing.autostart"
               name="browser.privatebrowsing.autostart"
               type="bool"/>
+
+  <!-- DRM content -->
+  <preference id="media.eme.enabled"
+              name="media.eme.enabled"
+              type="bool"/>
+
+  <!-- Popups -->
+  <preference id="dom.disable_open_during_load"
+              name="dom.disable_open_during_load"
+              type="bool"/>
+  <!-- Passwords -->
+  <preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
+
+  <!-- XXX buttons -->
+  <preference id="pref.privacy.disable_button.view_passwords"
+              name="pref.privacy.disable_button.view_passwords"
+              type="bool"/>
+  <preference id="pref.privacy.disable_button.view_passwords_exceptions"
+              name="pref.privacy.disable_button.view_passwords_exceptions"
+              type="bool"/>
+
+  <!-- Certificates tab -->
+  <preference id="security.default_personal_cert"
+              name="security.default_personal_cert"
+              type="string"/>
+
+  <preference id="security.disable_button.openCertManager"
+              name="security.disable_button.openCertManager"
+              type="bool"/>
+
+  <preference id="security.disable_button.openDeviceManager"
+              name="security.disable_button.openDeviceManager"
+              type="bool"/>
+
+  <preference id="security.OCSP.enabled"
+              name="security.OCSP.enabled"
+              type="int"/>
+
+  <!-- Add-ons, malware, phishing -->
+  <preference id="xpinstall.whitelist.required"
+              name="xpinstall.whitelist.required"
+              type="bool"/>
+
+  <preference id="browser.safebrowsing.malware.enabled"
+              name="browser.safebrowsing.malware.enabled"
+              type="bool"/>
+  <preference id="browser.safebrowsing.phishing.enabled"
+              name="browser.safebrowsing.phishing.enabled"
+              type="bool"/>
+
+  <preference id="browser.safebrowsing.downloads.enabled"
+              name="browser.safebrowsing.downloads.enabled"
+              type="bool"/>
+
+  <preference id="urlclassifier.malwareTable"
+              name="urlclassifier.malwareTable"
+              type="string"/>
+
+  <preference id="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
+              name="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
+              type="bool"/>
+  <preference id="browser.safebrowsing.downloads.remote.block_uncommon"
+              name="browser.safebrowsing.downloads.remote.block_uncommon"
+              type="bool"/>
+
+   <!-- Network tab -->
+  <preference id="browser.cache.disk.capacity"
+              name="browser.cache.disk.capacity"
+              type="int"/>
+  <preference id="browser.offline-apps.notify"
+              name="browser.offline-apps.notify"
+              type="bool"/>
+
+  <preference id="browser.cache.disk.smart_size.enabled"
+              name="browser.cache.disk.smart_size.enabled"
+              inverted="true"
+              type="bool"/>
+
 </preferences>
 
+<stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
+
 <hbox id="header-privacy"
       class="header"
       hidden="true"
       data-category="panePrivacy">
-  <label class="header-name" flex="1">&panePrivacy.title;</label>
+  <label class="header-name" flex="1">&panePrivacySecurity.title;</label>
   <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
 </hbox>
 
-<!-- Tracking -->
-<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
-  <vbox id="trackingprotectionbox" hidden="true">
-    <hbox align="start">
-      <vbox>
-        <caption><label>&trackingProtectionHeader.label;
-          <label id="trackingProtectionLearnMore" class="learnMore text-link"
-                 value="&trackingProtectionLearnMore.label;"/>
-        </label></caption>
-        <radiogroup id="trackingProtectionRadioGroup">
-          <radio value="always"
-                 label="&trackingProtectionAlways.label;"
-                 accesskey="&trackingProtectionAlways.accesskey;"/>
-          <radio value="private"
-                 label="&trackingProtectionPrivate.label;"
-                 accesskey="&trackingProtectionPrivate.accesskey;"/>
-          <radio value="never"
-                 label="&trackingProtectionNever.label;"
-                 accesskey="&trackingProtectionNever.accesskey;"/>
-        </radiogroup>
-      </vbox>
-      <spacer flex="1" />
-      <vbox>
-        <button id="trackingProtectionExceptions"
-                label="&trackingProtectionExceptions.label;"
-                accesskey="&trackingProtectionExceptions.accesskey;"
-                preference="pref.privacy.disable_button.tracking_protection_exceptions"/>
-        <button id="changeBlockList"
-                label="&changeBlockList.label;"
-                accesskey="&changeBlockList.accesskey;"
-                preference="pref.privacy.disable_button.change_blocklist"/>
-      </vbox>
-    </hbox>
-  </vbox>
-  <vbox id="trackingprotectionpbmbox">
-    <caption><label>&tracking.label;</label></caption>
-    <hbox align="center">
-      <checkbox id="trackingProtectionPBM"
-                preference="privacy.trackingprotection.pbmode.enabled"
-                accesskey="&trackingProtectionPBM5.accesskey;"
-                label="&trackingProtectionPBM5.label;" />
-      <label id="trackingProtectionPBMLearnMore"
-             class="learnMore text-link"
-             value="&trackingProtectionPBMLearnMore.label;"/>
-      <spacer flex="1" />
-      <button id="changeBlockListPBM"
-              label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
-              preference="pref.privacy.disable_button.change_blocklist"/>
-    </hbox>
-  </vbox>
-  <vbox>
-    <description>&doNotTrack.pre.label;<label
-    class="text-link" id="doNotTrackSettings"
-    >&doNotTrack.settings.label;</label>&doNotTrack.post.label;</description>
-  </vbox>
-</groupbox>
 
 <!-- History -->
 <groupbox id="historyGroup" data-category="panePrivacy" hidden="true">
   <caption><label>&history.label;</label></caption>
   <hbox align="center">
     <label id="historyModeLabel"
            control="historyMode"
            accesskey="&historyHeader.pre.accesskey;">&historyHeader.pre.label;
@@ -260,36 +284,293 @@
                     accesskey="&clearOnCloseSettings.accesskey;"/>
           </hbox>
         </vbox>
       </vbox>
     </vbox>
   </deck>
 </groupbox>
 
+
+<!-- Passwords -->
+<groupbox id="passwordsGroup" orient="vertical" data-category="panePrivacy" hidden="true">
+  <caption><label>&formsAndPasswords.label;</label></caption>
+
+  <hbox id="savePasswordsBox">
+    <checkbox id="savePasswords"
+              label="&rememberLogins1.label;" accesskey="&rememberLogins.accesskey;"
+              preference="signon.rememberSignons"
+              onsyncfrompreference="return gPrivacyPane.readSavePasswords();"/>
+    <spacer flex="1"/>
+    <button id="passwordExceptions"
+            label="&passwordExceptions.label;"
+            accesskey="&passwordExceptions.accesskey;"
+            preference="pref.privacy.disable_button.view_passwords_exceptions"/>
+  </hbox>
+  <grid id="passwordGrid">
+    <columns>
+      <column flex="1"/>
+      <column/>
+    </columns>
+    <rows id="passwordRows">
+      <row id="masterPasswordRow">
+        <hbox id="masterPasswordBox">
+          <checkbox id="useMasterPassword"
+                    label="&useMasterPassword.label;"
+                    accesskey="&useMasterPassword.accesskey;"/>
+          <spacer flex="1"/>
+        </hbox>
+        <button id="changeMasterPassword"
+                label="&changeMasterPassword.label;"
+                accesskey="&changeMasterPassword.accesskey;"/>
+      </row>
+      <row id="showPasswordRow">
+        <hbox id="showPasswordsBox"/>
+        <button id="showPasswords"
+                label="&savedLogins.label;" accesskey="&savedLogins.accesskey;"
+                preference="pref.privacy.disable_button.view_passwords"/>
+      </row>
+    </rows>
+  </grid>
+</groupbox>
+
+<!-- Tracking -->
+<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
+  <vbox id="trackingprotectionbox" hidden="true">
+    <hbox align="start">
+      <vbox hidden="false">
+        <caption><label>&trackingProtectionHeader.label;
+          <label id="trackingProtectionLearnMore" class="learnMore text-link"
+                 value="&trackingProtectionLearnMore.label;"/>
+        </label></caption>
+        <radiogroup id="trackingProtectionRadioGroup">
+          <radio value="always"
+                 label="&trackingProtectionAlways.label;"
+                 accesskey="&trackingProtectionAlways.accesskey;"/>
+          <radio value="private"
+                 label="&trackingProtectionPrivate.label;"
+                 accesskey="&trackingProtectionPrivate.accesskey;"/>
+          <radio value="never"
+                 label="&trackingProtectionNever.label;"
+                 accesskey="&trackingProtectionNever.accesskey;"/>
+        </radiogroup>
+      </vbox>
+      <spacer flex="1" />
+      <vbox hidden="true">
+        <button id="trackingProtectionExceptions"
+                label="&trackingProtectionExceptions.label;"
+                accesskey="&trackingProtectionExceptions.accesskey;"
+                preference="pref.privacy.disable_button.tracking_protection_exceptions"/>
+        <button id="changeBlockList"
+                label="&changeBlockList.label;"
+                accesskey="&changeBlockList.accesskey;"
+                preference="pref.privacy.disable_button.change_blocklist"/>
+      </vbox>
+    </hbox>
+  </vbox>
+  <vbox id="trackingprotectionpbmbox">
+    <caption><label>&tracking.label;</label></caption>
+    <hbox align="center">
+      <checkbox id="trackingProtectionPBM"
+                preference="privacy.trackingprotection.pbmode.enabled"
+                accesskey="&trackingProtectionPBM5.accesskey;"
+                label="&trackingProtectionPBM6.label;" />
+      <label id="trackingProtectionPBMLearnMore"
+             class="learnMore text-link"
+             value="&trackingProtectionPBMLearnMore.label;"/>
+      <spacer flex="1" />
+      <button id="changeBlockListPBM"
+              label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
+              preference="pref.privacy.disable_button.change_blocklist"/>
+    </hbox>
+  </vbox>
+  <vbox hidden="false">
+    <description>&doNotTrack.pre.label;<label
+    class="text-link" id="doNotTrackSettings"
+    >&doNotTrack.settings.label;</label>&doNotTrack.post.label;</description>
+  </vbox>
+</groupbox>
+
+
+  <!-- Pop-ups -->
+<groupbox id="miscGroup" data-category="panePrivacy" hidden="true">
+  <caption><label>&popups.label;</label></caption>
+  <grid id="contentGrid">
+    <columns>
+      <column flex="1"/>
+      <column/>
+    </columns>
+    <rows id="contentRows-1">
+      <row id="popupPolicyRow">
+        <vbox align="start">
+          <checkbox id="popupPolicy" preference="dom.disable_open_during_load"
+                    label="&blockPopups.label;" accesskey="&blockPopups.accesskey;"
+                    onsyncfrompreference="return gPrivacyPane.updateButtons('popupPolicyButton',
+                                                                        'dom.disable_open_during_load');"/>
+        </vbox>
+        <hbox pack="end">
+          <button id="popupPolicyButton" label="&popupExceptions.label;"
+                  accesskey="&popupExceptions.accesskey;"/>
+        </hbox>
+      </row>
+    </rows>
+  </grid>
+</groupbox>
+
+  <!-- Notifications -->
+<groupbox id="notificationsGroup" data-category="panePrivacy" hidden="true">
+  <caption><label>&notificationsPolicy.label;</label></caption>
+  <grid>
+    <columns>
+      <column flex="1"/>
+      <column/>
+    </columns>
+    <rows>
+      <row id="notificationsPolicyRow" align="center">
+        <hbox align="start">
+          <label id="notificationsPolicy">&notificationsPolicyDesc3.label;</label>
+          <label id="notificationsPolicyLearnMore"
+                 class="learnMore text-link"
+                 value="&notificationsPolicyLearnMore.label;"/>
+        </hbox>
+        <hbox pack="end">
+          <button id="notificationsPolicyButton" label="&notificationsPolicyButton.label;"
+                  accesskey="&notificationsPolicyButton.accesskey;"/>
+        </hbox>
+      </row>
+      <row id="notificationsDoNotDisturbRow" hidden="true">
+        <vbox align="start">
+          <checkbox id="notificationsDoNotDisturb" label="&notificationsDoNotDisturb.label;"
+                    accesskey="&notificationsDoNotDisturb.accesskey;"/>
+          <label id="notificationsDoNotDisturbDetails"
+                 class="indent"
+                 value="&notificationsDoNotDisturbDetails.value;"/>
+        </vbox>
+      </row>
+    </rows>
+  </grid>
+</groupbox>
+
+
 <!-- Location Bar -->
 <groupbox id="locationBarGroup"
           data-category="panePrivacy"
           hidden="true">
   <caption><label>&locationBar.label;</label></caption>
   <label id="locationBarSuggestionLabel">&locbar.suggest.label;</label>
   <checkbox id="historySuggestion" label="&locbar.history.label;"
             accesskey="&locbar.history.accesskey;"
             preference="browser.urlbar.suggest.history"/>
   <checkbox id="bookmarkSuggestion" label="&locbar.bookmarks.label;"
             accesskey="&locbar.bookmarks.accesskey;"
             preference="browser.urlbar.suggest.bookmark"/>
   <checkbox id="openpageSuggestion" label="&locbar.openpage.label;"
             accesskey="&locbar.openpage.accesskey;"
             preference="browser.urlbar.suggest.openpage"/>
-  <label class="text-link" onclick="gotoPref('search')">
+  <label class="text-link" onclick="gotoPref('general')">
     &suggestionSettings.label;
   </label>
 </groupbox>
 
+<!-- addons, forgery (phishing) UI Security -->
+<groupbox id="addonsPhishingGroup" data-category="panePrivacy" hidden="true">
+  <caption><label>&security.label;</label></caption>
+
+  <hbox id="addonInstallBox">
+    <checkbox id="warnAddonInstall"
+              label="&warnOnAddonInstall.label;"
+              accesskey="&warnOnAddonInstall.accesskey;"
+              preference="xpinstall.whitelist.required"
+              onsyncfrompreference="return gPrivacyPane.readWarnAddonInstall();"/>
+    <spacer flex="1"/>
+    <button id="addonExceptions"
+            label="&addonExceptions.label;"
+            accesskey="&addonExceptions.accesskey;"/>
+  </hbox>
+
+  <separator class="thin"/>
+  <vbox align="start">
+    <checkbox id="enableSafeBrowsing"
+              label="&enableSafeBrowsing.label;"
+              accesskey="&enableSafeBrowsing.accesskey;" />
+    <vbox class="indent">
+      <checkbox id="blockDownloads"
+                label="&blockDownloads.label;"
+                accesskey="&blockDownloads.accesskey;" />
+      <checkbox id="blockUncommonUnwanted"
+                label="&blockUncommonAndUnwanted.label;"
+                accesskey="&blockUncommonAndUnwanted.accesskey;" />
+    </vbox>
+  </vbox>
+</groupbox>
+
+<!-- Certificates -->
+<groupbox id="certSelection" align="start" data-category="panePrivacy" hidden="true">
+  <caption><label>&certPersonal.label;</label></caption>
+  <!--<description id="CertSelectionDesc" control="certSelection">&certPersonal.description;</description>-->
+
+  <!--
+    The values on these radio buttons may look like l10n issues, but
+    they're not - this preference uses *those strings* as its values.
+    I KID YOU NOT.
+  -->
+  <radiogroup id="certSelection"
+              preftype="string"
+              preference="security.default_personal_cert"
+              aria-labelledby="CertSelectionDesc">
+    <radio label="&selectCerts.auto;"
+            accesskey="&selectCerts.auto.accesskey;"
+            value="Select Automatically"/>
+    <radio label="&selectCerts.ask;"
+            accesskey="&selectCerts.ask.accesskey;"
+            value="Ask Every Time"/>
+  </radiogroup>
+  <checkbox id="enableOCSP"
+            label="&enableOCSP.label;"
+            accesskey="&enableOCSP.accesskey;"
+            onsyncfrompreference="return gPrivacyPane.readEnableOCSP();"
+            onsynctopreference="return gPrivacyPane.writeEnableOCSP();"
+            preference="security.OCSP.enabled"/>
+  <separator/>
+  <hbox>
+    <button id="viewCertificatesButton"
+            flex="1"
+            label="&viewCerts.label;"
+            accesskey="&viewCerts.accesskey;"
+            preference="security.disable_button.openCertManager"/>
+    <button id="viewSecurityDevicesButton"
+            flex="1"
+            label="&viewSecurityDevices.label;"
+            accesskey="&viewSecurityDevices.accesskey;"
+            preference="security.disable_button.openDeviceManager"/>
+    <hbox flex="10"/>
+  </hbox>
+</groupbox>
+
+<!-- DRM Content -->
+<groupbox id="drmGroup" data-category="panePrivacy" hidden="true">
+  <caption><label>&drmContent.label;</label></caption>
+  <grid id="contentGrid2">
+    <columns>
+      <column flex="1"/>
+      <column/>
+    </columns>
+    <rows id="contentRows-2">
+      <row id="playDRMContentRow">
+        <hbox align="center">
+          <checkbox id="playDRMContent" preference="media.eme.enabled"
+                    label="&playDRMContent.label;" accesskey="&playDRMContent.accesskey;"/>
+          <label id="playDRMContentLink" class="learnMore text-link" value="&playDRMContent.learnMore.label;"/>
+        </hbox>
+      </row>
+    </rows>
+  </grid>
+</groupbox>
+
+
 <!-- Containers -->
 <groupbox id="browserContainersGroup" data-category="panePrivacy" hidden="true">
   <vbox id="browserContainersbox" hidden="true">
     <caption><label>&browserContainersHeader.label;
       <label id="browserContainersLearnMore" class="learnMore text-link"
              value="&browserContainersLearnMore.label;"/>
     </label></caption>
     <hbox align="start">
@@ -304,8 +585,99 @@
       <vbox>
         <button id="browserContainersSettings"
                 label="&browserContainersSettings.label;"
                 accesskey="&browserContainersSettings.accesskey;"/>
       </vbox>
     </hbox>
   </vbox>
 </groupbox>
+
+<!-- Network -->
+<!-- Connection -->
+<groupbox id="connectionGroup" data-category="panePrivacy" hidden="true">
+  <caption><label>&connection.label;</label></caption>
+
+  <hbox align="center">
+    <description flex="1" control="connectionSettings">&connectionDesc.label;</description>
+    <button id="connectionSettings" icon="network" label="&connectionSettings.label;"
+            accesskey="&connectionSettings.accesskey;"/>
+  </hbox>
+</groupbox>
+
+<!-- Cache -->
+<groupbox id="cacheGroup" data-category="panePrivacy" hidden="true">
+  <caption><label>&httpCache.label;</label></caption>
+
+  <hbox align="center">
+    <label id="actualDiskCacheSize" flex="1"/>
+    <button id="clearCacheButton" icon="clear"
+            label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"/>
+  </hbox>
+  <hbox>
+    <checkbox preference="browser.cache.disk.smart_size.enabled"
+              id="allowSmartSize"
+              onsyncfrompreference="return gPrivacyPane.readSmartSizeEnabled();"
+              label="&overrideSmartCacheSize.label;"
+              accesskey="&overrideSmartCacheSize.accesskey;"/>
+  </hbox>
+  <hbox align="center" class="indent">
+    <label id="useCacheBefore" control="cacheSize"
+            accesskey="&limitCacheSizeBefore.accesskey;">
+      &limitCacheSizeBefore.label;
+    </label>
+    <textbox id="cacheSize" type="number" size="4" max="1024"
+              aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
+    <label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
+  </hbox>
+</groupbox>
+
+<!-- Offline apps -->
+<groupbox id="offlineGroup" data-category="panePrivacy" hidden="true" >
+  <caption><label>&offlineStorage2.label;</label></caption>
+
+  <hbox align="center">
+    <label id="actualAppCacheSize" flex="1"/>
+    <button id="clearOfflineAppCacheButton" icon="clear"
+            label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"/>
+  </hbox>
+  <hbox align="center">
+    <checkbox id="offlineNotify"
+              label="&offlineStorageNotify.label;" accesskey="&offlineStorageNotify.accesskey;"
+              preference="browser.offline-apps.notify"
+              onsyncfrompreference="return gPrivacyPane.readOfflineNotify();"/>
+    <spacer flex="1"/>
+    <button id="offlineNotifyExceptions"
+            label="&offlineStorageNotifyExceptions.label;"
+            accesskey="&offlineStorageNotifyExceptions.accesskey;"/>
+  </hbox>
+  <hbox>
+    <vbox flex="1">
+      <label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
+      <listbox id="offlineAppsList"
+              flex="1"
+              aria-labelledby="offlineAppsListLabel">
+      </listbox>
+    </vbox>
+    <vbox pack="end">
+      <button id="offlineAppsListRemove"
+              disabled="true"
+              label="&offlineAppsListRemove.label;"
+              accesskey="&offlineAppsListRemove.accesskey;"/>
+    </vbox>
+  </hbox>
+</groupbox>
+
+<!-- Site Data -->
+<groupbox id="siteDataGroup" hidden="true" data-category="panePrivacy">
+  <caption><label>&siteData.label;</label></caption>
+
+  <hbox align="center">
+    <label id="totalSiteDataSize" flex="1"></label>
+    <button id="clearSiteDataButton" icon="clear"
+            label="&clearSiteData.label;" accesskey="&clearSiteData.accesskey;"/>
+  </hbox>
+  <vbox align="end">
+    <button id="siteDataSettings"
+            label="&siteDataSettings.label;"
+            accesskey="&siteDataSettings.accesskey;"/>
+  </vbox>
+</groupbox>
deleted file mode 100644
--- a/browser/components/preferences/in-content/search.js
+++ /dev/null
@@ -1,604 +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/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
-                                  "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
-                                  "resource://gre/modules/Task.jsm");
-
-const ENGINE_FLAVOR = "text/x-moz-search-engine";
-
-var gEngineView = null;
-
-var gSearchPane = {
-
-  /**
-   * Initialize autocomplete to ensure prefs are in sync.
-   */
-  _initAutocomplete() {
-    Components.classes["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
-              .getService(Components.interfaces.mozIPlacesAutoComplete);
-  },
-
-  init() {
-    gEngineView = new EngineView(new EngineStore());
-    document.getElementById("engineList").view = gEngineView;
-    this.buildDefaultEngineDropDown();
-
-    let addEnginesLink = document.getElementById("addEngines");
-    let searchEnginesURL = Services.wm.getMostRecentWindow("navigator:browser")
-                                      .BrowserSearch.searchEnginesURL;
-    addEnginesLink.setAttribute("href", searchEnginesURL);
-
-    window.addEventListener("click", this);
-    window.addEventListener("command", this);
-    window.addEventListener("dragstart", this);
-    window.addEventListener("keypress", this);
-    window.addEventListener("select", this);
-    window.addEventListener("blur", this, true);
-
-    Services.obs.addObserver(this, "browser-search-engine-modified", false);
-    window.addEventListener("unload", () => {
-      Services.obs.removeObserver(this, "browser-search-engine-modified");
-    });
-
-    this._initAutocomplete();
-
-    let suggestsPref =
-      document.getElementById("browser.search.suggest.enabled");
-    suggestsPref.addEventListener("change", () => {
-      this.updateSuggestsCheckbox();
-    });
-    this.updateSuggestsCheckbox();
-  },
-
-  updateSuggestsCheckbox() {
-    let suggestsPref =
-      document.getElementById("browser.search.suggest.enabled");
-    let permanentPB =
-      Services.prefs.getBoolPref("browser.privatebrowsing.autostart");
-    let urlbarSuggests = document.getElementById("urlBarSuggestion");
-    urlbarSuggests.disabled = !suggestsPref.value || permanentPB;
-
-    let urlbarSuggestsPref =
-      document.getElementById("browser.urlbar.suggest.searches");
-    urlbarSuggests.checked = urlbarSuggestsPref.value;
-    if (urlbarSuggests.disabled) {
-      urlbarSuggests.checked = false;
-    }
-
-    let permanentPBLabel =
-      document.getElementById("urlBarSuggestionPermanentPBLabel");
-    permanentPBLabel.hidden = urlbarSuggests.hidden || !permanentPB;
-  },
-
-  buildDefaultEngineDropDown() {
-    // This is called each time something affects the list of engines.
-    let list = document.getElementById("defaultEngine");
-    // Set selection to the current default engine.
-    let currentEngine = Services.search.currentEngine.name;
-
-    // If the current engine isn't in the list any more, select the first item.
-    let engines = gEngineView._engineStore._engines;
-    if (!engines.some(e => e.name == currentEngine))
-      currentEngine = engines[0].name;
-
-    // Now clean-up and rebuild the list.
-    list.removeAllItems();
-    gEngineView._engineStore._engines.forEach(e => {
-      let item = list.appendItem(e.name);
-      item.setAttribute("class", "menuitem-iconic searchengine-menuitem menuitem-with-favicon");
-      if (e.iconURI) {
-        item.setAttribute("image", e.iconURI.spec);
-      }
-      item.engine = e;
-      if (e.name == currentEngine)
-        list.selectedItem = item;
-    });
-  },
-
-  handleEvent(aEvent) {
-    switch (aEvent.type) {
-      case "click":
-        if (aEvent.target.id != "engineChildren" &&
-            !aEvent.target.classList.contains("searchEngineAction")) {
-          let engineList = document.getElementById("engineList");
-          // We don't want to toggle off selection while editing keyword
-          // so proceed only when the input field is hidden.
-          // We need to check that engineList.view is defined here
-          // because the "click" event listener is on <window> and the
-          // view might have been destroyed if the pane has been navigated
-          // away from.
-          if (engineList.inputField.hidden && engineList.view) {
-            let selection = engineList.view.selection;
-            if (selection.count > 0) {
-              selection.toggleSelect(selection.currentIndex);
-            }
-            engineList.blur();
-          }
-        }
-        break;
-      case "command":
-        switch (aEvent.target.id) {
-          case "":
-            if (aEvent.target.parentNode &&
-                aEvent.target.parentNode.parentNode &&
-                aEvent.target.parentNode.parentNode.id == "defaultEngine") {
-              gSearchPane.setDefaultEngine();
-            }
-            break;
-          case "restoreDefaultSearchEngines":
-            gSearchPane.onRestoreDefaults();
-            break;
-          case "removeEngineButton":
-            Services.search.removeEngine(gEngineView.selectedEngine.originalEngine);
-            break;
-        }
-        break;
-      case "dragstart":
-        if (aEvent.target.id == "engineChildren") {
-          onDragEngineStart(aEvent);
-        }
-        break;
-      case "keypress":
-        if (aEvent.target.id == "engineList") {
-          gSearchPane.onTreeKeyPress(aEvent);
-        }
-        break;
-      case "select":
-        if (aEvent.target.id == "engineList") {
-          gSearchPane.onTreeSelect();
-        }
-        break;
-      case "blur":
-        if (aEvent.target.id == "engineList" &&
-            aEvent.target.inputField == document.getBindingParent(aEvent.originalTarget)) {
-          gSearchPane.onInputBlur();
-        }
-        break;
-    }
-  },
-
-  observe(aEngine, aTopic, aVerb) {
-    if (aTopic == "browser-search-engine-modified") {
-      aEngine.QueryInterface(Components.interfaces.nsISearchEngine);
-      switch (aVerb) {
-      case "engine-added":
-        gEngineView._engineStore.addEngine(aEngine);
-        gEngineView.rowCountChanged(gEngineView.lastIndex, 1);
-        gSearchPane.buildDefaultEngineDropDown();
-        break;
-      case "engine-changed":
-        gEngineView._engineStore.reloadIcons();
-        gEngineView.invalidate();
-        break;
-      case "engine-removed":
-        gSearchPane.remove(aEngine);
-        break;
-      case "engine-current":
-        // If the user is going through the drop down using up/down keys, the
-        // dropdown may still be open (eg. on Windows) when engine-current is
-        // fired, so rebuilding the list unconditionally would get in the way.
-        let selectedEngine =
-          document.getElementById("defaultEngine").selectedItem.engine;
-        if (selectedEngine.name != aEngine.name)
-          gSearchPane.buildDefaultEngineDropDown();
-        break;
-      case "engine-default":
-        // Not relevant
-        break;
-      }
-    }
-  },
-
-  onInputBlur(aEvent) {
-    let tree = document.getElementById("engineList");
-    if (!tree.hasAttribute("editing"))
-      return;
-
-    // Accept input unless discarded.
-    let accept = aEvent.charCode != KeyEvent.DOM_VK_ESCAPE;
-    tree.stopEditing(accept);
-  },
-
-  onTreeSelect() {
-    document.getElementById("removeEngineButton").disabled =
-      !gEngineView.isEngineSelectedAndRemovable();
-  },
-
-  onTreeKeyPress(aEvent) {
-    let index = gEngineView.selectedIndex;
-    let tree = document.getElementById("engineList");
-    if (tree.hasAttribute("editing"))
-      return;
-
-    if (aEvent.charCode == KeyEvent.DOM_VK_SPACE) {
-      // Space toggles the checkbox.
-      let newValue = !gEngineView._engineStore.engines[index].shown;
-      gEngineView.setCellValue(index, tree.columns.getFirstColumn(),
-                               newValue.toString());
-      // Prevent page from scrolling on the space key.
-      aEvent.preventDefault();
-    } else {
-      let isMac = Services.appinfo.OS == "Darwin";
-      if ((isMac && aEvent.keyCode == KeyEvent.DOM_VK_RETURN) ||
-          (!isMac && aEvent.keyCode == KeyEvent.DOM_VK_F2)) {
-        tree.startEditing(index, tree.columns.getLastColumn());
-      } else if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE ||
-                 (isMac && aEvent.shiftKey &&
-                  aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE &&
-                  gEngineView.isEngineSelectedAndRemovable())) {
-        // Delete and Shift+Backspace (Mac) removes selected engine.
-        Services.search.removeEngine(gEngineView.selectedEngine.originalEngine);
-     }
-    }
-  },
-
-  onRestoreDefaults() {
-    let num = gEngineView._engineStore.restoreDefaultEngines();
-    gEngineView.rowCountChanged(0, num);
-    gEngineView.invalidate();
-  },
-
-  showRestoreDefaults(aEnable) {
-    document.getElementById("restoreDefaultSearchEngines").disabled = !aEnable;
-  },
-
-  remove(aEngine) {
-    let index = gEngineView._engineStore.removeEngine(aEngine);
-    gEngineView.rowCountChanged(index, -1);
-    gEngineView.invalidate();
-    gEngineView.selection.select(Math.min(index, gEngineView.lastIndex));
-    gEngineView.ensureRowIsVisible(gEngineView.currentIndex);
-    document.getElementById("engineList").focus();
-  },
-
-  editKeyword: Task.async(function* (aEngine, aNewKeyword) {
-    let keyword = aNewKeyword.trim();
-    if (keyword) {
-      let eduplicate = false;
-      let dupName = "";
-
-      // Check for duplicates in Places keywords.
-      let bduplicate = !!(yield PlacesUtils.keywords.fetch(keyword));
-
-      // Check for duplicates in changes we haven't committed yet
-      let engines = gEngineView._engineStore.engines;
-      for (let engine of engines) {
-        if (engine.alias == keyword &&
-            engine.name != aEngine.name) {
-          eduplicate = true;
-          dupName = engine.name;
-          break;
-        }
-      }
-
-      // Notify the user if they have chosen an existing engine/bookmark keyword
-      if (eduplicate || bduplicate) {
-        let strings = document.getElementById("engineManagerBundle");
-        let dtitle = strings.getString("duplicateTitle");
-        let bmsg = strings.getString("duplicateBookmarkMsg");
-        let emsg = strings.getFormattedString("duplicateEngineMsg", [dupName]);
-
-        Services.prompt.alert(window, dtitle, eduplicate ? emsg : bmsg);
-        return false;
-      }
-    }
-
-    gEngineView._engineStore.changeEngine(aEngine, "alias", keyword);
-    gEngineView.invalidate();
-    return true;
-  }),
-
-  saveOneClickEnginesList() {
-    let hiddenList = [];
-    for (let engine of gEngineView._engineStore.engines) {
-      if (!engine.shown)
-        hiddenList.push(engine.name);
-    }
-    document.getElementById("browser.search.hiddenOneOffs").value =
-      hiddenList.join(",");
-  },
-
-  setDefaultEngine() {
-    Services.search.currentEngine =
-      document.getElementById("defaultEngine").selectedItem.engine;
-  }
-};
-
-function onDragEngineStart(event) {
-  var selectedIndex = gEngineView.selectedIndex;
-  var tree = document.getElementById("engineList");
-  var row = { }, col = { }, child = { };
-  tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);
-  if (selectedIndex >= 0 && !gEngineView.isCheckBox(row.value, col.value)) {
-    event.dataTransfer.setData(ENGINE_FLAVOR, selectedIndex.toString());
-    event.dataTransfer.effectAllowed = "move";
-  }
-}
-
-
-function EngineStore() {
-  let pref = document.getElementById("browser.search.hiddenOneOffs").value;
-  this.hiddenList = pref ? pref.split(",") : [];
-
-  this._engines = Services.search.getVisibleEngines().map(this._cloneEngine, this);
-  this._defaultEngines = Services.search.getDefaultEngines().map(this._cloneEngine, this);
-
-  // check if we need to disable the restore defaults button
-  var someHidden = this._defaultEngines.some(e => e.hidden);
-  gSearchPane.showRestoreDefaults(someHidden);
-}
-EngineStore.prototype = {
-  _engines: null,
-  _defaultEngines: null,
-
-  get engines() {
-    return this._engines;
-  },
-  set engines(val) {
-    this._engines = val;
-    return val;
-  },
-
-  _getIndexForEngine(aEngine) {
-    return this._engines.indexOf(aEngine);
-  },
-
-  _getEngineByName(aName) {
-    return this._engines.find(engine => engine.name == aName);
-  },
-
-  _cloneEngine(aEngine) {
-    var clonedObj = {};
-    for (var i in aEngine)
-      clonedObj[i] = aEngine[i];
-    clonedObj.originalEngine = aEngine;
-    clonedObj.shown = this.hiddenList.indexOf(clonedObj.name) == -1;
-    return clonedObj;
-  },
-
-  // Callback for Array's some(). A thisObj must be passed to some()
-  _isSameEngine(aEngineClone) {
-    return aEngineClone.originalEngine == this.originalEngine;
-  },
-
-  addEngine(aEngine) {
-    this._engines.push(this._cloneEngine(aEngine));
-  },
-
-  moveEngine(aEngine, aNewIndex) {
-    if (aNewIndex < 0 || aNewIndex > this._engines.length - 1)
-      throw new Error("ES_moveEngine: invalid aNewIndex!");
-    var index = this._getIndexForEngine(aEngine);
-    if (index == -1)
-      throw new Error("ES_moveEngine: invalid engine?");
-
-    if (index == aNewIndex)
-      return; // nothing to do
-
-    // Move the engine in our internal store
-    var removedEngine = this._engines.splice(index, 1)[0];
-    this._engines.splice(aNewIndex, 0, removedEngine);
-
-    Services.search.moveEngine(aEngine.originalEngine, aNewIndex);
-  },
-
-  removeEngine(aEngine) {
-    if (this._engines.length == 1) {
-      throw new Error("Cannot remove last engine!");
-    }
-
-    let engineName = aEngine.name;
-    let index = this._engines.findIndex(element => element.name == engineName);
-
-    if (index == -1)
-      throw new Error("invalid engine?");
-
-    let removedEngine = this._engines.splice(index, 1)[0];
-
-    if (this._defaultEngines.some(this._isSameEngine, removedEngine))
-      gSearchPane.showRestoreDefaults(true);
-    gSearchPane.buildDefaultEngineDropDown();
-    return index;
-  },
-
-  restoreDefaultEngines() {
-    var added = 0;
-
-    for (var i = 0; i < this._defaultEngines.length; ++i) {
-      var e = this._defaultEngines[i];
-
-      // If the engine is already in the list, just move it.
-      if (this._engines.some(this._isSameEngine, e)) {
-        this.moveEngine(this._getEngineByName(e.name), i);
-      } else {
-        // Otherwise, add it back to our internal store
-
-        // The search service removes the alias when an engine is hidden,
-        // so clear any alias we may have cached before unhiding the engine.
-        e.alias = "";
-
-        this._engines.splice(i, 0, e);
-        let engine = e.originalEngine;
-        engine.hidden = false;
-        Services.search.moveEngine(engine, i);
-        added++;
-      }
-    }
-    Services.search.resetToOriginalDefaultEngine();
-    gSearchPane.showRestoreDefaults(false);
-    gSearchPane.buildDefaultEngineDropDown();
-    return added;
-  },
-
-  changeEngine(aEngine, aProp, aNewValue) {
-    var index = this._getIndexForEngine(aEngine);
-    if (index == -1)
-      throw new Error("invalid engine?");
-
-    this._engines[index][aProp] = aNewValue;
-    aEngine.originalEngine[aProp] = aNewValue;
-  },
-
-  reloadIcons() {
-    this._engines.forEach(function(e) {
-      e.uri = e.originalEngine.uri;
-    });
-  }
-};
-
-function EngineView(aEngineStore) {
-  this._engineStore = aEngineStore;
-}
-EngineView.prototype = {
-  _engineStore: null,
-  tree: null,
-
-  get lastIndex() {
-    return this.rowCount - 1;
-  },
-  get selectedIndex() {
-    var seln = this.selection;
-    if (seln.getRangeCount() > 0) {
-      var min = {};
-      seln.getRangeAt(0, min, {});
-      return min.value;
-    }
-    return -1;
-  },
-  get selectedEngine() {
-    return this._engineStore.engines[this.selectedIndex];
-  },
-
-  // Helpers
-  rowCountChanged(index, count) {
-    this.tree.rowCountChanged(index, count);
-  },
-
-  invalidate() {
-    this.tree.invalidate();
-  },
-
-  ensureRowIsVisible(index) {
-    this.tree.ensureRowIsVisible(index);
-  },
-
-  getSourceIndexFromDrag(dataTransfer) {
-    return parseInt(dataTransfer.getData(ENGINE_FLAVOR));
-  },
-
-  isCheckBox(index, column) {
-    return column.id == "engineShown";
-  },
-
-  isEngineSelectedAndRemovable() {
-    return this.selectedIndex != -1 && this.lastIndex != 0;
-  },
-
-  // nsITreeView
-  get rowCount() {
-    return this._engineStore.engines.length;
-  },
-
-  getImageSrc(index, column) {
-    if (column.id == "engineName") {
-      if (this._engineStore.engines[index].iconURI)
-        return this._engineStore.engines[index].iconURI.spec;
-
-      if (window.devicePixelRatio > 1)
-        return "chrome://browser/skin/search-engine-placeholder@2x.png";
-      return "chrome://browser/skin/search-engine-placeholder.png";
-    }
-
-    return "";
-  },
-
-  getCellText(index, column) {
-    if (column.id == "engineName")
-      return this._engineStore.engines[index].name;
-    else if (column.id == "engineKeyword")
-      return this._engineStore.engines[index].alias;
-    return "";
-  },
-
-  setTree(tree) {
-    this.tree = tree;
-  },
-
-  canDrop(targetIndex, orientation, dataTransfer) {
-    var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
-    return (sourceIndex != -1 &&
-            sourceIndex != targetIndex &&
-            sourceIndex != targetIndex + orientation);
-  },
-
-  drop(dropIndex, orientation, dataTransfer) {
-    var sourceIndex = this.getSourceIndexFromDrag(dataTransfer);
-    var sourceEngine = this._engineStore.engines[sourceIndex];
-
-    const nsITreeView = Components.interfaces.nsITreeView;
-    if (dropIndex > sourceIndex) {
-      if (orientation == nsITreeView.DROP_BEFORE)
-        dropIndex--;
-    } else if (orientation == nsITreeView.DROP_AFTER) {
-      dropIndex++;
-    }
-
-    this._engineStore.moveEngine(sourceEngine, dropIndex);
-    gSearchPane.showRestoreDefaults(true);
-    gSearchPane.buildDefaultEngineDropDown();
-
-    // Redraw, and adjust selection
-    this.invalidate();
-    this.selection.select(dropIndex);
-  },
-
-  selection: null,
-  getRowProperties(index) { return ""; },
-  getCellProperties(index, column) { return ""; },
-  getColumnProperties(column) { return ""; },
-  isContainer(index) { return false; },
-  isContainerOpen(index) { return false; },
-  isContainerEmpty(index) { return false; },
-  isSeparator(index) { return false; },
-  isSorted(index) { return false; },
-  getParentIndex(index) { return -1; },
-  hasNextSibling(parentIndex, index) { return false; },
-  getLevel(index) { return 0; },
-  getProgressMode(index, column) { },
-  getCellValue(index, column) {
-    if (column.id == "engineShown")
-      return this._engineStore.engines[index].shown;
-    return undefined;
-  },
-  toggleOpenState(index) { },
-  cycleHeader(column) { },
-  selectionChanged() { },
-  cycleCell(row, column) { },
-  isEditable(index, column) { return column.id != "engineName"; },
-  isSelectable(index, column) { return false; },
-  setCellValue(index, column, value) {
-    if (column.id == "engineShown") {
-      this._engineStore.engines[index].shown = value == "true";
-      gEngineView.invalidate();
-      gSearchPane.saveOneClickEnginesList();
-    }
-  },
-  setCellText(index, column, value) {
-    if (column.id == "engineKeyword") {
-      gSearchPane.editKeyword(this._engineStore.engines[index], value)
-                 .then(valid => {
-        if (!valid)
-          document.getElementById("engineList").startEditing(index, column);
-      });
-    }
-  },
-  performAction(action) { },
-  performActionOnRow(action, index) { },
-  performActionOnCell(action, index, column) { }
-};
deleted file mode 100644
--- a/browser/components/preferences/in-content/search.xul
+++ /dev/null
@@ -1,86 +0,0 @@
-    <preferences id="searchPreferences" hidden="true" data-category="paneSearch">
-
-      <preference id="browser.search.suggest.enabled"
-                  name="browser.search.suggest.enabled"
-                  type="bool"/>
-
-      <preference id="browser.urlbar.suggest.searches"
-                  name="browser.urlbar.suggest.searches"
-                  type="bool"/>
-
-      <preference id="browser.search.hiddenOneOffs"
-                  name="browser.search.hiddenOneOffs"
-                  type="unichar"/>
-
-    </preferences>
-
-    <script type="application/javascript"
-            src="chrome://browser/content/preferences/in-content/search.js"/>
-
-    <stringbundle id="engineManagerBundle" src="chrome://browser/locale/engineManager.properties"/>
-
-    <hbox id="header-search"
-          class="header"
-          hidden="true"
-          data-category="paneSearch">
-      <label class="header-name" flex="1">&paneSearch.title;</label>
-      <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
-    </hbox>
-
-    <!-- Default Search Engine -->
-    <groupbox id="defaultEngineGroup" align="start" data-category="paneSearch">
-      <caption label="&defaultSearchEngine.label;"/>
-      <label>&chooseYourDefaultSearchEngine.label;</label>
-      <menulist id="defaultEngine">
-        <menupopup/>
-      </menulist>
-      <checkbox id="suggestionsInSearchFieldsCheckbox"
-                label="&provideSearchSuggestions.label;"
-                accesskey="&provideSearchSuggestions.accesskey;"
-                preference="browser.search.suggest.enabled"/>
-      <vbox class="indent">
-        <checkbox id="urlBarSuggestion" label="&showURLBarSuggestions.label;"
-                  accesskey="&showURLBarSuggestions.accesskey;"
-                  preference="browser.urlbar.suggest.searches"/>
-        <hbox id="urlBarSuggestionPermanentPBLabel"
-              align="center" class="indent">
-          <label flex="1">&urlBarSuggestionsPermanentPB.label;</label>
-        </hbox>
-      </vbox>
-    </groupbox>
-
-    <groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch">
-      <caption label="&oneClickSearchEngines.label;"/>
-      <label>&chooseWhichOneToDisplay.label;</label>
-
-      <tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true"
-            seltype="single">
-        <treechildren id="engineChildren" flex="1"/>
-        <treecols>
-          <treecol id="engineShown" type="checkbox" editable="true" sortable="false"/>
-          <treecol id="engineName" flex="4" label="&engineNameColumn.label;" sortable="false"/>
-          <treecol id="engineKeyword" flex="1" label="&engineKeywordColumn.label;" editable="true"
-                   sortable="false"/>
-        </treecols>
-      </tree>
-
-      <hbox>
-        <button id="restoreDefaultSearchEngines"
-                label="&restoreDefaultSearchEngines.label;"
-                accesskey="&restoreDefaultSearchEngines.accesskey;"
-                />
-        <spacer flex="1"/>
-        <button id="removeEngineButton"
-                class="searchEngineAction"
-                label="&removeEngine.label;"
-                accesskey="&removeEngine.accesskey;"
-                disabled="true"
-                />
-      </hbox>
-
-      <separator class="thin"/>
-
-      <hbox id="addEnginesBox" pack="start">
-        <label id="addEngines" class="text-link" value="&addMoreSearchEngines.label;"/>
-      </hbox>
-    </groupbox>
deleted file mode 100644
--- a/browser/components/preferences/in-content/security.js
+++ /dev/null
@@ -1,292 +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 */
-
-XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
- "resource://gre/modules/LoginHelper.jsm");
-
-Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-
-var gSecurityPane = {
-  _pane: null,
-
-  /**
-   * Initializes master password UI.
-   */
-  init() {
-    function setEventListener(aId, aEventType, aCallback) {
-      document.getElementById(aId)
-              .addEventListener(aEventType, aCallback.bind(gSecurityPane));
-    }
-
-    this._pane = document.getElementById("paneSecurity");
-    this._initMasterPasswordUI();
-    this._initSafeBrowsing();
-
-    setEventListener("addonExceptions", "command",
-      gSecurityPane.showAddonExceptions);
-    setEventListener("passwordExceptions", "command",
-      gSecurityPane.showPasswordExceptions);
-    setEventListener("useMasterPassword", "command",
-      gSecurityPane.updateMasterPasswordButton);
-    setEventListener("changeMasterPassword", "command",
-      gSecurityPane.changeMasterPassword);
-    setEventListener("showPasswords", "command",
-      gSecurityPane.showPasswords);
-  },
-
-  // ADD-ONS
-
-  /*
-   * Preferences:
-   *
-   * xpinstall.whitelist.required
-   * - true if a site must be added to a site whitelist before extensions
-   *   provided by the site may be installed from it, false if the extension
-   *   may be directly installed after a confirmation dialog
-   */
-
-  /**
-   * 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;
-  },
-
-  /**
-   * Displays the exceptions lists for add-on installation warnings.
-   */
-  showAddonExceptions() {
-    var bundlePrefs = document.getElementById("bundlePreferences");
-
-    var params = this._addonParams;
-    if (!params.windowTitle || !params.introText) {
-      params.windowTitle = bundlePrefs.getString("addons_permissions_title");
-      params.introText = bundlePrefs.getString("addonspermissionstext");
-    }
-
-    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
-                    null, params);
-  },
-
-  /**
-   * Parameters for the add-on install permissions dialog.
-   */
-  _addonParams:
-    {
-      blockVisible: false,
-      sessionVisible: false,
-      allowVisible: true,
-      prefilledHost: "",
-      permissionType: "install"
-    },
-
-  // PASSWORDS
-
-  /*
-   * Preferences:
-   *
-   * signon.rememberSignons
-   * - true if passwords are remembered, false otherwise
-   */
-
-  /**
-   * 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;
-  },
-
-  /**
-   * Displays a dialog in which the user can view and modify the list of sites
-   * where passwords are never saved.
-   */
-  showPasswordExceptions() {
-    var bundlePrefs = document.getElementById("bundlePreferences");
-    var params = {
-      blockVisible: true,
-      sessionVisible: false,
-      allowVisible: false,
-      hideStatusColumn: true,
-      prefilledHost: "",
-      permissionType: "login-saving",
-      windowTitle: bundlePrefs.getString("savedLoginsExceptions_title"),
-      introText: bundlePrefs.getString("savedLoginsExceptions_desc")
-    };
-
-    gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
-                    null, params);
-  },
-
-  /**
-   * Initializes master password UI: the "use master password" checkbox, selects
-   * the master password button to show, and enables/disables it as necessary.
-   * The master password is controlled by various bits of NSS functionality, so
-   * the UI for it can't be controlled by the normal preference bindings.
-   */
-  _initMasterPasswordUI() {
-    var noMP = !LoginHelper.isMasterPasswordSet();
-
-    var button = document.getElementById("changeMasterPassword");
-    button.disabled = noMP;
-
-    var checkbox = document.getElementById("useMasterPassword");
-    checkbox.checked = !noMP;
-  },
-
-  _initSafeBrowsing() {
-    let enableSafeBrowsing = document.getElementById("enableSafeBrowsing");
-    let blockDownloads = document.getElementById("blockDownloads");
-    let blockUncommonUnwanted = document.getElementById("blockUncommonUnwanted");
-
-    let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
-    let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
-
-    let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
-    let malwareTable = document.getElementById("urlclassifier.malwareTable");
-
-    let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
-    let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
-
-    enableSafeBrowsing.addEventListener("command", function() {
-      safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
-      safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
-
-      if (enableSafeBrowsing.checked) {
-        blockDownloads.removeAttribute("disabled");
-        if (blockDownloads.checked) {
-          blockUncommonUnwanted.removeAttribute("disabled");
-        }
-      } else {
-        blockDownloads.setAttribute("disabled", "true");
-        blockUncommonUnwanted.setAttribute("disabled", "true");
-      }
-    });
-
-    blockDownloads.addEventListener("command", function() {
-      blockDownloadsPref.value = blockDownloads.checked;
-      if (blockDownloads.checked) {
-        blockUncommonUnwanted.removeAttribute("disabled");
-      } else {
-        blockUncommonUnwanted.setAttribute("disabled", "true");
-      }
-    });
-
-    blockUncommonUnwanted.addEventListener("command", function() {
-      blockUnwantedPref.value = blockUncommonUnwanted.checked;
-      blockUncommonPref.value = blockUncommonUnwanted.checked;
-
-      let malware = malwareTable.value
-        .split(",")
-        .filter(x => x !== "goog-unwanted-shavar" && x !== "test-unwanted-simple");
-
-      if (blockUncommonUnwanted.checked) {
-        malware.push("goog-unwanted-shavar");
-        malware.push("test-unwanted-simple");
-      }
-
-      // sort alphabetically to keep the pref consistent
-      malware.sort();
-
-      malwareTable.value = malware.join(",");
-    });
-
-    // set initial values
-
-    enableSafeBrowsing.checked = safeBrowsingPhishingPref.value && safeBrowsingMalwarePref.value;
-    if (!enableSafeBrowsing.checked) {
-      blockDownloads.setAttribute("disabled", "true");
-      blockUncommonUnwanted.setAttribute("disabled", "true");
-    }
-
-    blockDownloads.checked = blockDownloadsPref.value;
-    if (!blockDownloadsPref.value) {
-      blockUncommonUnwanted.setAttribute("disabled", "true");
-    }
-
-    blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
-  },
-
-  /**
-   * 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");
-  }
-
-};
deleted file mode 100644
--- a/browser/components/preferences/in-content/security.xul
+++ /dev/null
@@ -1,131 +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/.
-
-<!-- Security panel -->
-
-<script type="application/javascript"
-        src="chrome://browser/content/preferences/in-content/security.js"/>
-
-<preferences id="securityPreferences" hidden="true" data-category="paneSecurity">
-  <!-- XXX buttons -->
-  <preference id="pref.privacy.disable_button.view_passwords"
-              name="pref.privacy.disable_button.view_passwords"
-              type="bool"/>
-  <preference id="pref.privacy.disable_button.view_passwords_exceptions"
-              name="pref.privacy.disable_button.view_passwords_exceptions"
-              type="bool"/>
-
-  <!-- Add-ons, malware, phishing -->
-  <preference id="xpinstall.whitelist.required"
-              name="xpinstall.whitelist.required"
-              type="bool"/>
-
-  <preference id="browser.safebrowsing.malware.enabled"
-              name="browser.safebrowsing.malware.enabled"
-              type="bool"/>
-  <preference id="browser.safebrowsing.phishing.enabled"
-              name="browser.safebrowsing.phishing.enabled"
-              type="bool"/>
-
-  <preference id="browser.safebrowsing.downloads.enabled"
-              name="browser.safebrowsing.downloads.enabled"
-              type="bool"/>
-
-  <preference id="urlclassifier.malwareTable"
-              name="urlclassifier.malwareTable"
-              type="string"/>
-
-  <preference id="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
-              name="browser.safebrowsing.downloads.remote.block_potentially_unwanted"
-              type="bool"/>
-  <preference id="browser.safebrowsing.downloads.remote.block_uncommon"
-              name="browser.safebrowsing.downloads.remote.block_uncommon"
-              type="bool"/>
-
-  <!-- Passwords -->
-  <preference id="signon.rememberSignons" name="signon.rememberSignons" type="bool"/>
-
-</preferences>
-
-<hbox id="header-security"
-      class="header"
-      hidden="true"
-      data-category="paneSecurity">
-  <label class="header-name" flex="1">&paneSecurity.title;</label>
-  <html:a class="help-button" target="_blank" aria-label="&helpButton.label;"></html:a>
-</hbox>
-
-<!-- addons, forgery (phishing) UI -->
-<groupbox id="addonsPhishingGroup" data-category="paneSecurity" hidden="true">
-  <caption><label>&general.label;</label></caption>
-
-  <hbox id="addonInstallBox">
-    <checkbox id="warnAddonInstall"
-              label="&warnOnAddonInstall.label;"
-              accesskey="&warnOnAddonInstall.accesskey;"
-              preference="xpinstall.whitelist.required"
-              onsyncfrompreference="return gSecurityPane.readWarnAddonInstall();"/>
-    <spacer flex="1"/>
-    <button id="addonExceptions"
-            label="&addonExceptions.label;"
-            accesskey="&addonExceptions.accesskey;"/>
-  </hbox>
-
-  <separator class="thin"/>
-  <vbox align="start">
-    <checkbox id="enableSafeBrowsing"
-              label="&enableSafeBrowsing.label;"
-              accesskey="&enableSafeBrowsing.accesskey;" />
-    <vbox class="indent">
-      <checkbox id="blockDownloads"
-                label="&blockDownloads.label;"
-                accesskey="&blockDownloads.accesskey;" />
-      <checkbox id="blockUncommonUnwanted"
-                label="&blockUncommonAndUnwanted.label;"
-                accesskey="&blockUncommonAndUnwanted.accesskey;" />
-    </vbox>
-  </vbox>
-</groupbox>
-
-<!-- Passwords -->
-<groupbox id="passwordsGroup" orient="vertical" data-category="paneSecurity" hidden="true">
-  <caption><label>&logins.label;</label></caption>
-
-  <hbox id="savePasswordsBox">
-    <checkbox id="savePasswords"
-              label="&rememberLogins.label;" accesskey="&rememberLogins.accesskey;"
-              preference="signon.rememberSignons"
-              onsyncfrompreference="return gSecurityPane.readSavePasswords();"/>
-    <spacer flex="1"/>
-    <button id="passwordExceptions"
-            label="&passwordExceptions.label;"
-            accesskey="&passwordExceptions.accesskey;"
-            preference="pref.privacy.disable_button.view_passwords_exceptions"/>
-  </hbox>
-  <grid id="passwordGrid">
-    <columns>
-      <column flex="1"/>
-      <column/>
-    </columns>
-    <rows id="passwordRows">
-      <row id="masterPasswordRow">
-        <hbox id="masterPasswordBox">
-          <checkbox id="useMasterPassword"
-                    label="&useMasterPassword.label;"
-                    accesskey="&useMasterPassword.accesskey;"/>
-          <spacer flex="1"/>
-        </hbox>
-        <button id="changeMasterPassword"
-                label="&changeMasterPassword.label;"
-                accesskey="&changeMasterPassword.accesskey;"/>
-      </row>
-      <row id="showPasswordRow">
-        <hbox id="showPasswordsBox"/>
-        <button id="showPasswords"
-                label="&savedLogins.label;" accesskey="&savedLogins.accesskey;"
-                preference="pref.privacy.disable_button.view_passwords"/>
-      </row>
-    </rows>
-  </grid>
-</groupbox>
--- a/browser/components/preferences/in-content/sync.xul
+++ b/browser/components/preferences/in-content/sync.xul
@@ -27,17 +27,17 @@
 
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/sync.js"/>
 
 <hbox id="header-sync"
       class="header"
       hidden="true"
       data-category="paneSync">
-  <label class="header-name" flex="1">&paneSync.title;</label>
+  <label class="header-name" flex="1">&paneSync1.title;</label>
   <html:a class="help-button text-link" target="_blank" aria-label="&helpButton.label;"></html:a>
 </hbox>
 
 <deck id="weavePrefsDeck" data-category="paneSync" hidden="true">
   <vbox id="noFxaAccount">
     <hbox>
       <vbox id="fxaContentWrapper">
         <groupbox id="noFxaGroup">
@@ -186,18 +186,18 @@
         <label control="fxaSyncComputerName">
           &fxaSyncDeviceName.label;
         </label>
       </caption>
       <hbox id="fxaDeviceName">
         <textbox id="fxaSyncComputerName" disabled="true"/>
         <hbox>
           <button id="fxaChangeDeviceName"
-                  label="&changeSyncDeviceName.label;"
-                  accesskey="&changeSyncDeviceName.accesskey;"/>
+                  label="&changeSyncDeviceName1.label;"
+                  accesskey="&changeSyncDeviceName1.accesskey;"/>
           <button id="fxaCancelChangeDeviceName"
                   label="&cancelChangeSyncDeviceName.label;"
                   accesskey="&cancelChangeSyncDeviceName.accesskey;"
                   hidden="true"/>
           <button id="fxaSaveChangeDeviceName"
                   label="&saveChangeSyncDeviceName.label;"
                   accesskey="&saveChangeSyncDeviceName.accesskey;"
                   hidden="true"/>
--- a/browser/components/preferences/in-content/tests/browser_advanced_siteData.js
+++ b/browser/components/preferences/in-content/tests/browser_advanced_siteData.js
@@ -228,17 +228,17 @@ registerCleanupFunction(function() {
 add_task(function* () {
   yield SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
   addPersistentStoragePerm(TEST_ORIGIN);
 
   yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_BASE_URL + "site_data_test.html");
   yield waitForEvent(gBrowser.selectedBrowser.contentWindow, "test-indexedDB-done");
   yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
 
-  yield openPreferencesViaOpenPreferencesAPI("advanced", "networkTab", { leaveOpen: true });
+  yield openPreferencesViaOpenPreferencesAPI("privacy", undefined, { leaveOpen: true });
 
   // Test the initial states
   let cacheUsage = yield cacheUsageGetter.get();
   let quotaUsage = yield getQuotaUsage(TEST_ORIGIN);
   let totalUsage = yield SiteDataManager.getTotalUsage();
   Assert.greater(cacheUsage, 0, "The cache usage should not be 0");
   Assert.greater(quotaUsage, 0, "The quota usage should not be 0");
   Assert.greater(totalUsage, 0, "The total usage should not be 0");
@@ -294,17 +294,17 @@ add_task(function* () {
   yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 add_task(function* () {
   yield SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
 
   mockSiteDataManager.register();
   let updatePromise = promiseSitesUpdated();
-  yield openPreferencesViaOpenPreferencesAPI("advanced", "networkTab", { leaveOpen: true });
+  yield openPreferencesViaOpenPreferencesAPI("privacy", undefined, { leaveOpen: true });
   yield updatePromise;
   yield openSettingsDialog();
 
   let doc = gBrowser.selectedBrowser.contentDocument;
   let dialogFrame = doc.getElementById("dialogFrame");
   let frameDoc = dialogFrame.contentDocument;
   let hostCol = frameDoc.getElementById("hostCol");
   let usageCol = frameDoc.getElementById("usageCol");
@@ -385,17 +385,17 @@ add_task(function* () {
   }
 });
 
 add_task(function* () {
   yield SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]});
 
   mockSiteDataManager.register();
   let updatePromise = promiseSitesUpdated();
-  yield openPreferencesViaOpenPreferencesAPI("advanced", "networkTab", { leaveOpen: true });
+  yield openPreferencesViaOpenPreferencesAPI("privacy", undefined, { leaveOpen: true });
   yield updatePromise;
   yield openSettingsDialog();
 
   let doc = gBrowser.selectedBrowser.contentDocument;
   let frameDoc = doc.getElementById("dialogFrame").contentDocument;
   let searchBox = frameDoc.getElementById("searchBox");
   let mockOrigins = Array.from(mockSiteDataManager.sites.keys());
 
--- a/browser/components/preferences/in-content/tests/browser_advanced_update.js
+++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js
@@ -91,17 +91,17 @@ function formatInstallDate(sec) {
   const dtOptions = { year: "numeric", month: "long", day: "numeric",
                       hour: "numeric", minute: "numeric", second: "numeric" };
   return date.toLocaleString(locale, dtOptions);
 }
 
 registerCleanupFunction(resetPreferences);
 
 add_task(function*() {
-  yield openPreferencesViaOpenPreferencesAPI("advanced", "updateTab", { leaveOpen: true });
+  yield openPreferencesViaOpenPreferencesAPI("advanced", undefined, { leaveOpen: true });
   resetPreferences();
   Services.prefs.setBoolPref("browser.search.update", false);
 
   let doc = gBrowser.selectedBrowser.contentDocument;
   let enableSearchUpdate = doc.getElementById("enableSearchUpdate");
   is_element_visible(enableSearchUpdate, "Check search update preference is visible");
 
   // Ensure that the update pref dialog reflects the actual pref value.
@@ -110,17 +110,17 @@ add_task(function*() {
   ok(enableSearchUpdate.checked, "Ensure search updates are enabled");
 
   gBrowser.removeCurrentTab();
 });
 
 add_task(function*() {
   mockUpdateManager.register();
 
-  yield openPreferencesViaOpenPreferencesAPI("advanced", "updateTab", { leaveOpen: true });
+  yield openPreferencesViaOpenPreferencesAPI("advanced", undefined, { leaveOpen: true });
   let doc = gBrowser.selectedBrowser.contentDocument;
 
   let showBtn = doc.getElementById("showUpdateHistory");
   let dialogOverlay = doc.getElementById("dialogOverlay");
 
   // Test the dialog window opens
   is(dialogOverlay.style.visibility, "", "The dialog should be invisible");
   showBtn.doCommand();
--- a/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js
+++ b/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js
@@ -1,16 +1,16 @@
 Services.prefs.setBoolPref("browser.preferences.instantApply", true);
 
 registerCleanupFunction(function() {
   Services.prefs.clearUserPref("browser.preferences.instantApply");
 });
 
 add_task(function*() {
-  yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
+  yield openPreferencesViaOpenPreferencesAPI("paneGeneral", null, {leaveOpen: true});
   let doc = gBrowser.contentDocument;
   var langGroup = Services.prefs.getComplexValue("font.language.group", Ci.nsIPrefLocalizedString).data
   is(doc.getElementById("font.language.group").value, langGroup,
      "Language group should be set correctly.");
 
   let defaultFontType = Services.prefs.getCharPref("font.default." + langGroup);
   let fontFamily = Services.prefs.getCharPref("font.name." + defaultFontType + "." + langGroup);
   let fontFamilyField = doc.getElementById("defaultFont");
--- a/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js
+++ b/browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js
@@ -3,21 +3,20 @@
 
 Services.prefs.setBoolPref("browser.preferences.instantApply", true);
 
 registerCleanupFunction(function() {
   Services.prefs.clearUserPref("browser.preferences.instantApply");
 });
 
 add_task(function*() {
-  let prefs = yield openPreferencesViaOpenPreferencesAPI("paneContent");
-  is(prefs.selectedPane, "paneContent", "Content pane was selected");
-  prefs = yield openPreferencesViaOpenPreferencesAPI("advanced", "updateTab");
+  let prefs = yield openPreferencesViaOpenPreferencesAPI("panePrivacy");
+  is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
+  prefs = yield openPreferencesViaOpenPreferencesAPI("advanced");
   is(prefs.selectedPane, "paneAdvanced", "Advanced pane was selected");
-  is(prefs.selectedAdvancedTab, "updateTab", "The update tab within the advanced prefs should be selected");
   prefs = yield openPreferencesViaHash("privacy");
   is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected when hash is 'privacy'");
   prefs = yield openPreferencesViaOpenPreferencesAPI("nonexistant-category");
   is(prefs.selectedPane, "paneGeneral", "General pane is selected by default when a nonexistant-category is requested");
   prefs = yield openPreferencesViaHash("nonexistant-category");
   is(prefs.selectedPane, "paneGeneral", "General pane is selected when hash is a nonexistant-category");
   prefs = yield openPreferencesViaHash();
   is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
--- a/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
+++ b/browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
@@ -35,17 +35,17 @@ add_task(function* () {
 
     // Test radio
     let radiogroup = doc.getElementById("radiogroup");
     radiogroup.focus();
     EventUtils.synthesizeKey(" ", {});
     yield checkPageScrolling(container, "radio");
   });
 
-  yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, function* (browser) {
+  yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences" }, function* (browser) {
     let doc = browser.contentDocument;
     let container = doc.getElementsByClassName("main-content")[0];
 
     // Test search
     let engineList = doc.getElementById("engineList");
     engineList.focus();
     EventUtils.synthesizeKey(" ", {});
     is(engineList.view.selection.currentIndex, 0, "Search engineList is selected");
--- a/browser/components/preferences/in-content/tests/browser_bug731866.js
+++ b/browser/components/preferences/in-content/tests/browser_bug731866.js
@@ -32,18 +32,18 @@ function checkElements(expectedPane) {
 
 function runTest(win) {
   is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
 
   let tab = win.document;
   gElements = tab.getElementById("mainPrefPane").children;
 
   let panes = [
-    "General", "Search", "Content", "Applications",
-    "Privacy", "Security", "Sync", "Advanced",
+    "General", "Applications",
+    "Privacy", "Sync", "Advanced",
   ];
 
   for (let pane of panes) {
     win.gotoPref("pane" + pane);
     checkElements(pane);
   }
 
   gBrowser.removeCurrentTab();
--- a/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js
+++ b/browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js
@@ -3,18 +3,18 @@
 
 
 registerCleanupFunction(function() {
   while (gBrowser.tabs[1])
     gBrowser.removeTab(gBrowser.tabs[1]);
 });
 
 add_task(function*() {
-  let prefs = yield openPreferencesViaOpenPreferencesAPI("paneContent", undefined, {leaveOpen: true});
-  is(prefs.selectedPane, "paneContent", "Content pane was selected");
+  let prefs = yield openPreferencesViaOpenPreferencesAPI("panePrivacy", undefined, {leaveOpen: true});
+  is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
 
   let doc = gBrowser.contentDocument;
   let notificationsDoNotDisturbRow = doc.getElementById("notificationsDoNotDisturbRow");
   if (notificationsDoNotDisturbRow.hidden) {
     todo(false, "Do not disturb is not available on this platform");
     return;
   }
 
--- a/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js
+++ b/browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js
@@ -1,14 +1,14 @@
 "use strict";
 
 const PERMISSIONS_URL = "chrome://browser/content/preferences/permissions.xul";
 
 add_task(function* urlFieldVisibleForPopupPermissions(finish) {
-  yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
+  yield openPreferencesViaOpenPreferencesAPI("panePrivacy", null, {leaveOpen: true});
   let win = gBrowser.selectedBrowser.contentWindow;
   let doc = win.document;
   let popupPolicyCheckbox = doc.getElementById("popupPolicy");
   ok(!popupPolicyCheckbox.checked, "popupPolicyCheckbox should be unchecked by default");
   popupPolicyCheckbox.click();
   let popupPolicyButton = doc.getElementById("popupPolicyButton");
   ok(popupPolicyButton, "popupPolicyButton found");
   let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
@@ -21,17 +21,17 @@ add_task(function* urlFieldVisibleForPop
   let url = dialog.document.getElementById("url");
   ok(!url.hidden, "url should be visible when one of block/session/allow visible");
 
   popupPolicyCheckbox.click();
   gBrowser.removeCurrentTab();
 });
 
 add_task(function* urlFieldHiddenForNotificationPermissions() {
-  yield openPreferencesViaOpenPreferencesAPI("paneContent", null, {leaveOpen: true});
+  yield openPreferencesViaOpenPreferencesAPI("panePrivacy", null, {leaveOpen: true});
   let win = gBrowser.selectedBrowser.contentWindow;
   let doc = win.document;
   let notificationsPolicyButton = doc.getElementById("notificationsPolicyButton");
   ok(notificationsPolicyButton, "notificationsPolicyButton found");
   let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL);
   notificationsPolicyButton.click();
   let dialog = yield dialogPromise;
   ok(dialog, "dialog loaded");
--- a/browser/components/preferences/in-content/tests/browser_security.js
+++ b/browser/components/preferences/in-content/tests/browser_security.js
@@ -16,29 +16,30 @@ registerCleanupFunction(function() {
 });
 
 // test the safebrowsing preference
 add_task(function*() {
   function* checkPrefSwitch(val1, val2) {
     Services.prefs.setBoolPref("browser.safebrowsing.phishing.enabled", val1);
     Services.prefs.setBoolPref("browser.safebrowsing.malware.enabled", val2);
 
-    yield openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true });
+    yield openPreferencesViaOpenPreferencesAPI("privacy", undefined, { leaveOpen: true });
 
     let doc = gBrowser.selectedBrowser.contentDocument;
     let checkbox = doc.getElementById("enableSafeBrowsing");
     let blockDownloads = doc.getElementById("blockDownloads");
     let blockUncommon = doc.getElementById("blockUncommonUnwanted");
     let checked = checkbox.checked;
     is(checked, val1 && val2, "safebrowsing preference is initialized correctly");
     // should be disabled when checked is false (= pref is turned off)
     is(blockDownloads.hasAttribute("disabled"), !checked, "block downloads checkbox is set correctly");
     is(blockUncommon.hasAttribute("disabled"), !checked, "block uncommon checkbox is set correctly");
 
-    // click the checkbox
+    // scroll the checkbox into the viewport and click checkbox
+    checkbox.scrollIntoView();
     EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
 
     // check that both settings are now turned on or off
     is(Services.prefs.getBoolPref("browser.safebrowsing.phishing.enabled"), !checked,
        "safebrowsing.enabled is set correctly");
     is(Services.prefs.getBoolPref("browser.safebrowsing.malware.enabled"), !checked,
        "safebrowsing.malware.enabled is set correctly");
 
@@ -56,27 +57,28 @@ add_task(function*() {
   yield* checkPrefSwitch(false, false);
 });
 
 // test the download protection preference
 add_task(function*() {
   function* checkPrefSwitch(val) {
     Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", val);
 
-    yield openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true });
+    yield openPreferencesViaOpenPreferencesAPI("privacy", undefined, { leaveOpen: true });
 
     let doc = gBrowser.selectedBrowser.contentDocument;
     let checkbox = doc.getElementById("blockDownloads");
     let blockUncommon = doc.getElementById("blockUncommonUnwanted");
     let checked = checkbox.checked;
     is(checked, val, "downloads preference is initialized correctly");
     // should be disabled when val is false (= pref is turned off)
     is(blockUncommon.hasAttribute("disabled"), !val, "block uncommon checkbox is set correctly");
 
-    // click the checkbox
+    // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
+    checkbox.scrollIntoView();
     EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
 
     // check that setting is now turned on or off
     is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.enabled"), !checked,
        "safebrowsing.downloads preference is set correctly");
 
     // check if the uncommon warning checkbox has updated
     is(blockUncommon.hasAttribute("disabled"), val, "block uncommon checkbox is set correctly");
@@ -89,24 +91,25 @@ add_task(function*() {
 });
 
 // test the unwanted/uncommon software warning preference
 add_task(function*() {
   function* checkPrefSwitch(val1, val2) {
     Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted", val1);
     Services.prefs.setBoolPref("browser.safebrowsing.downloads.remote.block_uncommon", val2);
 
-    yield openPreferencesViaOpenPreferencesAPI("security", undefined, { leaveOpen: true });
+    yield openPreferencesViaOpenPreferencesAPI("privacy", undefined, { leaveOpen: true });
 
     let doc = gBrowser.selectedBrowser.contentDocument;
     let checkbox = doc.getElementById("blockUncommonUnwanted");
     let checked = checkbox.checked;
     is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
 
-    // click the checkbox
+    // scroll the checkbox into view, otherwise the synthesizeMouseAtCenter will be ignored, and click it
+    checkbox.scrollIntoView();
     EventUtils.synthesizeMouseAtCenter(checkbox, {}, gBrowser.selectedBrowser.contentWindow);
 
     // check that both settings are now turned on or off
     is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_potentially_unwanted"), !checked,
        "block_potentially_unwanted is set correctly");
     is(Services.prefs.getBoolPref("browser.safebrowsing.downloads.remote.block_uncommon"), !checked,
        "block_uncommon is set correctly");
 
--- a/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/advanced.dtd
@@ -96,29 +96,30 @@
 
 <!ENTITY useService.label                "Use a background service to install updates">
 <!ENTITY useService.accesskey            "b">
 
 <!ENTITY autoUpdateOthers.label          "Automatically Update">
 <!ENTITY enableSearchUpdate.label        "Search Engines">
 <!ENTITY enableSearchUpdate.accesskey    "E">
 
+<!ENTITY reports.label                   "Reports">
+
 <!ENTITY offlineStorageNotify.label               "Tell you when a website asks to store data for offline use">
 <!ENTITY offlineStorageNotify.accesskey           "T">
 <!ENTITY offlineStorageNotifyExceptions.label     "Exceptions…">
 <!ENTITY offlineStorageNotifyExceptions.accesskey "x">
 
 <!ENTITY offlineAppsList2.label          "The following websites are allowed to store data for offline use:">
 <!ENTITY offlineAppsList.height          "7em">
 <!ENTITY offlineAppsListRemove.label     "Remove…">
 <!ENTITY offlineAppsListRemove.accesskey "R">
 <!ENTITY offlineAppRemove.confirm        "Remove offline data">
 
-<!ENTITY certificateTab.label            "Certificates">
-<!ENTITY certPersonal.label              "Requests">
+<!ENTITY certPersonal.label              "Certificates">
 <!ENTITY certPersonal.description        "When a server requests your personal certificate:">
 <!ENTITY selectCerts.auto                "Select one automatically">
 <!ENTITY selectCerts.auto.accesskey      "S">
 <!ENTITY selectCerts.ask                 "Ask you every time">
 <!ENTITY selectCerts.ask.accesskey       "A">
 <!ENTITY enableOCSP.label                "Query OCSP responder servers to confirm the current validity of certificates">
 <!ENTITY enableOCSP.accesskey            "Q">
 <!ENTITY viewCerts.label                 "View Certificates">
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.dtd
@@ -8,22 +8,22 @@
 <!-- LOCALIZATION NOTE (prefWindow.titleGNOME): This is not used for in-content preferences -->
 <!ENTITY  prefWindow.titleGNOME   "&brandShortName; Preferences">
 <!-- When making changes to prefWindow.styleWin test both Windows Classic and
      Luna since widget heights are different based on the OS theme -->
 <!ENTITY  prefWinMinSize.styleWin2      "width: 42em; min-height: 37.5em;">
 <!ENTITY  prefWinMinSize.styleMac       "width: 47em; min-height: 40em;">
 <!ENTITY  prefWinMinSize.styleGNOME     "width: 45.5em; min-height: 40.5em;">
 
-<!ENTITY  paneGeneral.title       "General">
-<!ENTITY  paneTabs.title          "Tabs">
-<!ENTITY  paneSearch.title        "Search">
-<!ENTITY  paneContent.title       "Content">
-<!ENTITY  paneApplications.title  "Applications">
-<!ENTITY  panePrivacy.title       "Privacy">
-<!ENTITY  paneContainers.title    "Container Tabs">
-<!ENTITY  paneSecurity.title      "Security">
-<!ENTITY  paneAdvanced.title      "Advanced">
+<!ENTITY  paneGeneral.title             "General">
+<!ENTITY  paneTabs.title                "Tabs">
+<!ENTITY  paneSearch.title              "Search">
+<!ENTITY  paneContent.title             "Content">
+<!ENTITY  paneDownloadLinks.title       "Downloads &amp; Links">
+<!ENTITY  panePrivacySecurity.title     "Privacy &amp; Security">
+<!ENTITY  paneContainers.title          "Container Tabs">
+<!ENTITY  paneSecurity.title            "Security">
+<!ENTITY  paneUpdates.title             "Updates">
 
-<!-- LOCALIZATION NOTE (paneSync.title): This should match syncBrand.shortName.label in ../syncBrand.dtd -->
-<!ENTITY  paneSync.title          "Sync">
+<!-- LOCALIZATION NOTE (paneSync1.title): This should match syncBrand.shortName.label in ../syncBrand.dtd -->
+<!ENTITY  paneSync1.title          "Firefox Account">
 
 <!ENTITY  helpButton.label        "Help">
--- a/browser/locales/en-US/chrome/browser/preferences/privacy.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/privacy.dtd
@@ -9,17 +9,17 @@
 <!ENTITY  trackingProtectionPrivate.accesskey  "l">
 <!ENTITY  trackingProtectionNever.label        "Never">
 <!ENTITY  trackingProtectionNever.accesskey    "n">
 <!ENTITY  trackingProtectionLearnMore.label    "Learn more">
 <!ENTITY  trackingProtectionExceptions.label   "Exceptions…">
 <!ENTITY  trackingProtectionExceptions.accesskey "x">
 
 <!ENTITY tracking.label                 "Tracking">
-<!ENTITY trackingProtectionPBM5.label         "Use Tracking Protection in Private Windows">
+<!ENTITY trackingProtectionPBM6.label         "Tracking Protection">
 <!ENTITY trackingProtectionPBM5.accesskey     "v">
 <!ENTITY trackingProtectionPBMLearnMore.label "Learn more">
 <!ENTITY changeBlockList.label          "Change Block List">
 <!ENTITY changeBlockList.accesskey      "C">
 
 <!-- LOCALIZATION NOTE (doNotTrack.pre.label): include a trailing space as needed -->
 <!-- LOCALIZATION NOTE (doNotTrack.post.label): include a starting space as needed -->
 <!ENTITY  doNotTrack.pre.label          "You can also ">
--- a/browser/locales/en-US/chrome/browser/preferences/security.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/security.dtd
@@ -1,13 +1,13 @@
 <!-- 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/. -->
 
-<!ENTITY  general.label                 "General">
+<!ENTITY  security.label                 "Security">
 
 <!ENTITY  warnOnAddonInstall.label        "Warn you when sites try to install add-ons">
 <!ENTITY  warnOnAddonInstall.accesskey    "W">
 
 <!-- LOCALIZATION NOTE (enableSafeBrowsing.label, blockDownloads.label, blockUncommonUnwanted.label):
   It is important that wording follows the guidelines outlined on this page:
   https://developers.google.com/safe-browsing/developers_guide_v2#AcceptableUsage
 -->
@@ -19,19 +19,19 @@
 
 <!ENTITY  blockUncommonAndUnwanted.label     "Warn you about unwanted and uncommon software">
 <!ENTITY  blockUncommonAndUnwanted.accesskey "C">
 
 <!ENTITY  addonExceptions.label         "Exceptions…">
 <!ENTITY  addonExceptions.accesskey     "E">
 
 
-<!ENTITY  logins.label                  "Logins">
+<!ENTITY  formsAndPasswords.label       "Forms &amp; Passwords">
 
-<!ENTITY  rememberLogins.label          "Remember logins for sites">
+<!ENTITY  rememberLogins1.label          "Remember logins and passwords for sites">
 <!ENTITY  rememberLogins.accesskey      "R">
 <!ENTITY  passwordExceptions.label      "Exceptions…">
 <!ENTITY  passwordExceptions.accesskey  "x">
 
 <!ENTITY  useMasterPassword.label        "Use a master password">
 <!ENTITY  useMasterPassword.accesskey    "U">
 <!ENTITY  changeMasterPassword.label     "Change Master Password…">
 <!ENTITY  changeMasterPassword.accesskey "M">
--- a/browser/locales/en-US/chrome/browser/preferences/sync.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/sync.dtd
@@ -14,18 +14,18 @@
 <!ENTITY engine.passwords.accesskey "P">
 <!ENTITY engine.prefs.label         "Preferences">
 <!ENTITY engine.prefs.accesskey     "S">
 <!ENTITY engine.addons.label        "Add-ons">
 <!ENTITY engine.addons.accesskey    "A">
 
 <!-- Device Settings -->
 <!ENTITY fxaSyncDeviceName.label       "Device Name">
-<!ENTITY changeSyncDeviceName.label "Change Device Name…">
-<!ENTITY changeSyncDeviceName.accesskey "h">
+<!ENTITY changeSyncDeviceName1.label "Change Device Name">
+<!ENTITY changeSyncDeviceName1.accesskey "h">
 <!ENTITY cancelChangeSyncDeviceName.label "Cancel">
 <!ENTITY cancelChangeSyncDeviceName.accesskey "n">
 <!ENTITY saveChangeSyncDeviceName.label "Save">
 <!ENTITY saveChangeSyncDeviceName.accesskey "v">
 
 <!-- Footer stuff -->
 <!ENTITY prefs.tosLink.label        "Terms of Service">
 <!ENTITY fxaPrivacyNotice.link.label "Privacy Notice">
--- a/browser/themes/shared/incontentprefs/icons.svg
+++ b/browser/themes/shared/incontentprefs/icons.svg
@@ -32,21 +32,46 @@
     </g>
     <g id="privacy-shape">
       <path d="M21.632,9.541c-0.083,1.403,0.246,3.079-1.597,5.498 c-1.965,2.578-3.914,2.594-4.284,2.575c-2.249-0.117-2.502-1.875-3.792-1.875c-1.13,0-2.012,1.745-3.711,1.836 c-0.37,0.02-2.319,0.042-4.284-2.536c-1.841-2.419-1.514-4.095-1.597-5.498C2.287,8.138,2,6.618,2,6.618s0.887,0.895,2.033,0.973 C5.179,7.67,5.394,7.191,7.811,6.501C10.424,5.752,12,8.814,12,8.814s1.776-3.016,4.189-2.313c2.414,0.7,2.515,1.169,3.661,1.091 C20.996,7.513,22,6.618,22,6.618S21.713,8.138,21.632,9.541z M8.117,10.129c-1.429-0.314-2.028,0.223-2.642,0.451 c-0.534,0.202-1.02,0.264-1.02,0.264s0.083,0.819,1.515,1.521c1.432,0.703,4.37,0.338,4.37,0.338S10.651,10.687,8.117,10.129z M18.525,10.58c-0.612-0.228-1.212-0.765-2.642-0.451c-2.534,0.558-2.223,2.573-2.223,2.573s2.938,0.365,4.37-0.338 c1.432-0.702,1.515-1.521,1.515-1.521S19.059,10.782,18.525,10.58z"/>
     </g>
     <g id="security-shape">
       <path d="M18.909,9.783h-0.863V8.086C18.046,4.725,15.339,2,12,2 C8.661,2,5.954,4.725,5.954,8.086v1.697H5.091c-0.955,0-1.728,0.779-1.728,1.739v8.738c0,0.961,0.773,1.74,1.728,1.74h13.818 c0.954,0,1.728-0.779,1.728-1.74v-8.738C20.637,10.562,19.863,9.783,18.909,9.783z M8.545,8.086c0-1.92,1.547-3.478,3.455-3.478 c1.908,0,3.455,1.557,3.455,3.478v1.697h-6.91V8.086z M5.181,16.092l-0.909-1.2v-2.284l2.728,3.483H5.181z M8.818,16.092 l-2.773-3.657h1.727l2.864,3.657H8.818z M12,16.092l-2.773-3.657h1.727l2.864,3.657H12z M15.637,16.092l-2.773-3.657h1.727 l2.864,3.657H15.637z M19.728,16.092h-0.455l-2.773-3.657h1.727l1.501,1.916V16.092z"/>
     </g>
     <g id="sync-shape">
-      <path d="M17.024,3.351 c-0.562,0.331 -1.311,0.879 -1.821,1.698 -0.367,0.592 -0.752,1.288 -1.08,1.914 0.987,0.413 1.862,1.095 2.476,2.029 0.614,0.957 0.929,2.122 0.83,3.351 -0.201,1.787 -1.359,3.433 -3.046,4.36 -0.696,-0.774 -1.951,-2.945 -1.951,-2.945 -0.007,0.007 -0.004,2.556 -0.871,4.334 -0.573,1.184 -1.24,2.202 -2.305,2.995 1.431,0.51 2.915,0.886 4.282,0.909 l 0.162,0.002 c 2.99,0.021 5.844,-0.48 5.844,-0.48 0,0 -1.236,-0.802 -1.808,-1.346 1.86,-1.072 3.111,-2.791 3.634,-4.708 0.283,-0.759 0.478,-1.566 0.57,-2.409 C 22.383,9.011 20.33,5.278 17.024,3.351 Z M 6.569,12.302 C 6.526,10.271 7.755,8.327 9.644,7.29 c 0.696,0.774 2.32,2.899 2.32,2.899 0,0 -0.064,-5.157 1.657,-7.973 -6.097,-0.668 -9.69,0.443 -9.69,0.443 0,0 1.763,0.607 2.333,1.136 C 6.122,3.891 5.984,3.992 5.85,4.096 4.4,5.064 3.368,6.449 2.825,7.994 2.436,8.892 2.171,9.863 2.06,10.887 1.622,14.886 3.629,18.572 6.871,20.515 7.39,20.124 7.975,19.631 8.61,18.983 9.189,18.389 9.647,17.682 10.021,16.967 8.082,16.208 6.714,14.404 6.569,12.302 Z"/>
+      <path style="fill:#F1F1F1;" d="M0.9,19.9h3.3H15h3.3c0.5,0,0.9-0.4,0.9-0.9v-1.1c0-1-0.5-1.9-1.2-2.5c-2.3-1.8-4.6-2.9-5.1-3.1
+      c-0.1,0-0.1-0.1-0.1-0.2v-1.6c0.3-0.5,0.4-1,0.5-1.5c0.2,0.1,0.6,0.1,1-1.3c0.3-1.1,0.1-1.5-0.2-1.6C15,1.7,13,1.6,13,1.6
+      S12.7,1,11.8,0.5C11.3,0.2,10.5-0.1,9.5,0C9.1,0,8.8,0.1,8.5,0.2c-0.4,0.1-0.7,0.3-1,0.5C7.1,1,6.8,1.2,6.4,1.6
+      c-0.5,0.5-1,1.2-1.1,2C5.1,4.3,5.1,5,5.4,5.8C5,5.7,4.6,5.9,5,7.4c0.3,1.1,0.6,1.4,0.8,1.4c0.1,0.6,0.3,1.3,0.7,1.9v1.4
+      c0,0.1,0,0.1-0.1,0.2c-0.5,0.2-2.8,1.4-5.1,3.1C0.5,16,0,16.9,0,17.9V19C0,19.5,0.4,19.9,0.9,19.9"/>
     </g>
     <g id="advanced-shape">
-      <path d="M19.173,16.163c0.004,0.04,0.007,0.08,0.007,0.121c0,1.748-3.197,3.165-7.14,3.165 c-3.943,0-7.14-1.417-7.14-3.165c0 -0.037,0.003-0.073,0.006-0.109C3.11,16.572,2,17.243,2,18.341C2,20.362,6.477,22,12,22 c5.523,0,10-1.638,10-3.659 C22,17.22,20.922,16.553,19.173,16.163z"/>
-      <path d="M18.224,15.979c0.006-0.11-0.018-0.285-0.054-0.39c0,0-0.762-2.205-1.176-3.403 c-0.624-1.807-2.112-6.139-2.112-6.139c-0.036-0.104-0.031-0.273,0.01-0.376l0.497-1.234c0.041-0.102,0.116-0.266,0.166-0.364 l0.986-1.942c0.05-0.098,0.013-0.133-0.081-0.077L9.965,5.871c-0.095,0.056-0.203,0.186-0.24,0.29c0,0-0.252,0.7-0.412,1.144 C8.64,9.173,7.968,11.04,7.296,12.908c-0.26,0.723-0.52,1.446-0.78,2.168c-0.056,0.156-0.112,0.311-0.168,0.466 c-0.093,0.26-0.049,0.617,0.032,0.881c0.237,0.763,1.001,1.189,1.708,1.435c0.611,0.213,1.254,0.328,1.895,0.403 c0.895,0.105,1.805,0.14,2.706,0.112c1.356-0.041,2.767-0.261,4.004-0.846c0.429-0.203,0.854-0.459,1.174-0.816 c0.121-0.135,0.226-0.287,0.297-0.455C18.215,16.134,18.224,15.979,18.224,15.979z M14.063,16.131 c0.019,0.108-0.046,0.156-0.143,0.104l-1.466-0.772c-0.097-0.052-0.257-0.052-0.354,0l-1.466,0.773 c-0.097,0.052-0.162,0.004-0.143-0.104l0.28-1.636c0.019-0.109-0.031-0.261-0.109-0.338l-1.186-1.158 c-0.079-0.077-0.054-0.153,0.055-0.169l1.638-0.239c0.109-0.016,0.238-0.11,0.286-0.209l0.733-1.488 c0.049-0.099,0.128-0.099,0.177,0l0.733,1.488c0.049,0.099,0.178,0.193,0.286,0.209l1.639,0.239 c0.109,0.016,0.134,0.092,0.055,0.169l-1.186,1.158c-0.079,0.077-0.128,0.229-0.109,0.338L14.063,16.131z"/>
+      <path style="fill:#F1F1F1;" d="M19.3,13.4C19.3,13.4,19.3,13.4,19.3,13.4L19.3,13.4C19.3,13.4,19.3,13.4,19.3,13.4L19.3,13.4z
+      M19.3,13.4c-0.1,1-0.5,1.8-1.2,2.4c-0.5,0.5-1.1,0.9-1.7,1.2c-0.2,0.4-0.4,0.7-0.8,1c-0.5,0.4-1.3,0.8-2.1,1
+      c-0.9,0.2-1.6,0.3-2.3,0.3h-0.9c0.1,0.2,0.2,0.2,0.4,0.2c-1.1-0.1-2.1-0.3-2.9-0.5c0.2,0.2,0.5,0.4,0.8,0.4c-1.5-0.3-2.9-1-4.1-1.9
+      c-0.3-0.2-0.4-0.3-0.5-0.4c-1-0.8-1.7-1.6-2.3-2.6c-0.7-1.1-1.1-2.5-1.3-4.1c-0.1,0.5-0.1,0.9-0.1,1.1C0.1,10.2,0.1,9,0.4,7.9
+      C0.3,8.2,0.1,8.6,0,9c0.1-0.8,0.4-1.8,0.9-2.8C1,5.8,1.2,5.5,1.3,5.4V4.3c0-0.1,0-0.3,0.1-0.6c0-0.2,0.1-0.4,0.2-0.6v0.1
+      c0,0,0-0.1,0-0.1c0-0.1,0-0.1,0-0.1c0-0.1,0-0.2,0.1-0.2v0.1c0,0,0-0.1,0-0.1c0,0,0-0.1,0-0.1s0-0.1,0-0.2C2,2.2,2,2.1,2,2.1
+      C2.2,2,2.2,1.9,2.3,1.9V2c0,0.2,0.1,0.5,0.3,1l0-0.1C2.8,3.1,3,3.4,3.4,3.7c0.8-0.2,1.5-0.3,2.4-0.1C5.9,3.5,5.9,3.4,6,3.3v0.1
+      C6.1,3.2,6.3,3.1,6.6,3v0c0.2-0.1,0.5-0.3,1-0.4L7.5,2.6c0.1-0.1,0.2-0.1,0.3-0.1c0.1,0,0.2,0,0.3,0c0.1,0,0.3,0,0.4,0
+      c-0.1,0-0.1,0.1-0.1,0.1c0,0-0.1,0.1-0.1,0.1s-0.1,0-0.1,0h0.1C7.8,3.2,7.4,3.7,7.2,4.4c-0.1,0-0.1,0.1-0.1,0.2l0.1,0.1
+      c0.2,0.3,0.5,0.5,0.9,0.5h1.4c0.2,0.1,0.3,0.2,0.3,0.2c0,0.2-0.1,0.4-0.3,0.6c0,0.1-0.1,0.2-0.3,0.4C8.5,7,8,7.3,7.7,7.6v0.1
+      c0,0,0,0,0,0.1c0,0,0,0,0,0.1c-0.1,0-0.1,0-0.1,0.1C7.7,7.9,7.8,8,7.8,8.2c0,0.2,0,0.4-0.1,0.6c0,0-0.1-0.1-0.1-0.1
+      c-0.1,0-0.1,0-0.1,0c0.1,0.1,0.2,0.1,0.2,0.2V9c0,0-0.1,0-0.1,0c0,0-0.1-0.1-0.1-0.1l-0.1,0c-0.1,0-0.1,0-0.2-0.1
+      c-0.1,0-0.1,0-0.1,0L7,8.7c-0.1,0-0.1,0-0.1,0L7,8.7c-0.1,0-0.1,0-0.2,0l-0.1,0C6.5,8.8,6.4,9,6.4,9.3c0,0.6,0.4,1.1,1.1,1.5
+      C7.7,11,8,11.1,8.3,11.2c0.3,0,0.5,0,0.7,0c0.2-0.1,0.4-0.1,0.6-0.2s0.4-0.2,0.5-0.2c0.7-0.2,1.4,0,1.9,0.5c0.2,0.1,0.2,0.2,0.1,0.4
+      c-0.1,0.2-0.2,0.3-0.4,0.2c-0.1,0-0.2,0-0.2,0c-0.1,0-0.1,0-0.3,0.1S11.1,12,11,12s-0.2,0.1-0.3,0.2c-0.1,0.1-0.3,0.2-0.4,0.3
+      c-0.9,0.5-1.9,0.6-3,0.4c0.4,0.4,0.7,0.7,1.1,0.9c0.1,0,0.2,0.1,0.6,0.1c0.3,0,0.5,0.1,0.6,0.2C9.4,14,9.1,14,8.9,14.1
+      c0.8,0.5,1.7,0.7,2.8,0.5c0.4-0.1,0.7-0.2,1-0.4c-0.1,0.1-0.1,0.3-0.2,0.4c0.1,0.1,0.4-0.1,0.6-0.5c0.1-0.1,0.3-0.3,0.6-0.4
+      c0,0,0,0.1,0,0.2c0,0.1,0,0.1,0,0.2s0,0.1,0.1,0.1c0.4,0,0.7-0.4,1.1-1.3c0.3-0.6,0.5-1.3,0.6-2.2c0.1,0.2,0.2,0.5,0.2,0.8
+      c0.2-0.5,0.3-1,0.3-1.3c0-0.3,0-1.3-0.1-2.9c0.3,0.4,0.5,0.7,0.7,1.1c0.1-1.2-0.1-2.2-0.5-3.1c-0.4-0.8-0.9-1.5-1.4-1.9
+      c0.5,0.1,1,0.3,1.4,0.6l-0.3-0.2c-1.4-1.4-3.1-2.2-5.1-2.4c-2-0.2-3.8,0.3-5.4,1.4c-0.6,0-1.1,0-1.5,0.1C3.6,2.7,3.5,2.6,3.5,2.5
+      C5.3,0.8,7.4,0,9.9,0s4.6,0.8,6.5,2.4L16.2,2c0.6,0.3,1,0.7,1.4,1.2l-0.1-0.3l0,0.1l0-0.1c0.9,0.7,1.4,1.6,1.7,2.7
+      c0.2,0.9,0.2,1.6,0.1,2.3c0.1,0.1,0.1,0.1,0.1,0.3l0.3-1.1c0.1,0.3,0.2,0.7,0.2,1C20,8.5,20,8.9,20,9.2c0,0.4-0.1,0.7-0.1,1
+      c-0.1,0.3-0.1,0.7-0.2,1s-0.2,0.6-0.3,0.8c-0.1,0.2-0.2,0.5-0.3,0.7C19.1,12.8,19.2,13,19.3,13.4L19.3,13.4z"/>
     </g>
   </defs>
   <use id="general" xlink:href="#general-shape"/>
   <use id="general-native" xlink:href="#general-shape"/>
   <use id="search" xlink:href="#search-shape"/>
   <use id="search-native" xlink:href="#search-shape"/>
   <use id="content" xlink:href="#content-shape"/>
   <use id="content-native" xlink:href="#content-shape"/>
--- a/browser/themes/shared/incontentprefs/preferences.inc.css
+++ b/browser/themes/shared/incontentprefs/preferences.inc.css
@@ -77,21 +77,21 @@ treecol {
   list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#search");
 }
 
 #category-content > .category-icon {
   list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#content");
 }
 
 #category-application > .category-icon {
-  list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#applications");
+  list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#content");
 }
 
 #category-privacy > .category-icon {
-  list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#privacy");
+  list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#security");
 }
 
 #category-security > .category-icon {
   list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#security");
 }
 
 #category-sync > .category-icon {
   list-style-image: url("chrome://browser/skin/preferences/in-content/icons.svg#sync");
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5484,22 +5484,22 @@
     "bug_numbers": [1276694],
     "alert_emails": ["gijs@mozilla.com"],
     "expires_in_version": "57",
     "keyed": true,
     "kind": "boolean",
     "releaseChannelCollection": "opt-out",
     "description": "Whether the browser we migrated from was the browser with the most recent data. Keyed by that browser's identifier (e.g. 'ie', 'edge', 'safari', etc.)."
   },
-  "FX_PREFERENCES_CATEGORY_OPENED": {
-    "bug_numbers": [1324167],
+  "FX_PREFERENCES_CATEGORY_OPENED_V2": {
+    "bug_numbers": [1335907],
     "alert_emails": ["jaws@mozilla.com"],
-    "expires_in_version": "56",
+    "expires_in_version": "59",
     "kind": "categorical",
-    "labels": ["unknown", "general", "search", "content", "applications", "privacy", "security", "sync", "advancedGeneral", "advancedDataChoices", "advancedNetwork", "advancedUpdates", "advancedCerts"],
+    "labels": ["unknown", "search-results", "general", "applications", "privacy", "sync", "advanced"],
     "releaseChannelCollection": "opt-out",
     "description": "Count how often each preference category is opened."
   },
   "INPUT_EVENT_RESPONSE_MS": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
     "bug_numbers": [1235908],
     "expires_in_version": "never",
     "kind": "exponential",