Skip to content

Error thrown when calling reporting.isAllowlisted() for new tab

Adblock Plus uses browser.tabs.onUpdated (via ext.pages.onLoading) to detect tab changes to then revalidate its allowlisting state (see adblockpluschrome/lib/allowlisting.js). However, when using reporting.isAllowlisted() there, an error is thrown each time a new tab is opened.

e.g.

browser.tabs.onUpdated.addListener((tabId, changeInfo) =>
{
  if (changeInfo.status == "loading")
  {
    sdk.reporting.isAllowlisted(tabId);
  }
});

throws

Error in event handler: TypeError: Cannot read property 'allowlisted' of undefined
    at Object.isAllowlisted