nsWindow for Android doesn't check whether the instance is destroying or not after dispatching an event

RESOLVED FIXED in Firefox 11



7 years ago
7 years ago


(Reporter: masayuki, Assigned: kats)



Firefox Tracking Flags

(firefox8-, firefox9-, firefox10-, firefox11- fixed, firefox-esr1011+ fixed, status1.9.2 unaffected, fennec+)


(Whiteboard: [sg:critical?][qa-])


(2 attachments, 2 obsolete attachments)

Android's nsWindow doesn't hold itself and doesn't check whether it's destroying or not after dispatching an event. I'm not sure that actually causes crash bugs. We should research it.

nsWindow might be destroyed by DOM event handler. Mac's widget has fixed this already but I'm not sure the detail and bug#. Steven probably knows the bug#.

I think nsWindow for Android should do:

+    nsRefPtr<nsWindow> kungFuDeathGrip(this);
+    if (Destroyed()) {
+        return;
+    }


nsWindow should set nsBaseWidget::mOnDestroyCalled to TRUE when it's destroying.
# It seems that nsBaseWidget::OnDestroy() should be called too...
Keywords: crash
Don't know enough about android to confirm this, but plausibly sg:critical based on analogy with other platforms.
Assignee: nobody → doug.turner
Ever confirmed: true
Whiteboard: [sg:critical?]
tracking-fennec: --- → ?
tracking-firefox8: --- → -
tracking-firefox9: --- → -
tracking-fennec: ? → +


7 years ago
Assignee: doug.turner → blassey.bugs


7 years ago
Assignee: blassey.bugs → kgupta
Bug 402505 is the one where this issue was happening on Mac. I tried the test cases from that bug on android and they didn't trigger any crashes. I'll keep investigating and try other ways to trigger the crash before concluding one way or another.
So I wasn't able to trigger the crash mostly because it seems impossible to close the window on Android. After discussing with blassey, it makes sense to fix this anyway since in the future it might be possible to close windows and this bug might show up. Will attach two patches (one for the missing nsBaseWidget::OnDestroy() call, and one for the kungFuDeathGrip stuff.
Created attachment 565374 [details] [diff] [review]
OnDestroy patch rev. 1
Created attachment 565375 [details] [diff] [review]
kungFu patch rev. 1

Sorry, forgot to check the patch box on the previous one.
Attachment #565374 - Flags: review?(doug.turner)
Attachment #565375 - Flags: review?(doug.turner)
Attachment #565374 - Attachment is patch: true

Comment 6

7 years ago
kats, can you build a test case that opens two xul windows and programatically close them?
Attachment #565375 - Flags: review?(doug.turner) → review?(mark.finkle)
Attachment #565374 - Flags: review?(doug.turner) → review?(mark.finkle)


7 years ago
tracking-firefox10: --- → -
tracking-firefox11: --- → -
Attachment #565374 - Flags: review?(mark.finkle) → review+
Comment on attachment 565375 [details] [diff] [review]
kungFu patch rev. 1

Each platform seems to handle these "check for destroyed after a DOM event" differently, but it looks like you have things covered here. Certainly better covered than before.

It's also true that we don't have really great ways to test these cases yet either.
Attachment #565375 - Flags: review?(mark.finkle) → review+
Created attachment 576226 [details] [diff] [review]
OnDestroy patch rev. 2

Rebase to m-c tip and update patch so that it is an hg export with commit message rather than a raw diff.
Attachment #565374 - Attachment is obsolete: true
Attachment #576226 - Flags: review+
Created attachment 576227 [details] [diff] [review]
kungFu patch rev. 2

Rebase to m-c tip and update patch so that it is an hg export with commit message rather than a raw diff.
Attachment #565375 - Attachment is obsolete: true
Attachment #576227 - Flags: review+
Keywords: checkin-needed
Attachment #576226 - Flags: checkin+
Attachment #576227 - Flags: checkin+


7 years ago
Target Milestone: --- → mozilla11


7 years ago
status-firefox11: --- → fixed
Since we're shipping XUL Mobile "11" based on ESR so we will need to fix this one on the ESR in order to get this mobile-only security fix out to users.
status-firefox-esr10: --- → affected
tracking-firefox-esr10: --- → 11+
[Triage comment]

This bug is being tracked for landing on ESR branch.  Please land patches on http://hg.mozilla.org/releases/mozilla-esr10/by Thursday March 1, 2012 in order to be ready for go-to-build on Friday March 2, 2012.

See https://wiki.mozilla.org/Release_Management/ESR_Landing_Process for more information.
Did we create a way to test this fix? I see comments about doing so but that's it.
No, IIRC we couldn't find a way to test this behaviour properly.
Not a 1.9.2 issue. Marking as unaffected.
status1.9.2: --- → unaffected
Untracking from QA Firefox Desktop verifications
Whiteboard: [sg:critical?] → [sg:critical?][qa-]
Group: core-security
You need to log in before you can comment on or make changes to this bug.