Bug 1251107 - Move the mouseout code to popupHideFn(). r=gijs
authorJared Wein <jwein@mozilla.com>
Thu, 25 Feb 2016 00:30:37 -0500
changeset 322073 48d839aa329bff5d22f47b394aeb03cb3e2533e7
parent 322072 5be7d7b889b7a0e8808bb6521633313a14624553
child 322074 94eddcf7acd03830eede2c8cfbb43780914f8d4b
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1251107
milestone47.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 1251107 - Move the mouseout code to popupHideFn(). r=gijs The mouseout code triggers the hiding of the popup, but it was previously in the popupEditFn meaning that it ran before we expected the popup to close, which caused this race condition. I also had to tweak the contextmenu test because it was depending on a mousedown/click which we are no longer listening for (we replaced that with mouseover/mouseout). MozReview-Commit-ID: 5mZujGuto5g
browser/base/content/test/general/browser_bookmark_popup.js
--- a/browser/base/content/test/general/browser_bookmark_popup.js
+++ b/browser/base/content/test/general/browser_bookmark_popup.js
@@ -46,16 +46,17 @@ function* test_bookmarks_popup({isNewBoo
     is(bookmarkPanelTitle.value,
       isNewBookmark ?
         gNavigatorBundle.getString("editBookmarkPanel.pageBookmarkedTitle") :
         gNavigatorBundle.getString("editBookmarkPanel.editBookmarkTitle"),
       "title should match isEditingBookmark state");
 
     if (!shouldAutoClose) {
       yield new Promise(resolve => setTimeout(resolve, 400));
+      is(bookmarkPanel.state, "open", "Panel should still be 'open' for non-autoclose");
     }
 
     let hiddenPromise = promisePopupHidden(bookmarkPanel);
     if (popupHideFn) {
       yield popupHideFn();
     }
     yield hiddenPromise;
     is(bookmarkStar.hasAttribute("starred"), !isBookmarkRemoved,
@@ -139,31 +140,32 @@ add_task(function* panel_shown_for_new_b
         EventUtils.synthesizeNativeMouseMove(bookmarkPanel, 0, 0, resolve, window);
       });
       info("Waiting for mouseover event");
       yield mouseOverPromise;
       info("Got mouseover event");
 
       yield new Promise(resolve => setTimeout(resolve, 400));
       is(bookmarkPanel.state, "open", "Panel should still be open on mouseover");
-
+    },
+    *popupHideFn() {
       let mouseOutPromise = new Promise(resolve => {
         bookmarkPanel.addEventListener("mouseout", function onmouseout() {
           bookmarkPanel.removeEventListener("mouseout", onmouseout);
           resolve();
         });
       });
       yield new Promise(resolve => {
         EventUtils.synthesizeNativeMouseMove(bookmarkStar, 0, 0, resolve, window);
       });
       info("Waiting for mouseout event");
       yield mouseOutPromise;
       info("Got mouseout event, should autoclose now");
     },
-    shouldAutoClose: true,
+    shouldAutoClose: false,
     isBookmarkRemoved: false,
   });
 });
 
 add_task(function* panel_shown_for_new_bookmark_no_autoclose_close_with_ESC() {
   yield test_bookmarks_popup({
     isNewBookmark: false,
     popupShowFn() {
@@ -203,17 +205,17 @@ add_task(function* panel_shown_for_new_b
     shouldAutoClose: false,
     popupHideFn() {
       bookmarkPanel.hidePopup();
     },
     isBookmarkRemoved: false,
   });
 });
 
-add_task(function* contextmenu_new_bookmark_click_no_autoclose() {
+add_task(function* contextmenu_new_bookmark_keypress_no_autoclose() {
   yield test_bookmarks_popup({
     isNewBookmark: true,
     *popupShowFn(browser) {
       let contextMenu = document.getElementById("contentAreaContextMenu");
       let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu,
                                                           "popupshown");
       let awaitPopupHidden = BrowserTestUtils.waitForEvent(contextMenu,
                                                            "popuphidden");
@@ -222,17 +224,17 @@ add_task(function* contextmenu_new_bookm
         button: 2
       }, browser);
       yield awaitPopupShown;
       document.getElementById("context-bookmarkpage").click();
       contextMenu.hidePopup();
       yield awaitPopupHidden;
     },
     popupEditFn() {
-      bookmarkPanelTitle.click();
+      EventUtils.sendChar("VK_TAB", window);
     },
     shouldAutoClose: false,
     popupHideFn() {
       bookmarkPanel.hidePopup();
     },
     isBookmarkRemoved: false,
   });
 });