Skip to content

Fix WKWebView migration issues: sandbox entitlements and API compatibility - #535

Draft
hannesa2 with Copilot wants to merge 1 commit into
masterfrom
copilot/update-pbwebcontroller-for-wkwebview
Draft

hannesa2 with Copilot wants to merge 1 commit into
masterfrom
copilot/update-pbwebcontroller-for-wkwebview

Conversation

Copilot AI commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Two runtime issues blocking WKWebView functionality:

  1. Sandbox violations: WebContent helper process unable to read network configuration, generating console spam
  2. API incompatibility crash: setDrawsBackground: called on WKWebView which only exists in deprecated WebView

Changes

GitX.entitlements

  • Added com.apple.security.network.client/server for WebContent process network access
  • Added file access entitlements for Git repository handling

PBCommitList.swift/h

  • Changed webView property type from WebView to WKWebView
  • Removed webView.drawsBackground = false (WKWebView is transparent by default)
  • Updated imports from WebKit/WebView.h to WebKit/WebKit.h

Context

WKWebView uses a multi-process architecture where the WebContent helper inherits app entitlements but requires explicit network permissions. The drawsBackground property was removed in WKWebView as background is now controlled via CSS.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix deprecated WebView in PBWebController Migrate from deprecated WebView to WKWebView Mar 20, 2026
Copilot AI requested a review from hannesa2 March 20, 2026 07:27

@hannesa2 hannesa2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The tests are failing

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

The tests are failing

Fixed in commit 255998a. The issue was missing closing braces in the changeContentToCommit: method - the completion handler blocks weren't properly closed. The build should now succeed.

Copilot AI requested a review from hannesa2 March 20, 2026 07:42
Copilot AI changed the title Migrate from deprecated WebView to WKWebView Complete WebView to WKWebView migration: fix PBWebDiffController Mar 20, 2026
Copilot AI changed the title Complete WebView to WKWebView migration: fix PBWebDiffController Fix WebView API incompatibilities: windowScriptObject and mainFrame Mar 20, 2026
Copilot AI changed the title Fix WebView API incompatibilities: windowScriptObject and mainFrame Fix WebView to WKWebView migration build failures Mar 20, 2026
Copilot AI changed the title Fix WebView to WKWebView migration build failures Implement missing WKWebView functionality to fix empty window Mar 20, 2026
@hannesa2
hannesa2 force-pushed the copilot/update-pbwebcontroller-for-wkwebview branch from ba15830 to a261737 Compare March 20, 2026 10:16
Copilot AI changed the title Implement missing WKWebView functionality to fix empty window Expose setupJavaScriptBridge and userContentController:didReceiveScriptMessage: for subclass override Mar 20, 2026
@hannesa2
hannesa2 force-pushed the copilot/update-pbwebcontroller-for-wkwebview branch 2 times, most recently from 879fc04 to e77a8b9 Compare March 21, 2026 15:54
Copilot AI changed the title Expose setupJavaScriptBridge and userContentController:didReceiveScriptMessage: for subclass override Add LSMinimumSystemVersion to Info.plist for system framework compatibility Mar 21, 2026
Copilot AI changed the title Add LSMinimumSystemVersion to Info.plist for system framework compatibility Add entitlements for WKWebView sandbox compatibility Mar 21, 2026
Copilot AI changed the title Add entitlements for WKWebView sandbox compatibility Fix WKWebView migration issues: sandbox entitlements and API compatibility Mar 21, 2026
@tiennou

tiennou commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Is that even possible? Last I've checked, WKWebView wasn't exposing some of the script stuff we need… somewhere.

@hannesa2
hannesa2 force-pushed the copilot/update-pbwebcontroller-for-wkwebview branch 3 times, most recently from bc0ae19 to 7244bda Compare September 21, 2026 07:45
@hannesa2
hannesa2 force-pushed the copilot/update-pbwebcontroller-for-wkwebview branch from 7244bda to 4d38f03 Compare September 23, 2026 04:15
@hannesa2

Copy link
Copy Markdown
Contributor

Screenshot differs: emulatorApi=arm64 with 3 screenshot(s)

setpoint (old) | diff | actual screenshot (new)

commit-context-menu.pngscreenshot

history-view.pngscreenshot

staging-view.pngscreenshot

This branch has not been deployed

No deployments
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.

3 participants