Bug 1038617 - B2G NFC: can't access dead object thrown from nsNfc.js. r=smaug

This commit is contained in:
Yoshi Huang 2014-07-21 15:43:45 +08:00
parent 4f8de1e372
commit 2bf4fe0214

View File

@ -264,7 +264,16 @@ mozNfc.prototype = {
return eventType;
},
hasDeadWrapper: function hasDeadWrapper() {
return Cu.isDeadWrapper(this._window) || Cu.isDeadWrapper(this.__DOM_IMPL__);
},
firePeerEvent: function firePeerEvent(evt, sessionToken) {
if (this.hasDeadWrapper()) {
dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
return;
}
let peerEvent = (NFC_PEER_EVENT_READY === evt) ? "peerready" : "peerlost";
let detail = {
"detail":sessionToken