diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-12-29 00:03:42 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2018-01-02 20:59:10 +0000 |
commit | 8059e2d9b874cbcebc76adf77b89f0cedf6e623d (patch) | |
tree | d23ae49b7a2d4b348c7abc4129e8f68dc93c5bed | |
parent | 4d4b118c1294d96741d71a775ac1c57b5acb96bb (diff) |
WKWebView: provide better diagnostics on navigation failure
Instead of the current page URL, provide the URL that actually had a
navigation failure, in the url property of the loadRequest parameter of
the loadingChanged signal. This does not hide any information as the
current page URL is still available via the WebView's url property.
Change-Id: Ie6350722b9b3529131c51d53144af24cf1ac722d
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
-rw-r--r-- | src/webview/qwebview_darwin.mm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/webview/qwebview_darwin.mm b/src/webview/qwebview_darwin.mm index 38ac829..35fc726 100644 --- a/src/webview/qwebview_darwin.mm +++ b/src/webview/qwebview_darwin.mm @@ -191,8 +191,12 @@ QT_END_NAMESPACE if (--qDarwinWebViewPrivate->requestFrameCount == 0) { [self pageDone]; NSString *errorString = [error localizedDescription]; + NSURL *failingURL = error.userInfo[@"NSErrorFailingURLKey"]; + const QUrl url = [failingURL isKindOfClass:[NSURL class]] + ? QUrl::fromNSURL(failingURL) + : qDarwinWebViewPrivate->url(); Q_EMIT qDarwinWebViewPrivate->loadingChanged( - QWebViewLoadRequestPrivate(qDarwinWebViewPrivate->url(), + QWebViewLoadRequestPrivate(url, QWebView::LoadFailedStatus, QString::fromNSString(errorString))); } |