mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
* refactor: emit WebContents' forwarded events natively 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. * fix: take the weak pointer before app listeners can destroy the WebContents * fix: run paired emits under one callback scope so ticks and microtasks drain after both * fix: read the login event's defaultPrevented after listeners' microtasks have run * fix: notify the window that owned the WebContents before its ready-to-show listeners ran * fix: hand app and webContents 'login' listeners the same authInfo object * fix: count select-bluetooth-device listeners under the emit's callback scope