summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-18 18:04:28 +0100
committerLiang Qi <liang.qi@qt.io>2018-01-18 18:10:27 +0100
commiteef3467cfad9f6ad892344bfcadbd59b5bcb4f53 (patch)
tree6871b7e2a09883dba43d68a774be4f9be760df19
parent4cefce7644f1eb9b9a5750ebc1b361976d866448 (diff)
parentf016c7781fb418fd57bae62d22ce46f8711de62a (diff)
Merge remote-tracking branch 'origin/5.9' into 5.105.10
Conflicts: .qmake.conf Change-Id: Ia6e0a844ba13f1fc5c1098bb70b172d8b120efc4
-rw-r--r--dist/changes-5.9.425
-rw-r--r--src/webview/qwebview_darwin.mm62
-rw-r--r--src/webview/webview-lib.pri1
-rw-r--r--src/webview/webview.pro2
4 files changed, 83 insertions, 7 deletions
diff --git a/dist/changes-5.9.4 b/dist/changes-5.9.4
new file mode 100644
index 0000000..d49a42f
--- /dev/null
+++ b/dist/changes-5.9.4
@@ -0,0 +1,25 @@
+Qt 5.9.4 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.9.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.9 series is binary compatible with the 5.8.x series.
+Applications compiled for 5.8 will continue to run with 5.9.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.9.4 Changes *
+****************************************************************************
+
+ - This release contains only minor code improvements.
+
diff --git a/src/webview/qwebview_darwin.mm b/src/webview/qwebview_darwin.mm
index ff9dc4d..90f6551 100644
--- a/src/webview/qwebview_darwin.mm
+++ b/src/webview/qwebview_darwin.mm
@@ -40,6 +40,7 @@
#include "qtwebviewfunctions.h"
#include "qtwebviewfunctions_p.h"
+#include <QtCore/private/qglobal_p.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qmap.h>
#include <QtCore/qvariant.h>
@@ -190,13 +191,57 @@ 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)));
}
}
+- (void)webView:(WKWebView *)webView
+decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
+ decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
+ __attribute__((availability(ios_app_extension,unavailable)))
+{
+ Q_UNUSED(webView);
+ NSURL *url = navigationAction.request.URL;
+ const BOOL handled = (^{
+#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(101300, 110000)
+ if (__builtin_available(macOS 10.13, iOS 11.0, *)) {
+ return [WKWebView handlesURLScheme:url.scheme];
+ } else
+#endif
+ {
+ // +[WKWebView handlesURLScheme:] is a stub that calls
+ // WebCore::SchemeRegistry::isBuiltinScheme();
+ // replicate that as closely as possible
+ return [@[
+ @"about", @"applewebdata", @"blob", @"data",
+ @"file", @"http", @"https", @"javascript",
+#ifdef Q_OS_MACOS
+ @"safari-extension",
+#endif
+ @"webkit-fake-url", @"wss", @"x-apple-content-filter",
+#ifdef Q_OS_MACOS
+ @"x-apple-ql-id"
+#endif
+ ] containsObject:url.scheme];
+ }
+ })();
+ if (!handled) {
+#ifdef Q_OS_MACOS
+ [[NSWorkspace sharedWorkspace] openURL:url];
+#elif defined(Q_OS_IOS)
+ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
+#endif
+ }
+ decisionHandler(handled ? WKNavigationActionPolicyAllow : WKNavigationActionPolicyCancel);
+}
+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change
context:(void *)context {
Q_UNUSED(object);
@@ -253,14 +298,19 @@ void QDarwinWebViewPrivate::setUrl(const QUrl &url)
{
if (url.isValid()) {
requestFrameCount = 0;
- if (!url.isLocalFile()) {
- [wkWebView loadRequest:[NSURLRequest requestWithURL:url.toNSURL()]];
- } else {
+
+#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(101100, 90000)
+ if (url.isLocalFile()) {
// We need to pass local files via loadFileURL and the read access should cover
// the directory that the file is in, to facilitate loading referenced images etc
- [wkWebView loadFileURL:url.toNSURL()
- allowingReadAccessToURL:QUrl(url.toString(QUrl::RemoveFilename)).toNSURL()];
+ if (__builtin_available(macOS 10.11, iOS 9, *)) {
+ [wkWebView loadFileURL:url.toNSURL()
+ allowingReadAccessToURL:QUrl(url.toString(QUrl::RemoveFilename)).toNSURL()];
+ return;
+ }
}
+#endif
+ [wkWebView loadRequest:[NSURLRequest requestWithURL:url.toNSURL()]];
}
}
diff --git a/src/webview/webview-lib.pri b/src/webview/webview-lib.pri
index f5d6774..1af6dcf 100644
--- a/src/webview/webview-lib.pri
+++ b/src/webview/webview-lib.pri
@@ -51,6 +51,7 @@ android {
$$COMMON_HEADERS \
qwebview_darwin_p.h
LIBS_PRIVATE += -framework Foundation -framework WebKit
+ macos: LIBS_PRIVATE += -framework AppKit
ios: LIBS_PRIVATE += -framework UIKit
macos: CONFIG += use_webengine_backend
diff --git a/src/webview/webview.pro b/src/webview/webview.pro
index 452a3cc..af1286e 100644
--- a/src/webview/webview.pro
+++ b/src/webview/webview.pro
@@ -1,7 +1,7 @@
TARGET = QtWebView
QT =
-QT_FOR_PRIVATE = quick-private gui-private
+QT_FOR_PRIVATE = quick-private core-private gui-private
include($$PWD/webview-lib.pri)