Bug 1116725 - TypeError : isLost is a readonly attribute. r=smaug, dimi

This commit is contained in:
Yoshi Huang 2014-12-31 17:08:17 +08:00
parent fa3994fa30
commit ca7f1552fe
3 changed files with 24 additions and 10 deletions

View File

@ -192,6 +192,10 @@ MozNFCTagImpl.prototype = {
return callback.promise;
},
notifyLost: function notifyLost() {
this.isLost = true;
},
classID: Components.ID("{4e1e2e90-3137-11e3-aa6e-0800200c9a66}"),
contractID: "@mozilla.org/nfc/tag;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
@ -244,6 +248,10 @@ MozNFCPeerImpl.prototype = {
return callback.promise;
},
notifyLost: function notifyLost() {
this.isLost = true;
},
classID: Components.ID("{c1b2bcf0-35eb-11e3-aa6e-0800200c9a66}"),
contractID: "@mozilla.org/nfc/peer;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
@ -432,7 +440,7 @@ MozNFCImpl.prototype = {
this, /* useCapture */false);
}
this.nfcTag.isLost = true;
this.nfcTag.notifyLost();
this.nfcTag = null;
debug("fire ontaglost " + sessionToken);
@ -491,7 +499,7 @@ MozNFCImpl.prototype = {
this, /* useCapture */false);
}
this.nfcPeer.isLost = true;
this.nfcPeer.notifyLost();
this.nfcPeer = null;
debug("fire onpeerlost");

View File

@ -10,6 +10,11 @@
[JSImplementation="@mozilla.org/nfc/peer;1", AvailableIn="PrivilegedApps"]
interface MozNFCPeer {
/**
* Indicate if this peer is already lost.
*/
readonly attribute boolean isLost;
/**
* Send NDEF data to peer device.
*/
@ -28,8 +33,6 @@ partial interface MozNFCPeer {
[ChromeOnly]
attribute DOMString session;
/**
* Indicate if this peer is already lost.
*/
readonly attribute boolean isLost;
[ChromeOnly]
void notifyLost();
};

View File

@ -72,6 +72,11 @@ interface MozNFCTag {
*/
readonly attribute boolean? canBeMadeReadOnly;
/**
* Indicate if this tag is already lost.
*/
readonly attribute boolean isLost;
/**
* Read current NDEF data on the tag.
*/
@ -102,8 +107,6 @@ partial interface MozNFCTag {
[ChromeOnly]
attribute DOMString session;
/**
* Indicate if this tag is already lost.
*/
readonly attribute boolean isLost;
[ChromeOnly]
void notifyLost();
};