Skip to content

Commit ba18559

Browse files
🤖 Merge PR DefinitelyTyped#74360 chrome: add RuleCondition.{topDomains, excludedTopDomains} by @arthuredelstein
Co-authored-by: Erwan Jugand <47392755+erwanjugand@users.noreply.github.com>
1 parent 55063de commit ba18559

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎types/chrome/index.d.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13952,6 +13952,34 @@ declare namespace chrome {
1395213952
*/
1395313953
excludedTabIds?: number[] | undefined;
1395413954

13955+
/**
13956+
* The rule will only match network requests when the associated top-level frame's domain matches one from the list of `topDomains`. If the list is omitted, the rule is applied to requests associated with all top-level frame domains. An empty list is not allowed.
13957+
*
13958+
* Notes:
13959+
* - Sub-domains like "a.example.com" are also allowed.
13960+
* - The entries must consist of only ascii characters.
13961+
* - Use punycode encoding for internationalized domains.
13962+
* - Sub-domains of the listed domains are also matched.
13963+
* - For requests with no associated top-level frame (e.g. ServiceWorker initiated requests, the request initiator's domain is considered instead.
13964+
* @since Chrome 141
13965+
*/
13966+
topDomains?: string[] | undefined;
13967+
13968+
/**
13969+
* The rule will not match network requests when the associated top-level frame's domain
13970+
* matches one from the list of excludedTopDomains. If the list is empty or omitted,
13971+
* The rule will not match network requests when the associated top-level frame's domain matches one from the list of `excludedTopDomains`. If the list is empty or omitted, no domains are excluded. This takes precedence over `topDomains`.
13972+
*
13973+
* Notes:
13974+
* - Sub-domains like "a.example.com" are also allowed.
13975+
* - The entries must consist of only ascii characters.
13976+
* - Use punycode encoding for internationalized domains.
13977+
* - Sub-domains of the listed domains are also excluded.
13978+
* - For requests with no associated top-level frame (e.g. ServiceWorker initiated requests, the request initiator's domain is considered instead.
13979+
* @since Chrome 141
13980+
*/
13981+
excludedTopDomains?: string[] | undefined;
13982+
1395513983
/** Whether the `urlFilter` or `regexFilter` (whichever is specified) is case sensitive. Default is false. */
1395613984
isUrlFilterCaseSensitive?: boolean | undefined;
1395713985

‎types/chrome/test/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4149,6 +4149,8 @@ async function testDeclarativeNetRequest() {
41494149
domainType: "firstParty",
41504150
excludedResourceTypes: [chrome.declarativeNetRequest.ResourceType.IMAGE, "object"],
41514151
excludedRequestMethods: [chrome.declarativeNetRequest.RequestMethod.POST, "get"],
4152+
topDomains: ["example.com", "example.net"],
4153+
excludedTopDomains: ["example.com", "example.org"],
41524154
},
41534155
};
41544156

0 commit comments

Comments
 (0)