Closed Bug 1420590 Opened 4 years ago Closed 4 years ago
dragleave event returns bad target
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;
But yes, that looks reasonable. Or one could pass false to AssignDragEventData and set only the needed *Target variables.
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/9b1af0e28db1 dragleave event returns bad target. r=smaug.
You need to log in before you can comment on or make changes to this bug.