Backed out changeset 909fc50c54a1 (bug 1838743) for causing failures on browser_947914_button_paste.js CLOSED TREE

This commit is contained in:
Norisz Fay 2023-07-07 05:57:07 +03:00
parent d8587a69a7
commit 8c7626e3a4
3 changed files with 0 additions and 33 deletions

View File

@ -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();
}
},

View File

@ -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;

View File

@ -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);