diff options
m--------- | src/3rdparty | 0 | ||||
-rw-r--r-- | src/core/Info_mac.plist | 20 | ||||
-rw-r--r-- | src/core/core.pro | 27 | ||||
-rw-r--r-- | src/core/core_module.pro | 47 | ||||
-rw-r--r-- | src/core/web_engine_context.cpp | 4 | ||||
-rw-r--r-- | src/core/web_engine_library_info.cpp | 56 | ||||
-rw-r--r-- | src/process/process.pro | 16 | ||||
-rw-r--r-- | src/webengine/api/qquickwebenginesettings.cpp | 1 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_loadFail.qml | 39 | ||||
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_loadUrl.qml | 5 |
10 files changed, 168 insertions, 47 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject 0dcd4e35086a90f643bb721fad1ef786f5fff8b +Subproject 577cd47e54bb88c81b7a5b5a6d658d8d61b2c74 diff --git a/src/core/Info_mac.plist b/src/core/Info_mac.plist new file mode 100644 index 000000000..58362c810 --- /dev/null +++ b/src/core/Info_mac.plist @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>@SHORT_VERSION@</string> + <key>CFBundleVersion</key> + <string>@FULL_VERSION@</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@LIBRARY@</string> + <key>CFBundleIdentifier</key> + <string>org.qt-project.Qt.QtWebEngineCore</string> +</dict> +</plist> diff --git a/src/core/core.pro b/src/core/core.pro index 927f8bab4..cf00f39cb 100644 --- a/src/core/core.pro +++ b/src/core/core.pro @@ -28,30 +28,3 @@ SUBDIRS += core_gyp_generator \ gyp_run.depends += gyp_configure_host gyp_configure_target SUBDIRS += gyp_configure_host gyp_configure_target } - -REPACK_DIR = $$OUT_PWD/$$getConfigDir()/gen/repack -locales.files = "$$REPACK_DIR/qtwebengine_locales/*" -locales.CONFIG += no_check_exist -locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales -resources.files = $$REPACK_DIR/qtwebengine_resources.pak -resources.CONFIG += no_check_exist -resources.path = $$[QT_INSTALL_DATA] - -PLUGIN_EXTENSION = .so -PLUGIN_PREFIX = lib -macx: PLUGIN_PREFIX = -win32 { - PLUGIN_EXTENSION = .dll - PLUGIN_PREFIX = -} - -icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat -icu.CONFIG += no_check_exist -icu.path = $$[QT_INSTALL_DATA] - -plugins.files = $$OUT_PWD/$$getConfigDir()/$${PLUGIN_PREFIX}ffmpegsumo$${PLUGIN_EXTENSION} -plugins.CONFIG += no_check_exist -plugins.path = $$[QT_INSTALL_PLUGINS]/qtwebengine - -INSTALLS += icu locales resources plugins - diff --git a/src/core/core_module.pro b/src/core/core_module.pro index 08e0b7822..66ab3ee4d 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -6,11 +6,58 @@ CMAKE_MODULE_TESTS = "-" QT += qml quick QT_PRIVATE += gui-private +# Needed to set a CFBundleIdentifier +QMAKE_INFO_PLIST = Info_mac.plist + # Look for linking information produced by gyp for our target according to core_generated.gyp !include($$OUT_PWD/$$getConfigDir()/$${TARGET}_linking.pri) { error("Could not find the linking information that gyp should have generated.") } +REPACK_DIR = $$OUT_PWD/$$getConfigDir()/gen/repack +# Duplicated from resources/resources.gyp +LOCALE_LIST = am ar bg bn ca cs da de el en-GB en-US es-419 es et fa fi fil fr gu he hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw ta te th tr uk vi zh-CN zh-TW +for(LOC, LOCALE_LIST) { + locales.files += $$REPACK_DIR/qtwebengine_locales/$${LOC}.pak +} +resources.files = $$REPACK_DIR/qtwebengine_resources.pak + +PLUGIN_EXTENSION = .so +PLUGIN_PREFIX = lib +osx: PLUGIN_PREFIX = +win32 { + PLUGIN_EXTENSION = .dll + PLUGIN_PREFIX = +} +icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat + +plugins.files = $$OUT_PWD/$$getConfigDir()/$${PLUGIN_PREFIX}ffmpegsumo$${PLUGIN_EXTENSION} + +!debug_and_release|!build_all|CONFIG(release, debug|release):contains(QT_CONFIG, qt_framework) { + locales.version = Versions + locales.path = Resources/qtwebengine_locales + resources.version = Versions + resources.path = Resources + icu.version = Versions + icu.path = Resources + plugins.version = Versions + plugins.path = Libraries + # No files, this prepares the bundle Helpers symlink, process.pro will create the directories + qtwebengineprocessplaceholder.version = Versions + qtwebengineprocessplaceholder.path = Helpers + QMAKE_BUNDLE_DATA += icu locales resources plugins qtwebengineprocessplaceholder +} else { + locales.CONFIG += no_check_exist + locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales + resources.CONFIG += no_check_exist + resources.path = $$[QT_INSTALL_DATA] + icu.CONFIG += no_check_exist + icu.path = $$[QT_INSTALL_DATA] + plugins.CONFIG += no_check_exist + plugins.path = $$[QT_INSTALL_PLUGINS]/qtwebengine + INSTALLS += icu locales resources plugins +} + # We distribute the module binary but headers are only available in-tree. CONFIG += no_module_headers load(qt_module) diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 20bf3e051..ac9a921e7 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -142,7 +142,11 @@ WebEngineContext::WebEngineContext() #if defined(OS_WIN) parsedCommandLine->AppendSwitch(switches::kDisableD3D11); + // ANGLE doesn't support multi-threading, doing texture upload from the GPU thread + // hasn't been causing problems yet but doing rendering there is conflicting with + // Qt's rendering of the scene graph. parsedCommandLine->AppendSwitch(switches::kDisableExperimentalWebGL); + parsedCommandLine->AppendSwitch(switches::kDisableAccelerated2dCanvas); #endif #if defined(QTWEBENGINE_MOBILE_SWITCHES) diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 4cdf3813e..026f4db83 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -92,6 +92,39 @@ QString location(QLibraryInfo::LibraryLocation path) return QLibraryInfo::location(path); } +#if defined(OS_MACOSX) +static inline CFBundleRef frameworkBundle() +{ + return CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.Qt.QtWebEngineCore")); +} + +static QString getPath(CFBundleRef frameworkBundle) +{ + QString path; + if (frameworkBundle) { + CFURLRef bundleUrl = CFBundleCopyBundleURL(frameworkBundle); + CFStringRef bundlePath = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle); + path = QString::fromCFString(bundlePath); + CFRelease(bundlePath); + CFRelease(bundleUrl); + } + return path; +} + +static QString getResourcesPath(CFBundleRef frameworkBundle) +{ + QString path; + if (frameworkBundle) { + CFURLRef resourcesRelativeUrl = CFBundleCopyResourcesDirectoryURL(frameworkBundle); + CFStringRef resourcesRelativePath = CFURLCopyFileSystemPath(resourcesRelativeUrl, kCFURLPOSIXPathStyle); + path = getPath(frameworkBundle) % QLatin1Char('/') % QString::fromCFString(resourcesRelativePath); + CFRelease(resourcesRelativePath); + CFRelease(resourcesRelativeUrl); + } + return path; +} +#endif + QString subProcessPath() { static bool initialized = false; @@ -100,14 +133,19 @@ QString subProcessPath() #else static QString processBinary (QLatin1String(QTWEBENGINEPROCESS_NAME)); #endif +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + static QString processPath (getPath(frameworkBundle()) + % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME)); +#else static QString processPath (location(QLibraryInfo::LibraryExecutablesPath) % QDir::separator() % processBinary); +#endif if (!initialized) { // Allow overriding at runtime for the time being. const QByteArray fromEnv = qgetenv("QTWEBENGINEPROCESS_PATH"); if (!fromEnv.isEmpty()) processPath = QString::fromLatin1(fromEnv); - if (processPath.isEmpty() || !QFileInfo(processPath).exists()) { + if (!QFileInfo(processPath).exists()) { qWarning("QtWebEngineProcess not found at location %s. Trying fallback path...", qPrintable(processPath)); processPath = QCoreApplication::applicationDirPath() % QDir::separator() % processBinary; } @@ -121,12 +159,20 @@ QString subProcessPath() QString pluginsPath() { +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + return getPath(frameworkBundle()) % QLatin1String("/Libraries"); +#else return location(QLibraryInfo::PluginsPath) % QDir::separator() % QLatin1String("qtwebengine"); +#endif } QString localesPath() { +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + return getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_locales"); +#else return location(QLibraryInfo::TranslationsPath) % QLatin1String("/qtwebengine_locales"); +#endif } QString fallbackDir() { @@ -155,7 +201,11 @@ base::FilePath WebEngineLibraryInfo::getPath(int key) QString directory; switch (key) { case QT_RESOURCES_PAK: +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + return toFilePath(getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_resources.pak")); +#else return toFilePath(location(QLibraryInfo::DataPath) % QLatin1String("/qtwebengine_resources.pak")); +#endif case base::FILE_EXE: case content::CHILD_PROCESS_EXE: return toFilePath(subProcessPath()); @@ -171,7 +221,11 @@ base::FilePath WebEngineLibraryInfo::getPath(int key) directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); break; case base::DIR_QT_LIBRARY_DATA: +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + return toFilePath(getResourcesPath(frameworkBundle())); +#else return toFilePath(location(QLibraryInfo::DataPath)); +#endif #if defined(OS_ANDROID) case base::DIR_SOURCE_ROOT: case base::DIR_ANDROID_EXTERNAL_STORAGE: diff --git a/src/process/process.pro b/src/process/process.pro index a9f5d183f..8ed09612a 100644 --- a/src/process/process.pro +++ b/src/process/process.pro @@ -3,14 +3,22 @@ TEMPLATE = app QT_PRIVATE += webenginecore -CONFIG -= app_bundle - load(qt_build_paths) -DESTDIR = $$MODULE_BASE_OUTDIR/libexec +contains(QT_CONFIG, qt_framework) { + # Deploy the QtWebEngineProcess app bundle into the QtWebEngineCore framework. + DESTDIR = $$MODULE_BASE_OUTDIR/lib/QtWebEngineCore.framework/Versions/5/Helpers +} else { + CONFIG -= app_bundle + DESTDIR = $$MODULE_BASE_OUTDIR/libexec +} INCLUDEPATH += ../core SOURCES = main.cpp -target.path = $$[QT_INSTALL_LIBEXECS] +contains(QT_CONFIG, qt_framework) { + target.path = $$[QT_INSTALL_LIBS]/QtWebEngineCore.framework/Versions/5/Helpers +} else { + target.path = $$[QT_INSTALL_LIBEXECS] +} INSTALLS += target diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index 7f36bad5e..743d22d81 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -78,6 +78,7 @@ QQuickWebEngineSettings *QQuickWebEngineSettings::globalSettings() QQuickWebEngineSettings::~QQuickWebEngineSettings() { + allSettings->removeAll(this->d_func()); } bool QQuickWebEngineSettings::autoLoadImages() const diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml index 7b0a1849e..694547863 100644 --- a/tests/auto/quick/qmltests/data/tst_loadFail.qml +++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml @@ -42,38 +42,49 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.0 +import QtWebEngine.experimental 1.0 TestWebEngineView { id: webEngineView width: 400 height: 300 - property variant testUrl - - SignalSpy { - id: spyIconChanged - target: webEngineView - signalName: "iconChanged" - } + property variant unavailableUrl TestCase { id: test name: "WebEngineViewLoadFail" + + function initTestCase() { + WebEngine.settings.errorPageEnabled = false + } + function test_fail() { - testUrl = Qt.resolvedUrl("file_that_does_not_exist.html") - webEngineView.url = testUrl + unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html") + webEngineView.url = unavailableUrl verify(webEngineView.waitForLoadFailed()) - spyIconChanged.clear() + } - // If this testcase finishes too early, we can not handle the received replacement content. - // So we should wait to ignore this error page. - spyIconChanged.wait() + function test_fail_url() { + var url = Qt.resolvedUrl("test1.html") + webEngineView.url = url + compare(webEngineView.url, url) + verify(webEngineView.waitForLoadSucceeded()) + compare(webEngineView.url, url) + + unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html") + webEngineView.url = unavailableUrl + compare(webEngineView.url, unavailableUrl) + verify(webEngineView.waitForLoadFailed()) + // When error page is disabled in case of LoadFail the entry of the unavailable page is not stored. + // We expect the url of the previously loaded page here. + compare(webEngineView.url, url) } } onLoadingChanged: { if (loadRequest.status == WebEngineView.LoadFailedStatus) { - test.compare(loadRequest.url, testUrl) + test.compare(loadRequest.url, unavailableUrl) test.compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain) } } diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml index 5f51e9036..e0e185eb0 100644 --- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml +++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml @@ -42,6 +42,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebEngine 1.0 +import QtWebEngine.experimental 1.0 TestWebEngineView { id: webEngineView @@ -106,6 +107,8 @@ TestWebEngineView { } function test_urlProperty() { + WebEngine.settings.errorPageEnabled = false + var url = Qt.resolvedUrl("test1.html") webEngineView.url = url @@ -117,7 +120,7 @@ TestWebEngineView { webEngineView.url = bogusSite compare(webEngineView.url, bogusSite) verify(webEngineView.waitForLoadFailed()) - compare(webEngineView.url, bogusSite) + compare(webEngineView.url, url) webEngineView.url = "about:blank" // Reset from previous test verify(webEngineView.waitForLoadSucceeded()) |