Skip to content

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

Open
studiogaram wants to merge 1 commit intopichillilorenzo: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 intopichillilorenzo:masterfrom
studiogaram:fix-evaluate-javascript-ios17

Conversation

@studiogaram
Copy link

@studiogaram studiogaram commented Feb 3, 2026

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