mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1492196 - fix browser_searchbar_openpopup.js so we don't accidentally try to drag content in the URL bar, r=florian
Differential Revision: https://phabricator.services.mozilla.com/D6180 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c5bf22cd9a
commit
ba80b3c145
@ -460,6 +460,14 @@ add_task(async function dont_consume_clicks() {
|
||||
|
||||
// Dropping text to the searchbar should open the popup
|
||||
add_task(async function drop_opens_popup() {
|
||||
// The previous task leaves focus in the URL bar. However, in that case drags
|
||||
// can be interpreted as being selection drags by the drag manager, which
|
||||
// breaks the drag synthesis from EventUtils.js below. To avoid this, focus
|
||||
// the browser content instead.
|
||||
let focusEventPromise = BrowserTestUtils.waitForEvent(gBrowser.selectedBrowser, "focus");
|
||||
gBrowser.selectedBrowser.focus();
|
||||
await focusEventPromise;
|
||||
|
||||
let promise = promiseEvent(searchPopup, "popupshown");
|
||||
// Use a source for the drop that is outside of the search bar area, to avoid
|
||||
// it receiving a mousedown and causing the popup to sometimes open.
|
||||
|
@ -2613,6 +2613,9 @@ function synthesizeDragOver(aSrcElement, aDestElement, aDragData, aDropEffect, a
|
||||
obs.removeObserver(trapDrag, "on-datatransfer-available");
|
||||
|
||||
var dataTransfer = sess.dataTransfer;
|
||||
if (!dataTransfer) {
|
||||
throw new Error("No data transfer object after synthesizing the mouse!");
|
||||
}
|
||||
|
||||
// The EventStateManager will fire our dragenter event if it needs to.
|
||||
var event = createDragEventObject("dragover", aDestElement, aDestWindow,
|
||||
|
Loading…
Reference in New Issue
Block a user