Skip to content

Conversation

@APshenkin
Copy link
Contributor

@APshenkin APshenkin commented Nov 14, 2025

Description

This PR ports #4480 to V3. RawMessageHandler will provide available origin info to handler, so that application can decide what to do with a message.

On Mac: Origin and IsMainFrame provided
On Windows: Origin and TopOrigin provided
On Linux: Origin only provided

Fixes # (issue) related to #4686

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

# System

┌─────────────────────────────────────────────────────────────────────────────────────────────┐
| Name              | Windows 10 Pro                                                          |
| Version           | 2009 (Build: 26220)                                                     |
| ID                | 25H2                                                                    |
| Branding          | Windows 11 Pro                                                          |
| Platform          | windows                                                                 |
| Architecture      | arm64                                                                   |
| Go WebView2Loader | true                                                                    |
| WebView2 Version  | 143.0.3650.7                                                            |
| CPU               | virt-9.1                                                                |
| GPU 1             | Red Hat VirtIO GPU DOD controller (Red Hat, Inc.) - Driver: 22.7.38.43  |
| Memory            | 32GB                                                                    |
└─────────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment

┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-dev                               |
| Go Version   | go1.24.1                                 |
| Revision     | 97b00ed52f6a5d85eed15f60f10552bbb32c9e03 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOARCH       | arm64                                    |
| GOARM64      | v8.0                                     |
| GOOS         | windows                                  |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | 97b00ed52f6a5d85eed15f60f10552bbb32c9e03 |
| vcs.time     | 2025-11-11T23:15:00Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies

┌───────────────────────────────────────────┐
| npm                        | 10.9.2       |
| NSIS                       | v3.10        |
| MakeAppx.exe (Windows SDK) | Installed    |
| MSIX Packaging Tool        | 1.2024.405.0 |
| SignTool.exe (Windows SDK) | Installed    |
|                                           |
└───────── * - Optional Dependency ─────────┘
# System

┌──────────────────────────────────────────────────┐
| Name          | MacOS                            |
| Version       | 26.1                             |
| ID            | 25B78                            |
| Branding      | MacOS 26.1                       |
| Platform      | darwin                           |
| Architecture  | arm64                            |
| Apple Silicon | true                             |
| CPU           | Apple M4 Max                     |
| CPU 1         | Apple M4 Max                     |
| CPU 2         | Apple M4 Max                     |
| GPU           | 40 cores, Metal Support: Metal 4 |
| Memory        | 128 GB                           |
└──────────────────────────────────────────────────┘

# Build Environment

┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-dev                               |
| Go Version   | go1.24.0                                 |
| Revision     | 4a445ce218b58db4a16ee8fa84eac0d7c9a69932 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOARCH       | arm64                                    |
| GOARM64      | v8.0                                     |
| GOOS         | darwin                                   |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | 4a445ce218b58db4a16ee8fa84eac0d7c9a69932 |
| vcs.time     | 2025-08-04T22:42:25Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies

┌────────────────────────────────────────────────────────────────────────┐
| Xcode cli tools | 2416                                                 |
| npm             | 10.9.2                                               |
| *NSIS           | Not Installed. Install with `brew install makensis`. |
|                                                                        |
└─────────────────────── * - Optional Dependency ────────────────────────┘
# System 

┌─────────────────────────────────────────────────────────────────────┐
| Name         | Fedora Linux                                         |
| Version      | 42                                                   |
| ID           | fedora                                               |
| Branding     | 42 (Workstation Edition)                             |
| Platform     | linux                                                |
| Architecture | arm64                                                |
| CPU          |                                                      |
| GPU 1        | Virtio 1.0 GPU (Red Hat, Inc.) - Driver: virtio-pci  |
| Memory       | 16GB                                                 |
└─────────────────────────────────────────────────────────────────────┘

# Build Environment 

┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-dev                               |
| Go Version   | go1.24.5                                 |
| Revision     | 97b00ed52f6a5d85eed15f60f10552bbb32c9e03 |
| Modified     | false                                    |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOARCH       | arm64                                    |
| GOARM64      | v8.0                                     |
| GOOS         | linux                                    |
| vcs          | git                                      |
| vcs.modified | false                                    |
| vcs.revision | 97b00ed52f6a5d85eed15f60f10552bbb32c9e03 |
| vcs.time     | 2025-11-11T23:15:00Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies 

