Bug 1398390 - Only react to mousedown if it is a left-click. r=Gijs
MozReview-Commit-ID: Ie2Xgasg2eN
This commit is contained in:
@@ -557,7 +557,7 @@ var BrowserPageActions = {
|
|||||||
*/
|
*/
|
||||||
mainButtonClicked(event) {
|
mainButtonClicked(event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
if ((event.type == "click" && event.button != 0) ||
|
if ((event.type == "mousedown" && event.button != 0) ||
|
||||||
(event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
|
(event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
|
||||||
event.keyCode != KeyEvent.DOM_VK_RETURN)) {
|
event.keyCode != KeyEvent.DOM_VK_RETURN)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -4230,6 +4230,9 @@ OverflowableToolbar.prototype = {
|
|||||||
this._enable();
|
this._enable();
|
||||||
break;
|
break;
|
||||||
case "mousedown":
|
case "mousedown":
|
||||||
|
if (aEvent.button != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (aEvent.target == this._chevron) {
|
if (aEvent.target == this._chevron) {
|
||||||
this._onClickChevron(aEvent);
|
this._onClickChevron(aEvent);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -359,6 +359,9 @@ const PanelUI = {
|
|||||||
|
|
||||||
let domEvent = null;
|
let domEvent = null;
|
||||||
if (aEvent) {
|
if (aEvent) {
|
||||||
|
if (aEvent.type == "mousedown" && aEvent.button != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (aEvent.type == "command" && aEvent.inputSource != null) {
|
if (aEvent.type == "command" && aEvent.inputSource != null) {
|
||||||
// Synthesize a new DOM mouse event to pass on the inputSource.
|
// Synthesize a new DOM mouse event to pass on the inputSource.
|
||||||
domEvent = document.createEvent("MouseEvent");
|
domEvent = document.createEvent("MouseEvent");
|
||||||
|
|||||||
@@ -504,6 +504,10 @@ const DownloadsIndicatorView = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onCommand(aEvent) {
|
onCommand(aEvent) {
|
||||||
|
if (aEvent.type == "mousedown" && aEvent.button != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the downloads button is in the menu panel, open the Library
|
// If the downloads button is in the menu panel, open the Library
|
||||||
let widgetGroup = CustomizableUI.getWidget("downloads-button");
|
let widgetGroup = CustomizableUI.getWidget("downloads-button");
|
||||||
if (widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) {
|
if (widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ add_task(async function test_overflow_anchor() {
|
|||||||
await waitForOverflowed(button, true);
|
await waitForOverflowed(button, true);
|
||||||
|
|
||||||
let promise = promisePanelOpened();
|
let promise = promisePanelOpened();
|
||||||
button.node.dispatchEvent(new Event("mousedown"));
|
EventUtils.sendMouseEvent({ type: "mousedown", button: 0 }, button.node);
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
let panel = DownloadsPanel.panel;
|
let panel = DownloadsPanel.panel;
|
||||||
@@ -58,7 +58,7 @@ add_task(async function test_overflow_anchor() {
|
|||||||
|
|
||||||
// Now try opening the panel again.
|
// Now try opening the panel again.
|
||||||
promise = promisePanelOpened();
|
promise = promisePanelOpened();
|
||||||
button.node.dispatchEvent(new Event("mousedown"));
|
EventUtils.sendMouseEvent({ type: "mousedown", button: 0 }, button.node);
|
||||||
await promise;
|
await promise;
|
||||||
|
|
||||||
is(panel.anchorNode.id, "downloads-indicator-anchor");
|
is(panel.anchorNode.id, "downloads-indicator-anchor");
|
||||||
|
|||||||
Reference in New Issue
Block a user