Conversation
Member
Author
|
@seokju-na I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 19 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 19 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="Sources/WebViewBundle/Bridge.swift">
<violation number="1" location="Sources/WebViewBundle/Bridge.swift:34">
P2: `install(on:)` is not idempotent and can crash when called more than once on the same configuration. Remove existing handler before re-adding `wvbIos`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| /// Registers this bridge on `configuration` as the `wvbIos` message handler. | ||
| func install(on configuration: WKWebViewConfiguration) { | ||
| configuration.userContentController.add(self, name: Self.messageHandlerName) |
There was a problem hiding this comment.
P2: install(on:) is not idempotent and can crash when called more than once on the same configuration. Remove existing handler before re-adding wvbIos.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Sources/WebViewBundle/Bridge.swift, line 34:
<comment>`install(on:)` is not idempotent and can crash when called more than once on the same configuration. Remove existing handler before re-adding `wvbIos`.</comment>
<file context>
@@ -0,0 +1,190 @@
+
+ /// Registers this bridge on `configuration` as the `wvbIos` message handler.
+ func install(on configuration: WKWebViewConfiguration) {
+ configuration.userContentController.add(self, name: Self.messageHandlerName)
+ }
+
</file context>
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.
Summary
Native
invoke()bridge forsource/remote/updater, mirroring the Electron IPC surface, plus a common error shape and unified logging.Key changes
<category><Name>commands (e.g.sourceListBundles), auto-registered byinstall. TypedDecodableargs /Encodableresponses (Codable both ways).BridgeError { code?, message }— common JSON error shape delivered to the webview.os.Logger(subsystem: webview-bundle) — includes a seam (CoreLog) to fold in the Rust core'stracingonce the FFI exposes a callback.Tests
swift test— 16 passing (codec decode/encode, command dispatch, error shape, auto-registration, log-level mapping).🤖 Generated with Claude Code
Summary by cubic
Adds a native
invoke()bridge forWKWebViewwith typedsource,remote, andupdatercommands, unified{ code?, message }errors, and unified logging. Invokes are now accepted only from the main frame; subframe messages are dropped for safety.New Features
invoke()commands forsource/*,remote/*,updater/*; auto-registered underwvbIoswith Codable args/results.BridgeError { code?, message }; missingRemote/Updaterreject withremote_not_initialized/updater_not_initialized.invokemessages are ignored and logged.os.Logger(subsystemwebview-bundle) withCoreLog.forward(...); log levels map toOSLogType.WebViewBundle.configure(),shared/safeShared, andinstall(on:bridge:),makeConfiguration(bridge:),makeWebView(frame:bridge:).Migration
WebViewBundle.configure(config)and useWebViewBundle.shared;webViewBundle(_:)/wvb(_:)now aliasconfigure(_:).install(on:)or usemakeConfiguration(bridge:)to auto-register commands; the message handler name iswvbIos.RemoteorUpdater, related web calls will reject with the codes above.Written for commit 817bf66. Summary will update on new commits.