Bug 1365133 - Update tests - Part 2. draft
authorEvan Tseng <evan@tseng.io>
Tue, 20 Jun 2017 15:11:46 +0800
changeset 607492 89cf60ac69ee8d478d113c959c56d52460d3f0c1
parent 607491 cf24dc6a6da232c10784f7075e0cc0e6205bca30
child 637034 8e75fe8f19da8117b79341d0ef5d29f252402fa0
push id67991
push userbmo:evan@tseng.io
push dateWed, 12 Jul 2017 09:14:44 +0000
bugs1365133
milestone56.0a1
Bug 1365133 - Update tests - Part 2. MozReview-Commit-ID: GoOXdJ4RfY9
browser/base/content/test/alerts/browser_notification_open_settings.js
browser/base/content/test/urlbar/browser_urlbarSearchSuggestions_opt-out.js
browser/base/content/urlbarBindings.xml
browser/components/preferences/in-content-new/privacy.js
browser/components/preferences/in-content-new/sync.js
browser/components/preferences/in-content-new/tests/browser.ini
browser/components/preferences/in-content-new/tests/browser_applications_selection.js
browser/components/preferences/in-content-new/tests/browser_bug1018066_resetScrollPosition.js
browser/components/preferences/in-content-new/tests/browser_bug1020245_openPreferences_to_paneContent.js
browser/components/preferences/in-content-new/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
browser/components/preferences/in-content-new/tests/browser_bug410900.js
browser/components/preferences/in-content-new/tests/browser_bug731866.js
browser/components/preferences/in-content-new/tests/browser_change_app_handler.js
browser/components/preferences/in-content-new/tests/browser_engines.js
browser/components/preferences/in-content-new/tests/browser_search_subdialogs_within_preferences_2.js
browser/components/preferences/in-content-new/tests/browser_search_within_preferences_1.js
browser/components/preferences/in-content-new/tests/browser_searchsuggestions.js
browser/components/preferences/in-content-new/tests/browser_security-1.js
browser/components/preferences/in-content-new/tests/browser_security-2.js
browser/components/preferences/in-content-new/tests/browser_security.js
browser/components/search/content/search.xml
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/test/browser/browser_experiments.js
--- a/browser/base/content/test/alerts/browser_notification_open_settings.js
+++ b/browser/base/content/test/alerts/browser_notification_open_settings.js
@@ -3,37 +3,53 @@
 var notificationURL = "http://example.org/browser/browser/base/content/test/alerts/file_dom_notifications.html";
 
 add_task(async function test_settingsOpen_observer() {
   info("Opening a dummy tab so openPreferences=>switchToTabHavingURI doesn't use the blank tab.");
   await BrowserTestUtils.withNewTab({
     gBrowser,
     url: "about:robots"
   }, async function dummyTabTask(aBrowser) {
+    // Ensure preferences is loaded before removing the tab.
+    let isPreferencesLoaded = false;
+    let waitForPreferencesLoaded = function() {
+      isPreferencesLoaded = true;
+    };
+    Services.obs.addObserver(waitForPreferencesLoaded, "sync-pane-loaded");
+
     let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:preferences#privacy");
     info("simulate a notifications-open-settings notification");
     let uri = NetUtil.newURI("https://example.com");
     let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
     Services.obs.notifyObservers(principal, "notifications-open-settings");
     let tab = await tabPromise;
     ok(tab, "The notification settings tab opened");
+    await BrowserTestUtils.waitForCondition(() => isPreferencesLoaded);
+    Services.obs.removeObserver(waitForPreferencesLoaded, "sync-pane-loaded");
     await BrowserTestUtils.removeTab(tab);
   });
 });
 
 add_task(async function test_settingsOpen_button() {
   let pm = Services.perms;
   info("Adding notification permission");
   pm.add(makeURI(notificationURL), "desktop-notification", pm.ALLOW_ACTION);
 
   try {
     await BrowserTestUtils.withNewTab({
       gBrowser,
       url: notificationURL
     }, async function tabTask(aBrowser) {
+      // Ensure preferences is loaded before removing the tab.
+      let isPreferencesLoaded = false;
+      let waitForPreferencesLoaded = function() {
+        isPreferencesLoaded = true;
+      };
+      Services.obs.addObserver(waitForPreferencesLoaded, "sync-pane-loaded");
+
       info("Waiting for notification");
       await openNotification(aBrowser, "showNotification2");
 
       let alertWindow = Services.wm.getMostRecentWindow("alert:alert");
       if (!alertWindow) {
         ok(true, "Notifications don't use XUL windows on all platforms.");
         await closeNotification(aBrowser);
         return;
@@ -42,16 +58,18 @@ add_task(async function test_settingsOpe
       let closePromise = promiseWindowClosed(alertWindow);
       let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:preferences#privacy");
       let openSettingsMenuItem = alertWindow.document.getElementById("openSettingsMenuItem");
       openSettingsMenuItem.click();
 
       info("Waiting for notification settings tab");
       let tab = await tabPromise;
       ok(tab, "The notification settings tab opened");
+      await BrowserTestUtils.waitForCondition(() => isPreferencesLoaded);
+      Services.obs.removeObserver(waitForPreferencesLoaded, "sync-pane-loaded");
 
       await closePromise;
       await BrowserTestUtils.removeTab(tab);
     });
   } finally {
     info("Removing notification permission");
     pm.remove(makeURI(notificationURL), "desktop-notification");
   }
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions_opt-out.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions_opt-out.js
@@ -51,17 +51,17 @@ add_task(async function focus() {
   EventUtils.synthesizeKey("d", {});
   await promiseSearchComplete();
   Assert.ok(suggestionsPresent());
   assertVisible(true);
   assertFooterVisible(true);
 
   // Check the Change Options link.
   let changeOptionsLink = document.getElementById("search-suggestions-change-settings");
-  let prefsPromise = BrowserTestUtils.waitForLocationChange(gBrowser, "about:preferences#general-search");
+  let prefsPromise = BrowserTestUtils.waitForLocationChange(gBrowser, "about:preferences#search");
   changeOptionsLink.click();
   await prefsPromise;
   Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
   // The preferences page does fancy stuff with focus, ensure to unload it.
   await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "about:blank");
 });
 
 add_task(async function new_tab() {
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1607,17 +1607,17 @@ file, You can obtain one at http://mozil
                      role="link"
 #ifdef XP_WIN
                      value="&urlbar.searchSuggestionsNotification.changeSettingsWin;"
                      accesskey="&urlbar.searchSuggestionsNotification.changeSettingsWin.accesskey;"
 #else
                      value="&urlbar.searchSuggestionsNotification.changeSettingsUnix;"
                      accesskey="&urlbar.searchSuggestionsNotification.changeSettingsUnix.accesskey;"
 #endif
-                     onclick="Preferences.get('browser.preferences.useOldOrganization') ? openPreferences('paneSearch') : openPreferences('general-search');"
+                     onclick="openPreferences('paneSearch');"
                      control="search-suggestions-change-settings"/>
         </xul:hbox>
       </xul:deck>
       <xul:richlistbox anonid="richlistbox" class="autocomplete-richlistbox"
                        flex="1"/>
       <xul:hbox anonid="footer">
         <children/>
         <xul:vbox anonid="one-off-search-buttons"
--- a/browser/components/preferences/in-content-new/privacy.js
+++ b/browser/components/preferences/in-content-new/privacy.js
@@ -283,16 +283,21 @@ var gPrivacyPane = {
     appendSearchKeywords("viewSecurityDevicesButton", [
       pkiBundle.getString("enable_fips"),
     ]);
     appendSearchKeywords("siteDataSettings", [
       bundlePrefs.getString("siteDataSettings.description"),
       bundlePrefs.getString("removeAllCookies.label"),
       bundlePrefs.getString("removeSelectedCookies.label"),
     ]);
+
+    // Notify observers that the UI is now ready
+    Components.classes["@mozilla.org/observer-service;1"]
+              .getService(Components.interfaces.nsIObserverService)
+              .notifyObservers(window, "privacy-pane-loaded");
   },
 
   // TRACKING PROTECTION MODE
 
   /**
    * Selects the right item of the Tracking Protection radiogroup.
    */
   trackingProtectionReadPrefs() {
--- a/browser/components/preferences/in-content-new/sync.js
+++ b/browser/components/preferences/in-content-new/sync.js
@@ -125,16 +125,21 @@ var gSyncPane = {
     document.getElementById("tosPP-small-ToS").setAttribute("href", Weave.Svc.Prefs.get("fxa.termsURL"));
     document.getElementById("tosPP-small-PP").setAttribute("href", Weave.Svc.Prefs.get("fxa.privacyURL"));
 
     fxAccounts.promiseAccountsManageURI(this._getEntryPoint()).then(accountsManageURI => {
       document.getElementById("verifiedManage").setAttribute("href", accountsManageURI);
     });
 
     this.updateWeavePrefs();
+
+    // Notify observers that the UI is now ready
+    Components.classes["@mozilla.org/observer-service;1"]
+              .getService(Components.interfaces.nsIObserverService)
+              .notifyObservers(window, "sync-pane-loaded");
   },
 
   _toggleComputerNameControls(editMode) {
     let textbox = document.getElementById("fxaSyncComputerName");
     textbox.disabled = !editMode;
     document.getElementById("fxaChangeDeviceName").hidden = editMode;
     document.getElementById("fxaCancelChangeDeviceName").hidden = !editMode;
     document.getElementById("fxaSaveChangeDeviceName").hidden = !editMode;
--- a/browser/components/preferences/in-content-new/tests/browser.ini
+++ b/browser/components/preferences/in-content-new/tests/browser.ini
@@ -48,17 +48,18 @@ skip-if = e10s
 [browser_proxy_backup.js]
 [browser_privacypane_1.js]
 [browser_privacypane_3.js]
 [browser_privacypane_4.js]
 [browser_privacypane_5.js]
 [browser_privacypane_8.js]
 [browser_sanitizeOnShutdown_prefLocked.js]
 [browser_searchsuggestions.js]
-[browser_security.js]
+[browser_security-1.js]
+[browser_security-2.js]
 [browser_siteData.js]
 [browser_siteData2.js]
 [browser_site_login_exceptions.js]
 [browser_subdialogs.js]
 support-files =
   subdialog.xul
   subdialog2.xul
 [browser_telemetry.js]
--- a/browser/components/preferences/in-content-new/tests/browser_applications_selection.js
+++ b/browser/components/preferences/in-content-new/tests/browser_applications_selection.js
@@ -1,17 +1,17 @@
 var win;
 var feedItem;
 var container;
 
 SimpleTest.requestCompleteLog();
 
 add_task(async function setup() {
-  await openPreferencesViaOpenPreferencesAPI("applications", {leaveOpen: true});
-  info("Preferences page opened on the applications pane.");
+  await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
+  info("Preferences page opened on the paneGeneral pane.");
 
   registerCleanupFunction(() => {
     gBrowser.removeCurrentTab();
   });
 });
 
 add_task(async function getFeedItem() {
   win = gBrowser.selectedBrowser.contentWindow;
--- a/browser/components/preferences/in-content-new/tests/browser_bug1018066_resetScrollPosition.js
+++ b/browser/components/preferences/in-content-new/tests/browser_bug1018066_resetScrollPosition.js
@@ -6,19 +6,18 @@ registerCleanupFunction(function() {
   window.resizeTo(window.outerWidth, originalWindowHeight);
   while (gBrowser.tabs[1])
     gBrowser.removeTab(gBrowser.tabs[1]);
 });
 
 add_task(async function() {
   originalWindowHeight = window.outerHeight;
   window.resizeTo(window.outerWidth, 300);
-  let prefs = await openPreferencesViaOpenPreferencesAPI("paneApplications", {leaveOpen: true});
-  is(prefs.selectedPane, "paneApplications", "Applications pane was selected");
+  let prefs = await openPreferencesViaOpenPreferencesAPI("paneSearch", {leaveOpen: true});
+  is(prefs.selectedPane, "paneSearch", "Search pane was selected");
   let mainContent = gBrowser.contentDocument.querySelector(".main-content");
   mainContent.scrollTop = 50;
   is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels");
 
   gBrowser.contentWindow.gotoPref("paneGeneral");
   is(mainContent.scrollTop, 0,
      "Switching to a different category should reset the scroll position");
 });
-
--- a/browser/components/preferences/in-content-new/tests/browser_bug1020245_openPreferences_to_paneContent.js
+++ b/browser/components/preferences/in-content-new/tests/browser_bug1020245_openPreferences_to_paneContent.js
@@ -6,60 +6,47 @@ Services.prefs.setBoolPref("browser.pref
 registerCleanupFunction(function() {
   Services.prefs.clearUserPref("browser.preferences.instantApply");
 });
 
 // Test opening to the differerent panes and subcategories in Preferences
 add_task(async function() {
   let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy");
   is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
-  prefs = await openPreferencesViaOpenPreferencesAPI("advanced");
-  is(prefs.selectedPane, "paneAdvanced", "Advanced pane was selected");
   prefs = await openPreferencesViaHash("privacy");
   is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected when hash is 'privacy'");
   prefs = await openPreferencesViaOpenPreferencesAPI("nonexistant-category");
   is(prefs.selectedPane, "paneGeneral", "General pane is selected by default when a nonexistant-category is requested");
   prefs = await openPreferencesViaHash("nonexistant-category");
   is(prefs.selectedPane, "paneGeneral", "General pane is selected when hash is a nonexistant-category");
   prefs = await openPreferencesViaHash();
   is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
   prefs = await openPreferencesViaOpenPreferencesAPI("privacy-reports", {leaveOpen: true});
   is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected by default");
   let doc = gBrowser.contentDocument;
   is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
   ok(doc.querySelector("#locationBarGroup").hidden, "Location Bar prefs should be hidden when only Reports are requested");
-  ok(!doc.querySelector("#header-privacy").hidden, "The header should be visible when a subcategory is requested");
-  await BrowserTestUtils.removeTab(gBrowser.selectedTab);
-  prefs = await openPreferencesViaOpenPreferencesAPI("general-search", {leaveOpen: true});
-  is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
-  doc = gBrowser.contentDocument;
-  is(doc.location.hash, "#general", "The subcategory should be removed from the URI");
-  ok(doc.querySelector("#startupGroup").hidden, "Startup should be hidden when only Search is requested");
-  ok(!doc.querySelector("#engineList").hidden, "The search engine list should be visible when Search is requested");
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 // Test opening Preferences with subcategory on an existing Preferences tab. See bug 1358475.
 add_task(async function() {
-  let prefs = await openPreferencesViaOpenPreferencesAPI("general-search", {leaveOpen: true});
+  let prefs = await openPreferencesViaOpenPreferencesAPI("general", {leaveOpen: true});
   is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
   let doc = gBrowser.contentDocument;
   is(doc.location.hash, "#general", "The subcategory should be removed from the URI");
-  ok(doc.querySelector("#startupGroup").hidden, "Startup should be hidden when only Search is requested");
-  ok(!doc.querySelector("#engineList").hidden, "The search engine list should be visible when Search is requested");
   // The reasons that here just call the `openPreferences` API without the helping function are
   //   - already opened one about:preferences tab up there and
   //   - the goal is to test on the existing tab and
   //   - using `openPreferencesViaOpenPreferencesAPI` would introduce more handling of additional about:blank and unneccessary event
   openPreferences("privacy-reports");
   let selectedPane = gBrowser.contentWindow.history.state;
   is(selectedPane, "panePrivacy", "Privacy pane should be selected");
   is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
   ok(doc.querySelector("#locationBarGroup").hidden, "Location Bar prefs should be hidden when only Reports are requested");
-  ok(!doc.querySelector("#header-privacy").hidden, "The header should be visible when a subcategory is requested");
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 
 function openPreferencesViaHash(aPane) {
   return new Promise(resolve => {
     gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:preferences" + (aPane ? "#" + aPane : ""));
     let newTabBrowser = gBrowser.selectedBrowser;
--- a/browser/components/preferences/in-content-new/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
+++ b/browser/components/preferences/in-content-new/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js
@@ -35,17 +35,17 @@ add_task(async function() {
 
     // Test radio
     let radiogroup = doc.getElementById("radiogroup");
     radiogroup.focus();
     EventUtils.synthesizeKey(" ", {});
     await checkPageScrolling(container, "radio");
   });
 
-  await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences" }, async function(browser) {
+  await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, async 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-new/tests/browser_bug410900.js
+++ b/browser/components/preferences/in-content-new/tests/browser_bug410900.js
@@ -17,17 +17,17 @@ function test() {
               getService(Ci.nsIExternalProtocolService);
   var info = extps.getProtocolHandlerInfo("apppanetest");
   info.possibleApplicationHandlers.appendElement(handler);
 
   var hserv = Cc["@mozilla.org/uriloader/handler-service;1"].
               getService(Ci.nsIHandlerService);
   hserv.store(info);
 
-  openPreferencesViaOpenPreferencesAPI("applications", {leaveOpen: true}).then(
+  openPreferencesViaOpenPreferencesAPI("general", {leaveOpen: true}).then(
       () => runTest(gBrowser.selectedBrowser.contentWindow)
   );
 }
 
 function runTest(win) {
   var rbox = win.document.getElementById("handlersView");
   ok(rbox, "handlersView is present");
 
--- a/browser/components/preferences/in-content-new/tests/browser_bug731866.js
+++ b/browser/components/preferences/in-content-new/tests/browser_bug731866.js
@@ -57,18 +57,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", "Applications",
-    "Privacy", "Sync", "Advanced",
+    "General", "Search",
+    "Privacy", "Sync",
   ];
 
   for (let pane of panes) {
     win.gotoPref("pane" + pane);
     checkElements(pane);
   }
 
   gBrowser.removeCurrentTab();
--- a/browser/components/preferences/in-content-new/tests/browser_change_app_handler.js
+++ b/browser/components/preferences/in-content-new/tests/browser_change_app_handler.js
@@ -11,18 +11,29 @@ function setupFakeHandler() {
   let infoToModify = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null);
   infoToModify.possibleApplicationHandlers.appendElement(handler);
 
   gHandlerSvc.store(infoToModify);
 }
 
 add_task(async function() {
   setupFakeHandler();
-  await openPreferencesViaOpenPreferencesAPI("applications", {leaveOpen: true});
-  info("Preferences page opened on the applications pane.");
+
+  // Ensure preferences is loaded before testing.
+  let isPreferencesLoaded = false;
+  let waitForPreferencesLoaded = function() {
+    isPreferencesLoaded = true;
+  };
+  Services.obs.addObserver(waitForPreferencesLoaded, "sync-pane-loaded");
+  await BrowserTestUtils.waitForCondition(() => isPreferencesLoaded);
+  Services.obs.removeObserver(waitForPreferencesLoaded, "sync-pane-loaded");
+
+  let prefs = await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
+  is(prefs.selectedPane, "paneGeneral", "General pane was selected");
+  await BrowserTestUtils.waitForCondition(() => isGeneralPaneLoaded);
   let win = gBrowser.selectedBrowser.contentWindow;
 
   let container = win.document.getElementById("handlersView");
   let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']");
   ok(ourItem, "handlersView is present");
   ourItem.scrollIntoView();
   container.selectItem(ourItem);
   ok(ourItem.selected, "Should be able to select our item.");
@@ -83,16 +94,18 @@ add_task(async function() {
   ok(!mimeInfo.preferredApplicationHandler, "App should no longer be set as preferred.");
 
   // Check that we display this result:
   list = await waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu"));
   ok(list.selectedItem, "Should have a selected item");
   ok(!list.selectedItem.handlerApp,
      "No app should be visible as preferred item.");
 
+  let tabRemovedPromise = BrowserTestUtils.tabRemoved(gBrowser.selectedTab);
   gBrowser.removeCurrentTab();
+  await tabRemovedPromise;
 });
 
 registerCleanupFunction(function() {
   let infoToModify = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null);
   gHandlerSvc.remove(infoToModify);
 });
 
--- a/browser/components/preferences/in-content-new/tests/browser_engines.js
+++ b/browser/components/preferences/in-content-new/tests/browser_engines.js
@@ -1,12 +1,12 @@
 // Test Engine list
 add_task(async function() {
-  let prefs = await openPreferencesViaOpenPreferencesAPI("general-search", {leaveOpen: true});
-  is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
+  let prefs = await openPreferencesViaOpenPreferencesAPI("search", {leaveOpen: true});
+  is(prefs.selectedPane, "paneSearch", "Search pane is selected by default");
   let doc = gBrowser.contentDocument;
 
   let tree = doc.querySelector("#engineList");
   ok(!tree.hidden, "The search engine list should be visible when Search is requested");
 
   // Check for default search engines to be displayed in the engineList
   let defaultEngines = Services.search.getDefaultEngines();
   for (let i = 0; i < defaultEngines.length; i++) {
--- a/browser/components/preferences/in-content-new/tests/browser_search_subdialogs_within_preferences_2.js
+++ b/browser/components/preferences/in-content-new/tests/browser_search_subdialogs_within_preferences_2.js
@@ -46,11 +46,11 @@ add_task(async function() {
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 /**
  * Test for searching for the "Notification Permissions" subdialog.
  */
 add_task(async function() {
   await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
-  evaluateSearchResults("request permission again", "notificationsGroup");
+  evaluateSearchResults("request permission again", "permissionsGroup");
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
--- a/browser/components/preferences/in-content-new/tests/browser_search_within_preferences_1.js
+++ b/browser/components/preferences/in-content-new/tests/browser_search_within_preferences_1.js
@@ -111,26 +111,34 @@ add_task(async function() {
 
   // Takes search off
   searchInput.value = "";
   searchInput.doCommand();
 
   // Checks if back to generalPane
   for (let i = 0; i < mainPrefTag.childElementCount; i++) {
     let child = mainPrefTag.children[i]
-    if (child.id == "startupGroup"
-    || child.id == "defaultEngineGroup"
-    || child.id == "oneClickSearchProvidersGroup"
-    || child.id == "paneGeneral"
-    || child.id == "accessibilityGroup"
+    if (child.id == "paneGeneral"
+    || child.id == "startupGroup"
     || child.id == "languagesGroup"
     || child.id == "fontsGroup"
+    || child.id == "downloadsGroup"
+    || child.id == "applicationsGroup"
+    || child.id == "drmGroup"
+    || child.id == "updateApp"
     || child.id == "browsingGroup"
     || child.id == "performanceGroup"
-    || child.id == "header-general") {
+    || child.id == "connectionGroup"
+    || child.id == "generalCategory"
+    || child.id == "languageAndAppearanceCategory"
+    || child.id == "filesAndApplicationsCategory"
+    || child.id == "updatesCategory"
+    || child.id == "performanceCategory"
+    || child.id == "browsingCategory"
+    || child.id == "networkProxyCategory") {
       is_element_visible(child, "Should be in general tab");
     } else if (child.id) {
       is_element_hidden(child, "Should not be in general tab");
     }
   }
 
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
@@ -165,17 +173,17 @@ add_task(async function() {
   await BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 /**
  * Test for if we go back to general tab after search case
  */
 add_task(async function() {
   await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
-  let generalPane = gBrowser.contentDocument.getElementById("header-general");
+  let generalPane = gBrowser.contentDocument.getElementById("generalCategory");
 
   is_element_hidden(generalPane, "Should not be in general");
 
   // Performs search
   let searchInput = gBrowser.contentDocument.getElementById("searchInput");
 
   is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
     "Search input should be focused when visiting preferences");
@@ -195,17 +203,17 @@ add_task(async function() {
 
 /**
  * Test for "Site Data" case, verifying elements with data-hidden-from-search = true
  * are hidden in search result.
  */
 add_task(async function() {
   await SpecialPowers.pushPrefEnv({"set": [["browser.storageManager.enabled", false]]});
   await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
-  let generalPane = gBrowser.contentDocument.getElementById("header-general");
+  let generalPane = gBrowser.contentDocument.getElementById("generalCategory");
 
   is_element_hidden(generalPane, "Should not be in general");
 
   // Performs search
   let searchInput = gBrowser.contentDocument.getElementById("searchInput");
 
   is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"),
     "Search input should be focused when visiting preferences");
--- a/browser/components/preferences/in-content-new/tests/browser_searchsuggestions.js
+++ b/browser/components/preferences/in-content-new/tests/browser_searchsuggestions.js
@@ -3,34 +3,34 @@ var original = Services.prefs.getBoolPre
 registerCleanupFunction(() => {
   Services.prefs.setBoolPref("browser.search.suggest.enabled", original);
 });
 
 // Open with suggestions enabled
 add_task(async function() {
   Services.prefs.setBoolPref("browser.search.suggest.enabled", true);
 
-  await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
+  await openPreferencesViaOpenPreferencesAPI("search", { leaveOpen: true });
 
   let doc = gBrowser.selectedBrowser.contentDocument;
   let urlbarBox = doc.getElementById("urlBarSuggestion");
   ok(!urlbarBox.disabled, "Checkbox should be enabled");
 
   Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
 
   ok(urlbarBox.disabled, "Checkbox should be disabled");
 
   gBrowser.removeCurrentTab();
 });
 
 // Open with suggestions disabled
 add_task(async function() {
   Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
 
-  await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
+  await openPreferencesViaOpenPreferencesAPI("search", { leaveOpen: true });
 
   let doc = gBrowser.selectedBrowser.contentDocument;
   let urlbarBox = doc.getElementById("urlBarSuggestion");
   ok(urlbarBox.disabled, "Checkbox should be disabled");
 
   Services.prefs.setBoolPref("browser.search.suggest.enabled", true);
 
   ok(!urlbarBox.disabled, "Checkbox should be enabled");
rename from browser/components/preferences/in-content-new/tests/browser_security.js
rename to browser/components/preferences/in-content-new/tests/browser_security-1.js
--- a/browser/components/preferences/in-content-new/tests/browser_security.js
+++ b/browser/components/preferences/in-content-new/tests/browser_security-1.js
@@ -61,83 +61,8 @@ add_task(async function() {
     is(blockUncommon.hasAttribute("disabled"), !checked || !blockDownloads.checked, "block uncommon checkbox is set correctly");
   }
 
   await checkPrefSwitch(true, true);
   await checkPrefSwitch(false, true);
   await checkPrefSwitch(true, false);
   await checkPrefSwitch(false, false);
 });
-
-// test the download protection preference
-add_task(async function() {
-  async function checkPrefSwitch(val) {
-    Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", val);
-
-    gBrowser.reload();
-    await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-
-    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");
-
-    // 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");
-
-  }
-
-  await checkPrefSwitch(true);
-  await checkPrefSwitch(false);
-});
-
-// test the unwanted/uncommon software warning preference
-add_task(async function() {
-  async 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);
-
-    gBrowser.reload();
-    await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-
-    let doc = gBrowser.selectedBrowser.contentDocument;
-    let checkbox = doc.getElementById("blockUncommonUnwanted");
-    let checked = checkbox.checked;
-    is(checked, val1 && val2, "unwanted/uncommon preference is initialized correctly");
-
-    // 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");
-
-    // when the preference is on, the malware table should include these ids
-    let malwareTable = Services.prefs.getCharPref("urlclassifier.malwareTable").split(",");
-    is(malwareTable.includes("goog-unwanted-shavar"), !checked,
-       "malware table doesn't include goog-unwanted-shavar");
-    is(malwareTable.includes("test-unwanted-simple"), !checked,
-       "malware table doesn't include test-unwanted-simple");
-    let sortedMalware = malwareTable.slice(0);
-    sortedMalware.sort();
-    Assert.deepEqual(malwareTable, sortedMalware, "malware table has been sorted");
-
-  }
-
-  await checkPrefSwitch(true, true);
-  await checkPrefSwitch(false, true);
-  await checkPrefSwitch(true, false);
-  await checkPrefSwitch(false, false);
-});
copy from browser/components/preferences/in-content-new/tests/browser_security.js
copy to browser/components/preferences/in-content-new/tests/browser_security-2.js
--- a/browser/components/preferences/in-content-new/tests/browser_security.js
+++ b/browser/components/preferences/in-content-new/tests/browser_security-2.js
@@ -21,57 +21,16 @@ registerCleanupFunction(function() {
 // to help improve test times on debug builds.
 add_task(async function setup() {
   await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
   registerCleanupFunction(async function() {
     await BrowserTestUtils.removeTab(gBrowser.selectedTab);
   });
 });
 
-// test the safebrowsing preference
-add_task(async function() {
-  async function checkPrefSwitch(val1, val2) {
-    Services.prefs.setBoolPref("browser.safebrowsing.phishing.enabled", val1);
-    Services.prefs.setBoolPref("browser.safebrowsing.malware.enabled", val2);
-
-    gBrowser.reload();
-    await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-
-    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");
-
-    // 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");
-
-    // check if the other checkboxes have updated
-    checked = checkbox.checked;
-    is(blockDownloads.hasAttribute("disabled"), !checked, "block downloads checkbox is set correctly");
-    is(blockUncommon.hasAttribute("disabled"), !checked || !blockDownloads.checked, "block uncommon checkbox is set correctly");
-  }
-
-  await checkPrefSwitch(true, true);
-  await checkPrefSwitch(false, true);
-  await checkPrefSwitch(true, false);
-  await checkPrefSwitch(false, false);
-});
-
 // test the download protection preference
 add_task(async function() {
   async function checkPrefSwitch(val) {
     Services.prefs.setBoolPref("browser.safebrowsing.downloads.enabled", val);
 
     gBrowser.reload();
     await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
 
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -1468,21 +1468,17 @@
           this._engines = null;
         ]]></body>
       </method>
 
       <method name="showSettings">
         <body><![CDATA[
           BrowserUITelemetry.countSearchSettingsEvent(this.telemetryOrigin);
 
-          if (Preferences.get("browser.preferences.useOldOrganization")) {
-            openPreferences("paneSearch", {origin: "contentSearch"});
-          } else {
-            openPreferences("general-search", {origin: "contentSearch"});
-          }
+          openPreferences("paneSearch", {origin: "contentSearch"});
 
           // If the preference tab was already selected, the panel doesn't
           // close itself automatically.
           this.popup.hidePopup();
         ]]></body>
       </method>
 
       <!-- Updates the parts of the UI that show the query string. -->
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1504,17 +1504,17 @@ var gViewController = {
       },
       doCommand() {
         let mainWindow = getMainWindowWithPreferencesPane();
         // The advanced subpanes are only supported in the old organization, which will
         // be removed by bug 1349689.
         if (Preferences.get("browser.preferences.useOldOrganization")) {
           mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "experimentsOpenPref"});
         } else {
-          mainWindow.openPreferences("paneAdvanced", {origin: "experimentsOpenPref"});
+          mainWindow.openPreferences("panePrivacy", {origin: "experimentsOpenPref"});
         }
       },
     },
 
     cmd_showUnsignedExtensions: {
       isEnabled() {
         return true;
       },
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_experiments.js
@@ -164,31 +164,31 @@ add_task(async function testExperimentLe
 add_task(async function testOpenPreferences() {
   await gCategoryUtilities.openType("experiment");
   let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
 
   is_element_visible(btn, "Change telemetry button visible in in-content UI.");
 
   let deferred = Promise.defer();
   Services.obs.addObserver(function observer(prefWin, topic, data) {
-    Services.obs.removeObserver(observer, "advanced-pane-loaded");
-    info("Advanced preference pane opened.");
+    Services.obs.removeObserver(observer, "privacy-pane-loaded");
+    info("Privacy preference pane opened.");
     executeSoon(function() {
       // We want this test to fail if the preferences pane changes,
       // but we can't check if the data-choices button is visible
       // since it is only in the DOM when MOZ_TELEMETRY_REPORTING=1.
-      let el = prefWin.document.getElementById("header-advanced");
+      let el = prefWin.document.getElementById("dataCollectionCategory");
       is_element_visible(el);
 
       prefWin.close();
       info("Closed preferences pane.");
 
       deferred.resolve();
     });
-  }, "advanced-pane-loaded");
+  }, "privacy-pane-loaded");
 
   info("Loading preferences pane.");
   // We need to focus before synthesizing the mouse event (bug 1240052) as
   // synthesizeMouseAtCenter currently only synthesizes the mouse in the child process.
   // This can cause some subtle differences if the child isn't focused.
   await SimpleTest.promiseFocus();
   await BrowserTestUtils.synthesizeMouseAtCenter("#experiments-change-telemetry", {},
                                                  gBrowser.selectedBrowser);