diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 6276c60b28ed..5f9225abc891 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -812,8 +812,6 @@ var BookmarksEventHandler = { // Call onCommand in the cases where it's not called automatically: // Middle-clicks outside of menus. this.onCommand(aEvent); - aEvent.preventDefault(); - aEvent.stopPropagation(); } }, diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs index 0ffd0adb5152..9acce3987606 100644 --- a/browser/components/urlbar/UrlbarInput.sys.mjs +++ b/browser/components/urlbar/UrlbarInput.sys.mjs @@ -3595,18 +3595,6 @@ export class UrlbarInput { } _on_paste(event) { - if (event.explicitOriginalTarget != this.inputField) { - // In Gecko, a paste event is fired on the field that has focus when - // pasting is performed by a middle mouse click. In normal web contents, - // it will not be issue because the focus will move to a component - // clicked. But for the urlbar (and XUL), as the focus is kept, the paste - // event is received even when clicking on other components. Thus, check - // the component that is the original source of the event, if it is not - // this input component, ignore. - event.preventDefault(); - return; - } - let originalPasteData = event.clipboardData.getData("text/plain"); if (!originalPasteData) { return; diff --git a/browser/components/urlbar/tests/browser/browser_middleClick.js b/browser/components/urlbar/tests/browser/browser_middleClick.js index b0255a87a447..1a5088f8278f 100644 --- a/browser/components/urlbar/tests/browser/browser_middleClick.js +++ b/browser/components/urlbar/tests/browser/browser_middleClick.js @@ -119,25 +119,6 @@ add_task(async function test_middleClickOnHomeButtonWithNewWindow() { await testMiddleClickOnHomeButtonWithNewWindow(true); }); -add_task(async function test_middleClickOnComponentNotHandlingPasteEvent() { - Services.prefs.setBoolPref("middlemouse.paste", true); - - info("Set initial value"); - SpecialPowers.clipboardCopyString("test\nsample"); - gURLBar.value = ""; - gURLBar.focus(); - - info("Middle click on a component that does not handle paste event"); - const onPasted = new Promise(r => - gURLBar.addEventListener("paste", r, { once: true }) - ); - const allTabsButton = document.getElementById("alltabs-button"); - EventUtils.synthesizeMouseAtCenter(allTabsButton, { button: 1 }); - await onPasted; - - Assert.equal(gURLBar.value, "", "URLBar has no pasted value"); -}); - async function testMiddleClickOnTab(isMiddleMousePastePrefOn) { info(`Set middlemouse.paste [${isMiddleMousePastePrefOn}]`); Services.prefs.setBoolPref("middlemouse.paste", isMiddleMousePastePrefOn);