Closed Bug 1038617 Opened 10 years ago Closed 10 years ago

B2G NFC: can't access dead object thrown from nsNfc.js

Categories

(Firefox OS Graveyard :: NFC, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.1 S1 (1aug)

People

(Reporter: allstars.chh, Assigned: allstars.chh)

References

Details

(Whiteboard: [p=3])

Attachments

(1 file, 3 obsolete files)

log from https://bugzilla.mozilla.org/show_bug.cgi?id=1034405#c3
It seems there is something wrong in notifyPeerEvent in Nfc.js or maybe the peerEventCallbackMap has problem, so in the end a closure from an previous leaked nsNfc.js is called and throw this error when the closure tried to get __DOM_IMPL__.
Assignee: nobody → allstars.chh
Attached patch Patch (obsolete) — Splinter Review
remove DEBUG.
Attachment #8459438 - Attachment is obsolete: true
Comment on attachment 8459439 [details] [diff] [review]
Patch

Hi, Kyle
When mozNfc.onpeerready is assigned, registerTarget in nsNfc.js will be called.

We discovered this bug from Bug 1034405.
When Contacts app is ready to share its content, it will set onpeerready callback,
However if a mozContact is received through NFC from another device at this moment, this contact would be dispatched through MozActivity and then an Activity Window will try to show this contact and set the onpeeready callback again.

So there are two calls to set onpeeready, one is from the Contacts app, and the other is from the Activity Window.
When the callback nsINfcPeerCallback is called, the window object and __DOM_IMPL are already invalid so the error "can't access dead object" will be thrown.

So I add the check isDeadWrapper for these two objects.

Can you help to review this?

Thanks
Attachment #8459439 - Flags: review?(khuey)
Attached patch Patch. v2 (obsolete) — Splinter Review
Move it into a function.
Attachment #8459439 - Attachment is obsolete: true
Attachment #8459439 - Flags: review?(khuey)
Attachment #8462293 - Flags: review?(khuey)
Comment on attachment 8462293 [details] [diff] [review]
Patch. v2

I have sent r? for two weeks and it seems Kyle is busy recently. :P

Change r? to smaug.

Hi Smaug
Do you have time to review this patch for me?
Or if you're busy I'll find other reviewer.

Thanks
Attachment #8462293 - Flags: review?(khuey) → review?(bugs)
Comment on attachment 8462293 [details] [diff] [review]
Patch. v2

isDeadWrapper sounds a bit wrong.
Perhaps hasDeadWrapper.
Attachment #8462293 - Flags: review?(bugs) → review+
Attached patch Patch. v3Splinter Review
rename to hasDeadWrapper
Attachment #8462293 - Attachment is obsolete: true
Attachment #8464468 - Flags: review+
Whiteboard: [p=3]
Target Milestone: --- → 2.1 S1 (1aug)
I think this has been landed on m-c

http://hg.mozilla.org/mozilla-central/rev/447fd3d98aa4

Tom, can we close this ?

Thank you.
Flags: needinfo?(cbook)
https://hg.mozilla.org/mozilla-central/rev/447fd3d98aa4
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Flags: needinfo?(cbook)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: