Closed Bug 1420590 Opened 7 years ago Closed 7 years ago

dragleave event returns bad target

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect, P2)

58 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox57 --- wontfix
firefox58 --- wontfix
firefox59 --- fixed

People

(Reporter: danny0838, Assigned: stone)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 Build ID: 20171024165158 Steps to reproduce: 1. download the attachment and open it in Firefox. 2. drag something into the page and then drag out. Actual results: When dragleave fires, the event.target is set to document (if e10s activated) or XULDocument (if e10s not activated; and accessing event.target throws an error in this case). Expected results: The event.target should be the .dropmask element. (in other browsers)
Attachment #8931845 - Attachment description: Illustration the dragleave bug → Illustration of the dragleave bug
Component: Untriaged → Drag and Drop
Product: Firefox → Core
Within EventStateManager::FireDragEnterOrExit an event is created and AssignDragEventData is called to copy over data from the existing event. However, the event target in mTarget is sometimes not the same as the one passed to EventDispatcher::Dispatch. Specifically, for dragexit/dragleave events, it is sLastDragOverFrame's content. It does seem to work if I manually null out mTarget and mOriginalTarget before calling EventDispatcher::Dispatch. Is this a suitable fix? Should I just do this in all cases? That is, something like the following for dragexit/dragleave events: event.AssignDragEventData(*aDragEvent, true); + event.mTarget = nullptr; + event.mOriginalTarget = nullptr;
Flags: needinfo?(bugs)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Hmm, is this a regression from bug 1327185, sort of.
Blocks: 1327185
Flags: needinfo?(bugs)
But yes, that looks reasonable. Or one could pass false to AssignDragEventData and set only the needed *Target variables.
Assignee: nobody → sshih
Attachment #8940061 - Flags: review?(bugs)
Attachment #8940061 - Flags: review?(bugs) → review+
Pushed by sshih@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/9b1af0e28db1 dragleave event returns bad target. r=smaug.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Blocks: 1609903
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: