Bug 1481344 - Fix perma-fail in browser_searchEngine_behaviors.js, improve how the search bar is cleared. r=mkaply
authorMark Banner <standard8@mozilla.com>
Mon, 20 Aug 2018 15:05:31 +0000
changeset 487463 e20c185652fe0f0eb6f2dad6ae682f03b8a2f4a1
parent 487462 f9ba9a7a94d2b444ee3d00b327c170efa5036e4b
child 487464 e9b2abafd25e0cfe41cff40c763d2f0b12848d3f
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkaply
bugs1481344
milestone63.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 1481344 - Fix perma-fail in browser_searchEngine_behaviors.js, improve how the search bar is cleared. r=mkaply MozReview-Commit-ID: IgT9aU41BHW Differential Revision: https://phabricator.services.mozilla.com/D3765
browser/components/search/test/browser_searchEngine_behaviors.js
--- a/browser/components/search/test/browser_searchEngine_behaviors.js
+++ b/browser/components/search/test/browser_searchEngine_behaviors.js
@@ -98,16 +98,17 @@ async function testSearchEngine(engineDe
   Services.search.currentEngine = engine;
   engine.alias = engineDetails.alias;
 
   let base = engineDetails.baseURL;
 
   // Test search URLs (including purposes).
   let url = engine.getSubmission("foo").uri.spec;
   Assert.equal(url, base + engineDetails.codes.submission, "Check search URL for 'foo'");
+  let sb = BrowserSearch.searchBar;
 
   let engineTests = [
     {
       name: "context menu search",
       searchURL: base + engineDetails.codes.context,
       run() {
         // Simulate a contextmenu search
         // FIXME: This is a bit "low-level"...
@@ -131,22 +132,18 @@ async function testSearchEngine(engineDe
         gURLBar.focus();
         EventUtils.synthesizeKey("KEY_Enter");
       }
     },
     {
       name: "search bar search",
       searchURL: base + engineDetails.codes.submission,
       run() {
-        let sb = BrowserSearch.searchBar;
         sb.focus();
         sb.value = "foo";
-        registerCleanupFunction(function() {
-          sb.value = "";
-        });
         EventUtils.synthesizeKey("KEY_Enter");
       }
     },
     {
       name: "new tab search",
       searchURL: base + engineDetails.codes.newTab,
       async preTest(tab) {
         let browser = tab.linkedBrowser;
@@ -180,10 +177,11 @@ async function testSearchEngine(engineDe
     await test.run(tab);
 
     let receivedURI = await stateChangePromise;
 
     Assert.equal(receivedURI, test.searchURL);
   }
 
   engine.alias = undefined;
+  sb.value = "";
   BrowserTestUtils.removeTab(tab);
 }