Bug 1602318 - Make some browser tests wait on the test uri to load instead of any uri. r=kmag
authorMatt Woodrow <mwoodrow@mozilla.com>
Sun, 26 Apr 2020 00:52:11 +0000
changeset 526107 ab3a2afede33ffede263b0d3d779d619ab869aff
parent 526106 34931634acb78a051ecd2ea115b9ad3d07531e44
child 526108 77aaa5f1a81bec40e3a3f390868bcca01bfa4dde
push id37350
push usernbeleuzu@mozilla.com
push dateSun, 26 Apr 2020 09:43:12 +0000
treeherdermozilla-central@21659f178a12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1602318
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1602318 - Make some browser tests wait on the test uri to load instead of any uri. r=kmag Differential Revision: https://phabricator.services.mozilla.com/D70624
browser/base/content/test/general/browser_tab_detach_restore.js
browser/components/sessionstore/test/browser.ini
browser/components/sessionstore/test/browser_broadcast.js
browser/components/urlbar/tests/browser/browser_canonizeURL.js
dom/security/test/general/browser_test_referrer_loadInOtherProcess.js
--- a/browser/base/content/test/general/browser_tab_detach_restore.js
+++ b/browser/base/content/test/general/browser_tab_detach_restore.js
@@ -10,17 +10,17 @@ add_task(async function() {
 
   // Clear out the closed windows set to start
   while (SessionStore.getClosedWindowCount() > 0) {
     SessionStore.forgetClosedWindow(0);
   }
 
   let tab = BrowserTestUtils.addTab(gBrowser);
   BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
-  await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
+  await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, uri);
   await TabStateFlusher.flush(tab.linkedBrowser);
 
   let key = tab.linkedBrowser.permanentKey;
   let win = gBrowser.replaceTabWithWindow(tab);
   await new Promise(resolve => whenDelayedStartupFinished(win, resolve));
 
   is(
     win.gBrowser.selectedBrowser.permanentKey,
--- a/browser/components/sessionstore/test/browser.ini
+++ b/browser/components/sessionstore/test/browser.ini
@@ -79,17 +79,16 @@ run-if = e10s && crashreporter
 skip-if = debug # bug 1167933
 [browser_async_remove_tab.js]
 run-if = e10s
 skip-if = fission || debug # bug 1211084
 [browser_attributes.js]
 [browser_backup_recovery.js]
 skip-if = (verify && debug && (os == 'linux'))
 [browser_broadcast.js]
-skip-if = fission || (os == 'mac') || (os == 'linux' && !debug && bits == 64)  # Bug 1533895; Fission: SecurityError: The operation is insecure.
 [browser_capabilities.js]
 [browser_cleaner.js]
 [browser_crashedTabs.js]
 skip-if = !e10s || !crashreporter || verify
 [browser_pinned_tabs.js]
 skip-if = debug || ccov # Bug 1625525
 [browser_unrestored_crashedTabs.js]
 skip-if = !e10s || !crashreporter
--- a/browser/components/sessionstore/test/browser_broadcast.js
+++ b/browser/components/sessionstore/test/browser_broadcast.js
@@ -5,17 +5,17 @@
 
 const INITIAL_VALUE = "browser_broadcast.js-initial-value-" + Date.now();
 
 /**
  * This test ensures we won't lose tab data queued in the content script when
  * closing a tab.
  */
 add_task(async function flush_on_tabclose() {
-  let tab = await createTabWithStorageData(["http://example.com"]);
+  let tab = await createTabWithStorageData(["http://example.com/"]);
   let browser = tab.linkedBrowser;
 
   await modifySessionStorage(browser, { test: "on-tab-close" });
   await promiseRemoveTabAndSessionState(tab);
 
   let [
     {
       state: { storage },
@@ -28,17 +28,17 @@ add_task(async function flush_on_tabclos
   );
 });
 
 /**
  * This test ensures we won't lose tab data queued in the content script when
  * duplicating a tab.
  */
 add_task(async function flush_on_duplicate() {
-  let tab = await createTabWithStorageData(["http://example.com"]);
+  let tab = await createTabWithStorageData(["http://example.com/"]);
   let browser = tab.linkedBrowser;
 
   await modifySessionStorage(browser, { test: "on-duplicate" });
   let tab2 = ss.duplicateTab(window, tab);
   await promiseTabRestored(tab2);
 
   await promiseRemoveTabAndSessionState(tab2);
   let [
@@ -56,17 +56,17 @@ add_task(async function flush_on_duplica
 });
 
 /**
  * This test ensures we won't lose tab data queued in the content script when
  * a window is closed.
  */
 add_task(async function flush_on_windowclose() {
   let win = await promiseNewWindow();
-  let tab = await createTabWithStorageData(["http://example.com"], win);
+  let tab = await createTabWithStorageData(["http://example.com/"], win);
   let browser = tab.linkedBrowser;
 
   await modifySessionStorage(browser, { test: "on-window-close" });
   await BrowserTestUtils.closeWindow(win);
 
   let [
     {
       tabs: [, { storage }],
@@ -79,17 +79,17 @@ add_task(async function flush_on_windowc
   );
 });
 
 /**
  * This test ensures that stale tab data is ignored when reusing a tab
  * (via e.g. setTabState) and does not overwrite the new data.
  */
 add_task(async function flush_on_settabstate() {
-  let tab = await createTabWithStorageData(["http://example.com"]);
+  let tab = await createTabWithStorageData(["http://example.com/"]);
   let browser = tab.linkedBrowser;
 
   // Flush to make sure our tab state is up-to-date.
   await TabStateFlusher.flush(browser);
 
   let state = ss.getTabState(tab);
   await modifySessionStorage(browser, { test: "on-set-tab-state" });
 
@@ -110,17 +110,17 @@ add_task(async function flush_on_settabs
 });
 
 /**
  * This test ensures that we won't lose tab data that has been sent
  * asynchronously just before closing a tab. Flushing must re-send all data
  * that hasn't been received by chrome, yet.
  */
 add_task(async function flush_on_tabclose_racy() {
-  let tab = await createTabWithStorageData(["http://example.com"]);
+  let tab = await createTabWithStorageData(["http://example.com/"]);
   let browser = tab.linkedBrowser;
 
   // Flush to make sure we start with an empty queue.
   await TabStateFlusher.flush(browser);
 
   await modifySessionStorage(browser, { test: "on-tab-close-racy" });
 
   // Flush all data contained in the content script but send it using
@@ -147,14 +147,15 @@ function promiseNewWindow() {
 }
 
 async function createTabWithStorageData(urls, win = window) {
   let tab = BrowserTestUtils.addTab(win.gBrowser);
   let browser = tab.linkedBrowser;
 
   for (let url of urls) {
     BrowserTestUtils.loadURI(browser, url);
-    await promiseBrowserLoaded(browser);
+    await promiseBrowserLoaded(browser, true, url);
+    dump("Loaded url: " + url + "\n");
     await modifySessionStorage(browser, { test: INITIAL_VALUE });
   }
 
   return tab;
 }
--- a/browser/components/urlbar/tests/browser/browser_canonizeURL.js
+++ b/browser/components/urlbar/tests/browser/browser_canonizeURL.js
@@ -50,21 +50,26 @@ add_task(async function checkCtrlWorks()
   });
 
   for (let [inputValue, expectedURL, options] of testcases) {
     info(`Testing input string: "${inputValue}" - expected: "${expectedURL}"`);
     let promiseLoad = BrowserTestUtils.waitForDocLoadAndStopIt(
       expectedURL,
       gBrowser.selectedBrowser
     );
+    let promiseStopped = BrowserTestUtils.browserStopped(
+      gBrowser.selectedBrowser,
+      undefined,
+      true
+    );
     gURLBar.focus();
     gURLBar.inputField.value = inputValue.slice(0, -1);
     EventUtils.sendString(inputValue.slice(-1));
     EventUtils.synthesizeKey("KEY_Enter", options);
-    await promiseLoad;
+    await Promise.all([promiseLoad, promiseStopped]);
   }
 });
 
 add_task(async function checkPrefTurnsOffCanonize() {
   // Add a dummy search engine to avoid hitting the network.
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME
   );
--- a/dom/security/test/general/browser_test_referrer_loadInOtherProcess.js
+++ b/dom/security/test/general/browser_test_referrer_loadInOtherProcess.js
@@ -82,17 +82,17 @@ var checkResult = async function(isRemot
 var waitForLoad = async function(uri) {
   info("waitForLoad " + uri);
   let loadURIOptions = {
     triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
     referrerInfo,
   };
   gBrowser.selectedBrowser.webNavigation.loadURI(uri, loadURIOptions);
 
-  await BrowserTestUtils.browserStopped(gBrowser);
+  await BrowserTestUtils.browserStopped(gBrowser, uri);
 };
 
 // Tests referrerInfo when navigating from a page in the remote process to main
 // process and vice versa.
 // The changing process code flow is (cpp) docshell.shouldLoadURI
 // -> (JS) browser.shouldLoadURI -> E10sUtils.redirectLoad
 // -> ContentRestore.restoreTabContent.
 // Finally, docshell will do the load in correct process with the input