Files
electron/lib
Samuel Attard cf50144c7d refactor: run webContents.executeJavaScript and friends over mojo (#53969)
* 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).
2026-09-17 15:07:37 -07:00
..