Bug 1167915 - followup: avoid modal dialog potentially blocking the test. r=ttaubert
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 08 Jun 2015 17:06:00 +0200
changeset 247586 eb586f84c8a306510213d57863fbfe978bc5170c
parent 247585 1497b026f64bbfbe4a3850a6357e2ecc2424531c
child 247587 85e876f34bcc00459f9ba47d5a3296de00aefd85
push id13403
push usermak77@bonardo.net
push dateMon, 08 Jun 2015 15:08:37 +0000
treeherderfx-team@eb586f84c8a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs1167915
milestone41.0a1
Bug 1167915 - followup: avoid modal dialog potentially blocking the test. r=ttaubert
browser/components/places/tests/browser/browser_bookmarkProperties_addKeywordForThisSearch.js
browser/components/places/tests/browser/head.js
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_addKeywordForThisSearch.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_addKeywordForThisSearch.js
@@ -5,19 +5,17 @@ const TEST_URL = "http://mochi.test:8888
 add_task(function* () {
   yield BrowserTestUtils.withNewTab({
     gBrowser,
     url: TEST_URL,
   }, function* (browser) {
     // We must wait for the context menu code to build metadata.
     yield openContextMenuForContentSelector(browser, 'form > input[name="search"]');
 
-    yield withBookmarksDialog(function*() {
-      AddKeywordForSearchField();
-    }, function* (dialogWin) {
+    yield withBookmarksDialog(AddKeywordForSearchField, function* (dialogWin) {
       let acceptBtn = dialogWin.document.documentElement.getButton("accept");
       ok(acceptBtn.disabled, "Accept button is disabled");
 
       let promiseKeywordNotification = promiseBookmarksNotification(
         "onItemChanged", (itemId, prop, isAnno, val) => prop == "keyword" && val =="kw");
 
       fillBookmarkTextField("editBMPanel_keywordField", "kw", dialogWin);
 
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -305,17 +305,19 @@ let withBookmarksDialog = Task.async(fun
         waitForFocus(() => {
           resolve(win);
         }, win);
       });
     });
   });
 
   info("withBookmarksDialog: opening the dialog");
-  yield openFn();
+  // The dialog might be modal and could block our events loop, so executeSoon.
+  executeSoon(openFn);
+
   info("withBookmarksDialog: waiting for the dialog");
   let dialogWin = yield dialogPromise;
 
   // Ensure overlay is loaded
   ok(dialogWin.gEditItemOverlay.initialized, "EditItemOverlay is initialized");
 
   info("withBookmarksDialog: executing the task");
   try {