Bug 1388066 - Fix message sender.tab when tabId is 0 on Firefox for Android. r=mixedpuppy,zombie

MozReview-Commit-ID: DPu6EZVg1nN

--HG--
extra : rebase_source : 95578d235fd065ae84ac5e2d3a307321854e1d14
This commit is contained in:
Shane Caraveo 2017-08-10 14:59:25 -07:00
Родитель 6bdc69c563
Коммит 8a0d711aa4
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -6,7 +6,7 @@ XPCOMUtils.defineLazyModuleGetter(global, "EventEmitter",
// 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
@ -17,7 +17,7 @@ const getSender = (extension, target, sender) => {
tabId = tabTracker.getBrowserData(target).tabId;
}
if (tabId) {
if (tabId != null && tabId >= 0) {
let tab = extension.tabManager.get(tabId, null);
if (tab) {
sender.tab = tab.convert();