The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in Firefox 11

Status

()

Core
Widget: Android
--
critical
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: masayuki, Assigned: kats)

Tracking

Trunk
mozilla11
All
Android
Points:
---

Firefox Tracking Flags

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

Details

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

Attachments

(2 attachments, 2 obsolete attachments)

(Reporter)

Description

6 years ago
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);
     DispatchEvent(event);
+    if (Destroyed()) {
+        return;
+    }

And:

nsWindow should set nsBaseWidget::mOnDestroyCalled to TRUE when it's destroying.
# It seems that nsBaseWidget::OnDestroy() should be called too...
(Reporter)

Updated

6 years ago
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
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [sg:critical?]
tracking-fennec: --- → ?
tracking-firefox8: --- → -
tracking-firefox9: --- → -
tracking-fennec: ? → +

Updated

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

Updated

6 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

6 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)

Updated

5 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
Try push: https://tbpl.mozilla.org/?tree=Try&rev=a0ad3f7fac68

Pushed to mozilla-inbound:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d34c48393e3b
https://hg.mozilla.org/integration/mozilla-inbound/rev/d10af1d1d985
Keywords: checkin-needed
Attachment #576226 - Flags: checkin+
Attachment #576227 - Flags: checkin+
https://hg.mozilla.org/mozilla-central/rev/d10af1d1d985
https://hg.mozilla.org/mozilla-central/rev/d34c48393e3b
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED

Updated

5 years ago
Target Milestone: --- → mozilla11

Updated

5 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.
Landed on the mozilla-esr10 repository:

https://hg.mozilla.org/releases/mozilla-esr10/rev/9d8331f4e43b
https://hg.mozilla.org/releases/mozilla-esr10/rev/4663a567d884
status-firefox-esr10: affected → fixed
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.