Bug 1346286 - Remove CPOWs from browser_findbar.js. r=Felipe draft
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 11 Nov 2016 14:21:55 -0800
changeset 499544 f35711abb82f626abeae1c31b58914312170cbb7
parent 499543 64eb63058b80c6aa01723cc54773263feb0e35d7
child 499545 0686a05899b0070f1673ce14340d6256409ab5aa
push id49450
push userbmo:mrbkap@mozilla.com
push dateWed, 15 Mar 2017 23:51:54 +0000
reviewersFelipe
bugs1346286
milestone55.0a1
Bug 1346286 - Remove CPOWs from browser_findbar.js. r=Felipe MozReview-Commit-ID: ASJgY0cKnHq
toolkit/content/tests/browser/browser_findbar.js
--- a/toolkit/content/tests/browser/browser_findbar.js
+++ b/toolkit/content/tests/browser/browser_findbar.js
@@ -22,17 +22,17 @@ add_task(function* test_hotkey_event_pro
 
   // Pressing these keys open the findbar.
   const HOTKEYS = ["/", "'"];
 
   // Checking if findbar appears when any hotkey is pressed.
   for (let key of HOTKEYS) {
     is(findbar.hidden, true, "Findbar is hidden now.");
     gBrowser.selectedTab = tab;
-    yield promiseFocus();
+    yield SimpleTest.promiseFocus(gBrowser.selectedBrowser);
     yield BrowserTestUtils.sendChar(key, browser);
     is(findbar.hidden, false, "Findbar should not be hidden.");
     yield closeFindbarAndWait(findbar);
   }
 
   // Stop propagation for all keyboard events.
   let frameScript = () => {
     const stopPropagation = e => e.stopImmediatePropagation();
@@ -44,17 +44,17 @@ add_task(function* test_hotkey_event_pro
 
   let mm = browser.messageManager;
   mm.loadFrameScript("data:,(" + frameScript.toString() + ")();", false);
 
   // Checking if findbar still appears when any hotkey is pressed.
   for (let key of HOTKEYS) {
     is(findbar.hidden, true, "Findbar is hidden now.");
     gBrowser.selectedTab = tab;
-    yield promiseFocus();
+    yield SimpleTest.promiseFocus(gBrowser.selectedBrowser);
     yield BrowserTestUtils.sendChar(key, browser);
     is(findbar.hidden, false, "Findbar should not be hidden.");
     yield closeFindbarAndWait(findbar);
   }
 
   gBrowser.removeTab(tab);
 });
 
@@ -232,27 +232,16 @@ function promiseFindFinished(searchText,
     };
     findbar.browser.finder.addResultListener(resultListener);
     findbar._find();
   });
 
   return deferred.promise;
 }
 
-/**
- * A promise-like wrapper for the waitForFocus helper.
- */
-function promiseFocus() {
-  return new Promise((resolve) => {
-    waitForFocus(function() {
-      resolve();
-    }, content);
-  });
-}
-
 function promiseRemotenessChange(tab, shouldBeRemote) {
   return new Promise((resolve) => {
     let browser = gBrowser.getBrowserForTab(tab);
     tab.addEventListener("TabRemotenessChange", function() {
       resolve();
     }, {once: true});
     gBrowser.updateBrowserRemoteness(browser, shouldBeRemote);
   });