Closed Bug 1167603 Opened 10 years ago Closed 10 years ago

Mark JSEventHandler::mTarget as MOZ_UNSAFE_REF

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: nika, Assigned: nika)

Details

Attachments

(1 file)

No description provided.
Component: DOM → DOM: Events
Attachment #8609376 - Flags: review?(bugs)
Comment on attachment 8609376 [details] [diff] [review] Mark JSEventHandler::mTarget as MOZ_UNSAFE_REF It is no always clear whether to use MOZ_NON_OWNING_REF or MOZ_UNSAFE_REF, but since MOZ_UNSAFE_REF sounds scarier, it is always fine :)
Attachment #8609376 - Flags: review?(bugs) → review+
Did you check we actually always call Disconnect() in case someone has set mTarget to non-null value?
I remember doing some dxr-diving with this bug to try and make sure that the Disconnect handler was actually called, but it may be worth the time to go through the code again (I remember that this one was particularly hairy).
In https://dxr.mozilla.org/mozilla-central/source/dom/xbl/nsXBLPrototypeHandler.cpp#325, Disconnect is called before the handler, scriptTarget, leaves scope at the end of the method. The other place where JSEventHandlers are created is https://dxr.mozilla.org/mozilla-central/source/dom/events/EventListenerManager.cpp#621-622. This event handler is associated with a `Listener` object, which ->Disconnect()s the JSEventHandler when it is destroyed. The Listener objects are all destroyed when the mTarget value belonging to the parent EventListenerManager object is invalidated (through EventListenerManager::Disconnect() - which is outside the scope of this patch).
Keywords: checkin-needed
can we get a try run for this change ? Thanks!
Flags: needinfo?(michael)
Keywords: checkin-needed
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d42a1d6babfa Sorry - this change is basically comments (as MOZ_UNSAFE_REF expands to /* nothing */) - so I didn't think I should bother with a try run.
Flags: needinfo?(michael)
Assignee: nobody → michael
(In reply to Pulsebot from comment #10) > https://hg.mozilla.org/integration/b2g-inbound/rev/2ce3db0db984 Ignore this, incorrect bug number.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: