ChromeDeclarativeNetRequest class
Properties
-
dynamicRulesetId
→ String
-
Ruleset ID for the dynamic rules added by the extension.
no setter
-
getmatchedrulesQuotaInterval
→ int
-
Time interval within which
MAX_GETMATCHEDRULES_CALLS_PER_INTERVAL getMatchedRules
calls can be made, specified in minutes.
Additional calls will fail immediately and set runtime.lastError
.
Note: getMatchedRules
calls associated with a user gesture
are exempt from the quota.
no setter
-
guaranteedMinimumStaticRules
→ int
-
The minimum number of static rules guaranteed to an extension across its
enabled static rulesets. Any rules above this limit will count towards
the global static rule limit.
no setter
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
isAvailable
→ bool
-
no setter
-
maxGetmatchedrulesCallsPerInterval
→ int
-
The number of times
getMatchedRules
can be called within a
period of GETMATCHEDRULES_QUOTA_INTERVAL
.
no setter
-
maxNumberOfDynamicAndSessionRules
→ int
-
The maximum number of combined dynamic and session scoped rules an
extension can add.
no setter
-
maxNumberOfDynamicRules
→ int
-
The maximum number of dynamic rules that an extension can add.
no setter
-
maxNumberOfEnabledStaticRulesets
→ int
-
The maximum number of static
Rulesets
an extension can
enable at any one time.
no setter
-
maxNumberOfRegexRules
→ int
-
The maximum number of regular expression rules that an extension can
add. This limit is evaluated separately for the set of dynamic rules and
those specified in the rule resources file.
no setter
-
maxNumberOfSessionRules
→ int
-
The maximum number of session scoped rules that an extension can add.
no setter
-
maxNumberOfStaticRulesets
→ int
-
The maximum number of static
Rulesets
an extension can
specify as part of the "rule_resources"
manifest key.
no setter
-
maxNumberOfUnsafeDynamicRules
→ int
-
The maximum number of "unsafe" dynamic rules that an extension can add.
no setter
-
maxNumberOfUnsafeSessionRules
→ int
-
The maximum number of "unsafe" session scoped rules that an extension can
add.
no setter
-
onRuleMatchedDebug
→ EventStream<MatchedRuleInfoDebug>
-
Fired when a rule is matched with a request. Only available for unpacked
extensions with the
declarativeNetRequestFeedback
permission
as this is intended to be used for debugging purposes only.
|info|: The rule that has been matched along with information about the
associated request.
no setter
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
sessionRulesetId
→ String
-
Ruleset ID for the session-scoped rules added by the extension.
no setter
Methods
-
getAvailableStaticRuleCount()
→ Future<int>
-
Returns the number of static rules an extension can enable before the
global static rule limit is
reached.
-
getDisabledRuleIds(GetDisabledRuleIdsOptions options)
→ Future<List<int>>
-
Returns the list of static rules in the given Ruleset that are
currently disabled.
|options|: Specifies the ruleset to query.
|callback|: Called with a list of ids that correspond to the disabled
rules in that ruleset.
-
getDynamicRules(GetRulesFilter? filter)
→ Future<List<Rule>>
-
Returns the current set of dynamic rules for the extension. Callers can
optionally filter the list of fetched rules by specifying a
filter
.
|filter|: An object to filter the list of fetched rules.
|callback|: Called with the set of dynamic rules. An error might be
raised in case of transient internal errors.
-
getEnabledRulesets()
→ Future<List<String>>
-
Returns the ids for the current set of enabled static rulesets.
|callback|: Called with a list of ids, where each id corresponds to an
enabled static Ruleset.
-
getMatchedRules(MatchedRulesFilter? filter)
→ Future<RulesMatchedDetails>
-
Returns all rules matched for the extension. Callers can optionally
filter the list of matched rules by specifying a
filter
.
This method is only available to extensions with the
declarativeNetRequestFeedback
permission or having the
activeTab
permission granted for the tabId
specified in filter
.
Note: Rules not associated with an active document that were matched more
than five minutes ago will not be returned.
|filter|: An object to filter the list of matched rules.
|callback|: Called once the list of matched rules has been fetched. In
case of an error, runtime.lastError
will be set and no rules will
be returned. This can happen for multiple reasons, such as insufficient
permissions, or exceeding the quota.
-
getSessionRules(GetRulesFilter? filter)
→ Future<List<Rule>>
-
Returns the current set of session scoped rules for the extension.
Callers can optionally filter the list of fetched rules by specifying a
filter
.
|filter|: An object to filter the list of fetched rules.
|callback|: Called with the set of session scoped rules.
-
isRegexSupported(RegexOptions regexOptions)
→ Future<IsRegexSupportedResult>
-
Checks if the given regular expression will be supported as a
regexFilter
rule condition.
|regexOptions|: The regular expression to check.
|callback|: Called with details consisting of whether the regular
expression is supported and the reason if not.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
setExtensionActionOptions(ExtensionActionOptions options)
→ Future<void>
-
Configures if the action count for tabs should be displayed as the
extension action's badge text and provides a way for that action count to
be incremented.
-
testMatchOutcome(TestMatchRequestDetails request)
→ Future<TestMatchOutcomeResult>
-
Checks if any of the extension's declarativeNetRequest rules would match
a hypothetical request.
Note: Only available for unpacked extensions as this is only intended to
be used during extension development.
|requestDetails|: The request details to test.
|callback|: Called with the details of matched rules.
-
toString()
→ String
-
A string representation of this object.
inherited
-
updateDynamicRules(UpdateRuleOptions options)
→ Future<void>
-
Modifies the current set of dynamic rules for the extension.
The rules with IDs listed in
options.removeRuleIds
are first
removed, and then the rules given in options.addRules
are
added. Notes:
-
updateEnabledRulesets(UpdateRulesetOptions options)
→ Future<void>
-
Updates the set of enabled static rulesets for the extension. The
rulesets with IDs listed in
options.disableRulesetIds
are
first removed, and then the rulesets listed in
options.enableRulesetIds
are added.
Note that the set of enabled static rulesets is persisted across sessions
but not across extension updates, i.e. the rule_resources
manifest key will determine the set of enabled static rulesets on each
extension update.
|callback|: Called once the update is complete. In case of an error,
runtime.lastError
will be set and no change will be made to set of
enabled rulesets. This can happen for multiple reasons, such as invalid
ruleset IDs, rule count limit exceeded, or internal errors.
-
updateSessionRules(UpdateRuleOptions options)
→ Future<void>
-
Modifies the current set of session scoped rules for the extension.
The rules with IDs listed in
options.removeRuleIds
are first
removed, and then the rules given in options.addRules
are
added. Notes:
-
updateStaticRules(UpdateStaticRulesOptions options)
→ Future<void>
-
Disables and enables individual static rules in a Ruleset.
Changes to rules belonging to a disabled Ruleset will take
effect the next time that it becomes enabled.
|callback|: Called once the update is complete. In case of an error,
runtime.lastError
will be set and no change will be made to the
enabled static rules.