declarativeNetRequest.getMatchedRules
Returns all the rules matched for the extension. Callers can filter the list of matched rules by specifying a filter
. This method is only available to extensions with the "declarativeNetRequestFeedback"
permission or that have the "activeTab"
permission granted for the tabId
specified in filter
. Rules not associated with an active document that were matched more than five minutes ago are not returned.
Syntax
js
let gettingMatchedRules = browser.declarativeNetRequest.getMatchedRules(
filter // object
);
Parameters
filter
Optional-
An object to filter the list of matched rules.
minTimeStamp
Optional-
A
number
. If specified, only matches rules after the specified timestamp. tabId
Optional-
A
number
. If specified, only matches rules for the specified tab. Matches rules not associated with any active tab if set to-1
.
Return value
A Promise
that fulfills with an object with these properties:
rule
-
declarativeNetRequest.MatchedRule
. Details of a matched rule. tabId
-
number
ThetabId
of the tab the request originated from if the tab is still active. Otherwise,-1
. timeStamp
-
number
The time the rule was matched. Timestamps correspond to the Javascript convention for times, i.e. the number of milliseconds since the epoch.
If no rules are matched, the object is empty. If the request fail, the promise is rejected with an error message
Examples
Browser compatibility
BCD tables only load in the browser