From 233565104b09f743bb2341bf2dee3ec59344f6e3 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Wed, 2 Oct 2013 16:00:37 -0700 Subject: [PATCH] Back out ca56f76237df (bug 922934) because of metro-chrome test failures --- browser/metro/base/content/helperui/MenuUI.js | 17 ++++++++--------- .../mochitest/browser_context_menu_tests.js | 6 ++---- .../browser_context_menu_tests_02.html | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/browser/metro/base/content/helperui/MenuUI.js b/browser/metro/base/content/helperui/MenuUI.js index 3aa9a497de10..6663ee263c04 100644 --- a/browser/metro/base/content/helperui/MenuUI.js +++ b/browser/metro/base/content/helperui/MenuUI.js @@ -432,10 +432,9 @@ MenuPopup.prototype = { let deferred = Promise.defer(); window.addEventListener("keypress", this, true); - window.addEventListener("mousedown", this, true); - window.addEventListener("touchstart", this, true); - window.addEventListener("scroll", this, true); + window.addEventListener("click", this, true); Elements.stack.addEventListener("PopupChanged", this, false); + Elements.browsers.addEventListener("PanBegin", this, false); this._panel.hidden = false; let popupFrom = !aPositionOptions.bottomAligned ? "above" : "below"; @@ -462,10 +461,9 @@ MenuPopup.prototype = { let deferred = Promise.defer(); window.removeEventListener("keypress", this, true); - window.removeEventListener("mousedown", this, true); - window.removeEventListener("touchstart", this, true); - window.removeEventListener("scroll", this, true); + window.removeEventListener("click", this, true); Elements.stack.removeEventListener("PopupChanged", this, false); + Elements.browsers.removeEventListener("PanBegin", this, false); let self = this; this._panel.addEventListener("transitionend", function popuphidden() { @@ -501,9 +499,7 @@ MenuPopup.prototype = { this.hide(); } break; - case "mousedown": - case "touchstart": - case "scroll": + case "click": if (!this._popup.contains(aEvent.target)) { aEvent.stopPropagation(); this.hide(); @@ -521,6 +517,9 @@ MenuPopup.prototype = { this.hide(); } break; + case "PanBegin": + this.hide(); + break; } } }; diff --git a/browser/metro/base/tests/mochitest/browser_context_menu_tests.js b/browser/metro/base/tests/mochitest/browser_context_menu_tests.js index 518b6f9529e1..500fb9460327 100644 --- a/browser/metro/base/tests/mochitest/browser_context_menu_tests.js +++ b/browser/metro/base/tests/mochitest/browser_context_menu_tests.js @@ -98,11 +98,9 @@ gTests.push({ "context-copy-link"]); promise = waitForEvent(document, "popuphidden"); - win.scrollBy(0, 1); - let hidden = yield promise; - ok(hidden && !(hidden instanceof Error), "scrolling hides the context menu"); + ContextMenuUI.hide(); + yield promise; win.getSelection().removeAllRanges(); - win.scrollBy(0, -1); //////////////////////////////////////////////////////////// // Context menu in content on a link diff --git a/browser/metro/base/tests/mochitest/browser_context_menu_tests_02.html b/browser/metro/base/tests/mochitest/browser_context_menu_tests_02.html index 20ff6f81174f..de4f5c7143b5 100644 --- a/browser/metro/base/tests/mochitest/browser_context_menu_tests_02.html +++ b/browser/metro/base/tests/mochitest/browser_context_menu_tests_02.html @@ -23,8 +23,8 @@


-
+
hello, I'm sorry but I must be going.
- + \ No newline at end of file