#53975: refactor: emit WebContents' forwarded events natively
Description of Change
WebContents' JS _init registered listeners on itself only to re-emit with data C++ already had. Those are now emitted where they originate: console-message (with the deprecated positional args), unresponsive (when not ignored/hidden/uninitialised), app login / render-process-gone (plus the logging hint), the owner window's ready-to-show, the -before-unload-fired veto for non-interactive types, devtools-reload-page → reload, select-bluetooth-device cancellation when nobody listens, and app web-contents-created. Listener order and microtask/nextTick phase are kept as the JS trampoline (always the first listener) produced them.
Two intentional differences: the console-message deprecation warning is given when an old-signature listener is added rather than on its first message, and web-contents-created carries a real Event and is emitted once _init has finished.
No runtime change intended beyond one JS hop less per event; ~90 lines out of lib/browser/api/web-contents.ts.
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: none
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron