Skip to content

[webview_flutter_wkwebview] Report the failed URL in onHttpError - #13784

Open
farhansadikgalib wants to merge 1 commit into
flutter:mainfrom
farhansadikgalib:wkwebview-http-error-url
Open

farhansadikgalib wants to merge 1 commit into
flutter:mainfrom
farhansadikgalib:wkwebview-http-error-url

Conversation

@farhansadikgalib

@farhansadikgalib farhansadikgalib commented Nov 25, 2026 •

Copy link
Copy Markdown

onHttpError on iOS and macOS only reported the status code. HttpResponseError.request and HttpResponseError.response.uri were always null, so an app could not tell whether the page itself failed or a resource inside it, such as an iframe.

This PR adds url to the HTTPURLResponse pigeon wrapper, implements it in the Swift delegate, and uses it in WebKitWebViewController to fill in both the request and the response URI. When the response has no URL, both stay null as before.

The generated files were produced with pigeon 29.0.4, the version they were already generated with, so the diff only contains the new field.

Tests are added for the Swift delegate and for the Dart navigation delegate, with and without a URL.

Fixes flutter/flutter#195465

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

onHttpError on iOS and macOS only reported the status code, so the request and the response URI were always null. Expose the URL of HTTPURLResponse through the pigeon wrapper and use it to fill in both.

Fixes flutter/flutter#195465
@google-cla

google-cla Bot commented Nov 25, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@farhansadikgalib
farhansadikgalib marked this pull request as ready for review November 25, 2026 07:28
@github-actions github-actions Bot added platform-ios platform-macos p: webview_flutter P2 Important issues not at the top of the work list labels Nov 25, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the webview_flutter_wkwebview package to report the URL of a failed load in onHttpError. It adds a url property to the HTTPURLResponse class across Pigeon, Dart, and Swift implementations, and updates WebKitNavigationDelegate to populate the WebResourceRequest and WebResourceResponse with this URL. Unit tests have been added to verify the new functionality. There are no review comments to address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p: webview_flutter P2 Important issues not at the top of the work list platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[webview_flutter_wkwebview] onHttpError doesn't say which URL failed

1 participant