-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix/webview2 initialization order #4707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Fixes the "Not enough memory resources" error by moving AllowExternalDrag call after chromium.Embed(). This critical initialization order issue was causing drag-and-drop to fail with WebView2 v142. ## Changes - Move AllowExternalDrag(false) call to after chromium.Embed() - Add capability check using chromium.HasCapability(edge.AllowExternalDrop) - Change condition from DisableWebViewDrop to EnableFileDrop for clarity - Add comments explaining the initialization order requirement ## Technical Details The issue occurred because AllowExternalDrag was called before the WebView2 was properly embedded, causing it to fail with insufficient memory errors. This particularly affected users with WebView2 v142. When EnableFileDrop is true, Wails handles file drops, so we disable the WebView's native external drag to prevent automatic file opening. Fixes #4701, #4700, #4694 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Updated go-webview2 dependency from v1.0.22 to v1.0.23 - Added changelog entry for WebView2 initialization order fix - Added changelog entry for go-webview2 update 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
WalkthroughMoved WebView2 drag-and-drop configuration to run after chromium.Embed(), added logging around embed and request processing, bumped go-webview2 to v1.0.23, and updated changelog entries documenting the init-order fix. Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant WebView2
participant Chromium
rect rgb(255,240,245)
note over App,WebView2: Previous flow (pre-embed config)
App->>WebView2: Configure AllowExternalDrag(false)
App->>WebView2: Embed control
WebView2->>Chromium: Initialize
end
rect rgb(240,255,245)
note over App,WebView2: New flow (post-embed config)
App->>WebView2: Embed control
WebView2->>Chromium: Initialize
App->>Chromium: Check edge.AllowExternalDrop capability
alt capability present
App->>Chromium: AllowExternalDrag(false)
Chromium-->>App: success / error
App->>App: Log result (success or detailed error)
else capability absent
App->>App: Log capability absent
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2025-10-17T23:16:11.570ZApplied to files:
📚 Learning: 2025-08-08T09:13:16.916ZApplied to files:
🧬 Code graph analysis (1)v2/internal/frontend/desktop/windows/frontend.go (1)
⏰ 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). (7)
🔇 Additional comments (3)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
v2/go.sumis excluded by!**/*.sum
📒 Files selected for processing (3)
v2/go.mod(1 hunks)v2/internal/frontend/desktop/windows/frontend.go(1 hunks)website/src/pages/changelog.mdx(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Mihara
Repo: wailsapp/wails PR: 4481
File: v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl:29-30
Timestamp: 2025-08-08T10:25:32.415Z
Learning: For Wails v3 Linux nfpm template, Debian/Ubuntu WebKitGTK runtime package names differ: Debian 12 (Bookworm) uses libwebkit2gtk-4.1-0 while Ubuntu 22.04 (Jammy) uses libwebkit2gtk-4.0-37. Prefer an OR dependency "libwebkit2gtk-4.1-0 | libwebkit2gtk-4.0-37" in v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl to support both.
📚 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:
v2/internal/frontend/desktop/windows/frontend.go
🧬 Code graph analysis (1)
v2/internal/frontend/desktop/windows/frontend.go (1)
v2/pkg/options/options.go (1)
DragAndDrop(201-216)
⏰ 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). (6)
- GitHub Check: Run Go Tests (ubuntu-22.04, 1.23)
- GitHub Check: Run Go Tests (ubuntu-24.04, 1.23)
- GitHub Check: Run Go Tests (windows-latest, 1.23)
- GitHub Check: semgrep/ci
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
website/src/pages/changelog.mdx (2)
17-19: Verify the additional issue references are intentional.The changelog references issues #4701, #4700, and #4694, but the PR description only mentions #4694. Confirm that all three issues are addressed by this fix.
39-40: LGTM!The documentation correctly notes the go-webview2 dependency update to v1.0.23 under the v2.11.0 release.
Deploying wails with
|
| Latest commit: |
7c74e27
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://44013176.wails.pages.dev |
| Branch Preview URL: | https://fix-webview2-initialization.wails.pages.dev |
|



Reorder initialisation of webview2
Potentially Fixes #4694
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.