Bug 1560178 - fix/remove about:addons tests that load discovery pane in the parent, r=aswan a=RyanVM
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 12 Jul 2019 16:27:27 +0000
changeset 544670 20dec11dae3c02b4a87c7a9809de38262f61752d
parent 544669 6aa4c38274c43f00b98eeb974c7ee067dfc4e8e4
child 544671 823a920c31272d43d8790e9630f44391a4de4bcb
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan, RyanVM
bugs1560178
milestone69.0
Bug 1560178 - fix/remove about:addons tests that load discovery pane in the parent, r=aswan a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D36308
toolkit/mozapps/extensions/test/browser/browser_discovery.js
toolkit/mozapps/extensions/test/browser/browser_webapi_access.js
--- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js
@@ -211,17 +211,17 @@ function clickLink(aId, aCallback) {
       browser.removeProgressListener(gProgressListener);
       resolve();
     };
 
     var link = browser.contentDocument.getElementById(aId);
     EventUtils.sendMouseEvent({ type: "click" }, link);
 
     executeSoon(function() {
-      ok(isLoading(), "Clicking a link should show the loading pane");
+      ok(isLoading(), "Clicking link " + aId + " should show the loading pane");
     });
   });
   if (aCallback) {
     promise.then(aCallback);
   }
   return promise;
 }
 
@@ -349,73 +349,16 @@ add_test(async function() {
 
   var browser = gManagerWindow.document.getElementById("discover-browser");
   is(getURL(browser), MAIN_URL, "Should have loaded the right url");
 
   is(getHash(browser), null, "Hash should not have been passed");
   close_manager(gManagerWindow, run_next_test);
 });
 
-// Tests that navigating to an insecure page fails
-add_test(async function() {
-  let aWindow = await open_manager("addons://discover/");
-  gManagerWindow = aWindow;
-  gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
-  var browser = gManagerWindow.document.getElementById("discover-browser");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  await clickLink("link-http");
-  ok(isError(), "Should have shown the error page");
-
-  await gCategoryUtilities.openType("extension");
-  await gCategoryUtilities.openType("discover");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  close_manager(gManagerWindow, run_next_test);
-});
-
-// Tests that navigating to a different domain fails
-add_test(async function() {
-  let aWindow = await open_manager("addons://discover/");
-  gManagerWindow = aWindow;
-  gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
-  var browser = gManagerWindow.document.getElementById("discover-browser");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  await clickLink("link-domain");
-  ok(isError(), "Should have shown the error page");
-
-  await gCategoryUtilities.openType("extension");
-  await gCategoryUtilities.openType("discover");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  close_manager(gManagerWindow, run_next_test);
-});
-
-// Tests that navigating to a missing page fails
-add_test(async function() {
-  let aWindow = await open_manager("addons://discover/");
-  gManagerWindow = aWindow;
-  gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
-  var browser = gManagerWindow.document.getElementById("discover-browser");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  await clickLink("link-bad");
-  ok(isError(), "Should have shown the error page");
-
-  await gCategoryUtilities.openType("extension");
-  await gCategoryUtilities.openType("discover");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  close_manager(gManagerWindow, run_next_test);
-});
-
 // Tests that navigating to a page on the same domain works
 add_test(async function() {
   let aWindow = await open_manager("addons://discover/");
   gManagerWindow = aWindow;
   gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
   var browser = gManagerWindow.document.getElementById("discover-browser");
   is(getURL(browser), MAIN_URL, "Should have loaded the right url");
@@ -429,75 +372,32 @@ add_test(async function() {
 
   await gCategoryUtilities.openType("extension");
   await gCategoryUtilities.openType("discover");
   is(getURL(browser), MAIN_URL, "Should have loaded the right url");
 
   close_manager(gManagerWindow, run_next_test);
 });
 
-// Tests repeated navigation to the same page followed by a navigation to a
-// different domain
-add_test(async function() {
-  let aWindow = await open_manager("addons://discover/");
-  gManagerWindow = aWindow;
-  gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
-  var browser = gManagerWindow.document.getElementById("discover-browser");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  var count = 10;
-  function clickAgain(aCallback) {
-    if (count-- == 0) {
-      aCallback();
-    } else {
-      clickLink("link-normal", clickAgain.bind(null, aCallback));
-    }
-  }
-
-  clickAgain(async function() {
-    is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-    await clickLink("link-domain");
-    ok(isError(), "Should have shown the error page");
-
-    await gCategoryUtilities.openType("extension");
-    await gCategoryUtilities.openType("discover");
-    is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-    close_manager(gManagerWindow, run_next_test);
-  });
-});
-
 // Loading an insecure main page should work if that is what the prefs say, should
 // also be able to navigate to a https page and back again
 add_test(async function() {
   Services.prefs.setCharPref(PREF_DISCOVERURL, TESTROOT + "discovery.html");
 
   let aWindow = await open_manager("addons://discover/");
   gManagerWindow = aWindow;
   gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
   var browser = gManagerWindow.document.getElementById("discover-browser");
   is(
     getURL(browser),
     TESTROOT + "discovery.html",
     "Should have loaded the right url"
   );
 
-  await clickLink("link-normal");
-  is(getURL(browser), MAIN_URL, "Should have loaded the right url");
-
-  await clickLink("link-http");
-  is(
-    getURL(browser),
-    TESTROOT + "discovery.html",
-    "Should have loaded the right url"
-  );
-
   close_manager(gManagerWindow, run_next_test);
 });
 
 // Stopping the initial load should display the error page and then correctly
 // reload when switching away and back again
 add_test(async function() {
   Services.prefs.setCharPref(PREF_DISCOVERURL, MAIN_URL);
 
--- a/toolkit/mozapps/extensions/test/browser/browser_webapi_access.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_webapi_access.js
@@ -135,16 +135,20 @@ add_task(async function test_navigated_w
       gBrowser.removeTab(tab);
     }
   );
 });
 
 // Check that if a page is embedded in a chrome content UI that it can still
 // access the API.
 add_task(async function test_chrome_frame() {
+  SpecialPowers.pushPrefEnv({
+    set: [["security.allow_unsafe_parent_loads", true]],
+  });
+
   await BrowserTestUtils.withNewTab(
     `${CHROMEROOT}webapi_checkchromeframe.xul`,
     async function test_available(browser) {
       let available = await check_frame_availability(browser);
       ok(available, "API should be available.");
     }
   );
 });