author | Dimi Lee <dlee@mozilla.com> |
Thu, 27 Nov 2014 17:02:56 +0800 | |
changeset 217884 | 5bbffe503f7b833b23d7a90e1c65fd3dbb84bd24 |
parent 217883 | c6155f114ca279894649f9bd746096d8440c40c1 |
child 217885 | 98f74038323eb7ede6f638f641efe7ff7f2878f6 |
push id | 27895 |
push user | philringnalda@gmail.com |
push date | Fri, 28 Nov 2014 01:08:57 +0000 |
treeherder | autoland@ebdbd84d933d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | allstars.chh |
bugs | 1093483 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/nfc/gonk/Nfc.js | file | annotate | diff | comparison | revisions | |
dom/nfc/gonk/nfc_consts.js | file | annotate | diff | comparison | revisions |
--- a/dom/nfc/gonk/Nfc.js +++ b/dom/nfc/gonk/Nfc.js @@ -604,27 +604,19 @@ Nfc.prototype = { */ gSystemMessenger.broadcastMessage("nfc-hci-event-transaction", message); }, /** * Process a message from the gMessageManager. */ receiveMessage: function receiveMessage(message) { - let isRFAPI = message.name == "NFC:ChangeRFState"; - let isSendFile = message.name == "NFC:SendFile"; - let isInfoAPI = message.name == "NFC:QueryInfo"; - - if (!isRFAPI && !isInfoAPI && (this.rfState != NFC.NFC_RF_STATE_DISCOVERY)) { - debug("NFC is not enabled. current rfState:" + this.rfState); - this.sendNfcErrorResponse(message, NFC.NFC_GECKO_ERROR_NOT_ENABLED); - return null; - } - - if (!isRFAPI && !isSendFile && !isInfoAPI) { + if (["NFC:ChangeRFState", + "NFC:SendFile", + "NFC:QueryInfo"].indexOf(message.name) == -1) { // Update the current sessionId before sending to the NFC service. message.data.sessionId = SessionHelper.getId(message.data.sessionToken); } switch (message.name) { case "NFC:ChangeRFState": this.sendToNfcService("changeRFState", message.data); break;
--- a/dom/nfc/gonk/nfc_consts.js +++ b/dom/nfc/gonk/nfc_consts.js @@ -21,24 +21,22 @@ this.DEBUG_ALL = false; // Set individually to debug specific layers this.DEBUG_CONTENT_HELPER = DEBUG_ALL || false; this.DEBUG_NFC = DEBUG_ALL || false; // Gecko specific error codes this.NFC_GECKO_SUCCESS = 0; this.NFC_GECKO_ERROR_GENERIC_FAILURE = 1; this.NFC_GECKO_ERROR_P2P_REG_INVALID = 2; -this.NFC_GECKO_ERROR_NOT_ENABLED = 3; -this.NFC_GECKO_ERROR_SEND_FILE_FAILED = 4; -this.NFC_GECKO_ERROR_BAD_SESSION_TOKEN = 5; +this.NFC_GECKO_ERROR_SEND_FILE_FAILED = 3; +this.NFC_GECKO_ERROR_BAD_SESSION_TOKEN = 4; this.NFC_ERROR_MSG = {}; this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_GENERIC_FAILURE] = "NfcGenericFailureError"; this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_P2P_REG_INVALID] = "NfcP2PRegistrationInvalid"; -this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_NOT_ENABLED] = "NfcNotEnabledError"; this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_SEND_FILE_FAILED] = "NfcSendFileFailed"; this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_BAD_SESSION_TOKEN] = "NfcBadSessionToken"; this.NFC_RF_STATE_IDLE = "idle"; this.NFC_RF_STATE_LISTEN = "listen"; this.NFC_RF_STATE_DISCOVERY = "discovery"; this.TOPIC_MOZSETTINGS_CHANGED = "mozsettings-changed";