Bug 1708243 - Part 2: stop using sender data from the child process r=robwu,agi

Differential Revision: https://phabricator.services.mozilla.com/D123351
This commit is contained in:
Tomislav Jovanovic
2021-08-31 23:15:17 +00:00
parent 5bf7e576be
commit 007d45809d
11 changed files with 121 additions and 97 deletions

View File

@@ -44,34 +44,6 @@ function isPrivateTab(nativeTab) {
return PrivateBrowsingUtils.isBrowserPrivate(nativeTab.linkedBrowser);
}
// 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;
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 (
ExtensionCommon.instanceOf(target, "XULFrameElement") ||
ExtensionCommon.instanceOf(target, "HTMLIFrameElement")
) {
tabId = tabTracker.getBrowserData(target).tabId;
}
if (tabId) {
let tab = extension.tabManager.get(tabId, null);
if (tab) {
sender.tab = tab.convert();
}
}
};
// Used by Extension.jsm
global.tabGetSender = getSender;
/* eslint-disable mozilla/balanced-listeners */
extensions.on("uninstalling", (msg, extension) => {
if (extension.uninstallURL) {