Backed out 7 changesets (bug 1615732) for bc failures on browser_ext_pageAction_click_types.js. CLOSED TREE

Backed out changeset 031b8abf43a8 (bug 1615732)
Backed out changeset 297d82b338dc (bug 1615732)
Backed out changeset bbcb173e6c44 (bug 1615732)
Backed out changeset d7c5824d4579 (bug 1615732)
Backed out changeset f648cf0653a7 (bug 1615732)
Backed out changeset fcd441a2a860 (bug 1615732)
Backed out changeset fa861e50f198 (bug 1615732)

--HG--
extra : histedit_source : 16a05a43f3a9666c4fcf244062c28a5dc81061fd
This commit is contained in:
Cosmin Sabou 2020-04-06 23:49:58 +03:00
Родитель 2f4d9af7d3
Коммит 3b3f1af25e
23 изменённых файлов: 16 добавлений и 464 удалений

Просмотреть файл

@ -701,14 +701,7 @@ var BrowserPageActions = {
},
doCommandForAction(action, event, buttonNode) {
// On mac, ctrl-click will send a context menu event from the widget, so we
// don't want to handle the click event when ctrl key is pressed.
if (
event &&
event.type == "click" &&
(event.button != 0 ||
(AppConstants.platform == "macosx" && event.ctrlKey))
) {
if (event && event.type == "click" && event.button != 0) {
return;
}
if (event && event.type == "keypress") {
@ -860,11 +853,7 @@ var BrowserPageActions = {
mainButtonClicked(event) {
event.stopPropagation();
if (
// On mac, ctrl-click will send a context menu event from the widget, so
// we don't want to bring up the panel when ctrl key is pressed.
(event.type == "mousedown" &&
(event.button != 0 ||
(AppConstants.platform == "macosx" && event.ctrlKey))) ||
(event.type == "mousedown" && event.button != 0) ||
(event.type == "keypress" &&
event.charCode != KeyEvent.DOM_VK_SPACE &&
event.keyCode != KeyEvent.DOM_VK_RETURN)

Просмотреть файл

@ -38,51 +38,6 @@ const mockTargets = [
{ id: "3", name: "no client record device", type: "phone" },
];
add_task(async function openPanel() {
if (AppConstants.platform == "macosx") {
// Ignore this test on Mac.
return;
}
let url = "http://example.com/";
await BrowserTestUtils.withNewTab(url, async () => {
// Should still open the panel when Ctrl key is pressed.
await promisePageActionPanelOpen({ ctrlKey: true });
// Done.
let hiddenPromise = promisePageActionPanelHidden();
BrowserPageActions.panelNode.hidePopup();
await hiddenPromise;
});
});
add_task(async function starButtonCtrlClick() {
// On macOS, ctrl-click shouldn't open the panel because this normally opens
// the context menu. This happens via the `contextmenu` event which is created
// by widget code, so our simulated clicks do not do so, so we can't test
// anything on macOS.
if (AppConstants.platform == "macosx") {
return;
}
// Open a unique page.
let url = "http://example.com/browser_page_action_star_button";
await BrowserTestUtils.withNewTab(url, async () => {
StarUI._createPanelIfNeeded();
const popup = document.getElementById("editBookmarkPanel");
const starButtonBox = document.getElementById("star-button-box");
let shownPromise = promisePanelShown(popup);
EventUtils.synthesizeMouseAtCenter(starButtonBox, { ctrlKey: true });
await shownPromise;
ok(true, "Panel shown after button pressed");
let hiddenPromise = promisePanelHidden(popup);
document.getElementById("editBookmarkPanelRemoveButton").click();
await hiddenPromise;
});
});
add_task(async function bookmark() {
// Open a unique page.
let url = "http://example.com/browser_page_action_menu";

Просмотреть файл

@ -5,7 +5,7 @@ const { PlacesTestUtils } = ChromeUtils.import(
"resource://testing-common/PlacesTestUtils.jsm"
);
function promisePageActionPanelOpen(eventDict = {}) {
function promisePageActionPanelOpen() {
let dwu = window.windowUtils;
return BrowserTestUtils.waitForCondition(() => {
// Wait for the main page action button to become visible. It's hidden for
@ -24,10 +24,7 @@ function promisePageActionPanelOpen(eventDict = {}) {
return Promise.resolve();
}
let shownPromise = promisePageActionPanelShown();
EventUtils.synthesizeMouseAtCenter(
BrowserPageActions.mainButtonNode,
eventDict
);
EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
return shownPromise;
})
.then(() => {

Просмотреть файл

@ -302,12 +302,7 @@ const PanelUI = {
}
break;
case "mousedown":
// On Mac, ctrl-click will send a context menu event from the widget, so
// we don't want to bring up the panel when ctrl key is pressed.
if (
aEvent.button == 0 &&
(AppConstants.platform != "macosx" || !aEvent.ctrlKey)
) {
if (aEvent.button == 0) {
this.toggle(aEvent);
}
break;
@ -385,13 +380,7 @@ const PanelUI = {
async showSubView(aViewId, aAnchor, aEvent) {
let domEvent = null;
if (aEvent) {
// On Mac, ctrl-click will send a context menu event from the widget, so
// we don't want to bring up the panel when ctrl key is pressed.
if (
aEvent.type == "mousedown" &&
(aEvent.button != 0 ||
(AppConstants.platform == "macosx" && aEvent.ctrlKey))
) {
if (aEvent.type == "mousedown" && aEvent.button != 0) {
return;
}
if (

Просмотреть файл

@ -137,8 +137,6 @@ skip-if = verify
[browser_1484275_PanelMultiView_toggle_with_other_popup.js]
[browser_allow_dragging_removable_false.js]
[browser_bootstrapped_custom_toolbar.js]
[browser_character_encoding_ctrl_click.js]
[browser_ctrl_click_panel_opening.js]
[browser_currentset_post_reset.js]
[browser_customizemode_contextmenu_menubuttonstate.js]
skip-if = os == "win" && bits == 64 # 1526429

Просмотреть файл

@ -1,36 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_character_encoding_menu() {
// On macOS, ctrl-click shouldn't open the panel because this normally opens
// the context menu. This happens via the `contextmenu` event which is created
// by widget code, so our simulated clicks do not do so, so we can't test
// anything on macOS.
if (AppConstants.platform == "macosx") {
ok(true, "The test is ignored on Mac");
return;
}
CustomizableUI.addWidgetToArea(
"characterencoding-button",
CustomizableUI.AREA_NAVBAR,
4
);
const button = document.getElementById("characterencoding-button");
const view = document.getElementById("PanelUI-characterEncodingView");
let shownPromise = subviewShown(view);
EventUtils.synthesizeMouseAtCenter(button, { ctrlKey: true });
await shownPromise;
ok(true, "Character encoding menu shown after button pressed");
// Close character encoding popup.
let hiddenPromise = subviewHidden(view);
view.closest("panel").hidePopup();
await hiddenPromise;
CustomizableUI.reset();
});

Просмотреть файл

@ -1,53 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_appMenu_mainView() {
// On macOS, ctrl-click shouldn't open the panel because this normally opens
// the context menu. This happens via the `contextmenu` event which is created
// by widget code, so our simulated clicks do not do so, so we can't test
// anything on macOS:
if (AppConstants.platform == "macosx") {
ok(true, "The test is ignored on Mac");
return;
}
const mainView = document.getElementById("appMenu-mainView");
let shownPromise = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
// Should still open the panel when Ctrl key is pressed.
EventUtils.synthesizeMouseAtCenter(PanelUI.menuButton, { ctrlKey: true });
await shownPromise;
ok(true, "Main menu shown after button pressed");
// Close the main panel.
let hiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden");
mainView.closest("panel").hidePopup();
await hiddenPromise;
});
add_task(async function test_appMenu_libraryView() {
// On macOS, ctrl-click shouldn't open the panel because this normally opens
// the context menu. This happens via the `contextmenu` event which is created
// by widget code, so our simulated clicks do not do so, so we can't test
// anything on macOS:
if (AppConstants.platform == "macosx") {
ok(true, "The test is ignored on Mac");
return;
}
const libraryView = document.getElementById("appMenu-libraryView");
const button = document.getElementById("library-button");
let shownPromise = BrowserTestUtils.waitForEvent(libraryView, "ViewShown");
// Should still open the panel when Ctrl key is pressed.
EventUtils.synthesizeMouseAtCenter(button, { ctrlKey: true });
await shownPromise;
ok(true, "Library menu shown after button pressed");
// Close the Library panel.
let hiddenPromise = BrowserTestUtils.waitForEvent(document, "popuphidden");
libraryView.closest("panel").hidePopup();
await hiddenPromise;
});

Просмотреть файл

@ -568,11 +568,7 @@ const DownloadsIndicatorView = {
onCommand(aEvent) {
if (
// On Mac, ctrl-click will send a context menu event from the widget, so
// we don't want to bring up the panel when ctrl key is pressed.
(aEvent.type == "mousedown" &&
(aEvent.button != 0 ||
(AppConstants.platform == "macosx" && aEvent.ctrlKey))) ||
(aEvent.type == "mousedown" && aEvent.button != 0) ||
(aEvent.type == "keypress" && aEvent.key != " " && aEvent.key != "Enter")
) {
return;

Просмотреть файл

@ -15,7 +15,6 @@ skip-if = (os == 'win' && os_version == '10.0' && ccov) # Bug 1306510
[browser_library_clearall.js]
[browser_downloads_panel_block.js]
skip-if = true # Bug 1352792
[browser_downloads_panel_ctrl_click.js]
[browser_downloads_panel_height.js]
[browser_downloads_autohide.js]
[browser_go_to_download_page.js]

Просмотреть файл

@ -1,35 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_downloads_panel() {
// On macOS, ctrl-click shouldn't open the panel because this normally opens
// the context menu. This happens via the `contextmenu` event which is created
// by widget code, so our simulated clicks do not do so, so we can't test
// anything on macOS.
if (AppConstants.platform == "macosx") {
ok(true, "The test is ignored on Mac");
return;
}
await SpecialPowers.pushPrefEnv({
set: [["browser.download.autohideButton", false]],
});
await promiseButtonShown("downloads-button");
const button = document.getElementById("downloads-button");
let shownPromise = promisePanelOpened();
// Should still open the panel when Ctrl key is pressed.
EventUtils.synthesizeMouseAtCenter(button, { ctrlKey: true });
await shownPromise;
is(DownloadsPanel.panel.state, "open", "Check that panel state is 'open'");
// Close download panel
DownloadsPanel.hidePanel();
is(
DownloadsPanel.panel.state,
"closed",
"Check that panel state is 'closed'"
);
});

Просмотреть файл

@ -59,16 +59,6 @@ add_task(async function test_clickData() {
for (let modifier of Object.keys(map)) {
for (let i = 0; i < 2; i++) {
// On Mac, ctrl-click will send a context menu event from the widget,
// we won't send xul command event and won't have onClick message, either.
if (
AppConstants.platform == "macosx" &&
i == 0 &&
modifier == "ctrlKey"
) {
continue;
}
let clickEventData = { button: i };
clickEventData[modifier] = true;
await clickBrowserAction(extension, window, clickEventData);

Просмотреть файл

@ -17,7 +17,6 @@ skip-if = (verify && debug)
[browser_bookmark_backup_export_import.js]
[browser_bookmark_change_location.js]
[browser_bookmark_folder_moveability.js]
[browser_bookmark_menu_ctrl_click.js]
[browser_bookmark_popup.js]
skip-if = (os == "linux" && debug) || (verify && (os == 'win')) # mouseover not reliable on linux debug builds
[browser_bookmark_private_window.js]

Просмотреть файл

@ -1,43 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function onPopupEvent(popup, evt) {
let fullEvent = "popup" + evt;
return BrowserTestUtils.waitForEvent(popup, fullEvent, false, e => {
return e.target == popup;
});
}
add_task(async function test_bookmarks_menu() {
// On macOS, ctrl-click shouldn't open the panel because this normally opens
// the context menu. This happens via the `contextmenu` event which is created
// by widget code, so our simulated clicks do not do so, so we can't test
// anything on macOS.
if (AppConstants.platform == "macosx") {
ok(true, "The test is ignored on Mac");
return;
}
CustomizableUI.addWidgetToArea(
"bookmarks-menu-button",
CustomizableUI.AREA_NAVBAR,
4
);
const button = document.getElementById("bookmarks-menu-button");
const popup = document.getElementById("BMB_bookmarksPopup");
let shownPromise = onPopupEvent(popup, "shown");
EventUtils.synthesizeMouseAtCenter(button, { ctrlKey: true });
await shownPromise;
ok(true, "Bookmarks menu shown after button pressed");
// Close bookmarks popup.
let hiddenPromise = onPopupEvent(popup, "hidden");
popup.hidePopup();
await hiddenPromise;
CustomizableUI.reset();
});

Просмотреть файл

@ -157,15 +157,7 @@ nsresult nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
case eMouseClick: {
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (mouseEvent->IsLeftClickEvent()
#ifdef XP_MACOSX
// On Mac, ctrl-click will send a context menu event from the widget,
// so we don't want to dispatch widget command if it is redispatched
// from the mouse event with ctrl key is pressed.
&& !mouseEvent->IsControl()
#endif
) {
if (mouseEvent->IsLeftClickEvent()) {
MouseClicked(mouseEvent);
}
break;

Просмотреть файл

@ -383,11 +383,6 @@ nsresult nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
#endif
} else if (aEvent->mMessage == eMouseDown &&
aEvent->AsMouseEvent()->mButton == MouseButton::eLeft &&
#ifdef XP_MACOSX
// On mac, ctrl-click will send a context menu event from the
// widget, so we don't want to bring up the menu.
!aEvent->AsMouseEvent()->IsControl() &&
#endif
!IsDisabled() && IsMenu()) {
// The menu item was selected. Bring up the menu.
// We have children.

Просмотреть файл

@ -285,14 +285,7 @@ nsresult nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
case eMouseClick: {
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (mouseEvent->IsLeftClickEvent()
#ifdef XP_MACOSX
// On Mac, ctrl-click will send a context menu event from the widget,
// so we don't want to dispatch widget command if it is redispatched
// from the mouse event with ctrl key is pressed.
&& !mouseEvent->IsControl()
#endif
) {
if (mouseEvent->IsLeftClickEvent()) {
MouseClicked(mouseEvent);
}
break;

Просмотреть файл

@ -134,14 +134,7 @@ nsresult nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
case eMouseClick: {
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (mouseEvent->IsLeftClickEvent()
#ifdef XP_MACOSX
// On Mac, ctrl-click will send a context menu event from the widget,
// so we don't want to dispatch widget command if it is redispatched
// from the mouse event with ctrl key is pressed.
&& !mouseEvent->IsControl()
#endif
) {
if (mouseEvent->IsLeftClickEvent()) {
MouseClicked(mouseEvent);
}
break;

Просмотреть файл

@ -35,9 +35,6 @@ skip-if = os == 'linux' # No native mousedown event on Linux
skip-if = (verify && (os == 'win'))
[test_submenuClose.xhtml]
[test_windowminmaxsize.xhtml]
[test_resizer_ctrl_click.xhtml]
[test_resizer_incontent.xhtml]
[test_splitter.xhtml]
skip-if = toolkit == 'android' # no XUL theme
[test_titlebar_ctrl_click.xhtml]
[test_toolbarbutton_ctrl_click.xhtml]

Просмотреть файл

@ -1,50 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for the resizer element
-->
<window title="Titlebar" width="200" height="200"
onload="setTimeout(test_resizer_ctrl_click, 0);"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<resizer id="resizer" dir="bottomend" width="16" height="16"/>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
const { AppConstants } = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
SimpleTest.waitForExplicitFinish();
function test_resizer_ctrl_click()
{
let resizer = document.getElementById("resizer");
let isCommandFired = false;
resizer.addEventListener("click", function(aEvent) {
// Delay check for command event, because it is fired after click event.
setTimeout(() => {
is(isCommandFired, AppConstants.platform != "macosx",
"Check if command event is fired");
SimpleTest.finish();
}, 0);
});
resizer.addEventListener("command", function(aEvent) {
isCommandFired = true;
ok(aEvent.ctrlKey, "Check ctrlKey for command event");
ok(!aEvent.shiftKey, "Check shiftKey for command event");
ok(!aEvent.altKey, "Check altKey for command event");
ok(!aEvent.metaKey, "Check metaKey for command event");
is(aEvent.inputSource, MouseEvent.MOZ_SOURCE_MOUSE,
"Check inputSource for command event");
});
synthesizeMouseAtCenter(resizer, { ctrlKey: true });
}
]]>
</script>
</window>

Просмотреть файл

@ -1,52 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for the titlebar element
-->
<window title="Titlebar" width="200" height="200"
onload="setTimeout(test_titlebar_ctrl_click, 0);"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<titlebar id="titlebar">
<label id="label" value="Titlebar"/>
</titlebar>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
const { AppConstants } = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
SimpleTest.waitForExplicitFinish();
function test_titlebar_ctrl_click()
{
let titlebar = document.getElementById("titlebar");
let isCommandFired = false;
titlebar.addEventListener("click", function(aEvent) {
// Delay check for command event, because it is fired after click event.
setTimeout(() => {
is(isCommandFired, AppConstants.platform != "macosx",
"Check if command event is fired");
SimpleTest.finish();
}, 0);
});
titlebar.addEventListener("command", function(aEvent) {
isCommandFired = true;
ok(aEvent.ctrlKey, "Check ctrlKey for command event");
ok(!aEvent.shiftKey, "Check shiftKey for command event");
ok(!aEvent.altKey, "Check altKey for command event");
ok(!aEvent.metaKey, "Check metaKey for command event");
is(aEvent.inputSource, MouseEvent.MOZ_SOURCE_MOUSE,
"Check inputSource for command event");
});
synthesizeMouseAtCenter(titlebar, { ctrlKey: true });
}
]]>
</script>
</window>

Просмотреть файл

@ -1,50 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<!--
XUL Widget Test for the toolbarbutton element
-->
<window title="Titlebar" width="200" height="200"
onload="setTimeout(test_resizer_ctrl_click, 0);"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<toolbarbutton id="toolbarbutton" width="16" height="16"/>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
const { AppConstants } = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
SimpleTest.waitForExplicitFinish();
function test_resizer_ctrl_click()
{
let toolbarbutton = document.getElementById("toolbarbutton");
let isCommandFired = false;
toolbarbutton.addEventListener("click", function(aEvent) {
// Delay check for command event, because it is fired after click event.
setTimeout(() => {
is(isCommandFired, AppConstants.platform != "macosx",
"Check if command event is fired");
SimpleTest.finish();
}, 0);
});
toolbarbutton.addEventListener("command", function(aEvent) {
isCommandFired = true;
ok(aEvent.ctrlKey, "Check ctrlKey for command event");
ok(!aEvent.shiftKey, "Check shiftKey for command event");
ok(!aEvent.altKey, "Check altKey for command event");
ok(!aEvent.metaKey, "Check metaKey for command event");
is(aEvent.inputSource, MouseEvent.MOZ_SOURCE_MOUSE,
"Check inputSource for command event");
});
synthesizeMouseAtCenter(toolbarbutton, { ctrlKey: true });
}
]]>
</script>
</window>

Просмотреть файл

@ -1562,14 +1562,6 @@
value: @IS_NIGHTLY_BUILD@
mirror: always
#if defined(XP_MACOSX)
# Whether to disable treating ctrl click as right click
- name: dom.event.treat_ctrl_click_as_right_click.disabled
type: bool
value: @IS_NIGHTLY_BUILD@
mirror: always
#endif
# Enable clipboard readText() and writeText() by default
- name: dom.events.asyncClipboard
type: bool

Просмотреть файл

@ -3159,6 +3159,8 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
return;
}
NSUInteger modifierFlags = [theEvent modifierFlags];
WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild, WidgetMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
@ -3170,12 +3172,10 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
}
geckoEvent.mClickCount = clickCount;
if (!StaticPrefs::dom_event_treat_ctrl_click_as_right_click_disabled() &&
([theEvent modifierFlags] & NSControlKeyMask)) {
if (modifierFlags & NSControlKeyMask)
geckoEvent.mButton = MouseButton::eRight;
} else {
else
geckoEvent.mButton = MouseButton::eLeft;
}
mGeckoChild->DispatchInputEvent(&geckoEvent);
mBlockedLastMouseDown = NO;
@ -3199,13 +3199,10 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
WidgetMouseEvent geckoEvent(true, eMouseUp, mGeckoChild, WidgetMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
if (!StaticPrefs::dom_event_treat_ctrl_click_as_right_click_disabled() &&
([theEvent modifierFlags] & NSControlKeyMask)) {
if ([theEvent modifierFlags] & NSControlKeyMask)
geckoEvent.mButton = MouseButton::eRight;
} else {
else
geckoEvent.mButton = MouseButton::eLeft;
}
// Remember the event's position before calling DispatchInputEvent, because
// that call can mutate it and convert it into a different coordinate space.