Repository navigation
Prepare WebView callbacks for Send and Sync - #5501
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The unsafe Send/Sync adapter depends on STA marshaling, owner-thread release, and COM shutdown behavior requiring human validation because Windows/WebView2 and Reactor runtime regressions could not be executed here.
No open issues 🎉
What changed in this PR
Prepares windows-webview for the proposed Send + Sync requirement in #5469 while preserving public callback signatures. The global bound remains outside this PR.
Changes:
- Makes callback adapters non-agile and adds checks that captures are accessed and destroyed on their owning single-threaded COM apartment.
- Fixes identifier hygiene for nested
#[implement]macro expansion. - Adds callback lifetime, cross-apartment, and Reactor teardown regressions, plus COM lifetime documentation.
| File | Description |
|---|---|
crates/tools/webview/src/webview.txt |
Adds apartment-query APIs and constants to binding inputs. |
crates/tests/libs/webview/src/registry.rs |
Registers the native callback lifetime fixture. |
crates/tests/libs/webview/src/main.rs |
Drops the harness before checking live-object diagnostics. |
crates/tests/libs/webview/src/fixtures/mod.rs |
Includes the callback lifetime fixture module. |
crates/tests/libs/webview/src/fixtures/callback_lifetime.rs |
Tests native callback invocation and capture destruction. |
crates/tests/libs/reactor/tests/ui/main.rs |
Runs the WebView ownership fixture. |
crates/tests/libs/reactor/src/webview.rs |
Tests callback ownership through Reactor window teardown. |
crates/tests/libs/reactor/src/lib.rs |
Registers the Reactor WebView fixture. |
crates/tests/libs/reactor/readme.md |
Documents the WebView callback fixture. |
crates/tests/libs/reactor/Cargo.toml |
Adds WebView with Reactor integration for testing. |
crates/tests/libs/implement/tests/query.rs |
Adds nested-macro interface-query coverage. |
crates/libs/webview/src/webview.rs |
Propagates callback creation errors before registration. |
crates/libs/webview/src/protocol.rs |
Guards resource-handler state with owner-thread checks. |
crates/libs/webview/src/profile.rs |
Propagates browsing-data callback creation errors. |
crates/libs/webview/src/owner.rs |
Introduces checked owner-thread storage and unit tests. |
crates/libs/webview/src/options.rs |
Propagates environment callback creation errors. |
crates/libs/webview/src/lib.rs |
Includes the owner-thread module. |
crates/libs/webview/src/handler.rs |
Converts adapters and adds threading and lifetime regressions. |
crates/libs/webview/src/environment.rs |
Propagates environment and controller callback creation errors. |
crates/libs/webview/src/cookie.rs |
Propagates cookie callback creation errors. |
crates/libs/webview/src/controller.rs |
Propagates controller and focus callback creation errors. |
crates/libs/webview/src/bindings.rs |
Adds generated COM apartment-query bindings. |
crates/libs/webview/readme.md |
Documents COM initialization and object teardown requirements. |
crates/libs/webview/Cargo.toml |
Enables procedural macros for callback implementations. |
crates/libs/implement/src/gen.rs |
Aligns generated identifier spans for nested macro expansion. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make WebView callbacks non-agile and keep captures on their owning STA, with assertions for thread-affinity violations. No dispatcher or new locking; public callback signatures stay the same.
Includes the nested
#[implement]hygiene fix needed by the adapters and native lifetime regressions. Prepares WebView for #5469; the globalSend + Syncbound remains separate.