Skip to content

Fix iOS 14~17 EXC_BAD_ACCESS crash when evaluateJavaScript on windowID WebViews#2776

Open
studiogaram wants to merge 1 commit into
pichillilorenzo:masterfrom
studiogaram:fix-evaluate-javascript-ios17
Open

Fix iOS 14~17 EXC_BAD_ACCESS crash when evaluateJavaScript on windowID WebViews#2776
studiogaram wants to merge 1 commit into
pichillilorenzo:masterfrom
studiogaram:fix-evaluate-javascript-ios17

Conversation

@studiogaram

@studiogaram studiogaram commented Feb 3, 2026

Copy link
Copy Markdown

Connection with issue(s)

스크린샷 2026-02-03 오후 9 00 02

Resolve issue #2600

Testing and Review Notes

Steps to reproduce the crash (before fix):

  1. Create a parent WebView with javaScriptCanOpenWindowsAutomatically: true and supportMultipleWindows: true
  2. Trigger window.open() or click a link with target="_blank" to open a popup window
  3. Create a child WebView with the windowId from onCreateWindow
  4. Call evaluateJavascript() on the child WebView
  5. Result: App crashes with EXC_BAD_ACCESS (code=1, address=0x0) on iOS 14~17

Steps to verify the fix:

  1. Repeat the same steps above
  2. Expected Result: evaluateJavascript() works without crash on iOS 14~17
  3. Note: iOS 18+ uses the original behavior with contentWorld parameter

Root Cause:

  • WindowId WebViews reuse WKWebView from parent and share WKWebViewConfiguration
  • They skip custom WKUserContentController initialization
  • When evaluateJavaScript is called with contentWorld parameter, the internal content world state is not properly
    initialized for popup WebViews

Workaround Applied:

  • On iOS < 18: Use non-contentWorld version of evaluateJavaScript for windowId WebViews
  • On iOS 18+: Use original behavior (Apple may have fixed this issue)

To Do

  • double check the original issue to confirm it is fully satisfied
  • add testing notes and screenshots in PR description to help guide reviewers
  • request the "UX" team perform a design review (if/when applicable)

…d WebViews

 On iOS 14~17, calling evaluateJavaScript/callAsyncJavaScript with
   contentWorld parameter on WebViews created via windowId (popup windows)
   causes EXC_BAD_ACCESS (code=1, address=0x0).

   Root cause: WindowId WebViews share WKWebViewConfiguration with parent
   and skip custom UserContentController initialization, leaving
   WKContentWorld in an uninitialized state.

   Workaround: Use non-contentWorld version of evaluateJavaScript for
   windowId WebViews on iOS < 18
@probot-autolabeler probot-autolabeler Bot added iOS macOS macOS platform labels Feb 3, 2026
kuronekorou39 added a commit to kuronekorou39/mobile-omniverse that referenced this pull request Apr 23, 2026
iPad Google ログインのネイティブクラッシュ原因を特定。
upstream Issue #2600 / PR #2776 の既知バグで、windowId で作られる
子 WebView は親の WKWebViewConfiguration を共有するが UserContentController
の初期化をスキップするため、プラグイン内部の evaluateJavaScript(contentWorld:)
呼び出しで EXC_BAD_ACCESS が発生する。iOS 14-17.x で発生、iOS 18+ では
Apple 側で修正済み。iPadOS 17.7.10 直撃。

PR #2776 はマージ未だが、scripts/patch_inappwebview.py で CI 時に
ローカルの plugin source に差分を当てる。iOS 18+ では条件分岐で無効化
されるため iPhone iOS 18+ には完全に影響なし。iOS 14-17 では legacy
evaluateJavaScript API(contentWorld 引数なし版)を使うため動作する。

参考:
- pichillilorenzo/flutter_inappwebview#2600
- pichillilorenzo/flutter_inappwebview#2776

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

iOS macOS macOS platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant