Bug 1133390 - onfocuschanged(false) will be notified twice. r=dimi, a=bajaj
authorYoshi Huang <allstars.chh@mozilla.com>
Mon, 16 Feb 2015 11:13:18 +0800
changeset 233099 3daa393da2f91c7810cdc209c37e1636d29d3c8c
parent 233098 6b5a8f183c55673ba93d35d438a487a7f3b897d7
child 233100 089444e5358eda5a6f6cd8edfaef6777015897c7
push id177
push userryanvm@gmail.com
push dateTue, 17 Feb 2015 19:30:19 +0000
treeherdermozilla-b2g37_v2_2@089444e5358e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi, bajaj
bugs1133390
milestone37.0a2
Bug 1133390 - onfocuschanged(false) will be notified twice. r=dimi, a=bajaj
dom/nfc/gonk/Nfc.js
--- a/dom/nfc/gonk/Nfc.js
+++ b/dom/nfc/gonk/Nfc.js
@@ -173,18 +173,20 @@ XPCOMUtils.defineLazyGetter(this, "gMess
         dump("invalid target");
         return;
       }
 
       target.sendAsyncMessage("NFC:DOMEvent", options);
     },
 
     setFocusApp: function setFocusApp(id, isFocus) {
-      // if calling setNFCFocus(true) on the same browser-element, ignore.
-      if (isFocus && (id == this.focusApp)) {
+      // if calling setNFCFocus(true) on the browser-element which is already
+      // focused, or calling setNFCFocus(false) on the browser-element which has
+      // lost focus already, ignore.
+      if (isFocus == (id == this.focusApp)) {
         return;
       }
 
       if (this.focusApp != NFC.SYSTEM_APP_ID) {
         this.onFocusChanged(this.focusApp, false);
       }
 
       if (isFocus) {