From ca7f1552fe7c8b6425e9c10604980565450c6852 Mon Sep 17 00:00:00 2001 From: Yoshi Huang Date: Wed, 31 Dec 2014 17:08:17 +0800 Subject: [PATCH] Bug 1116725 - TypeError : isLost is a readonly attribute. r=smaug, dimi --- dom/nfc/nsNfc.js | 12 ++++++++++-- dom/webidl/MozNFCPeer.webidl | 11 +++++++---- dom/webidl/MozNFCTag.webidl | 11 +++++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 78c88167333e..7033155ba7df 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -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"); diff --git a/dom/webidl/MozNFCPeer.webidl b/dom/webidl/MozNFCPeer.webidl index a98b7a635c5d..1ab4bccce2ef 100644 --- a/dom/webidl/MozNFCPeer.webidl +++ b/dom/webidl/MozNFCPeer.webidl @@ -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(); }; diff --git a/dom/webidl/MozNFCTag.webidl b/dom/webidl/MozNFCTag.webidl index 07b31ab1f2c9..07f564b4ef05 100644 --- a/dom/webidl/MozNFCTag.webidl +++ b/dom/webidl/MozNFCTag.webidl @@ -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(); };