Closed Bug 688208 Opened 13 years ago Closed 13 years ago

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

Categories

(Core Graveyard :: Widget: Android, defect)

All
Android
defect
Not set
critical

Tracking

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

RESOLVED FIXED
mozilla11
Tracking Status
firefox8 - ---
firefox9 - ---
firefox10 - ---
firefox11 - fixed
firefox-esr10 11+ fixed
status1.9.2 --- unaffected
fennec + ---

People

(Reporter: masayuki, Assigned: kats)

Details

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

Attachments

(2 files, 2 obsolete files)

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...
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-fennec: ? → +
Assignee: doug.turner → blassey.bugs
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.
Attached patch kungFu patch rev. 1 (obsolete) — Splinter Review
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
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)
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+
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+
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+
Target Milestone: --- → mozilla11
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.
[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.
Untracking from QA Firefox Desktop verifications
Whiteboard: [sg:critical?] → [sg:critical?][qa-]
Group: core-security
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: