Bug 1400491 - Set up mutation observer before synthesizing composition. r=mikedeboer,ursula
authorEd Lee <edilee@mozilla.com>
Fri, 27 Apr 2018 13:59:07 -0700
changeset 472422 9306053288b663041576285ae1a0e4c83c52447e
parent 472421 f2e2f5d4f04574ca9838d86a2a70be7ccb709db2
child 472423 9cf25c9e5c4608f716998c0ab4b71c3ee40b6301
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer, ursula
bugs1400491
milestone61.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 1400491 - Set up mutation observer before synthesizing composition. r=mikedeboer,ursula Undisable test for mac opt and linux32 opt. MozReview-Commit-ID: 74IZ6VkPdER
browser/base/content/test/about/browser.ini
browser/base/content/test/about/browser_aboutHome_search_composing.js
--- a/browser/base/content/test/about/browser.ini
+++ b/browser/base/content/test/about/browser.ini
@@ -11,17 +11,16 @@ support-files =
 [browser_aboutCertError.js]
 support-files =
   dummy_page.html
 [browser_aboutHome_imitate.js]
 [browser_aboutHome_input.js]
 skip-if = true # Bug 1409054 to remove; previously skipped for intermittents, e.g., Bug 1399648
 [browser_aboutHome_search_POST.js]
 [browser_aboutHome_search_composing.js]
-skip-if = !debug && (os == "mac" || (os == "linux" && bits == 32)) # Bug 1400491, bug 1399648
 [browser_aboutHome_search_searchbar.js]
 [browser_aboutHome_search_suggestion.js]
 skip-if = os == "mac" || (os == "linux" && (!debug || bits == 64)) # Bug 1399648, bug 1402502
 [browser_aboutHome_search_telemetry.js]
 [browser_aboutHome_snippets.js]
 skip-if = true # Bug 1409054 to remove
 [browser_aboutHome_wrapsCorrectly.js]
 skip-if = true # Bug 1409054 to remove; previously skipped for intermittents, e.g., Bug 1395602
--- a/browser/base/content/test/about/browser_aboutHome_search_composing.js
+++ b/browser/base/content/test/about/browser_aboutHome_search_composing.js
@@ -16,28 +16,18 @@ add_task(async function() {
     await p;
 
     await ContentTask.spawn(browser, null, async function() {
       // Start composition and type "x"
       let input = content.document.querySelector(["#searchText", "#newtab-search-text"]);
       input.focus();
     });
 
-    // FYI: "compositionstart" will be dispatched automatically.
-    await BrowserTestUtils.synthesizeCompositionChange({
-      composition: {
-        string: "x",
-        clauses: [
-          { length: 1, attr: Ci.nsITextInputProcessor.ATTR_RAW_CLAUSE }
-        ]
-      },
-      caret: { start: 1, length: 0 }
-    }, browser);
-
-    await ContentTask.spawn(browser, null, async function() {
+    info("Setting up the mutation observer before synthesizing composition");
+    let mutationPromise = ContentTask.spawn(browser, null, async function() {
       let searchController = content.wrappedJSObject.gContentSearchController;
 
       // Wait for the search suggestions to become visible.
       let table = searchController._suggestionsList;
       let input = content.document.querySelector(["#searchText", "#newtab-search-text"]);
 
       await new Promise(resolve => {
         let observer = new content.MutationObserver(() => {
@@ -58,16 +48,30 @@ add_task(async function() {
 
       // ContentSearchUIController looks at the current selectedIndex when
       // performing a search. Synthesizing the mouse event on the suggestion
       // doesn't actually mouseover the suggestion and trigger it to be flagged
       // as selected, so we manually select it first.
       searchController.selectedIndex = 1;
     });
 
+    // FYI: "compositionstart" will be dispatched automatically.
+    await BrowserTestUtils.synthesizeCompositionChange({
+      composition: {
+        string: "x",
+        clauses: [
+          { length: 1, attr: Ci.nsITextInputProcessor.ATTR_RAW_CLAUSE }
+        ]
+      },
+      caret: { start: 1, length: 0 }
+    }, browser);
+
+    info("Waiting for search suggestion table unhidden");
+    await mutationPromise;
+
     // Click the second suggestion.
     let expectedURL = Services.search.currentEngine
       .getSubmission("xbar", null, "homepage").uri.spec;
     let loadPromise = waitForDocLoadAndStopIt(expectedURL);
     await BrowserTestUtils.synthesizeMouseAtCenter("#TEMPID", {
       button: 0
     }, browser);
     await loadPromise;