From 6469f308c0f0f710544d7d55c7655384bed27795 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Tue, 2 May 2017 15:41:05 +0300 Subject: Import WebKit commit a4582ff260c0683b310e8ebbd5c3e6d5ad9fccc2 Change-Id: Ic5519f3eaf22b68312d410b65d70445f05c631fa Reviewed-by: Konstantin Tokarev --- Source/WebCore/loader/CookieJar.cpp | 4 ---- Source/WebKit/PlatformQt.cmake | 2 +- Source/WebKit/qt/Api/qwebsettings.cpp | 18 +++++++-------- Source/WebKit/qt/Api/qwebsettings.h | 4 ++-- .../qt/WebCoreSupport/FrameNetworkingContextQt.cpp | 23 ++++++++---------- .../qt/WebCoreSupport/FrameNetworkingContextQt.h | 2 ++ .../WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp | 2 +- Source/WebKit/win/Plugins/PluginView.cpp | 2 ++ Source/WebKit2/CMakeLists.txt | 6 ++--- Source/cmake/OptionsQt.cmake | 27 ++++++++++++++++------ 10 files changed, 49 insertions(+), 41 deletions(-) diff --git a/Source/WebCore/loader/CookieJar.cpp b/Source/WebCore/loader/CookieJar.cpp index bb68434b7..33f284490 100644 --- a/Source/WebCore/loader/CookieJar.cpp +++ b/Source/WebCore/loader/CookieJar.cpp @@ -48,16 +48,12 @@ static NetworkingContext* networkingContext(const Document* document) return frame->loader().networkingContext(); } -#if PLATFORM(COCOA) || USE(CFNETWORK) || USE(SOUP) inline NetworkStorageSession& storageSession(const Document* document) { NetworkingContext* context = networkingContext(document); return context ? context->storageSession() : NetworkStorageSession::defaultStorageSession(); } #define LOCAL_SESSION(document) NetworkStorageSession& session = storageSession(document); -#else -#define LOCAL_SESSION(document) NetworkStorageSession session(networkingContext(document)); -#endif String cookies(const Document* document, const URL& url) { diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake index beee95a5d..d2562e5e7 100644 --- a/Source/WebKit/PlatformQt.cmake +++ b/Source/WebKit/PlatformQt.cmake @@ -232,7 +232,7 @@ if (ENABLE_WEBKIT2) if (APPLE) set(WEBKIT2_LIBRARY -Wl,-force_load WebKit2) elseif (MSVC) - set(WEBKIT2_LIBRARY "-WHOLEARCHIVE:WebKit2") + set(WEBKIT2_LIBRARY "-WHOLEARCHIVE:WebKit2${CMAKE_DEBUG_POSTFIX}") elseif (UNIX) set(WEBKIT2_LIBRARY -Wl,--whole-archive WebKit2 -Wl,--no-whole-archive) else () diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 4bc481126..e6b32f52a 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -69,10 +69,13 @@ QWEBKIT_EXPORT void qt_networkAccessAllowed(bool isAllowed) class QWebSettingsPrivate { public: - QWebSettingsPrivate(WebCore::Settings* wcSettings = 0) + QWebSettingsPrivate(WebCore::Page* page = nullptr) : offlineStorageDefaultQuota(0) - , settings(wcSettings) + , page(page) + , settings(nullptr) { + if (page) + settings = &page->settings(); } QHash fontFamilies; @@ -87,6 +90,7 @@ public: qint64 offlineStorageDefaultQuota; QWebSettings::ThirdPartyCookiePolicy thirdPartyCookiePolicy; void apply(); + WebCore::Page* page; WebCore::Settings* settings; }; @@ -211,13 +215,9 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::PluginsEnabled)); settings->setPluginsEnabled(value); -// FIXME: setPrivateBrowsingEnabled was removed, instead we have Page::enableLegacyPrivateBrowsing -// and ephemeral sessions (and I guess it's better to use the latter) -/* value = attributes.value(QWebSettings::PrivateBrowsingEnabled, global->attributes.value(QWebSettings::PrivateBrowsingEnabled)); - settings->setPrivateBrowsingEnabled(value); -*/ + page->setSessionID(value ? WebCore::SessionID::legacyPrivateSessionID() : WebCore::SessionID::defaultSessionID()); value = attributes.value(QWebSettings::SpatialNavigationEnabled, global->attributes.value(QWebSettings::SpatialNavigationEnabled)); @@ -612,8 +612,8 @@ QWebSettings::QWebSettings() /*! \internal */ -QWebSettings::QWebSettings(WebCore::Settings* settings) - : d(new QWebSettingsPrivate(settings)) +QWebSettings::QWebSettings(WebCore::Page* page) + : d(new QWebSettingsPrivate(page)) { d->apply(); allSettings()->append(d); diff --git a/Source/WebKit/qt/Api/qwebsettings.h b/Source/WebKit/qt/Api/qwebsettings.h index d05775e1f..0b0a1f00a 100644 --- a/Source/WebKit/qt/Api/qwebsettings.h +++ b/Source/WebKit/qt/Api/qwebsettings.h @@ -28,7 +28,7 @@ #include namespace WebCore { - class Settings; +class Page; } class QWebPage; @@ -186,7 +186,7 @@ private: Q_DISABLE_COPY(QWebSettings) QWebSettings(); - QWebSettings(WebCore::Settings *settings); + QWebSettings(WebCore::Page* page); ~QWebSettings(); QWebSettingsPrivate *d; diff --git a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp index e85185f67..76277befb 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp @@ -32,12 +32,6 @@ namespace WebCore { -static std::unique_ptr& privateSession() -{ - static NeverDestroyed> session; - return session; -} - FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled) : FrameNetworkingContext(frame) , m_originatingObject(originatingObject) @@ -45,20 +39,21 @@ FrameNetworkingContextQt::FrameNetworkingContextQt(Frame* frame, QObject* origin { } +void FrameNetworkingContextQt::setSession(std::unique_ptr&& session) +{ + m_session = WTFMove(session); +} + PassRefPtr FrameNetworkingContextQt::create(Frame* frame, QObject* originatingObject, bool mimeSniffingEnabled) { - return adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled)); + RefPtr self = adoptRef(new FrameNetworkingContextQt(frame, originatingObject, mimeSniffingEnabled)); + self->setSession(std::make_unique(self.get())); + return self; } NetworkStorageSession& FrameNetworkingContextQt::storageSession() const { - ASSERT(isMainThread()); - - if (frame() && frame()->page()->usesEphemeralSession()) - notImplemented(); -// return *privateSession(); // FIXME: Implement and call ensurePrivateBrowsingSession() - - return NetworkStorageSession::defaultStorageSession(); + return *m_session; } QObject* FrameNetworkingContextQt::originatingObject() const diff --git a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h index 6f53e7a93..085f08f08 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h @@ -30,6 +30,7 @@ public: private: FrameNetworkingContextQt(Frame*, QObject* originatingObject, bool mimeSniffingEnabled); + void setSession(std::unique_ptr&&); NetworkStorageSession& storageSession() const override; @@ -38,6 +39,7 @@ private: bool mimeSniffingEnabled() const override; bool thirdPartyCookiePolicyPermission(const QUrl&) const override; + mutable std::unique_ptr m_session; QObject* m_originatingObject; bool m_mimeSniffingEnabled; }; diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp index 9b6d18ecd..084d5069d 100644 --- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp +++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp @@ -285,7 +285,7 @@ void QWebPageAdapter::initializeWebCorePage() page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); - settings = new QWebSettings(&page->settings()); + settings = new QWebSettings(page); #if ENABLE(NOTIFICATIONS) WebCore::provideNotification(page, NotificationPresenterClientQt::notificationPresenter()); diff --git a/Source/WebKit/win/Plugins/PluginView.cpp b/Source/WebKit/win/Plugins/PluginView.cpp index 0ee5380cc..6939439ba 100644 --- a/Source/WebKit/win/Plugins/PluginView.cpp +++ b/Source/WebKit/win/Plugins/PluginView.cpp @@ -1479,6 +1479,8 @@ NPError PluginView::getAuthenticationInfo(const char* protocol, const char* host void PluginView::privateBrowsingStateChanged(bool privateBrowsingEnabled) { + if (!m_plugin) + return; NPP_SetValueProcPtr setValue = m_plugin->pluginFuncs()->setvalue; if (!setValue) return; diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index ffff0fc55..9af82650b 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -818,10 +818,10 @@ if (ENABLE_DATABASE_PROCESS) endif () endif () -POPULATE_LIBRARY_VERSION(WEBKIT2) -set_target_properties(WebKit2 PROPERTIES VERSION ${WEBKIT2_VERSION} SOVERSION ${WEBKIT2_VERSION_MAJOR}) +if (NOT PORT STREQUAL "Mac") + POPULATE_LIBRARY_VERSION(WEBKIT2) + set_target_properties(WebKit2 PROPERTIES VERSION ${WEBKIT2_VERSION} SOVERSION ${WEBKIT2_VERSION_MAJOR}) -if (NOT APPLE) install(TARGETS WebProcess NetworkProcess DESTINATION "${LIBEXEC_INSTALL_DIR}") if (SHARED_CORE OR NOT PORT STREQUAL "Qt") install(TARGETS WebKit2 DESTINATION "${LIB_INSTALL_DIR}") diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index b9db8d8bc..568ee2ad1 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -20,6 +20,12 @@ if (QT_CONAN_DIR) COMMAND conan imports -f \"${QT_CONAN_DIR}/conanfile.txt\" --dest \${_conan_imports_dest} WORKING_DIRECTORY \"${QT_CONAN_DIR}\" ) + + set(_conan_imports_manifest \"\${_conan_imports_dest}/conan_imports_manifest.txt\") + if (EXISTS \${_conan_imports_manifest}) + file(REMOVE \${_conan_imports_manifest}) + message(\"Removed conan install manifest: \${_conan_imports_manifest}\") + endif () ") endif () @@ -306,8 +312,13 @@ if (MSVC) endif () if (DEFINED ENV{SQLITE3SRCDIR}) - get_filename_component(SQLITE_INCLUDE_DIR $ENV{SQLITE3SRCDIR} ABSOLUTE) - set(SQLITE_SOURCE_FILE ${SQLITE_INCLUDE_DIR}/sqlite3.c) + get_filename_component(SQLITE3SRC_ABS_DIR $ENV{SQLITE3SRCDIR} ABSOLUTE) + set(SQLITE3_SOURCE_DIR ${SQLITE3SRC_ABS_DIR} CACHE PATH "Path to SQLite sources to use instead of system library" FORCE) +endif () + +if (SQLITE3_SOURCE_DIR) + set(SQLITE_INCLUDE_DIR ${SQLITE3_SOURCE_DIR}) + set(SQLITE_SOURCE_FILE ${SQLITE3_SOURCE_DIR}/sqlite3.c) if (NOT EXISTS ${SQLITE_SOURCE_FILE}) message(FATAL_ERROR "${SQLITE_SOURCE_FILE} not found.") endif () @@ -426,12 +437,14 @@ if (ENABLE_WEBKIT2) ) SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE) SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_MULTIPROCESS TRUE) +endif () - if (APPLE) - SET_AND_EXPOSE_TO_BUILD(USE_MACH_PORTS 1) # Qt-specific - elseif (UNIX) - SET_AND_EXPOSE_TO_BUILD(USE_UNIX_DOMAIN_SOCKETS 1) - endif () +# Mach ports and Unix sockets are currently used by WK2, but their USE() values +# affect building WorkQueue +if (APPLE) + SET_AND_EXPOSE_TO_BUILD(USE_MACH_PORTS 1) # Qt-specific +elseif (UNIX) + SET_AND_EXPOSE_TO_BUILD(USE_UNIX_DOMAIN_SOCKETS 1) endif () if (ENABLE_QT_WEBCHANNEL) -- cgit v1.2.3