Index: lib/devtools.js |
=================================================================== |
--- a/lib/devtools.js |
+++ b/lib/devtools.js |
@@ -40,9 +40,9 @@ |
return panel && !panel.reload && !panel.reloading; |
} |
-function getActivePanel(page) |
+function getActivePanel(tabId) |
{ |
- let panel = panels.get(page.id); |
+ let panel = panels.get(tabId); |
if (isActivePanel(panel)) |
return panel; |
return null; |
@@ -122,8 +122,7 @@ |
/** |
* Logs a request to the devtools panel. |
* |
- * @param {?Page} page The page the request occured on or null if |
- * the request isn't associated with a page |
+ * @param {number[]} tabIds The tabIds associated with the request |
* @param {string} url The URL of the request |
* @param {string} type The request type |
* @param {string} docDomain The IDN-decoded hostname of the document |
@@ -134,7 +133,7 @@ |
* @param {?BlockingFilter} filter The matched filter or null if there is no |
* match |
*/ |
-exports.logRequest = function(page, url, type, docDomain, |
+exports.logRequest = function(tabIds, url, type, docDomain, |
thirdParty, sitekey, |
specificOnly, filter) |
{ |
@@ -143,21 +142,21 @@ |
let request = {url, type, docDomain, thirdParty, sitekey, specificOnly}; |
for (let [tabId, panel] of panels) |
- if ((!page || page.id == tabId) && isActivePanel(panel)) |
+ if ((tabIds.length == 0 || tabIds.includes(tabId)) && isActivePanel(panel)) |
addRecord(panel, request, filter); |
}; |
/** |
* Logs active element hiding filters to the devtools panel. |
* |
- * @param {Page} page The page the elements were hidden on |
+ * @param {number} tabId The ID of the tab, the elements were hidden in |
* @param {string[]} selectors The selectors of applied ElemHideFilters |
* @param {string[]} filters The text of applied ElemHideEmulationFilters |
* @param {string} docDomain The IDN-decoded hostname of the document |
*/ |
-function logHiddenElements(page, selectors, filters, docDomain) |
+function logHiddenElements(tabId, selectors, filters, docDomain) |
{ |
- let panel = getActivePanel(page); |
+ let panel = getActivePanel(tabId); |
if (panel) |
{ |
for (let subscription of FilterStorage.subscriptions) |
@@ -186,7 +185,7 @@ |
* Logs a whitelisting filter, that disables (some kind of) |
* blocking for a particular document, to the devtools panel. |
* |
- * @param {Page} page The page the whitelisting is active on |
+ * @param {number} tabId The tabId the whitelisting is active for |
* @param {string} url The url of the whitelisted document |
* @param {number} typeMask The bit mask of whitelisting types checked |
* for |
@@ -194,10 +193,10 @@ |
* document |
* @param {WhitelistFilter} filter The matched whitelisting filter |
*/ |
-exports.logWhitelistedDocument = function(page, url, typeMask, docDomain, |
+exports.logWhitelistedDocument = function(tabId, url, typeMask, docDomain, |
filter) |
{ |
- let panel = getActivePanel(page); |
+ let panel = getActivePanel(tabId); |
if (panel) |
{ |
for (let type of nonRequestTypes) |
@@ -209,14 +208,14 @@ |
}; |
/** |
- * Checks whether a page is inspected by the devtools panel. |
+ * Checks whether a tab is inspected by the devtools panel. |
* |
- * @param {Page} page |
+ * @param {number} tabId |
* @return {boolean} |
*/ |
-exports.hasPanel = function(page) |
+exports.hasPanel = function(tabId) |
{ |
- return panels.has(page.id); |
+ return panels.has(tabId); |
}; |
function onBeforeRequest(details) |
@@ -381,7 +380,7 @@ |
port.on("devtools.traceElemHide", (message, sender) => |
{ |
logHiddenElements( |
- sender.page, message.selectors, message.filters, |
+ sender.page.id, message.selectors, message.filters, |
extractHostFromFrame(sender.frame) |
); |
}); |