Bug 1492482 - Remove CPOW usage from browser_urlbarKeepStateAcrossTabSwitches.js. r=Gijs
authorMike Conley <mconley@mozilla.com>
Tue, 02 Oct 2018 17:56:57 +0000
changeset 494964 17c32940a63fed73043fb6ce13483b567a62259e
parent 494963 159f859490af5faf83fd8d967f22af51e9b4f88f
child 494965 517aee4235da13396a5e3dfd5dda8098277981c5
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1492482
milestone64.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 1492482 - Remove CPOW usage from browser_urlbarKeepStateAcrossTabSwitches.js. r=Gijs Depends on D6953 Differential Revision: https://phabricator.services.mozilla.com/D6954
browser/base/content/test/urlbar/browser_urlbarKeepStateAcrossTabSwitches.js
--- a/browser/base/content/test/urlbar/browser_urlbarKeepStateAcrossTabSwitches.js
+++ b/browser/base/content/test/urlbar/browser_urlbarKeepStateAcrossTabSwitches.js
@@ -3,19 +3,23 @@
 /**
  * Verify user typed text remains in the URL bar when tab switching, even when
  * loads fail.
  */
 add_task(async function() {
   let input = "i-definitely-dont-exist.example.com";
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false);
   let browser = tab.linkedBrowser;
-  // NB: CPOW usage because new tab pages can be preloaded, in which case no
-  // load events fire.
-  await BrowserTestUtils.waitForCondition(() => browser.contentDocumentAsCPOW && !browser.contentDocumentAsCPOW.hidden);
+  // Note: Waiting on content document not being hidden because new tab pages can be preloaded,
+  // in which case no load events fire.
+  await ContentTask.spawn(browser, null, async () => {
+    await ContentTaskUtils.waitForCondition(() => {
+      return content.document && !content.document.hidden;
+    });
+  });
   let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser);
   gURLBar.value = input;
   gURLBar.select();
   EventUtils.sendKey("return");
   await errorPageLoaded;
   is(gURLBar.textValue, input, "Text is still in URL bar");
   await BrowserTestUtils.switchTab(gBrowser, tab.previousElementSibling);
   await BrowserTestUtils.switchTab(gBrowser, tab);
@@ -27,19 +31,23 @@ add_task(async function() {
  * Invalid URIs fail differently (that is, immediately, in the loadURI call)
  * if keyword searches are turned off. Test that this works, too.
  */
 add_task(async function() {
   let input = "To be or not to be-that is the question";
   await SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]});
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false);
   let browser = tab.linkedBrowser;
-  // NB: CPOW usage because new tab pages can be preloaded, in which case no
-  // load events fire.
-  await BrowserTestUtils.waitForCondition(() => browser.contentDocumentAsCPOW && !browser.contentDocumentAsCPOW.hidden);
+  // Note: Waiting on content document not being hidden because new tab pages can be preloaded,
+  // in which case no load events fire.
+  await ContentTask.spawn(browser, null, async () => {
+    await ContentTaskUtils.waitForCondition(() => {
+      return content.document && !content.document.hidden;
+    });
+  });
   let errorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser);
   gURLBar.value = input;
   gURLBar.select();
   EventUtils.sendKey("return");
   await errorPageLoaded;
   is(gURLBar.textValue, input, "Text is still in URL bar");
   is(tab.linkedBrowser.userTypedValue, input, "Text still stored on browser");
   await BrowserTestUtils.switchTab(gBrowser, tab.previousElementSibling);