Repository navigation
[webview_flutter_wkwebview] Report the failed URL in onHttpError - #13784
farhansadikgalib wants to merge 1 commit into
Conversation
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
|
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. |
There was a problem hiding this comment.
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.
onHttpErroron iOS and macOS only reported the status code.HttpResponseError.requestandHttpResponseError.response.uriwere 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
urlto theHTTPURLResponsepigeon wrapper, implements it in the Swift delegate, and uses it inWebKitWebViewControllerto 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
[shared_preferences]///).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-assistbot 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
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