┌───────────────────────────┐
| pkg-config | 2.3.0        |
| webkit2gtk | 2.50.1       |
| gcc        | 15.2.1       |
| gtk3       | 3.24.49      |
| npm        | 10.9.2       |
|                           |
└─ * - Optional Dependency ─┘

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features
    • Message handler callbacks now receive origin and frame context (origin, top-origin, main-frame flag) so handlers can know where messages originate.
  • Chores / API
    • Callback signature updated — please adjust any custom message handlers to accept the additional origin information parameter.

✏️ Tip: You can customize this high-level summary in your review settings.

- Implemented origin and top origin tracking for web messages from JavaScript.
- Updated `RawMessageHandler` to include `originInfo`.
- Added cross-platform support for retrieving the origin of messages in macOS, Windows, and Linux.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

The PR adds an OriginInfo struct and propagates origin/top-origin/isMainFrame metadata from platform WebView layers into window messages, updating the RawMessageHandler callback signature to accept a third parameter originInfo *application.OriginInfo and adjusting call sites and platform bridges accordingly.

Changes

Cohort / File(s) Summary
Core API / Options
v3/pkg/application/application.go, v3/pkg/application/application_options.go
Add public OriginInfo type (Origin, TopOrigin, IsMainFrame); change Options.RawMessageHandler signature from func(Window, string) to func(Window, string, *OriginInfo); extend internal windowMessage to carry originInfo.
Example
v3/examples/raw-message/main.go
Update example handler to accept originInfo *application.OriginInfo and log Origin, TopOrigin, and IsMainFrame using fmt.Sprintf.
macOS (Darwin)
v3/pkg/application/application_darwin.go, v3/pkg/application/webview_window_darwin.m
Change processMessage C-Go bridge to accept origin and isMainFrame (signature expanded); extract origin/top-frame info in Objective‑C and pass them into processMessage; populate originInfo in the Go message.
Linux (CGO / WebKit)
v3/pkg/application/linux_cgo.go
Add C helpers to store/lookup WebView in content manager; retrieve WebView to extract page origin in sendMessageToBackend and populate originInfo for the outgoing message.
Windows (WebView2)
v3/pkg/application/webview_window_windows.go
Read sender and args source via WebView2 GetSource() (with error handling); construct OriginInfo with Origin and TopOrigin and attach it to windowMessage before enqueueing.

Sequence Diagram(s)

sequenceDiagram
    participant WebView as WebView (platform)
    participant Native as Native Bridge
    participant Go as Go Runtime
    participant Handler as RawMessageHandler

    WebView->>Native: emit script message (body + frame info)
    activate Native
    Note right of Native: extract origin/top-origin,\nisMainFrame (platform-specific)
    Native->>Go: processMessage(windowID, msg, origin, isMainFrame)
    deactivate Native

    activate Go
    Note right of Go: construct windowMessage with originInfo
    Go->>Handler: RawMessageHandler(window, msg, originInfo)
    deactivate Go

    activate Handler
    Handler->>Handler: consume/log/process message + originInfo
    deactivate Handler
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay close attention to platform boundary conversions (C char ↔ Go string) and nil handling for originInfo.
  • Review correctness of WebView origin extraction on each platform and error paths in WebView2 code.
  • Confirm all processMessage call sites were updated to match the new signature.

Possibly related PRs

Suggested labels

Enhancement, To Be Documented, go, Linux, size:L

Suggested reviewers

  • leaanthony

Poem

