diff --git a/dom/nfc/NfcContentHelper.js b/dom/nfc/NfcContentHelper.js index bc1027b9462f..5b3deeafb311 100644 --- a/dom/nfc/NfcContentHelper.js +++ b/dom/nfc/NfcContentHelper.js @@ -90,16 +90,10 @@ NfcContentHelper.prototype = { }), _requestMap: null, - _rfState: null, eventListener: null, - init: function init(aWindow) { - let info = cpmm.sendSyncMessage("NFC:QueryInfo")[0]; - this._rfState = info.rfState; - }, - queryRFState: function queryRFState() { - return this._rfState; + return cpmm.sendSyncMessage("NFC:QueryInfo")[0].rfState; }, setFocusApp: function setFocusApp(tabId, isFocus) { @@ -319,8 +313,7 @@ NfcContentHelper.prototype = { this.eventListener.notifyTagLost(result.sessionToken); break; case NFC.RF_EVENT_STATE_CHANGED: - this._rfState = result.rfState; - this.eventListener.notifyRFStateChanged(this._rfState); + this.eventListener.notifyRFStateChanged(result.rfState); break; case NFC.FOCUS_CHANGED: this.eventListener.notifyFocusChanged(result.focus); diff --git a/dom/nfc/nsINfcContentHelper.idl b/dom/nfc/nsINfcContentHelper.idl index c74009b74cae..635f1ff23386 100644 --- a/dom/nfc/nsINfcContentHelper.idl +++ b/dom/nfc/nsINfcContentHelper.idl @@ -124,11 +124,9 @@ interface nsINfcBrowserAPI : nsISupports in boolean isFocus); }; -[scriptable, uuid(080a84f1-f039-46ed-9dc6-f34ce3aa9638)] +[scriptable, uuid(f098c114-b21f-43f5-9f53-0c22b4f194eb)] interface nsINfcContentHelper : nsISupports { - void init(in nsIDOMWindow window); - /** * Read current NDEF data on the tag. * @@ -206,7 +204,7 @@ interface nsINfcContentHelper : nsISupports in nsINfcRequestCallback callback); /** - * Get current RF state. + * Get current RF state. This function will be blocking. */ DOMString queryRFState(); diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 67265efa7871..a680dd351bf3 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -361,7 +361,6 @@ MozNFCImpl.prototype = { this.defineEventHandlerGetterSetter("onpeerlost"); if (this._nfcContentHelper) { - this._nfcContentHelper.init(aWindow); this._tabId = this.getTabId(aWindow); this._nfcContentHelper.addEventListener(this, this._tabId); this._rfState = this._nfcContentHelper.queryRFState();