Skip to content

[WebKit] Preserve native defaults for unhandled policy events. Fixes #4214 - #26897

Open
rolfbjarne wants to merge 1 commit into
mainfrom
dev/rolf/web-policy-delegate-defaults
Open

rolfbjarne wants to merge 1 commit into
mainfrom
dev/rolf/web-policy-delegate-defaults

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Subscribing to a WebView policy event creates a generated delegate that also advertises unhandled decision callbacks. WebKit then calls those no-op implementations instead of applying its native defaults, leaving page loads unresolved when navigation is handled but MIME-type decisions are not.

Mark all three WebPolicyDelegate decision callbacks with NoDefaultValue so the generated delegate only responds to their selectors while the corresponding event has subscribers. Add a macOS regression test covering selector availability as handlers are added and removed, while preserving the ordinary policy-failure notification.

Fixes #4214

🤖 Pull request created by Copilot

Mark the three WebPolicyDelegate decision callbacks with NoDefaultValue so the generated event delegate only responds to selectors with subscribed handlers. This lets WebKit apply its native policy when, for example, navigation is handled but MIME-type decisions are not, instead of leaving the load unresolved.

Add a macOS regression test covering each selector as handlers are added and removed, while preserving the ordinary policy-failure notification.

Fixes #4214

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 94248f0f-e005-4288-8334-d17603eeaf29
Copilot AI balanced review requested due to automatic review settings October 16, 2026 13:28
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner October 16, 2026 13:28

Copilot AI 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.

🔵 Needs a closer look

Native delegate behavior still needs confirmation from macOS build and regression test results.

0 open findings

What changed in this PR

Preserves WebKit’s native policy defaults when corresponding managed events have no subscribers, addressing #4214.

Changes:

  • Adds NoDefaultValue to all three policy decision callbacks.
  • Adds macOS regression coverage for selector availability as handlers change, while retaining failure notifications.
File Description
tests/​monotouch-test/​WebKit/​WebViewTest.cs Tests selector availability when handlers are added and removed.
src/​webkit.cs Makes policy decision selectors conditional on event subscribers.

🧠 Review effort: Balanced

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 4b9b46255e216dd289fe072f6b0d2a368dadd1fd [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #4b9b462] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 2 tests failed, 219 tests passed.

Failures

❌ monotouch tests (iOS)

2 tests failed, 18 tests passed.

Failed tests

  • monotouch-test/iOS - simulator/Release (all optimizations): TimedOut
  • monotouch-test/iOS - simulator/Release (trimmable static registrar, all optimizations): TimedOut

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 20 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Golden Gate (27): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 4b9b46255e216dd289fe072f6b0d2a368dadd1fd [PR build]

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebPolicyDelegate binding breaks on macOS Mojave

3 participants