| Code-Review | +1 |
Thanks Andrea! Could I get access to the design doc? LGTM for this intro CL
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[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
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
return 'webRequestInternal.' + eventName.substring('webRequest.'.length);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);
}
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
return 'webRequestInternal.' + eventName.substring('webRequest.'.length);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);
}
```
Thanks - that makes sense. Will fix this in the next commit in the chain.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |