Repository navigation
refactor: emit WebContents' forwarded events natively - #53979
Merged
MarshallOfSound merged 8 commits intoSep 16, 2026
Merged
MarshallOfSound merged 8 commits into
MarshallOfSound merged 8 commits into
Conversation
WebContents' JS _init registered listeners on itself whose only job was to re-emit with data C++ already had: '-console-message' -> 'console-message' (plus the deprecated positional arguments), '-unresponsive' -> 'unresponsive' (when not ignored/hidden/uninitialised), 'login' and 'render-process-gone' -> app (and a debugging hint when logging is on), 'ready-to-show' -> the owner BrowserWindow, '-before-unload-fired' -> preventDefault for non-interactive types, 'devtools-reload-page' -> reload(), 'select-bluetooth-device' -> cancel when nobody listens, and app 'web-contents-created' at the end of _init. Each is now done where the event originates, in the order the JS listener (always the first one) gave: app before the WebContents' own listeners for login/render-process-gone, the window after the WebContents for ready-to-show, reload() before 'devtools-reload-page'. The 'console-message' deprecation warning is now given when a listener with the old signature is added rather than on its first message. Co-authored-by: Sam Attard <[email protected]>
…ntents Co-authored-by: Sam Attard <[email protected]>
…s drain after both Co-authored-by: Sam Attard <[email protected]>
…sks have run Co-authored-by: Sam Attard <[email protected]>
…-show listeners ran Co-authored-by: Sam Attard <[email protected]>
Co-authored-by: Sam Attard <[email protected]>
…k scope Co-authored-by: Sam Attard <[email protected]>
5 tasks done
…ly (#53981) - 'render-process-gone' and 'login': the WebContents' own listeners run off the wrapper saved before the app emit, so they still run when an app listener destroys the WebContents (as the rest of an emit in progress did), and nothing of the native object is used after the app emit - select-bluetooth-device: re-check the chooser and the WebContents after calling the app-replaceable listenerCount() - drop the now-unused weak pointer in OnFirstNonEmptyLayout, make the isolate locals const, brace-initialise the callback scopes - specs for the app-before-webContents order, the shared microtask drain, and the destroyed-by-app-listener case (cherry picked from commit 4d10ef9)
MarshallOfSound
enabled auto-merge (squash)
September 16, 2026 20:10
MarshallOfSound
approved these changes
Sep 16, 2026
codebytere
approved these changes
Sep 16, 2026
jkleinsc
approved these changes
Sep 16, 2026
MarshallOfSound
deleted the
trop/45-x-y-bp-refactor-emit-webcontents-forwarded-events-natively-1789520520292
branch
September 16, 2026 20:17
|
No Release Notes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #53975
See that PR for details.
Notes: none