[Extensions] Introduce feature flag for webRequest collapsed listeners [chromium/src : main]

0 views
Skip to first unread message

Emilia Paz (Gerrit)

unread,
Oct 27, 2025, 12:31:16 PM (10 days ago) Oct 27
to Andrea Orru, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Andrea Orru and Devlin Cronin

Emilia Paz voted and added 1 comment

Votes added by Emilia Paz

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Emilia Paz . resolved

Thanks Andrea! Could I get access to the design doc? LGTM for this intro CL

Open in Gerrit

Related details

Attention is currently required from:
  • Andrea Orru
  • Devlin Cronin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id0413200c083336385bd68b56fee01f9ec1e7ab6
Gerrit-Change-Number: 7082312
Gerrit-PatchSet: 5
Gerrit-Owner: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Emilia Paz <emil...@chromium.org>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Attention: Andrea Orru <andre...@chromium.org>
Gerrit-Comment-Date: Mon, 27 Oct 2025 16:31:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Andrea Orru (Gerrit)

unread,
Oct 27, 2025, 1:35:34 PM (10 days ago) Oct 27
to Emilia Paz, Devlin Cronin, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Devlin Cronin

Andrea Orru voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention is currently required from:
  • Devlin Cronin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id0413200c083336385bd68b56fee01f9ec1e7ab6
Gerrit-Change-Number: 7082312
Gerrit-PatchSet: 5
Gerrit-Owner: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Emilia Paz <emil...@chromium.org>
Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Comment-Date: Mon, 27 Oct 2025 17:35:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Chromium LUCI CQ (Gerrit)

unread,
Oct 27, 2025, 3:26:25 PM (10 days ago) Oct 27
to Andrea Orru, Emilia Paz, Devlin Cronin, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

Chromium LUCI CQ submitted the change

Change information

Commit message:
[Extensions] Introduce feature flag for webRequest collapsed listeners

This change is the first step required to support persistent filtered
event listeners for the webRequest API.

A new feature flag, `kEnableWebRequestCollapsedListeners`, is added and
disabled by default. When enabled, it causes the JavaScript
`WebRequestEvent` to be conditionally proxied. For service worker
contexts, it will use the new, currently unimplemented
`LazyWebRequestEventImpl`. In all other cases, it falls back to the
existing `WebRequestEventImpl`.

This change introduces no new behavior, as the new implementation is a
placeholder and the feature is turned off by default.

Design doc:
https://docs.google.com/document/d/1ExKZpUyHKDDEkOZ5SOu9bV8sJvTH0QI4qXDZ6vMiWo0/edit?usp=sharing
Bug: 448893426
Change-Id: Id0413200c083336385bd68b56fee01f9ec1e7ab6
Reviewed-by: Emilia Paz <emil...@chromium.org>
Commit-Queue: Andrea Orru <andre...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1536159}
Files:
  • M extensions/common/extension_features.cc
  • M extensions/common/extension_features.h
  • M extensions/renderer/api/core_extensions_renderer_api_provider.cc
  • M extensions/renderer/api/web_request_natives.cc
  • M extensions/renderer/api/web_request_natives.h
  • M extensions/renderer/resources/extensions_renderer_resources.grd
  • A extensions/renderer/resources/lazy_web_request_event.js
  • M extensions/renderer/resources/web_request_event.js
Change size: M
Delta: 8 files changed, 108 insertions(+), 13 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Emilia Paz
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id0413200c083336385bd68b56fee01f9ec1e7ab6
Gerrit-Change-Number: 7082312
Gerrit-PatchSet: 6
Gerrit-Owner: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Emilia Paz <emil...@chromium.org>
open
diffy
satisfied_requirement

woxxom (Gerrit)

unread,
Oct 28, 2025, 2:53:31 AM (9 days ago) Oct 28
to Chromium LUCI CQ, Andrea Orru, Emilia Paz, Devlin Cronin, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Andrea Orru

woxxom added 1 comment

File extensions/renderer/resources/lazy_web_request_event.js
Line 15, Patchset 6 (Latest): return 'webRequestInternal.' + eventName.substring('webRequest.'.length);
woxxom . unresolved

String methods can be spoofed by the extension via String.prototype, so you'll need to use `$String`.

Since `startsWith` is [not safe-guarded currently](https://crsrc.org/extensions/renderer/safe_builtins.cc;l=91;drc=c96a878b1cb45f60aac2285ffbdbd6b53dc92415) you can use `indexOf` instead, although `slice` is just as good performance-wise, AFAIK, since it should reuse the original string buffer internally:

```js
if ($String.slice(eventName, 0, 'webRequest.'.length) === 'webRequest.') {
return 'webRequestInternal.' + $String.slice(eventName, 'webRequest.'.length);
}
```
Open in Gerrit

Related details

Attention is currently required from:
  • Andrea Orru
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id0413200c083336385bd68b56fee01f9ec1e7ab6
Gerrit-Change-Number: 7082312
Gerrit-PatchSet: 6
Gerrit-Owner: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Emilia Paz <emil...@chromium.org>
Gerrit-CC: woxxom <wox...@gmail.com>
Gerrit-Attention: Andrea Orru <andre...@chromium.org>
Gerrit-Comment-Date: Tue, 28 Oct 2025 06:53:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
open
diffy

Andrea Orru (Gerrit)

unread,
Oct 28, 2025, 12:46:21 PM (9 days ago) Oct 28
to Chromium LUCI CQ, woxxom, Emilia Paz, Devlin Cronin, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

Andrea Orru added 1 comment

File extensions/renderer/resources/lazy_web_request_event.js
Line 15, Patchset 6 (Latest): return 'webRequestInternal.' + eventName.substring('webRequest.'.length);
woxxom . resolved

String methods can be spoofed by the extension via String.prototype, so you'll need to use `$String`.

Since `startsWith` is [not safe-guarded currently](https://crsrc.org/extensions/renderer/safe_builtins.cc;l=91;drc=c96a878b1cb45f60aac2285ffbdbd6b53dc92415) you can use `indexOf` instead, although `slice` is just as good performance-wise, AFAIK, since it should reuse the original string buffer internally:

```js
if ($String.slice(eventName, 0, 'webRequest.'.length) === 'webRequest.') {
return 'webRequestInternal.' + $String.slice(eventName, 'webRequest.'.length);
}
```
Andrea Orru

Thanks - that makes sense. Will fix this in the next commit in the chain.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id0413200c083336385bd68b56fee01f9ec1e7ab6
Gerrit-Change-Number: 7082312
Gerrit-PatchSet: 6
Gerrit-Owner: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
Gerrit-Reviewer: Emilia Paz <emil...@chromium.org>
Gerrit-CC: woxxom <wox...@gmail.com>
Gerrit-Comment-Date: Tue, 28 Oct 2025 16:46:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: woxxom <wox...@gmail.com>
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages