Repository navigation
perf: stop routing renderer requests and file loads through the main thread - #53115
Conversation
4ef1e05 to
cc22f58
Compare
deepak1556
left a comment
There was a problem hiding this comment.
Can you also update the benchmark table for the non ideal case when there are listeners.
…are observed Every URLLoaderFactory handed to a renderer was wrapped in a ProxyingURLLoaderFactory living on the UI thread, so each subresource request took a detour through the browser's main thread even when no webRequest listener or intercepted protocol existed, and waited there behind whatever JavaScript the app was running. A page with 150 small subresources loads in 51 ms with an idle main process and 152 ms when the main process is busy for 100 ms after commit. Put a small gate on the IO thread in front of the proxy for renderer-facing factories: it forwards straight to the network service unless the session currently has a webRequest listener, an intercepted scheme matching the request, or an --ignore-connections-limit domain, in which case the request goes to the proxy exactly as before. The state is a few words under a lock, written by api::WebRequest and ProtocolRegistry when listeners or handlers change, so adding a listener takes effect for the next request without recreating factories. Same page: 46 ms idle, 51 ms with the busy main process; fetch() round trip 0.43 -> 0.41 ms.
AsarURLLoaderFactory (Electron's factory for file://, including paths inside asar archives) was created and bound on the UI thread, although all it does per request is post an AsarURLLoader to the thread pool. So every <script>, <link> or image a file:// page loads was dispatched via the browser's main thread and waited there behind the app's JavaScript: a page with 60 small stylesheets on disk loads in 30 ms with an idle main process, 130 ms when the main process is busy for 100 ms after the navigation commits, 230 ms for 200 ms. Bind the factory on the IO thread instead. The same page loads in 28 / 30 / 31 ms.
…t webRequest listeners ProxyingURLLoaderFactory put every proxied request in "extraHeaders" mode, which makes the network service call back into this process (TrustedHeaderClient) before sending headers and after receiving them. That is what lets webRequest listeners see and modify headers the network stack owns, so it stays whenever the session has any listener; requests that reach the proxy only because a protocol is intercepted or a connection-limit domain is configured have nothing to consult there and now skip the two round trips.
Every console call in a renderer reached OnDidAddMessageToConsole, which created an Event, filled a dictionary and emitted into JS whether or not the app had a 'console-message' listener: 22.6 us of main-process CPU per renderer console.log here. WebContents now keeps a flag from JS (newListener / removeListener) and returns early without it: 13.4 us per message, i.e. 20,000 renderer log lines cost the main process 269 ms instead of 452.
cc22f58 to
7233c86
Compare
|
added the with-listener and intercepted-protocol rows to the table: with any webRequest listener registered the page load, fetch round trip and per-request main-process CPU are unchanged from main (still routed through the main thread), which is the expected non-ideal case. |
|
Release Notes Persisted
|
|
I was unable to backport this PR to "43-x-y" cleanly; |
|
I was unable to backport this PR to "42-x-y" cleanly; |
|
I was unable to backport this PR to "44-x-y" cleanly; |
|
@codebytere has manually backported this PR to "43-x-y", please check out #53142 |
|
@codebytere has manually backported this PR to "42-x-y", please check out #53143 |
…thread (#53115) * perf: keep renderer network requests off the main thread unless they are observed Every URLLoaderFactory handed to a renderer was wrapped in a ProxyingURLLoaderFactory living on the UI thread, so each subresource request took a detour through the browser's main thread even when no webRequest listener or intercepted protocol existed, and waited there behind whatever JavaScript the app was running. A page with 150 small subresources loads in 51 ms with an idle main process and 152 ms when the main process is busy for 100 ms after commit. Put a small gate on the IO thread in front of the proxy for renderer-facing factories: it forwards straight to the network service unless the session currently has a webRequest listener, an intercepted scheme matching the request, or an --ignore-connections-limit domain, in which case the request goes to the proxy exactly as before. The state is a few words under a lock, written by api::WebRequest and ProtocolRegistry when listeners or handlers change, so adding a listener takes effect for the next request without recreating factories. Same page: 46 ms idle, 51 ms with the busy main process; fetch() round trip 0.43 -> 0.41 ms. * perf: bind the file:// URL loader factory off the main thread AsarURLLoaderFactory (Electron's factory for file://, including paths inside asar archives) was created and bound on the UI thread, although all it does per request is post an AsarURLLoader to the thread pool. So every <script>, <link> or image a file:// page loads was dispatched via the browser's main thread and waited there behind the app's JavaScript: a page with 60 small stylesheets on disk loads in 30 ms with an idle main process, 130 ms when the main process is busy for 100 ms after the navigation commits, 230 ms for 200 ms. Bind the factory on the IO thread instead. The same page loads in 28 / 30 / 31 ms. * perf: skip the trusted-header round trips for requests proxied without webRequest listeners ProxyingURLLoaderFactory put every proxied request in "extraHeaders" mode, which makes the network service call back into this process (TrustedHeaderClient) before sending headers and after receiving them. That is what lets webRequest listeners see and modify headers the network stack owns, so it stays whenever the session has any listener; requests that reach the proxy only because a protocol is intercepted or a connection-limit domain is configured have nothing to consult there and now skip the two round trips. * perf: don't build console-message events while nothing listens for them Every console call in a renderer reached OnDidAddMessageToConsole, which created an Event, filled a dictionary and emitted into JS whether or not the app had a 'console-message' listener: 22.6 us of main-process CPU per renderer console.log here. WebContents now keeps a flag from JS (newListener / removeListener) and returns early without it: 13.4 us per message, i.e. 20,000 renderer log lines cost the main process 269 ms instead of 452. (cherry picked from commit adc50a1)
…thread (#53115) * perf: keep renderer network requests off the main thread unless they are observed Every URLLoaderFactory handed to a renderer was wrapped in a ProxyingURLLoaderFactory living on the UI thread, so each subresource request took a detour through the browser's main thread even when no webRequest listener or intercepted protocol existed, and waited there behind whatever JavaScript the app was running. A page with 150 small subresources loads in 51 ms with an idle main process and 152 ms when the main process is busy for 100 ms after commit. Put a small gate on the IO thread in front of the proxy for renderer-facing factories: it forwards straight to the network service unless the session currently has a webRequest listener, an intercepted scheme matching the request, or an --ignore-connections-limit domain, in which case the request goes to the proxy exactly as before. The state is a few words under a lock, written by api::WebRequest and ProtocolRegistry when listeners or handlers change, so adding a listener takes effect for the next request without recreating factories. Same page: 46 ms idle, 51 ms with the busy main process; fetch() round trip 0.43 -> 0.41 ms. * perf: bind the file:// URL loader factory off the main thread AsarURLLoaderFactory (Electron's factory for file://, including paths inside asar archives) was created and bound on the UI thread, although all it does per request is post an AsarURLLoader to the thread pool. So every <script>, <link> or image a file:// page loads was dispatched via the browser's main thread and waited there behind the app's JavaScript: a page with 60 small stylesheets on disk loads in 30 ms with an idle main process, 130 ms when the main process is busy for 100 ms after the navigation commits, 230 ms for 200 ms. Bind the factory on the IO thread instead. The same page loads in 28 / 30 / 31 ms. * perf: skip the trusted-header round trips for requests proxied without webRequest listeners ProxyingURLLoaderFactory put every proxied request in "extraHeaders" mode, which makes the network service call back into this process (TrustedHeaderClient) before sending headers and after receiving them. That is what lets webRequest listeners see and modify headers the network stack owns, so it stays whenever the session has any listener; requests that reach the proxy only because a protocol is intercepted or a connection-limit domain is configured have nothing to consult there and now skip the two round trips. * perf: don't build console-message events while nothing listens for them Every console call in a renderer reached OnDidAddMessageToConsole, which created an Event, filled a dictionary and emitted into JS whether or not the app had a 'console-message' listener: 22.6 us of main-process CPU per renderer console.log here. WebContents now keeps a flag from JS (newListener / removeListener) and returns early without it: 13.4 us per message, i.e. 20,000 renderer log lines cost the main process 269 ms instead of 452. (cherry picked from commit adc50a1)
…thread (#53143) perf: stop routing renderer requests and file loads through the main thread (#53115) * perf: keep renderer network requests off the main thread unless they are observed Every URLLoaderFactory handed to a renderer was wrapped in a ProxyingURLLoaderFactory living on the UI thread, so each subresource request took a detour through the browser's main thread even when no webRequest listener or intercepted protocol existed, and waited there behind whatever JavaScript the app was running. A page with 150 small subresources loads in 51 ms with an idle main process and 152 ms when the main process is busy for 100 ms after commit. Put a small gate on the IO thread in front of the proxy for renderer-facing factories: it forwards straight to the network service unless the session currently has a webRequest listener, an intercepted scheme matching the request, or an --ignore-connections-limit domain, in which case the request goes to the proxy exactly as before. The state is a few words under a lock, written by api::WebRequest and ProtocolRegistry when listeners or handlers change, so adding a listener takes effect for the next request without recreating factories. Same page: 46 ms idle, 51 ms with the busy main process; fetch() round trip 0.43 -> 0.41 ms. * perf: bind the file:// URL loader factory off the main thread AsarURLLoaderFactory (Electron's factory for file://, including paths inside asar archives) was created and bound on the UI thread, although all it does per request is post an AsarURLLoader to the thread pool. So every <script>, <link> or image a file:// page loads was dispatched via the browser's main thread and waited there behind the app's JavaScript: a page with 60 small stylesheets on disk loads in 30 ms with an idle main process, 130 ms when the main process is busy for 100 ms after the navigation commits, 230 ms for 200 ms. Bind the factory on the IO thread instead. The same page loads in 28 / 30 / 31 ms. * perf: skip the trusted-header round trips for requests proxied without webRequest listeners ProxyingURLLoaderFactory put every proxied request in "extraHeaders" mode, which makes the network service call back into this process (TrustedHeaderClient) before sending headers and after receiving them. That is what lets webRequest listeners see and modify headers the network stack owns, so it stays whenever the session has any listener; requests that reach the proxy only because a protocol is intercepted or a connection-limit domain is configured have nothing to consult there and now skip the two round trips. * perf: don't build console-message events while nothing listens for them Every console call in a renderer reached OnDidAddMessageToConsole, which created an Event, filled a dictionary and emitted into JS whether or not the app had a 'console-message' listener: 22.6 us of main-process CPU per renderer console.log here. WebContents now keeps a flag from JS (newListener / removeListener) and returns early without it: 13.4 us per message, i.e. 20,000 renderer log lines cost the main process 269 ms instead of 452. (cherry picked from commit adc50a1)
…thread (#53142) perf: stop routing renderer requests and file loads through the main thread (#53115) * perf: keep renderer network requests off the main thread unless they are observed Every URLLoaderFactory handed to a renderer was wrapped in a ProxyingURLLoaderFactory living on the UI thread, so each subresource request took a detour through the browser's main thread even when no webRequest listener or intercepted protocol existed, and waited there behind whatever JavaScript the app was running. A page with 150 small subresources loads in 51 ms with an idle main process and 152 ms when the main process is busy for 100 ms after commit. Put a small gate on the IO thread in front of the proxy for renderer-facing factories: it forwards straight to the network service unless the session currently has a webRequest listener, an intercepted scheme matching the request, or an --ignore-connections-limit domain, in which case the request goes to the proxy exactly as before. The state is a few words under a lock, written by api::WebRequest and ProtocolRegistry when listeners or handlers change, so adding a listener takes effect for the next request without recreating factories. Same page: 46 ms idle, 51 ms with the busy main process; fetch() round trip 0.43 -> 0.41 ms. * perf: bind the file:// URL loader factory off the main thread AsarURLLoaderFactory (Electron's factory for file://, including paths inside asar archives) was created and bound on the UI thread, although all it does per request is post an AsarURLLoader to the thread pool. So every <script>, <link> or image a file:// page loads was dispatched via the browser's main thread and waited there behind the app's JavaScript: a page with 60 small stylesheets on disk loads in 30 ms with an idle main process, 130 ms when the main process is busy for 100 ms after the navigation commits, 230 ms for 200 ms. Bind the factory on the IO thread instead. The same page loads in 28 / 30 / 31 ms. * perf: skip the trusted-header round trips for requests proxied without webRequest listeners ProxyingURLLoaderFactory put every proxied request in "extraHeaders" mode, which makes the network service call back into this process (TrustedHeaderClient) before sending headers and after receiving them. That is what lets webRequest listeners see and modify headers the network stack owns, so it stays whenever the session has any listener; requests that reach the proxy only because a protocol is intercepted or a connection-limit domain is configured have nothing to consult there and now skip the two round trips. * perf: don't build console-message events while nothing listens for them Every console call in a renderer reached OnDidAddMessageToConsole, which created an Event, filled a dictionary and emitted into JS whether or not the app had a 'console-message' listener: 22.6 us of main-process CPU per renderer console.log here. WebContents now keeps a flag from JS (newListener / removeListener) and returns early without it: 13.4 us per message, i.e. 20,000 renderer log lines cost the main process 269 ms instead of 452. (cherry picked from commit adc50a1)
…thread (#53115) * perf: keep renderer network requests off the main thread unless they are observed Every URLLoaderFactory handed to a renderer was wrapped in a ProxyingURLLoaderFactory living on the UI thread, so each subresource request took a detour through the browser's main thread even when no webRequest listener or intercepted protocol existed, and waited there behind whatever JavaScript the app was running. A page with 150 small subresources loads in 51 ms with an idle main process and 152 ms when the main process is busy for 100 ms after commit. Put a small gate on the IO thread in front of the proxy for renderer-facing factories: it forwards straight to the network service unless the session currently has a webRequest listener, an intercepted scheme matching the request, or an --ignore-connections-limit domain, in which case the request goes to the proxy exactly as before. The state is a few words under a lock, written by api::WebRequest and ProtocolRegistry when listeners or handlers change, so adding a listener takes effect for the next request without recreating factories. Same page: 46 ms idle, 51 ms with the busy main process; fetch() round trip 0.43 -> 0.41 ms. * perf: bind the file:// URL loader factory off the main thread AsarURLLoaderFactory (Electron's factory for file://, including paths inside asar archives) was created and bound on the UI thread, although all it does per request is post an AsarURLLoader to the thread pool. So every <script>, <link> or image a file:// page loads was dispatched via the browser's main thread and waited there behind the app's JavaScript: a page with 60 small stylesheets on disk loads in 30 ms with an idle main process, 130 ms when the main process is busy for 100 ms after the navigation commits, 230 ms for 200 ms. Bind the factory on the IO thread instead. The same page loads in 28 / 30 / 31 ms. * perf: skip the trusted-header round trips for requests proxied without webRequest listeners ProxyingURLLoaderFactory put every proxied request in "extraHeaders" mode, which makes the network service call back into this process (TrustedHeaderClient) before sending headers and after receiving them. That is what lets webRequest listeners see and modify headers the network stack owns, so it stays whenever the session has any listener; requests that reach the proxy only because a protocol is intercepted or a connection-limit domain is configured have nothing to consult there and now skip the two round trips. * perf: don't build console-message events while nothing listens for them Every console call in a renderer reached OnDidAddMessageToConsole, which created an Event, filled a dictionary and emitted into JS whether or not the app had a 'console-message' listener: 22.6 us of main-process CPU per renderer console.log here. WebContents now keeps a flag from JS (newListener / removeListener) and returns early without it: 13.4 us per message, i.e. 20,000 renderer log lines cost the main process 269 ms instead of 452. (cherry picked from commit adc50a1)
…thread (#53141) perf: stop routing renderer requests and file loads through the main thread (#53115) * perf: keep renderer network requests off the main thread unless they are observed Every URLLoaderFactory handed to a renderer was wrapped in a ProxyingURLLoaderFactory living on the UI thread, so each subresource request took a detour through the browser's main thread even when no webRequest listener or intercepted protocol existed, and waited there behind whatever JavaScript the app was running. A page with 150 small subresources loads in 51 ms with an idle main process and 152 ms when the main process is busy for 100 ms after commit. Put a small gate on the IO thread in front of the proxy for renderer-facing factories: it forwards straight to the network service unless the session currently has a webRequest listener, an intercepted scheme matching the request, or an --ignore-connections-limit domain, in which case the request goes to the proxy exactly as before. The state is a few words under a lock, written by api::WebRequest and ProtocolRegistry when listeners or handlers change, so adding a listener takes effect for the next request without recreating factories. Same page: 46 ms idle, 51 ms with the busy main process; fetch() round trip 0.43 -> 0.41 ms. * perf: bind the file:// URL loader factory off the main thread AsarURLLoaderFactory (Electron's factory for file://, including paths inside asar archives) was created and bound on the UI thread, although all it does per request is post an AsarURLLoader to the thread pool. So every <script>, <link> or image a file:// page loads was dispatched via the browser's main thread and waited there behind the app's JavaScript: a page with 60 small stylesheets on disk loads in 30 ms with an idle main process, 130 ms when the main process is busy for 100 ms after the navigation commits, 230 ms for 200 ms. Bind the factory on the IO thread instead. The same page loads in 28 / 30 / 31 ms. * perf: skip the trusted-header round trips for requests proxied without webRequest listeners ProxyingURLLoaderFactory put every proxied request in "extraHeaders" mode, which makes the network service call back into this process (TrustedHeaderClient) before sending headers and after receiving them. That is what lets webRequest listeners see and modify headers the network stack owns, so it stays whenever the session has any listener; requests that reach the proxy only because a protocol is intercepted or a connection-limit domain is configured have nothing to consult there and now skip the two round trips. * perf: don't build console-message events while nothing listens for them Every console call in a renderer reached OnDidAddMessageToConsole, which created an Event, filled a dictionary and emitted into JS whether or not the app had a 'console-message' listener: 22.6 us of main-process CPU per renderer console.log here. WebContents now keeps a flag from JS (newListener / removeListener) and returns early without it: 13.4 us per message, i.e. 20,000 renderer log lines cost the main process 269 ms instead of 452. (cherry picked from commit adc50a1)
…r-only webRequest listeners The IO-thread gate from #53115 sent every renderer request through the UI-thread ProxyingURLLoaderFactory as soon as the session had any webRequest listener, and the proxy itself wrapped every request in an InProgressRequest for the same reason: a listener may modify the request and re-runs on every redirect leg, so its URL filter cannot be applied up front. Two things can be decided up front though: - A request's resource type never changes across redirects, so the listeners' existing `types` filter is honored before the request reaches the UI thread: a blocking listener (onBeforeRequest, onBeforeSendHeaders, onHeadersReceived) registered with types: ['mainFrame', 'subFrame'] no longer pulls images, scripts and fetches through the main process. - onSendHeaders, onBeforeRedirect, onResponseStarted, onCompleted and onErrorOccurred cannot change anything. When only such listeners match a request's type, it goes straight to the network service and a pass-through URLLoaderClient on the IO thread reports the redirect, response and completion to api::WebRequest afterwards; the listeners get the same details objects (including onSendHeaders per redirect leg), the renderer never waits for them. InterceptState holds two resource-type masks instead of a boolean, recomputed whenever a listener is added or removed, and both the gate and the proxy's pass-through path consult them. Linux x64, page with 150 subresources from a local server while the main process is busy for 100 ms after commit: onCompleted + onErrorOccurred listeners 160 -> 55 ms (no listeners: 54 ms); fetch() round trip 0.59 -> 0.46 ms; main process CPU per request 335 -> 244 us. With onBeforeRequest / onHeadersReceived limited to frame types, subresources take the direct path as well (fetch 0.61 -> 0.42 ms, 321 -> 133 us per request); the document itself is still intercepted, so that page's load event lands at 108 ms under the same load.
…r-only webRequest listeners (#53204) * perf: keep requests off the main thread for type-filtered and observer-only webRequest listeners The IO-thread gate from #53115 sent every renderer request through the UI-thread ProxyingURLLoaderFactory as soon as the session had any webRequest listener, and the proxy itself wrapped every request in an InProgressRequest for the same reason: a listener may modify the request and re-runs on every redirect leg, so its URL filter cannot be applied up front. Two things can be decided up front though: - A request's resource type never changes across redirects, so the listeners' existing `types` filter is honored before the request reaches the UI thread: a blocking listener (onBeforeRequest, onBeforeSendHeaders, onHeadersReceived) registered with types: ['mainFrame', 'subFrame'] no longer pulls images, scripts and fetches through the main process. - onSendHeaders, onBeforeRedirect, onResponseStarted, onCompleted and onErrorOccurred cannot change anything. When only such listeners match a request's type, it goes straight to the network service and a pass-through URLLoaderClient on the IO thread reports the redirect, response and completion to api::WebRequest afterwards; the listeners get the same details objects (including onSendHeaders per redirect leg), the renderer never waits for them. InterceptState holds two resource-type masks instead of a boolean, recomputed whenever a listener is added or removed, and both the gate and the proxy's pass-through path consult them. Linux x64, page with 150 subresources from a local server while the main process is busy for 100 ms after commit: onCompleted + onErrorOccurred listeners 160 -> 55 ms (no listeners: 54 ms); fetch() round trip 0.59 -> 0.46 ms; main process CPU per request 335 -> 244 us. With onBeforeRequest / onHeadersReceived limited to frame types, subresources take the direct path as well (fetch 0.61 -> 0.42 ms, 321 -> 133 us per request); the document itself is still intercepted, so that page's load event lands at 108 ms under the same load. * test: type-filtered and observer-only webRequest listeners leave requests on the direct path * refactor: align observed webRequest loads with network semantics --------- Co-authored-by: deepak1556 <[email protected]>
…r-only webRequest listeners (#53240) * perf: keep requests off the main thread for type-filtered and observer-only webRequest listeners The IO-thread gate from #53115 sent every renderer request through the UI-thread ProxyingURLLoaderFactory as soon as the session had any webRequest listener, and the proxy itself wrapped every request in an InProgressRequest for the same reason: a listener may modify the request and re-runs on every redirect leg, so its URL filter cannot be applied up front. Two things can be decided up front though: - A request's resource type never changes across redirects, so the listeners' existing `types` filter is honored before the request reaches the UI thread: a blocking listener (onBeforeRequest, onBeforeSendHeaders, onHeadersReceived) registered with types: ['mainFrame', 'subFrame'] no longer pulls images, scripts and fetches through the main process. - onSendHeaders, onBeforeRedirect, onResponseStarted, onCompleted and onErrorOccurred cannot change anything. When only such listeners match a request's type, it goes straight to the network service and a pass-through URLLoaderClient on the IO thread reports the redirect, response and completion to api::WebRequest afterwards; the listeners get the same details objects (including onSendHeaders per redirect leg), the renderer never waits for them. InterceptState holds two resource-type masks instead of a boolean, recomputed whenever a listener is added or removed, and both the gate and the proxy's pass-through path consult them. Linux x64, page with 150 subresources from a local server while the main process is busy for 100 ms after commit: onCompleted + onErrorOccurred listeners 160 -> 55 ms (no listeners: 54 ms); fetch() round trip 0.59 -> 0.46 ms; main process CPU per request 335 -> 244 us. With onBeforeRequest / onHeadersReceived limited to frame types, subresources take the direct path as well (fetch 0.61 -> 0.42 ms, 321 -> 133 us per request); the document itself is still intercepted, so that page's load event lands at 108 ms under the same load. Co-authored-by: Shelley Vohr <[email protected]> * test: type-filtered and observer-only webRequest listeners leave requests on the direct path Co-authored-by: Shelley Vohr <[email protected]> * refactor: align observed webRequest loads with network semantics Co-authored-by: deepak1556 <[email protected]> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <[email protected]> Co-authored-by: deepak1556 <[email protected]>
Description of Change
A renderer's network requests and file:// loads no longer wait for the main process's JavaScript. Today every
URLLoaderFactoryElectron hands a renderer is fronted by objects bound on the browser UI thread, so each<script>, stylesheet,fetch()or image request is dispatched by the main thread and sits in its queue while app code runs. Measured on Linux x64 release builds, medians of 3 warm loads, with the main process either idle or running 100 ms of JavaScript right after the navigation commits (which is what app startup looks like from the window's side):webRequestlistenersprotocol.handle()for another schemewebRequestlistener registered (matching or not)loadFile)fetch()round trip, no listeners / with awebRequestlistenerconsole.log, noconsole-messagelistenerFour commits, each independent:
WillCreateURLLoaderFactorywrapped every factory in aProxyingURLLoaderFactoryon the UI thread, listeners or not. Renderer-facing factories now get a smallURLLoaderFactoryGateon the IO thread in front of the proxy: it forwards straight to the network service unless the session has awebRequestlistener, an intercepted scheme matching the request, or an--ignore-connections-limitdomain, in which case the request goes to the proxy exactly as before. That state is a few words under a lock thatapi::WebRequestandProtocolRegistryupdate, so a listener added at any time applies to the next request without recreating factories (listeners re-run on redirects, which is why their URL filters are not applied at the gate). With a listener registered nothing changes, within noise.AsarURLLoaderFactoryonly posts loaders to the thread pool, so it is now bound on the IO thread; file:// subresources stop queueing behind main-process work.TrustedHeaderClientround trips per request); that is what lets listeners see and modify network-owned headers, so it stays whenever the session has anywebRequestlistener, and requests that reach the proxy only for an intercepted protocol or an--ignore-connections-limitdomain skip it.console-messageevents while nothing listens for them.OnDidAddMessageToConsolecreated an event object and emitted into JS for every renderer console call;WebContentsnow keeps a flag fromnewListener/removeListenerand returns early without it.Checklist
npm testpasses (webRequest, protocol, session, net, BrowserWindow, webContents, asar, webview, subframe, service worker, extensions and chromium specs locally on Linux)Release Notes
Notes: Page resources,
fetch()calls and file:// loads in renderers no longer wait for the main process to be idle when nowebRequestlisteners or protocol interceptors are registered.