From ba18559b136e7640e347773d7ba0c8f67757f1e0 Mon Sep 17 00:00:00 2001 From: Arthur Edelstein Date: Sun, 18 Jan 2026 15:56:59 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74360=20`chrome`:?= =?UTF-8?q?=20add=20RuleCondition.{topDomains,=20excludedTopDomains}=20by?= =?UTF-8?q?=20@arthuredelstein?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Erwan Jugand <47392755+erwanjugand@users.noreply.github.com> --- types/chrome/index.d.ts | 28 ++++++++++++++++++++++++++++ types/chrome/test/index.ts | 2 ++ 2 files changed, 30 insertions(+) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 8bc53df1c33e3f..e0d5ec0c0e1e68 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -13952,6 +13952,34 @@ declare namespace chrome { */ excludedTabIds?: number[] | undefined; + /** + * 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. + * + * Notes: + * - Sub-domains like "a.example.com" are also allowed. + * - The entries must consist of only ascii characters. + * - Use punycode encoding for internationalized domains. + * - Sub-domains of the listed domains are also matched. + * - For requests with no associated top-level frame (e.g. ServiceWorker initiated requests, the request initiator's domain is considered instead. + * @since Chrome 141 + */ + topDomains?: string[] | undefined; + + /** + * 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, + * 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`. + * + * Notes: + * - Sub-domains like "a.example.com" are also allowed. + * - The entries must consist of only ascii characters. + * - Use punycode encoding for internationalized domains. + * - Sub-domains of the listed domains are also excluded. + * - For requests with no associated top-level frame (e.g. ServiceWorker initiated requests, the request initiator's domain is considered instead. + * @since Chrome 141 + */ + excludedTopDomains?: string[] | undefined; + /** Whether the `urlFilter` or `regexFilter` (whichever is specified) is case sensitive. Default is false. */ isUrlFilterCaseSensitive?: boolean | undefined; diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index 9dc29a73a87d76..323330f3012305 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -4149,6 +4149,8 @@ async function testDeclarativeNetRequest() { domainType: "firstParty", excludedResourceTypes: [chrome.declarativeNetRequest.ResourceType.IMAGE, "object"], excludedRequestMethods: [chrome.declarativeNetRequest.RequestMethod.POST, "get"], + topDomains: ["example.com", "example.net"], + excludedTopDomains: ["example.com", "example.org"], }, };