declarativeNetRequest.getMatchedRules() returns blocked URLs for past 5 minutes instead of current webpage URLs.

We are using declarativeNetRequest.getMatchedRules() to get the matched rules' URLs. When user switches website in the same tab, it returns URLs which were blocked in the previous website also, within past 5 minutes.

Is it possible to fetch getMatchedRules() only for current webpage in the same tab?

Answered by Frameworks Engineer in 806841022

This is expected behavior. The getMatchedRules() API can filter by tabId and minTimeStamp, but it doesn’t offer a direct way to filter by the current webpage in the same tab.

To work around this, you can use the minTimeStamp parameter and pass the timestamp from the last result to exclude matches from the previous page.

Accepted Answer

This is expected behavior. The getMatchedRules() API can filter by tabId and minTimeStamp, but it doesn’t offer a direct way to filter by the current webpage in the same tab.

To work around this, you can use the minTimeStamp parameter and pass the timestamp from the last result to exclude matches from the previous page.

declarativeNetRequest.getMatchedRules() returns blocked URLs for past 5 minutes instead of current webpage URLs.
 
 
Q