summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2017-04-27 02:11:30 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-04-28 15:30:37 +0000
commit54e605a32bdceab163e4f2725794c1aab43adc73 (patch)
tree493e0254601213505e06fcf12900646da050025a
parent4bd713d56aa9bb86bc96ea9cb0c64cbf94bf43d4 (diff)
Import WebKit commit 7aa9943a36e7f3e72207dbf448d2d80fb368a300
Change-Id: I7e96b8e5ba5eef9b0c6c0835e200f770200573ed Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
-rw-r--r--Source/WTF/wtf/Platform.h2
-rw-r--r--Source/WTF/wtf/spi/darwin/XPCSPI.h2
-rw-r--r--Source/WebCore/PlatformQt.cmake16
-rw-r--r--Source/WebCore/platform/cocoa/MachSendRight.cpp102
-rw-r--r--Source/WebCore/platform/cocoa/MachSendRight.h59
-rw-r--r--Source/WebCore/platform/spi/cocoa/MachVMSPI.h47
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp11
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h1
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp5
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h1
-rw-r--r--Source/WebKit/qt/WidgetApi/qwebpage.cpp7
-rw-r--r--Source/WebKit/qt/WidgetApi/qwebpage.h2
-rw-r--r--Source/WebKit/qt/declarative/CMakeLists.txt1
-rw-r--r--Source/WebKit2/Platform/IPC/Connection.h8
-rw-r--r--Source/WebKit2/Platform/IPC/MessageDecoder.h1
-rw-r--r--Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm10
-rw-r--r--Source/WebKit2/Platform/Module.h2
-rw-r--r--Source/WebKit2/PlatformQt.cmake5
-rw-r--r--Source/WebKit2/Shared/API/APIData.h2
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKNativeEvent.h2
-rw-r--r--Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h2
-rw-r--r--Source/WebKit2/UIProcess/ChildProcessProxy.cpp4
-rw-r--r--Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp5
-rw-r--r--Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp4
-rw-r--r--Source/cmake/KDEInstallDirs.cmake4
-rw-r--r--Source/cmake/OptionsQt.cmake12
-rw-r--r--Tools/QtTestBrowser/launcherwindow.cpp10
-rw-r--r--Tools/QtTestBrowser/launcherwindow.h2
-rw-r--r--Tools/qt/manifest.txt3
29 files changed, 299 insertions, 33 deletions
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
index d42efbdec..3f2069e7c 100644
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
@@ -983,7 +983,7 @@
#define USE_EXPORT_MACROS_FOR_TESTING 1
#endif
-#if PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(QT) && !OS(DARWIN) && !OS(WINDOWS))
+#if PLATFORM(GTK) || PLATFORM(EFL)
#define USE_UNIX_DOMAIN_SOCKETS 1
#endif
diff --git a/Source/WTF/wtf/spi/darwin/XPCSPI.h b/Source/WTF/wtf/spi/darwin/XPCSPI.h
index dd09c8fa7..e30315ab5 100644
--- a/Source/WTF/wtf/spi/darwin/XPCSPI.h
+++ b/Source/WTF/wtf/spi/darwin/XPCSPI.h
@@ -29,7 +29,7 @@
#include <dispatch/dispatch.h>
#include <os/object.h>
-#if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK)
+#if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK) || PLATFORM(QT)
#include <xpc/xpc.h>
#else
diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake
index a6a807fce..44ed482fb 100644
--- a/Source/WebCore/PlatformQt.cmake
+++ b/Source/WebCore/PlatformQt.cmake
@@ -193,7 +193,7 @@ endif ()
if (ENABLE_NETSCAPE_PLUGIN_API)
if (WIN32)
- set(WebCore_FORWARDING_HEADERS_FILES
+ list(APPEND WebCore_FORWARDING_HEADERS_FILES
platform/graphics/win/LocalWindowsContext.h
platform/win/BitmapInfo.h
@@ -210,8 +210,8 @@ if (ENABLE_NETSCAPE_PLUGIN_API)
version
)
elseif (PLUGIN_BACKEND_XLIB)
- set(WebCore_FORWARDING_HEADERS_FILES
- plugins/qt/QtX11ImageConversion.h
+ list(APPEND WebCore_FORWARDING_HEADERS_FILES
+ plugins/qt/QtX11ImageConversion.h
)
list(APPEND WebCore_SOURCES
plugins/qt/QtX11ImageConversion.cpp
@@ -285,6 +285,16 @@ if (ENABLE_WEBKIT2)
list(APPEND WebCore_SOURCES
page/qt/GestureTapHighlighter.cpp
)
+ if (USE_MACH_PORTS)
+ list(APPEND WebCore_FORWARDING_HEADERS_FILES
+ platform/cocoa/MachSendRight.h
+
+ platform/spi/cocoa/MachVMSPI.h
+ )
+ list(APPEND WebCore_SOURCES
+ platform/cocoa/MachSendRight.cpp
+ )
+ endif ()
endif ()
if (ENABLE_OPENGL)
diff --git a/Source/WebCore/platform/cocoa/MachSendRight.cpp b/Source/WebCore/platform/cocoa/MachSendRight.cpp
new file mode 100644
index 000000000..0e9ebc70a
--- /dev/null
+++ b/Source/WebCore/platform/cocoa/MachSendRight.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MachSendRight.h"
+
+#include <mach/mach_error.h>
+#include <mach/mach_init.h>
+#include <utility>
+
+namespace WebCore {
+
+static void retainSendRight(mach_port_t port)
+{
+ if (!MACH_PORT_VALID(port))
+ return;
+
+ auto kr = mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, 1);
+ if (kr != KERN_SUCCESS)
+ LOG_ERROR("mach_port_mod_refs error: %s (%x)", mach_error_string(kr), kr);
+}
+
+static void releaseSendRight(mach_port_t port)
+{
+ if (!MACH_PORT_VALID(port))
+ return;
+
+ auto kr = mach_port_deallocate(mach_task_self(), port);
+ if (kr != KERN_SUCCESS)
+ LOG_ERROR("mach_port_deallocate error: %s (%x)", mach_error_string(kr), kr);
+}
+
+MachSendRight MachSendRight::adopt(mach_port_t port)
+{
+ return MachSendRight(port);
+}
+
+MachSendRight MachSendRight::create(mach_port_t port)
+{
+ retainSendRight(port);
+
+ return adopt(port);
+}
+
+MachSendRight::MachSendRight(mach_port_t port)
+ : m_port(port)
+{
+}
+
+MachSendRight::MachSendRight(MachSendRight&& other)
+ : m_port(other.leakSendRight())
+{
+}
+
+MachSendRight::~MachSendRight()
+{
+ releaseSendRight(m_port);
+}
+
+MachSendRight& MachSendRight::operator=(MachSendRight&& other)
+{
+ if (this != &other) {
+ releaseSendRight(m_port);
+ m_port = other.leakSendRight();
+ }
+
+ return *this;
+}
+
+MachSendRight MachSendRight::copySendRight() const
+{
+ return create(m_port);
+}
+
+mach_port_t MachSendRight::leakSendRight()
+{
+ return std::exchange(m_port, MACH_PORT_NULL);
+}
+
+}
diff --git a/Source/WebCore/platform/cocoa/MachSendRight.h b/Source/WebCore/platform/cocoa/MachSendRight.h
new file mode 100644
index 000000000..cded9dcb0
--- /dev/null
+++ b/Source/WebCore/platform/cocoa/MachSendRight.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MachSendRight_h
+#define MachSendRight_h
+
+#include <mach/mach_port.h>
+
+namespace WebCore {
+
+class MachSendRight {
+public:
+ WEBCORE_EXPORT static MachSendRight adopt(mach_port_t);
+ WEBCORE_EXPORT static MachSendRight create(mach_port_t);
+
+ MachSendRight() = default;
+ WEBCORE_EXPORT MachSendRight(MachSendRight&&);
+ WEBCORE_EXPORT ~MachSendRight();
+
+ WEBCORE_EXPORT MachSendRight& operator=(MachSendRight&&);
+
+ explicit operator bool() const { return m_port != MACH_PORT_NULL; }
+
+ mach_port_t sendRight() const { return m_port; }
+
+ WEBCORE_EXPORT MachSendRight copySendRight() const;
+ WEBCORE_EXPORT mach_port_t leakSendRight() WARN_UNUSED_RETURN;
+
+private:
+ explicit MachSendRight(mach_port_t);
+
+ mach_port_t m_port { MACH_PORT_NULL };
+};
+
+}
+
+#endif // MachSendRight_h
diff --git a/Source/WebCore/platform/spi/cocoa/MachVMSPI.h b/Source/WebCore/platform/spi/cocoa/MachVMSPI.h
new file mode 100644
index 000000000..d31cb42d8
--- /dev/null
+++ b/Source/WebCore/platform/spi/cocoa/MachVMSPI.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MachVMSPI_h
+#define MachVMSPI_h
+
+#include <mach/boolean.h>
+#include <mach/kern_return.h>
+#include <mach/mach_types.h>
+
+#if PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK) || PLATFORM(QT)
+#include <mach/mach_vm.h>
+#endif
+
+EXTERN_C kern_return_t mach_vm_allocate(vm_map_t target, mach_vm_address_t*, mach_vm_size_t, int flags);
+EXTERN_C kern_return_t mach_vm_deallocate(vm_map_t target, mach_vm_address_t, mach_vm_size_t);
+EXTERN_C kern_return_t mach_vm_map(vm_map_t targetTask, mach_vm_address_t*, mach_vm_size_t, mach_vm_offset_t mask, int flags,
+ mem_entry_name_port_t, memory_object_offset_t, boolean_t copy, vm_prot_t currentProtection, vm_prot_t maximumProtection, vm_inherit_t);
+EXTERN_C kern_return_t mach_vm_protect(vm_map_t targetTask, mach_vm_address_t, mach_vm_size_t, boolean_t setMaximum, vm_prot_t newProtection);
+EXTERN_C kern_return_t mach_vm_region(vm_map_t targetTask, mach_vm_address_t*, mach_vm_size_t*, vm_region_flavor_t, vm_region_info_t,
+ mach_msg_type_number_t* infoCount, mach_port_t* objectName);
+EXTERN_C kern_return_t mach_vm_region_recurse(vm_map_t targetTask, mach_vm_address_t*, mach_vm_size_t*, uint32_t* depth, vm_region_recurse_info_t, mach_msg_type_number_t* infoCount);
+EXTERN_C kern_return_t mach_vm_purgable_control(vm_map_t target, mach_vm_address_t, vm_purgable_t control, int* state);
+
+#endif // MachVMSPI_h
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
index bd9fee1f2..79dfb906f 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
@@ -22,6 +22,7 @@
#include "InspectorClientQt.h"
#include "InspectorController.h"
+#include "MIMETypeRegistry.h"
#include "Page.h"
#include "QWebFrameAdapter.h"
#include "QWebPageAdapter.h"
@@ -164,7 +165,6 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
header = WebKit::QHttpRequestHeader(QString::fromLatin1(m_data));
if (header.isValid()) {
m_path = header.path();
- m_contentType = header.contentType().toLatin1();
m_contentLength = header.contentLength();
if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("websocket")))
isWebSocket = true;
@@ -217,6 +217,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
m_endOfHeaders = false;
QByteArray response;
+ QString contentType;
int code = 200;
QString text = QString::fromLatin1("OK");
@@ -230,7 +231,8 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
.arg(QUrl(it.value()->m_inspectedWebPage->mainFrameAdapter().url).toString()));
}
indexHtml.append(QLatin1String("</ul></body></html>"));
- response = indexHtml.toLatin1();
+ response = indexHtml.toUtf8();
+ contentType = QStringLiteral("text/html; charset=utf-8");
} else {
QString path = QString::fromLatin1(":%1").arg(m_path);
QFile file(path);
@@ -240,6 +242,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
if (file.exists()) {
file.open(QIODevice::ReadOnly);
response = file.readAll();
+ contentType = MIMETypeRegistry::getMIMETypeForPath(m_path);
} else {
code = 404;
text = QString::fromLatin1("Not OK");
@@ -248,8 +251,8 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
WebKit::QHttpResponseHeader responseHeader(code, text, 1, 0);
responseHeader.setContentLength(response.size());
- if (!m_contentType.isEmpty())
- responseHeader.setContentType(QString::fromLatin1(m_contentType));
+ if (!contentType.isEmpty())
+ responseHeader.setContentType(contentType);
QByteArray asciiHeader = responseHeader.toString().toLatin1();
m_tcpConnection->write(asciiHeader);
diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
index 2754b58d9..35278c7c4 100644
--- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
@@ -85,7 +85,6 @@ private:
InspectorServerQt* m_server;
QString m_path;
- QByteArray m_contentType;
int m_contentLength;
bool m_endOfHeaders;
QByteArray m_data;
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
index fb85535fc..9b6d18ecd 100644
--- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
@@ -490,6 +490,11 @@ void QWebPageAdapter::adjustPointForClicking(QMouseEvent* ev)
#endif
}
+bool QWebPageAdapter::tryClosePage()
+{
+ return mainFrameAdapter().frame->loader().shouldClose();
+}
+
void QWebPageAdapter::mouseMoveEvent(QMouseEvent* ev)
{
WebCore::Frame* frame = mainFrameAdapter().frame;
diff --git a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h
index 48bc0afe0..33e9bcad8 100644
--- a/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h
+++ b/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h
@@ -315,6 +315,7 @@ public:
void adjustPointForClicking(QMouseEvent*);
+ bool tryClosePage();
void mouseMoveEvent(QMouseEvent*);
void mousePressEvent(QMouseEvent*);
void mouseDoubleClickEvent(QMouseEvent*);
diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.cpp b/Source/WebKit/qt/WidgetApi/qwebpage.cpp
index c2bc712e8..56ecaa0c1 100644
--- a/Source/WebKit/qt/WidgetApi/qwebpage.cpp
+++ b/Source/WebKit/qt/WidgetApi/qwebpage.cpp
@@ -1208,6 +1208,7 @@ QWebInspector* QWebPagePrivate::getOrCreateInspector()
\value ToggleMediaPlayPause Toggles the play/pause state of the hovered audio or video element. (Added in Qt 5.2)
\value ToggleMediaMute Mutes or unmutes the hovered audio or video element. (Added in Qt 5.2)
\value ToggleVideoFullscreen Switches the hovered video element into or out of fullscreen mode. (Added in Qt 5.2)
+ \value RequestClose Request to close the web page. If defined, the window.onbeforeunload handler is run, and the user can confirm or reject to close the page. If the close request is confirmed, windowCloseRequested is emitted. (Added in ?)
\omitvalue WebActionCount
@@ -1835,6 +1836,12 @@ void QWebPage::triggerAction(WebAction action, bool)
it.next()->d->cancelLoad();
break;
}
+ case RequestClose: {
+ bool success = d->tryClosePage();
+ if (success)
+ emit windowCloseRequested();
+ break;
+ }
default:
command = QWebPagePrivate::editorCommandForWebActions(action);
break;
diff --git a/Source/WebKit/qt/WidgetApi/qwebpage.h b/Source/WebKit/qt/WidgetApi/qwebpage.h
index 50849494a..c67830c6c 100644
--- a/Source/WebKit/qt/WidgetApi/qwebpage.h
+++ b/Source/WebKit/qt/WidgetApi/qwebpage.h
@@ -193,6 +193,8 @@ public:
ToggleMediaMute,
ToggleVideoFullscreen,
+ RequestClose,
+
WebActionCount
};
diff --git a/Source/WebKit/qt/declarative/CMakeLists.txt b/Source/WebKit/qt/declarative/CMakeLists.txt
index 17502c664..6a76e88b5 100644
--- a/Source/WebKit/qt/declarative/CMakeLists.txt
+++ b/Source/WebKit/qt/declarative/CMakeLists.txt
@@ -16,6 +16,7 @@ include_directories(
${WTF_DIR}
)
include_directories(SYSTEM
+ ${ICU_INCLUDE_DIRS}
${Qt5Quick_INCLUDE_DIRS}
${Qt5Quick_PRIVATE_INCLUDE_DIRS}
)
diff --git a/Source/WebKit2/Platform/IPC/Connection.h b/Source/WebKit2/Platform/IPC/Connection.h
index 14cc8851d..c4a23a577 100644
--- a/Source/WebKit2/Platform/IPC/Connection.h
+++ b/Source/WebKit2/Platform/IPC/Connection.h
@@ -159,9 +159,9 @@ public:
Client* client() const { return m_client; }
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(MACH_PORTS))) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
void setShouldCloseConnectionOnMachExceptions();
-#elif PLATFORM(QT)
+#elif PLATFORM(QT) && USE(UNIX_DOMAIN_SOCKETS)
void setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier);
#endif
@@ -204,7 +204,7 @@ public:
Identifier identifier() const;
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) || (PLATFORM(QT) && USE(MACH_PORTS))
bool kill();
void terminateSoon(double intervalInSeconds);
#endif
@@ -360,7 +360,7 @@ private:
mach_port_t m_receivePort;
dispatch_source_t m_receivePortDataAvailableSource;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(MACH_PORTS))) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
void exceptionSourceEventHandler();
// If setShouldCloseConnectionOnMachExceptions has been called, this has
diff --git a/Source/WebKit2/Platform/IPC/MessageDecoder.h b/Source/WebKit2/Platform/IPC/MessageDecoder.h
index 39c560d7b..7aa3f4682 100644
--- a/Source/WebKit2/Platform/IPC/MessageDecoder.h
+++ b/Source/WebKit2/Platform/IPC/MessageDecoder.h
@@ -35,6 +35,7 @@
#endif
#if HAVE(QOS_CLASSES)
+#include <pthread.h>
#include <pthread/qos.h>
#endif
diff --git a/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm b/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm
index 8626bf29c..b7ac61a9d 100644
--- a/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm
+++ b/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm
@@ -130,7 +130,7 @@ void Connection::platformInvalidate()
m_receivePortDataAvailableSource = 0;
m_receivePort = MACH_PORT_NULL;
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(MACH_PORTS))) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
if (m_exceptionPort) {
dispatch_source_cancel(m_exceptionPortDataAvailableSource);
dispatch_release(m_exceptionPortDataAvailableSource);
@@ -150,7 +150,7 @@ void Connection::terminateSoon(double intervalInSeconds)
void Connection::platformInitialize(Identifier identifier)
{
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(MACH_PORTS))) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
m_exceptionPort = MACH_PORT_NULL;
m_exceptionPortDataAvailableSource = nullptr;
#endif
@@ -219,7 +219,7 @@ bool Connection::open()
connection->receiveSourceEventHandler();
});
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(MACH_PORTS))) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
if (m_exceptionPort) {
m_exceptionPortDataAvailableSource = createDataAvailableSource(m_exceptionPort, m_connectionQueue, [connection] {
connection->exceptionSourceEventHandler();
@@ -238,7 +238,7 @@ bool Connection::open()
if (m_deadNameSource)
dispatch_resume(m_deadNameSource);
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(MACH_PORTS))) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
if (m_exceptionPortDataAvailableSource)
dispatch_resume(m_exceptionPortDataAvailableSource);
#endif
@@ -540,7 +540,7 @@ void Connection::receiveSourceEventHandler()
processIncomingMessage(WTFMove(decoder));
}
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || (PLATFORM(QT) && USE(MACH_PORTS))) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
void Connection::exceptionSourceEventHandler()
{
ReceiveBuffer buffer;
diff --git a/Source/WebKit2/Platform/Module.h b/Source/WebKit2/Platform/Module.h
index 5d665091e..5a98f47f1 100644
--- a/Source/WebKit2/Platform/Module.h
+++ b/Source/WebKit2/Platform/Module.h
@@ -73,7 +73,7 @@ private:
void* platformFunctionPointer(const char* functionName) const;
String m_path;
-#if USE(CF)
+#if USE(CF) && !PLATFORM(QT)
RetainPtr<CFBundleRef> m_bundle;
#if !defined(__LP64__)
CFBundleRefNum m_bundleResourceMap;
diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake
index 9dac25f68..c3776fc4f 100644
--- a/Source/WebKit2/PlatformQt.cmake
+++ b/Source/WebKit2/PlatformQt.cmake
@@ -210,7 +210,7 @@ qt5_add_resources(WebKit2_SOURCES
WebKit2.qrc
)
-if (APPLE)
+if (USE_MACH_PORTS)
list(APPEND WebKit2_INCLUDE_DIRECTORIES
"${WEBKIT2_DIR}/Platform/IPC/mac"
"${WEBKIT2_DIR}/Platform/mac"
@@ -221,6 +221,9 @@ if (APPLE)
Platform/mac/MachUtilities.cpp
Platform/mac/SharedMemoryMac.cpp
)
+ list(APPEND WebKit2_LIBRARIES
+ objc
+ )
elseif (WIN32)
list(APPEND WebKit2_SOURCES
Platform/IPC/win/ConnectionWin.cpp
diff --git a/Source/WebKit2/Shared/API/APIData.h b/Source/WebKit2/Shared/API/APIData.h
index f5035244d..6eabbe660 100644
--- a/Source/WebKit2/Shared/API/APIData.h
+++ b/Source/WebKit2/Shared/API/APIData.h
@@ -36,7 +36,9 @@ class ArgumentDecoder;
class ArgumentEncoder;
}
+#if PLATFORM(COCOA)
OBJC_CLASS NSData;
+#endif
namespace API {
diff --git a/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h
index bfce62e00..70fa8f3c5 100644
--- a/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h
+++ b/Source/WebKit2/UIProcess/API/C/WKNativeEvent.h
@@ -43,8 +43,6 @@ class NSEvent;
struct NSEvent;
#endif
typedef NSEvent *WKNativeEventPtr;
-#elif defined(WIN32) || defined(_WIN32)
-typedef const struct tagMSG* WKNativeEventPtr;
#elif defined(BUILDING_GTK__)
typedef union _GdkEvent GdkEvent;
typedef const GdkEvent* WKNativeEventPtr;
diff --git a/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h b/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h
index 24a45afd4..0b643da4c 100644
--- a/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h
+++ b/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h
@@ -242,7 +242,7 @@ template<typename T, typename U> inline bool operator!=(T* a, const WKRetainPtr<
return a != b.get();
}
-template<typename T> inline WKRetainPtr<T> adoptWK(T) __attribute__((warn_unused_result));
+template<typename T> inline WKRetainPtr<T> adoptWK(T) WARN_UNUSED_RETURN;
template<typename T> inline WKRetainPtr<T> adoptWK(T o)
{
return WKRetainPtr<T>(AdoptWK, o);
diff --git a/Source/WebKit2/UIProcess/ChildProcessProxy.cpp b/Source/WebKit2/UIProcess/ChildProcessProxy.cpp
index a41be8e11..74d317973 100644
--- a/Source/WebKit2/UIProcess/ChildProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/ChildProcessProxy.cpp
@@ -172,9 +172,9 @@ void ChildProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection::Id
ASSERT(!m_connection);
m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || PLATFORM(QT) && USE(MACH_PORTS)) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
m_connection->setShouldCloseConnectionOnMachExceptions();
-#elif PLATFORM(QT) && !OS(WINDOWS)
+#elif PLATFORM(QT) && USE(UNIX_DOMAIN_SOCKETS)
m_connection->setShouldCloseConnectionOnProcessTermination(processIdentifier());
#endif
diff --git a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp
index 73a0c2664..bc3b8e168 100644
--- a/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp
+++ b/Source/WebKit2/UIProcess/InspectorServer/qt/WebInspectorServerQt.cpp
@@ -56,10 +56,7 @@ bool WebInspectorServer::platformResourceForPath(const String& path, Vector<char
file.open(QIODevice::ReadOnly);
data.grow(file.size());
file.read(data.data(), data.size());
-
- size_t extStart = localPath.reverseFind('.');
- String ext = localPath.substring(extStart != notFound ? extStart + 1 : 0);
- contentType = WebCore::MIMETypeRegistry::getMIMETypeForExtension(ext);
+ contentType = WebCore::MIMETypeRegistry::getMIMETypeForPath(localPath);
return true;
}
return false;
diff --git a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
index 62c75e45c..9bc7a04c7 100644
--- a/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
+++ b/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
@@ -214,9 +214,9 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection::I
}
m_connection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
+#if (PLATFORM(MAC) || PLATFORM(QT) && USE(MACH_PORTS)) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
m_connection->setShouldCloseConnectionOnMachExceptions();
-#elif PLATFORM(QT)
+#elif PLATFORM(QT) && USE(UNIX_DOMAIN_SOCKETS)
m_connection->setShouldCloseConnectionOnProcessTermination(processIdentifier());
#endif
diff --git a/Source/cmake/KDEInstallDirs.cmake b/Source/cmake/KDEInstallDirs.cmake
index f41f2b8b6..2834c1842 100644
--- a/Source/cmake/KDEInstallDirs.cmake
+++ b/Source/cmake/KDEInstallDirs.cmake
@@ -449,6 +449,10 @@ if(KDE_INSTALL_USE_QT_SYS_PATHS)
file(RELATIVE_PATH INCLUDE_INSTALL_DIR ${qt_install_prefix} ${qt_include_dir})
set(KDE_INSTALL_INCLUDEDIR ${INCLUDE_INSTALL_DIR})
+ query_qmake(qt_libexec_dir QT_INSTALL_LIBEXECS)
+ file(RELATIVE_PATH LIBEXEC_INSTALL_DIR ${qt_install_prefix} ${qt_libexec_dir})
+ set(KDE_INSTALL_LIBEXECDIR ${LIBEXEC_INSTALL_DIR})
+
# Qt-specific vars
query_qmake(qt_plugins_dir QT_INSTALL_PLUGINS)
diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake
index 252decd05..b9db8d8bc 100644
--- a/Source/cmake/OptionsQt.cmake
+++ b/Source/cmake/OptionsQt.cmake
@@ -86,11 +86,15 @@ if (WIN32 OR APPLE)
set(USE_LIBHYPHEN_DEFAULT OFF)
set(USE_GSTREAMER_DEFAULT OFF)
set(USE_QT_MULTIMEDIA_DEFAULT ON)
- set(ENABLE_WEBKIT2_DEFAULT OFF)
else ()
set(USE_LIBHYPHEN_DEFAULT ON)
set(USE_GSTREAMER_DEFAULT ON)
set(USE_QT_MULTIMEDIA_DEFAULT OFF)
+endif ()
+
+if (WIN32)
+ set(ENABLE_WEBKIT2_DEFAULT OFF)
+else ()
set(ENABLE_WEBKIT2_DEFAULT ON)
endif ()
@@ -422,6 +426,12 @@ if (ENABLE_WEBKIT2)
)
SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_MULTIPROCESS TRUE)
+
+ 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 ()
endif ()
if (ENABLE_QT_WEBCHANNEL)
diff --git a/Tools/QtTestBrowser/launcherwindow.cpp b/Tools/QtTestBrowser/launcherwindow.cpp
index 1321760f8..3d3414272 100644
--- a/Tools/QtTestBrowser/launcherwindow.cpp
+++ b/Tools/QtTestBrowser/launcherwindow.cpp
@@ -592,6 +592,16 @@ bool LauncherWindow::isGraphicsBased() const
return bool(qobject_cast<QGraphicsView*>(m_view));
}
+void LauncherWindow::closeEvent(QCloseEvent* e)
+{
+ e->ignore();
+ auto c = connect(page(), &QWebPage::windowCloseRequested, this, [e]() {
+ e->accept();
+ });
+ page()->triggerAction(QWebPage::RequestClose);
+ disconnect(c);
+}
+
void LauncherWindow::sendTouchEvent()
{
if (m_touchPoints.isEmpty())
diff --git a/Tools/QtTestBrowser/launcherwindow.h b/Tools/QtTestBrowser/launcherwindow.h
index c9388da85..9020109db 100644
--- a/Tools/QtTestBrowser/launcherwindow.h
+++ b/Tools/QtTestBrowser/launcherwindow.h
@@ -195,6 +195,8 @@ private:
bool isGraphicsBased() const;
private:
+ void closeEvent(QCloseEvent*) final;
+
static QVector<int> m_zoomLevels;
int m_currentZoom;
diff --git a/Tools/qt/manifest.txt b/Tools/qt/manifest.txt
index a09153070..cd60a6299 100644
--- a/Tools/qt/manifest.txt
+++ b/Tools/qt/manifest.txt
@@ -82,6 +82,9 @@ file Source/WTF/wtf/cf
file Source/WTF/wtf/cocoa
file Source/WTF/wtf/text/cf
file Source/WebCore/platform/cf/SharedBufferCF.cpp
+file Source/WebCore/platform/cocoa/MachSendRight.cpp
+file Source/WebCore/platform/cocoa/MachSendRight.h
+file Source/WebCore/platform/spi/cocoa/MachVMSPI.h
# WK2 on Windows and macOS
file Source/WebKit2/Platform/IPC/mac