Bug 1408166 - prevent search bar popup from ever showing when browser_940307_panel_click_closure_handling is running to avoid it interfering with context menu clicks, r=florian
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 07 Nov 2017 10:54:10 +0000
changeset 443763 0f669b70d35963ed8e2f7e22beef23b84770fc65
parent 443762 b7736e7e1d4fd6b650650959206f8db6d8997089
child 443764 9f51e91195a607444db9cf371b0d81c7f442d09e
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1408166
milestone58.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 1408166 - prevent search bar popup from ever showing when browser_940307_panel_click_closure_handling is running to avoid it interfering with context menu clicks, r=florian MozReview-Commit-ID: jyRcdAKpxR
browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
--- a/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
+++ b/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
@@ -33,16 +33,19 @@ add_task(async function searchbar_in_pan
 
   let searchbar = document.getElementById("searchbar");
   await waitForCondition(() => "value" in searchbar && searchbar.value === "");
 
   // Focusing a non-empty searchbox will cause us to open the
   // autocomplete panel and search for suggestions, which would
   // trigger network requests. Temporarily disable suggestions.
   await SpecialPowers.pushPrefEnv({set: [["browser.search.suggest.enabled", false]]});
+  let dontShowPopup = e => e.preventDefault();
+  let searchbarPopup = searchbar.textbox.popup;
+  searchbarPopup.addEventListener("popupshowing", dontShowPopup);
 
   searchbar.value = "foo";
   searchbar.focus();
   // Reaching into this context menu is pretty evil, but hey... it's a test.
   let textbox = document.getAnonymousElementByAttribute(searchbar.textbox, "anonid", "textbox-input-box");
   let contextmenu = document.getAnonymousElementByAttribute(textbox, "anonid", "input-box-contextmenu");
   let contextMenuShown = promisePanelElementShown(window, contextmenu);
   EventUtils.synthesizeMouseAtCenter(searchbar, {type: "contextmenu", button: 2});
@@ -50,26 +53,26 @@ add_task(async function searchbar_in_pan
 
   ok(isOverflowOpen(), "Panel should still be open");
 
   let selectAll = contextmenu.querySelector("[cmd='cmd_selectAll']");
   let contextMenuHidden = promisePanelElementHidden(window, contextmenu);
   EventUtils.synthesizeMouseAtCenter(selectAll, {});
   await contextMenuHidden;
 
-  // Hide the suggestion panel.
-  searchbar.textbox.popup.hidePopup();
-
   ok(isOverflowOpen(), "Panel should still be open");
 
   let hiddenPanelPromise = promiseOverflowHidden(window);
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   await hiddenPanelPromise;
   ok(!isOverflowOpen(), "Panel should no longer be open");
 
+  // Allow search bar popup to show again.
+  searchbarPopup.removeEventListener("popupshowing", dontShowPopup);
+
   // We focused the search bar earlier - ensure we don't keep doing that.
   gURLBar.select();
 
   CustomizableUI.reset();
 });
 
 add_task(async function disabled_button_in_panel() {
   button = document.createElement("toolbarbutton");