Skip to content

fix(desktop): guard WebView getWebContentsId against detached DOM#152

Merged
MocA-Love merged 2 commits into
mainfrom
fix/sentry-fork-issues
Apr 12, 2026
Merged

fix(desktop): guard WebView getWebContentsId against detached DOM#152
MocA-Love merged 2 commits into
mainfrom
fix/sentry-fork-issues

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

Summary

  • WebViewのdom-readyイベントがDOM切り離し後に発火した場合にgetWebContentsId()がクラッシュする問題を修正
  • wv.isConnectedチェックとtry-catchガードを追加

Sentry Issue

  • Fixes ELECTRON-19: "The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called"
  • 発生条件: persistent webviewがコンテナ間を移動中にdom-readyが発火(isTrusted: falseの合成イベント)

調査結果

Sentry全66件のissueを調査した結果:

  • 修正済み: 31件 (Sentry resolved + コードベースで修正確認)
  • Upstream側バグ: ELECTRON-1R/1S, 1P/1N, 1Z, 21, 1Q等 → スキップ
  • 外的要因: ネイティブクラッシュ7件, react-dndバグ, ネットワークエラー等
  • フォーク固有バグ: ELECTRON-19 (本PR)
  • ELECTRON-H: 調査の結果worktree内のgit switch挙動の問題でupstream側 → スキップ

Test plan

  • WebViewを含むBrowserPaneを開き、タブを素早く切り替えてクラッシュしないことを確認
  • ブラウザペインのURL読み込み中にワークスペースを切り替えてもクラッシュしないことを確認

The dom-ready event can fire after the WebView has been detached from the
DOM (isTrusted: false synthetic event), causing getWebContentsId() to throw.
Add isConnected check and try-catch to prevent the crash.

Fixes ELECTRON-19
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 10 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 2 minutes and 10 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c8157cfc-40f5-4b71-a13d-246f64134f41

📥 Commits

Reviewing files that changed from the base of the PR and between dcb96d6 and 1f23f93.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/hooks/usePersistentWebview/usePersistentWebview.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sentry-fork-issues

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
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f0860d125

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Restructure the dom-ready handler so the pending-URL drain always runs,
even when the WebView is temporarily disconnected from the DOM. This
prevents queued navigations from getting stuck indefinitely when
dom-ready fires during wrapper moves.
@MocA-Love MocA-Love merged commit 252a926 into main Apr 12, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant