feat: add custom CEF V8 extensions support (#17)

* feat: Register extensions in render process

- Add CefExtensions type to hold V8 extension code
- Pass extensions through BrowserProcessAppBuilder
- Register extensions in RenderProcessHandler on WebKit initialization
- Decode JSON extensions from command line switch
- Prefix extension names with "v8/" per CEF convention
- Include actual JSON in error messages for debugging

l

* feat: refactor window.cef API and register as CEF extension

* fix: remove debug print statements in render process handler

* refactor: centralize EXTENSIONS_SWITCH constant in util.rs

* fmt

* refactor: implement Default trait for CefApiHandler

* docs: add documentation for CefApiHandler and its JavaScript API functions

---------

Co-authored-by: not-elm <elmgameinfo@gmail.com>
This commit is contained in:
elm
2026-02-04 16:08:32 +09:00
committed by GitHub
parent b7900a24a0
commit 519aa2b2bf
21 changed files with 473 additions and 454 deletions

View File

@@ -24,6 +24,11 @@
### Features
- Added `PreloadScripts` component for specifying JavaScript to be executed when the page is initialized.
- Added `CefExtensions` type for registering custom JavaScript APIs via CEF's `register_extension`
- Extensions are global and load before any page scripts
- New `extensions` example demonstrating custom JS APIs
- Refactored `window.cef` API (`brp`, `emit`, `listen`) to be registered as a CEF extension during `on_web_kit_initialized`
- The API is now available earlier in the page lifecycle
### Bug Fixes