Bug 1479744 - Clear search history to prevent TV perma fail for browser/base/content/test/about/browser_aboutHome_search_composing.js r=adw
authorAndrei Oprea <andrei.br92@gmail.com>
Sat, 12 Jan 2019 00:13:23 +0000
changeset 513894 da8b6bcd0deb5c1235d743e136ce240951eb2b8b
parent 513893 895cc0297ce2e47092dc5736cd444a573ba03ed2
child 513895 5e9dc7f35bcf23c6c0215f423a6fd074aea5e416
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1479744
milestone66.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 1479744 - Clear search history to prevent TV perma fail for browser/base/content/test/about/browser_aboutHome_search_composing.js r=adw Differential Revision: https://phabricator.services.mozilla.com/D14769
browser/base/content/test/about/browser_aboutHome_search_composing.js
browser/base/content/test/about/head.js
--- a/browser/base/content/test/about/browser_aboutHome_search_composing.js
+++ b/browser/base/content/test/about/browser_aboutHome_search_composing.js
@@ -10,16 +10,32 @@ add_task(async function() {
   await BrowserTestUtils.withNewTab({ gBrowser, url: "about:home" }, async function(browser) {
     // Add a test engine that provides suggestions and switch to it.
     let currEngine = Services.search.defaultEngine;
     let engine = await promiseNewEngine("searchSuggestionEngine.xml");
     let p = promiseContentSearchChange(browser, engine.name);
     Services.search.defaultEngine = engine;
     await p;
 
+    // Clear any search history results
+    await new Promise((resolve, reject) => {
+      FormHistory.update({op: "remove"}, {
+        handleError(error) {
+          reject(error);
+        },
+        handleCompletion(reason) {
+          if (!reason) {
+            resolve();
+          } else {
+            reject();
+          }
+        },
+      });
+    });
+
     await ContentTask.spawn(browser, null, async function() {
       // Start composition and type "x"
       let input = content.document.querySelector(["#searchText", "#newtab-search-text"]);
       input.focus();
     });
 
     info("Setting up the mutation observer before synthesizing composition");
     let mutationPromise = ContentTask.spawn(browser, null, async function() {
--- a/browser/base/content/test/about/head.js
+++ b/browser/base/content/test/about/head.js
@@ -1,10 +1,14 @@
 /* eslint-env mozilla/frame-script */
 
+XPCOMUtils.defineLazyModuleGetters(this, {
+  FormHistory: "resource://gre/modules/FormHistory.jsm",
+});
+
 function injectErrorPageFrame(tab, src) {
   return ContentTask.spawn(tab.linkedBrowser, {frameSrc: src}, async function({frameSrc}) {
     let loaded = ContentTaskUtils.waitForEvent(content.wrappedJSObject, "DOMFrameContentLoaded");
     let iframe = content.document.createElement("iframe");
     iframe.src = frameSrc;
     content.document.body.appendChild(iframe);
     await loaded;
     // We will have race conditions when accessing the frame content after setting a src,