| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks, Andrea! LGTM % nits.
I was originally wondering if there was a way we could just have this on WebRequestEvent itself (in web_request_event.js), but I didn't see a very clean one.
v8::Isolate* isolate = v8::Isolate::GetCurrent();nit: maybe pass in Isolate to avoid re-fetching it?
DCHECK(on_dispatched_callback.IsEmpty())nit: prefer CHECKs in new code
"[\"first\",\"second\"]",prefer string literal
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
nit: maybe pass in Isolate to avoid re-fetching it?
Done
nit: prefer CHECKs in new code
Done
"[\"first\",\"second\"]",Andrea Orruprefer string literal
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
4 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: extensions/renderer/bindings/api_event_handler_unittest.cc
Insertions: 1, Deletions: 1.
The diff is too large to show. Please review the diff.
```
```
The name of the file: extensions/renderer/bindings/api_event_handler.cc
Insertions: 6, Deletions: 5.
The diff is too large to show. Please review the diff.
```
[Extensions] Introduce bindingUtil.registerEventDispatchHandler()
This change is part of a series that will eventually refactor out the
sub-event naming hack (e.g. webRequest.onBeforeRequest/sN).
Later CLs in this series will move blocking webRequest dispatch from
once per listener to once per renderer context: the browser will send a
single event per context carrying the union of the matching listeners'
options, and the renderer will then match the request against each of
its own listeners. Each listener callback will receive a copy of the
details stripped to the options it asked for. The renderer will report
the blocking responses to the browser.
This requires the renderer to take over the event's dispatch entirely
and to never invoke listeners through the emitter at all (because the
emitter's plain fan-out runs every listener callback with the same
arguments and cannot do per-listener matching and tailoring).
The existing APIEventHandler hook for influencing dispatch is the
argument massager, which rewrites an event's arguments and hands them
back to the emitter via a curried dispatch function. However, it fits
the case poorly: the curried dispatch function is unused (the renderer
fans out itself), and because FireEventInContext() pushes the event's
EventFilteringInfo onto the emitter expecting dispatch to pop it, a
massager that never calls dispatch leaks one pending filter entry per
event (note that EventFilteringInfo is always empty for webRequest
events).
Add a dedicated primitive instead. RegisterEventDispatchHandler()
registers a function that owns the event's dispatch:
FireEventInContext() hands it the raw arguments and returns, bypassing
the emitter (which, for such events, only transports the listener
registration to the browser) and the event-filter bookkeeping entirely.
Unlike a massager it receives no dispatch function and no filter is
pushed, so there is nothing to leak. Exposed to JS bindings as
`bindingUtil.registerEventDispatchHandler()`.
Design doc: go/no-webrequest-subevent
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |