Bug 1165841 - Part 3: remove _rfState and init from NfcContentHelper. r=dimi

This commit is contained in:
Yoshi Huang 2015-05-20 17:10:17 +08:00
parent 2338dbd5cc
commit c1ccc522ea
3 changed files with 4 additions and 14 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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();