mirror of
https://github.com/electron/electron.git
synced 2026-10-28 11:44:46 +08:00
* refactor: run webContents.executeJavaScript and friends over mojo `webContents.executeJavaScript`, `executeJavaScriptInIsolatedWorld`, `insertCSS`, `removeInsertedCSS`, `insertText` and `setVisualZoomLevelLimits` used to send an internal IPC message that a handler in the renderer's Electron bundle answered by calling `webFrame`. They are now methods on mojom::ElectronRenderer implemented by ElectronApiServiceImpl, so they no longer depend on Electron's JavaScript running in the renderer. Script results still come back through Electron's V8 serializer and a returned promise is still awaited. * fix: address review comments on executeJavaScript over mojo - Let Blink await a returned promise: extend the RequestExecuteScript patch so the raw-value callback also receives the rejection reason of an awaited result, use PromiseResultOption::kAwait, and reply from a plain function instead of the self-owned helper that chained on the promise. - Bind the browser-side replies with base::SplitOnceCallback instead of a shared_ptr'd promise, and enter the promise's context before deserializing the result (WebFrameMain::BindPromiseToReply).