Skip to content

Fix #234 - Popup filter matches missed when using tabId option

Anton Smirnov requested to merge 234-popup_log into master

Blocked by https://gitlab.com/eyeo/adblockplus/abc/webext-sdk/-/merge_requests/352 (waiting to use the utils to remove the flakiness of the test).

Pass original tab (source) tabId for logging and listeners notifications only, the rest is the same. Add a test (that fails for master branch).

Checked the console output to be as expected:

before:

EWE.filters.add(["||testpages.adblockplus.org/testfiles/popup/link.html^$popup"]);
Promise {<fulfilled>: undefined}
EWE.reporting.onBlockableItem.addListener(console.log.bind(null, "all"));
undefined
chrome.tabs.create({url: "https://testpages.adblockplus.org/en/filters/popup"}, (tab) =>
{
  console.log("opener tab ID", tab.id);
  EWE.reporting.onBlockableItem.addListener(console.log.bind(null, "tab"), {tabId: tab.id});
});

undefined
VM21:3 opener tab ID 7424
diagnostics.jss:131 all {request: {…}, filter: {…}, matchInfo: {…}}

after:

EWE.filters.add(["||testpages.adblockplus.org/testfiles/popup/link.html^$popup"]);
Promise {<fulfilled>: undefined}
EWE.reporting.onBlockableItem.addListener(console.log.bind(null, "all"))
undefined
chrome.tabs.create({url: "https://testpages.adblockplus.org/en/filters/popup"}, (tab) =>
{
  console.log("opener tab ID", tab.id);
  EWE.reporting.onBlockableItem.addListener(console.log.bind(null, "tab"), {tabId: tab.id});
});

undefined
VM20:3 opener tab ID 6140
diagnostics.jss:131 all {request: {…}, filter: {…}, matchInfo: {…}}
diagnostics.jss:131 tab {request: {…}, filter: {…}, matchInfo: {…}}

Closes #234 (closed)

Edited by Anton Smirnov

Merge request reports

Loading