🐰 A tiny hop from frame to land,
I carry origin in my hand,
From native shore to Go's warm den,
I whisper where your message began. 😊

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding origin information to the raw message handler API.
Description check ✅ Passed The description covers the key aspects: purpose (porting PR #4480), platform-specific details, issue reference, type of change, testing across all platforms, and test configuration output. Most required template sections are completed.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
v3/pkg/application/application_options.go (1)

89-92: Clarify originInfo semantics in docs and note the breaking change.

Document that originInfo may be nil and that fields are platform-dependent (Linux: Origin only; macOS: Origin+IsMainFrame; Windows: Origin+TopOrigin). Also update changelog and user docs accordingly.

Apply this doc tweak near RawMessageHandler:

   // RawMessageHandler is called when the frontend sends a raw message.
   // This is useful for implementing custom frontend-to-backend communication.
-  RawMessageHandler func(window Window, message string, originInfo *OriginInfo)
+  // originInfo:
+  //   - May be nil if unavailable.
+  //   - Linux: Origin only; macOS: Origin + IsMainFrame; Windows: Origin + TopOrigin.
+  RawMessageHandler func(window Window, message string, originInfo *OriginInfo)

Would you like me to open a follow-up PR to update the v3 docs and changelog?

v3/pkg/application/linux_cgo.go (1)

1661-1671: Origin extraction returns full URL; consider canonical origin (scheme+host[:port]).

Optional: normalize to the origin (no path/query/fragment) for parity with browser origin checks. Current behavior is consistent across platforms, so this is a nicety, not a blocker.

Example (C side):

// After obtaining currentUri:
GUri *guri = g_uri_parse(currentUri, G_URI_FLAGS_NONE, NULL);
if (guri) {
  gchar *originStr = g_uri_to_string_partial(guri, G_URI_HIDE_USERINFO|G_URI_HIDE_QUERY|G_URI_HIDE_FRAGMENT|G_URI_HIDE_PATH);
  origin = g_strdup(originStr);
  g_free(originStr);
  g_uri_unref(guri);
}

Also applies to: 1680-1683

v3/pkg/application/application.go (1)

214-223: Add a short doc comment to OriginInfo for API consumers.

Helps clarify OS-specific population and intent.

Apply:

-type OriginInfo struct {
+// OriginInfo carries message provenance. Fields are platform-dependent:
+//   - Linux: Origin only
+//   - macOS: Origin + IsMainFrame
+//   - Windows: Origin + TopOrigin
+// Any field may be an empty string/false when unavailable.
+type OriginInfo struct {
   Origin      string
   TopOrigin   string
   IsMainFrame bool
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c36618c and 97b00ed.

📒 Files selected for processing (7)
  • v3/examples/raw-message/main.go (2 hunks)
  • v3/pkg/application/application.go (2 hunks)
  • v3/pkg/application/application_darwin.go (1 hunks)
  • v3/pkg/application/application_options.go (1 hunks)
  • v3/pkg/application/linux_cgo.go (4 hunks)
  • v3/pkg/application/webview_window_darwin.m (11 hunks)
  • v3/pkg/application/webview_window_windows.go (1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: APshenkin
Repo: wailsapp/wails PR: 4480
File: v2/internal/frontend/desktop/darwin/message.h:17-19
Timestamp: 2025-08-08T09:13:16.916Z
Learning: In Wails v2 bindings origin verification, processBindingMessage intentionally has different signatures across platforms: Darwin includes an isMainFrame bool (WKWebKit provides it), Linux uses two params (message, source) as WebKitGTK doesn’t expose main-frame info there, and Windows handles origin checks in Go via WebView2 sender/args without a C bridge. This divergence is acceptable/expected per maintainer (APshenkin).
📚 Learning: 2025-08-08T09:13:16.916Z
Learnt from: APshenkin
Repo: wailsapp/wails PR: 4480
File: v2/internal/frontend/desktop/darwin/message.h:17-19
Timestamp: 2025-08-08T09:13:16.916Z
Learning: In Wails v2 bindings origin verification, processBindingMessage intentionally has different signatures across platforms: Darwin includes an isMainFrame bool (WKWebKit provides it), Linux uses two params (message, source) as WebKitGTK doesn’t expose main-frame info there, and Windows handles origin checks in Go via WebView2 sender/args without a C bridge. This divergence is acceptable/expected per maintainer (APshenkin).

Applied to files:

  • v3/pkg/application/application_darwin.go
  • v3/pkg/application/application_options.go
  • v3/pkg/application/webview_window_darwin.m
  • v3/pkg/application/webview_window_windows.go
  • v3/pkg/application/application.go
  • v3/pkg/application/linux_cgo.go
  • v3/examples/raw-message/main.go
📚 Learning: 2024-09-21T13:34:24.145Z
Learnt from: nixpare
Repo: wailsapp/wails PR: 3763
File: v3/pkg/application/webview_window_bindings_darwin.h:0-0
Timestamp: 2024-09-21T13:34:24.145Z
Learning: In this codebase, typedefs for window references (like replacing `void *` with `WindowRef`) are not preferred; using `void *` is acceptable.

Applied to files:

  • v3/pkg/application/webview_window_darwin.m
📚 Learning: 2025-08-24T03:55:43.103Z
Learnt from: leaanthony
Repo: wailsapp/wails PR: 4534
File: v3/examples/liquid-glass/README.md:44-46
Timestamp: 2025-08-24T03:55:43.103Z
Learning: macOS 26 is the version that introduces native NSGlassEffectView support for Liquid Glass effects, representing a new internal/development versioning scheme beyond the publicly documented macOS 15 Sequoia.

Applied to files:

  • v3/pkg/application/webview_window_darwin.m
📚 Learning: 2024-09-21T09:56:48.126Z
Learnt from: nixpare
Repo: wailsapp/wails PR: 3763
File: v3/pkg/application/webview_panel_darwin.go:88-89
Timestamp: 2024-09-21T09:56:48.126Z
Learning: Safety checks for `p.nsPanel` are performed in the `SetFloating` method of `WebviewPanel`, following the `WebviewWindow` and `macosWebviewWindow` implementations and code style.

Applied to files:

  • v3/pkg/application/webview_window_darwin.m
📚 Learning: 2025-10-17T23:16:11.570Z
Learnt from: Sammy-T
Repo: wailsapp/wails PR: 4570
File: v2/internal/frontend/desktop/linux/window_webkit6.go:97-108
Timestamp: 2025-10-17T23:16:11.570Z
Learning: For webkit_6/GTK4 builds in v2/internal/frontend/desktop/linux/window_webkit6.go, GTK widget creation should not be wrapped in invokeOnMainThread. The activation mechanism (activateWg + onActivate export) already handles thread safety, and additional wrapping would cause issues.

Applied to files:

  • v3/pkg/application/webview_window_windows.go
  • v3/pkg/application/linux_cgo.go
📚 Learning: 2024-09-20T23:34:29.841Z
Learnt from: nixpare
Repo: wailsapp/wails PR: 3763
File: v3/examples/keybindings/main.go:16-17
Timestamp: 2024-09-20T23:34:29.841Z
Learning: In the codebase, `application.Options.KeyBindings` uses the `application.Window` type, whereas `application.WebviewWindowOptions.KeyBindings` uses `*application.WebviewWindow`. This is intentional and acceptable.

Applied to files:

  • v3/pkg/application/linux_cgo.go
🧬 Code graph analysis (5)
v3/pkg/application/application_darwin.go (1)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
v3/pkg/application/application_options.go (2)
v3/pkg/application/window.go (1)
  • Window (16-112)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
v3/pkg/application/webview_window_windows.go (1)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
v3/pkg/application/linux_cgo.go (1)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
v3/examples/raw-message/main.go (1)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
v3/pkg/application/linux_cgo.go (1)

65-74: Storing WebView pointer on content manager: confirm lifetime relationship.

Looks fine, but this assumes the content manager outlives (or shares lifetime with) the WebView. If destruction ordering can differ, consider a weak reference (GWeakRef) or clearing the data on teardown.

If helpful, I can add a teardown hook to clear "webview" when the WebView is finalized.

Also applies to: 1122-1123

v3/pkg/application/application.go (1)

718-719: LGTM: RawMessageHandler now receives originInfo.

Callback propagation looks correct.

v3/pkg/application/webview_window_darwin.m (1)

7-7: Extern signature is correct and matches the Go export.

The C extern declaration at line 7 matches the cgo-exported Go function exactly: both have 4 parameters with corresponding types (unsigned int ↔ C.uint, const char* ↔ *C.char, bool ↔ bool), and no conflicting declarations exist in v3 headers.

Note: The original review also flagged a potential NULL string concern (origin could be nil when passed to UTF8String, which may cause C.GoString to panic on the Go side). While the signature itself is correct, that safety issue should still be addressed—consider guarding with a default empty string if origin is nil.

- Ensure proper fallback to empty strings for `origin` and `topOrigin` when errors or nil values are encountered.
- Normalize handling of `message.body` to account for non-NSString values in macOS.
@leaanthony
Copy link
Member

@coderabbitai generate docstrings

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #4717

coderabbitai bot added a commit that referenced this pull request Nov 18, 2025
Docstrings generation was requested by @leaanthony.

* #4710 (comment)

The following files were modified:

* `v3/examples/raw-message/main.go`
* `v3/pkg/application/application_darwin.go`
* `v3/pkg/application/linux_cgo.go`
@github-actions github-actions bot added the Documentation Improvements or additions to documentation label Nov 19, 2025
@sonarqubecloud
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
v3/pkg/application/webview_window_windows.go (1)

1805-1815: Consider using warning() log level for graceful degradation.

Since the code now degrades gracefully by continuing with empty strings when origin retrieval fails, warning() would be more appropriate than error() for these log messages.

Apply this diff:

   topSource, err := sender.GetSource()
   if err != nil {
-    globalApplication.error(fmt.Sprintf("Unable to get source from sender: %s", err.Error()))
+    globalApplication.warning("Unable to get source from sender: %v", err)
     topSource = ""
   }

   senderSource, err := args.GetSource()
   if err != nil {
-    globalApplication.error(fmt.Sprintf("Unable to get source from args: %s", err.Error()))
+    globalApplication.warning("Unable to get source from args: %v", err)
     senderSource = ""
   }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97b00ed and d6d070b.

📒 Files selected for processing (4)
  • v3/examples/raw-message/main.go (2 hunks)
  • v3/pkg/application/application_darwin.go (1 hunks)
  • v3/pkg/application/webview_window_darwin.m (11 hunks)
  • v3/pkg/application/webview_window_windows.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • v3/pkg/application/webview_window_darwin.m
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: APshenkin
Repo: wailsapp/wails PR: 4480
File: v2/internal/frontend/desktop/darwin/message.h:17-19
Timestamp: 2025-08-08T09:13:16.916Z
Learning: In Wails v2 bindings origin verification, processBindingMessage intentionally has different signatures across platforms: Darwin includes an isMainFrame bool (WKWebKit provides it), Linux uses two params (message, source) as WebKitGTK doesn’t expose main-frame info there, and Windows handles origin checks in Go via WebView2 sender/args without a C bridge. This divergence is acceptable/expected per maintainer (APshenkin).
📚 Learning: 2025-08-08T09:13:16.916Z
Learnt from: APshenkin
Repo: wailsapp/wails PR: 4480
File: v2/internal/frontend/desktop/darwin/message.h:17-19
Timestamp: 2025-08-08T09:13:16.916Z
Learning: In Wails v2 bindings origin verification, processBindingMessage intentionally has different signatures across platforms: Darwin includes an isMainFrame bool (WKWebKit provides it), Linux uses two params (message, source) as WebKitGTK doesn’t expose main-frame info there, and Windows handles origin checks in Go via WebView2 sender/args without a C bridge. This divergence is acceptable/expected per maintainer (APshenkin).

Applied to files:

  • v3/examples/raw-message/main.go
  • v3/pkg/application/webview_window_windows.go
  • v3/pkg/application/application_darwin.go
📚 Learning: 2025-02-24T06:08:55.645Z
Learnt from: popaprozac
Repo: wailsapp/wails PR: 4098
File: v3/pkg/services/notifications/notifications_windows.go:91-113
Timestamp: 2025-02-24T06:08:55.645Z
Learning: The JSON quote handling in Windows notifications' activation arguments (v3/pkg/services/notifications/notifications_windows.go) has a known limitation with single-quote collisions that needs to be addressed after initial testing.

Applied to files:

  • v3/pkg/application/webview_window_windows.go
📚 Learning: 2025-10-17T23:16:11.570Z
Learnt from: Sammy-T
Repo: wailsapp/wails PR: 4570
File: v2/internal/frontend/desktop/linux/window_webkit6.go:97-108
Timestamp: 2025-10-17T23:16:11.570Z
Learning: For webkit_6/GTK4 builds in v2/internal/frontend/desktop/linux/window_webkit6.go, GTK widget creation should not be wrapped in invokeOnMainThread. The activation mechanism (activateWg + onActivate export) already handles thread safety, and additional wrapping would cause issues.

Applied to files:

  • v3/pkg/application/webview_window_windows.go
🧬 Code graph analysis (3)
v3/examples/raw-message/main.go (1)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
v3/pkg/application/webview_window_windows.go (1)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
v3/pkg/application/application_darwin.go (1)
v3/pkg/application/application.go (1)
  • OriginInfo (219-223)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
🔇 Additional comments (2)
v3/pkg/application/webview_window_windows.go (1)

1821-1824: LGTM! Origin information properly populated.

The OriginInfo struct is correctly populated with the retrieved origin values. IsMainFrame defaults to false, which is acceptable for Windows since the platform doesn't easily expose main-frame information through WebView2 compared to Darwin's WKWebKit.

Based on learnings

v3/pkg/application/application_darwin.go (1)

347-359: LGTM! Nil origin properly guarded.

The nil check before C.GoString(origin) correctly prevents crashes when origin is NULL from Objective-C. The OriginInfo is properly populated with Origin and IsMainFrame fields, which are the platform-specific data available from WKWebKit on macOS.

Based on learnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation MacOS v3-alpha Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants