In at least Chrome 41, events' currentTarget is an own property with a broken descriptor. Setting a new descriptor on one of these events makes it impossible to restore the default behavior of currentTarget for that event, making it useless to any later listeners. Shady DOM occasionally has to manually dispatch an event, which involves temporarily setting a new currentTarget descriptor to allow Shady DOM to update this property. With this PR, if the currentTarget property of events is broken as it is in Chrome 41, Shady DOM will create a new object with the event as its prototype, modify that new object's currentTarget descriptor, and pass that new object to listeners during the manual dispatch.
EventTarget doesn't exist in some older browsers, so objects that would normally have EventTarget.prototype in their prototype chain in modern browsers instead have separate copies of those properties on other prototypes. XMLHttpRequest is one of these objects with EventTarget-like properties, but these properties were unpatched until this PR.
In at least Chrome 41, events'
currentTarget
is an own property with a broken descriptor. Setting a new descriptor on one of these events makes it impossible to restore the default behavior ofcurrentTarget
for that event, making it useless to any later listeners. Shady DOM occasionally has to manually dispatch an event, which involves temporarily setting a newcurrentTarget
descriptor to allow Shady DOM to update this property. With this PR, if thecurrentTarget
property of events is broken as it is in Chrome 41, Shady DOM will create a new object with the event as its prototype, modify that new object'scurrentTarget
descriptor, and pass that new object to listeners during the manual dispatch.EventTarget
doesn't exist in some older browsers, so objects that would normally haveEventTarget.prototype
in their prototype chain in modern browsers instead have separate copies of those properties on other prototypes.XMLHttpRequest
is one of these objects withEventTarget
-like properties, but these properties were unpatched until this PR.