Bug 1388066 fix when tabId is zero draft
authorShane Caraveo <scaraveo@mozilla.com>
Thu, 10 Aug 2017 14:59:25 -0700
changeset 644358 8687c79d7b3aa75435f9df0eba37f2c82b3cee88
parent 644169 5322c03f4c8587fe526172d3f87160031faa6d75
child 725591 b3a2a39c7f739fc6dda55a1fe55b415e64e0f3c2
push id73418
push usermixedpuppy@gmail.com
push dateThu, 10 Aug 2017 22:00:32 +0000
bugs1388066
milestone57.0a1
Bug 1388066 fix when tabId is zero MozReview-Commit-ID: DPu6EZVg1nN
mobile/android/components/extensions/ext-android.js
--- a/mobile/android/components/extensions/ext-android.js
+++ b/mobile/android/components/extensions/ext-android.js
@@ -1,28 +1,28 @@
 "use strict";
 
 XPCOMUtils.defineLazyModuleGetter(global, "EventEmitter",
                                   "resource://gre/modules/EventEmitter.jsm");
 
 // This function is pretty tightly tied to Extension.jsm.
 // Its job is to fill in the |tab| property of the sender.
 const getSender = (extension, target, sender) => {
-  let tabId;
+  let tabId = -1;
   if ("tabId" in sender) {
     // The message came from a privileged extension page running in a tab. In
     // that case, it should include a tabId property (which is filled in by the
     // page-open listener below).
     tabId = sender.tabId;
     delete sender.tabId;
   } else if (target instanceof Ci.nsIDOMXULElement) {
     tabId = tabTracker.getBrowserData(target).tabId;
   }
 
-  if (tabId) {
+  if (tabId >= 0) {
     let tab = extension.tabManager.get(tabId, null);
     if (tab) {
       sender.tab = tab.convert();
     }
   }
 };
 
 // Used by Extension.jsm