Bug 1133390 - onfocuschanged(false) will be notified twice. r=dimi
authorYoshi Huang <allstars.chh@mozilla.com>
Mon, 16 Feb 2015 11:13:18 +0800
changeset 256211 f379cddbf40ecc61514a40d47d44567f6f70f641
parent 256210 df27e9927e4b1921747735d18f2ef9325fb3e4fa
child 256212 5fa3cd10706a065abc48b55f40ce81c253ab3227
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi
bugs1133390
milestone38.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
Bug 1133390 - onfocuschanged(false) will be notified twice. r=dimi From 1c1b9ad0570901cc2c9ce6bce1bbeda210c1e1ca Mon Sep 17 00:00:00 2001 --- dom/nfc/gonk/Nfc.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
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) {