With the patches in bug 1265072, I believe there are only two _callers_ of GetContextForEventHandlers: 1) The ifdef DEBUG block in EventDispatcher::Dispatch. Not sure what this is trying to assert and whether we really care about it. 2) DataTransfer::GetDataAtInternal which is simply using it to get to nsIGlobalObject; it can do that just as well by doing GetWindowIfCurrent() or GetOwner() (possibly with CheckInnerWindowCorrectness, depending on how it wants to handle non-current inners). Am I missing something about how this function should be used?
(1) is just trying to get some sane global or check whether we used to have a global. If there hasn't been any global ever, like in XBL documents case, we bypass the warning/assertion. IIRC C++ XBL code uses load event listener in an unsafe way, if that was exposed to scripts, but it is not, at least not in any trivial way. 2) could indeed use something like GetWindowIfCurrent, whatever it is actually called. The method was added in Bug 435656 to deal with nsCxPushing consistently, so that we'd fail fast in case there wasn't a global to use (but the event target used to be bound to some global in some way).
Hmm. I guess GetWindowIfCurrent() is on DOMEventTargetHelper, not on EventTarget, with bug 1265072. I guess we could try pushing up virtual things like that to EventTarget... Basically, it seems silly to go through the scriptcontext to get the global, since the "get the scriptcontext" stuff gets the global first...
2 years ago
Depends on: 1265072
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Last Resolved: 3 days ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.