summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/CMakeLists.txt2
-rw-r--r--Source/WebCore/PlatformQt.cmake21
-rwxr-xr-xSource/WebCore/Scripts/make-js-file-arrays.py91
-rw-r--r--Source/WebCore/bridge/qt/qt_class.cpp2
-rw-r--r--Source/WebCore/bridge/qt/qt_runtime.cpp2
-rw-r--r--Source/WebCore/bridge/qt/qt_runtime.h2
-rw-r--r--Source/WebCore/inspector/InspectorDOMAgent.cpp2
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.cpp13
-rw-r--r--Source/WebCore/platform/graphics/opengl/TemporaryOpenGLSetting.cpp10
-rw-r--r--Source/WebCore/platform/network/qt/BlobUrlConversion.cpp98
-rw-r--r--Source/WebCore/platform/network/qt/BlobUrlConversion.h29
-rw-r--r--Source/WebCore/platform/network/qt/CookieJarQt.cpp32
-rw-r--r--Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp5
-rw-r--r--Source/WebCore/platform/network/qt/ResourceRequestQt.cpp56
-rw-r--r--Source/WebCore/platform/qt/UserAgentQt.cpp4
-rw-r--r--Source/WebCore/rendering/line/BreakingContext.h6
-rw-r--r--Source/WebCore/rendering/line/LineWidth.cpp4
-rw-r--r--Source/WebCore/rendering/line/LineWidth.h8
-rw-r--r--Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h2
19 files changed, 213 insertions, 176 deletions
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 7d0ad0433..e1efb9991 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -3558,9 +3558,11 @@ if (WebCore_USER_AGENT_SCRIPTS)
MAKE_JS_FILE_ARRAYS(
${DERIVED_SOURCES_WEBCORE_DIR}/UserAgentScriptsData.cpp
${DERIVED_SOURCES_WEBCORE_DIR}/UserAgentScripts.h
+ WebCore
WebCore_USER_AGENT_SCRIPTS
WebCore_USER_AGENT_SCRIPTS_DEPENDENCIES
)
+ list(APPEND WebCore_DERIVED_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/UserAgentScriptsData.cpp)
endif ()
# Generate plug-in resources
diff --git a/Source/WebCore/PlatformQt.cmake b/Source/WebCore/PlatformQt.cmake
index c5466b6c7..f0e68cf9e 100644
--- a/Source/WebCore/PlatformQt.cmake
+++ b/Source/WebCore/PlatformQt.cmake
@@ -110,6 +110,7 @@ list(APPEND WebCore_SOURCES
platform/network/NetworkStorageSessionStub.cpp
platform/network/MIMESniffing.cpp
+ platform/network/qt/BlobUrlConversion.cpp
platform/network/qt/CookieJarQt.cpp
platform/network/qt/CredentialStorageQt.cpp
platform/network/qt/DNSQt.cpp
@@ -162,19 +163,19 @@ list(APPEND WebCore_SOURCES
platform/text/qt/TextBreakIteratorInternalICUQt.cpp
)
-QTWEBKIT_GENERATE_MOC_FILES_CPP(
+QTWEBKIT_GENERATE_MOC_FILES_CPP(WebCore
platform/network/qt/DNSQt.cpp
platform/qt/MainThreadSharedTimerQt.cpp
)
-QTWEBKIT_GENERATE_MOC_FILES_H(
+QTWEBKIT_GENERATE_MOC_FILES_H(WebCore
platform/network/qt/CookieJarQt.h
platform/network/qt/QNetworkReplyHandler.h
platform/network/qt/QtMIMETypeSniffer.h
)
-QTWEBKIT_GENERATE_MOC_FILE_H(platform/network/qt/NetworkStateNotifierPrivate.h platform/network/qt/NetworkStateNotifierQt.cpp)
-QTWEBKIT_GENERATE_MOC_FILE_H(platform/network/qt/SocketStreamHandlePrivate.h platform/network/qt/SocketStreamHandleQt.cpp)
+QTWEBKIT_GENERATE_MOC_FILE_H(WebCore platform/network/qt/NetworkStateNotifierPrivate.h platform/network/qt/NetworkStateNotifierQt.cpp)
+QTWEBKIT_GENERATE_MOC_FILE_H(WebCore platform/network/qt/SocketStreamHandlePrivate.h platform/network/qt/SocketStreamHandleQt.cpp)
if (COMPILER_IS_GCC_OR_CLANG)
set_source_files_properties(
@@ -182,6 +183,12 @@ if (COMPILER_IS_GCC_OR_CLANG)
PROPERTIES
COMPILE_FLAGS "-frtti -UQT_NO_DYNAMIC_CAST"
)
+
+ set_source_files_properties(
+ platform/network/qt/BlobUrlConversion.cpp
+ PROPERTIES
+ COMPILE_FLAGS "-fexceptions -UQT_NO_EXCEPTIONS"
+ )
endif ()
if (ENABLE_DEVICE_ORIENTATION)
@@ -197,7 +204,7 @@ if (ENABLE_GAMEPAD_DEPRECATED)
list(APPEND WebCore_SOURCES
platform/qt/GamepadsQt.cpp
)
- QTWEBKIT_GENERATE_MOC_FILES_CPP(platform/qt/GamepadsQt.cpp)
+ QTWEBKIT_GENERATE_MOC_FILES_CPP(WebCore platform/qt/GamepadsQt.cpp)
endif ()
if (ENABLE_GRAPHICS_CONTEXT_3D)
@@ -221,7 +228,7 @@ if (ENABLE_NETSCAPE_PLUGIN_API)
platform/win/WebCoreInstanceHandle.cpp
)
list(APPEND WebCore_LIBRARIES
- Shlwapi
+ shlwapi
version
)
elseif (PLUGIN_BACKEND_XLIB)
@@ -374,7 +381,7 @@ if (USE_QT_MULTIMEDIA)
list(APPEND WebCore_LIBRARIES
${Qt5Multimedia_LIBRARIES}
)
- QTWEBKIT_GENERATE_MOC_FILES_H(platform/graphics/qt/MediaPlayerPrivateQt.h)
+ QTWEBKIT_GENERATE_MOC_FILES_H(WebCore platform/graphics/qt/MediaPlayerPrivateQt.h)
endif ()
if (ENABLE_VIDEO)
diff --git a/Source/WebCore/Scripts/make-js-file-arrays.py b/Source/WebCore/Scripts/make-js-file-arrays.py
deleted file mode 100755
index 3116a11bb..000000000
--- a/Source/WebCore/Scripts/make-js-file-arrays.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-import io
-import os
-from optparse import OptionParser
-from StringIO import StringIO
-from jsmin import JavascriptMinify
-
-
-def stringifyCodepoint(code):
- if code < 128:
- return '{0:d}'.format(code)
- else:
- return "'\\x{0:02x}'".format(code)
-
-
-def chunk(list, chunkSize):
- for i in xrange(0, len(list), chunkSize):
- yield list[i:i + chunkSize]
-
-
-def main():
- parser = OptionParser(usage="usage: %prog [--no-minify] header source [input [input...]]")
- parser.add_option('--no-minify', action='store_true', help='Do not run the input files through jsmin')
- (options, arguments) = parser.parse_args()
- if len(arguments) < 3:
- print 'Error: must provide at least 3 arguments'
- parser.print_usage()
- exit(-1)
-
- headerPath = arguments[0]
- sourcePath = arguments[1]
- inputPaths = arguments[2:]
-
- headerFile = open(headerPath, 'w')
- print >> headerFile, 'namespace WebCore {'
-
- sourceFile = open(sourcePath, 'w')
- print >> sourceFile, '#include "{0:s}"'.format(os.path.basename(headerPath))
- print >> sourceFile, 'namespace WebCore {'
-
- jsm = JavascriptMinify()
-
- for inputFileName in inputPaths:
- inputStream = io.FileIO(inputFileName)
- outputStream = StringIO()
-
- if not options.no_minify:
- jsm.minify(inputStream, outputStream)
- characters = outputStream.getvalue()
- else:
- characters = inputStream.read()
-
- size = len(characters)
- variableName = os.path.splitext(os.path.basename(inputFileName))[0]
-
- print >> headerFile, 'extern const char {0:s}JavaScript[{1:d}];'.format(variableName, size)
- print >> sourceFile, 'const char {0:s}JavaScript[{1:d}] = {{'.format(variableName, size)
-
- codepoints = map(ord, characters)
- for codepointChunk in chunk(codepoints, 16):
- print >> sourceFile, ' {0:s},'.format(','.join(map(stringifyCodepoint, codepointChunk)))
-
- print >> sourceFile, '};'
-
- print >> headerFile, '}'
- print >> sourceFile, '}'
-
-if __name__ == '__main__':
- main()
diff --git a/Source/WebCore/bridge/qt/qt_class.cpp b/Source/WebCore/bridge/qt/qt_class.cpp
index 5efebc0fd..1554f8d63 100644
--- a/Source/WebCore/bridge/qt/qt_class.cpp
+++ b/Source/WebCore/bridge/qt/qt_class.cpp
@@ -108,7 +108,7 @@ JSValue QtClass::fallbackObject(ExecState* exec, Instance* inst, PropertyName id
return jsUndefined();
int flags = metaMethod.methodType() == QMetaMethod::Signal ? QtRuntimeMethod::MethodIsSignal : 0;
- QtRuntimeMethod* method = new QtRuntimeMethod(context, static_cast<QtInstance*>(inst)->getObject(), normal, index, flags, qtinst);
+ QtRuntimeMethod* method = new QtRuntimeMethod(static_cast<QtInstance*>(inst)->getObject(), normal, index, flags, qtinst);
qtinst->m_methods.insert(name, method);
JSValue obj = toJS(method->jsObjectRef(context, &exception));
if (exception)
diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp
index 84335e8ca..4859faee3 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.cpp
+++ b/Source/WebCore/bridge/qt/qt_runtime.cpp
@@ -1230,7 +1230,7 @@ static JSClassRef prototypeForSignalsAndSlots()
return cls;
}
-QtRuntimeMethod::QtRuntimeMethod(JSContextRef ctx, QObject* object, const QByteArray& identifier, int index, int flags, QtInstance* instance)
+QtRuntimeMethod::QtRuntimeMethod(QObject* object, const QByteArray& identifier, int index, int flags, QtInstance* instance)
: m_object(object)
, m_identifier(identifier)
, m_index(index)
diff --git a/Source/WebCore/bridge/qt/qt_runtime.h b/Source/WebCore/bridge/qt/qt_runtime.h
index 34a97244a..c9d675c3f 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.h
+++ b/Source/WebCore/bridge/qt/qt_runtime.h
@@ -84,7 +84,7 @@ public:
AllowPrivate = 2
};
- QtRuntimeMethod(JSContextRef, QObject*, const QByteArray& identifier, int signalIndex, int flags, QtInstance*);
+ QtRuntimeMethod(QObject*, const QByteArray& identifier, int signalIndex, int flags, QtInstance*);
~QtRuntimeMethod();
static JSValueRef call(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp
index ef9bb394e..82d35c1a8 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp
@@ -1446,7 +1446,7 @@ Ref<Inspector::Protocol::DOM::EventListener> InspectorDOMAgent::buildObjectForEv
JSC::JSLockHolder lock(scriptListener->isolatedWorld().vm());
state = execStateFromNode(scriptListener->isolatedWorld(), &node->document());
handler = scriptListener->jsFunction(&node->document());
- if (handler) {
+ if (handler && state) {
body = handler->toString(state)->value(state);
if (auto function = JSC::jsDynamicCast<JSC::JSFunction*>(handler)) {
if (!function->isHostOrBuiltinFunction()) {
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 35127c647..fb4a63e0b 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -823,10 +823,17 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida
logMemoryCacheResourceRequest(frame(), DiagnosticLoggingKeys::inMemoryCacheKey(), DiagnosticLoggingKeys::unusedReasonErrorKey());
return Reload;
}
-
- // For resources that are not yet loaded we ignore the cache policy.
- if (existingResource->isLoading())
+
+ if (existingResource->isLoading()) {
+ // Do not use cached main resources that are still loading because sharing
+ // loading CachedResources in this case causes issues with regards to cancellation.
+ // If one of the DocumentLoader clients decides to cancel the load, then the load
+ // would be cancelled for all other DocumentLoaders as well.
+ if (type == CachedResource::Type::MainResource)
+ return Reload;
+ // For cached subresources that are still loading we ignore the cache policy.
return Use;
+ }
auto revalidationDecision = existingResource->makeRevalidationDecision(cachePolicy(type));
logResourceRevalidationDecision(revalidationDecision, frame());
diff --git a/Source/WebCore/platform/graphics/opengl/TemporaryOpenGLSetting.cpp b/Source/WebCore/platform/graphics/opengl/TemporaryOpenGLSetting.cpp
index c502a0c3b..8ae96b94c 100644
--- a/Source/WebCore/platform/graphics/opengl/TemporaryOpenGLSetting.cpp
+++ b/Source/WebCore/platform/graphics/opengl/TemporaryOpenGLSetting.cpp
@@ -29,7 +29,11 @@
#if ENABLE(GRAPHICS_CONTEXT_3D)
#include "TemporaryOpenGLSetting.h"
-#if USE(OPENGL_ES_2)
+#if PLATFORM(QT)
+#define FUNCTIONS m_functions
+#include "OpenGLShimsQt.h"
+#define glIsEnabled(...) m_functions->glIsEnabled(__VA_ARGS__)
+#elif USE(OPENGL_ES_2)
#include <GLES2/gl2.h>
#include "OpenGLESShims.h"
#elif PLATFORM(IOS)
@@ -38,10 +42,6 @@
#include <OpenGL/gl.h>
#elif PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN)
#include "OpenGLShims.h"
-#elif PLATFORM(QT)
-#define FUNCTIONS m_functions
-#include "OpenGLShimsQt.h"
-#define glIsEnabled(...) m_functions->glIsEnabled(__VA_ARGS__)
#endif
namespace WebCore {
diff --git a/Source/WebCore/platform/network/qt/BlobUrlConversion.cpp b/Source/WebCore/platform/network/qt/BlobUrlConversion.cpp
new file mode 100644
index 000000000..8f61eaeb9
--- /dev/null
+++ b/Source/WebCore/platform/network/qt/BlobUrlConversion.cpp
@@ -0,0 +1,98 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2017 Konstantin Tokarev <annulen@yandex.ru>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "BlobUrlConversion.h"
+
+#include "BlobData.h"
+#include "BlobRegistryImpl.h"
+
+#include <QUrl>
+#include <wtf/text/Base64.h>
+
+namespace WebCore {
+
+static bool appendBlobResolved(Vector<char>& out, const URL& url, QString* contentType = 0)
+{
+ RefPtr<BlobData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
+ if (!blobData)
+ return false;
+
+ if (contentType)
+ *contentType = blobData->contentType();
+
+ BlobDataItemList::const_iterator it = blobData->items().begin();
+ const BlobDataItemList::const_iterator itend = blobData->items().end();
+ for (; it != itend; ++it) {
+ const BlobDataItem& blobItem = *it;
+ if (blobItem.type() == BlobDataItem::Type::Data) {
+ if (!out.tryAppend(reinterpret_cast<const char*>(blobItem.data().data()->data()) + blobItem.offset(), blobItem.length()))
+ return false;
+ } else if (blobItem.type() == BlobDataItem::Type::File) {
+ // File types are not allowed here, so just ignore it.
+ RELEASE_ASSERT_WITH_MESSAGE(false, "File types are not allowed here");
+ } else
+ ASSERT_NOT_REACHED();
+ }
+ return true;
+}
+
+static QUrl resolveBlobUrl(const URL& url)
+{
+ RefPtr<BlobData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
+ if (!blobData)
+ return QUrl();
+
+ Vector<char> data;
+ QString contentType;
+ if (!appendBlobResolved(data, url, &contentType)) {
+ qWarning("Failed to convert blob data to base64: cannot allocate memory for continuous blob data");
+ return QUrl();
+ }
+
+ // QByteArray::{from,to}Base64 are prone to integer overflow, this is the maximum size that can be safe
+ size_t maxBase64Size = std::numeric_limits<int>::max() / 3 - 1;
+
+ Vector<char> base64;
+ WTF::base64Encode(data, base64, WTF::Base64URLPolicy);
+ if (base64.isEmpty() || base64.size() > maxBase64Size) {
+ qWarning("Failed to convert blob data to base64: data is too large");
+ return QUrl();
+ }
+
+ QString dataUri(QStringLiteral("data:"));
+ dataUri.append(contentType);
+ dataUri.append(QStringLiteral(";base64,"));
+ dataUri.reserve(dataUri.size() + base64.size());
+ dataUri.append(QLatin1String(base64.data(), base64.size()));
+ return QUrl(dataUri);
+}
+
+QUrl convertBlobToDataUrl(const QUrl& url)
+{
+ QT_TRY {
+ return resolveBlobUrl(url);
+ } QT_CATCH(const std::bad_alloc &) {
+ qWarning("Failed to convert blob data to base64: not enough memory");
+ }
+ return QUrl();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/qt/BlobUrlConversion.h b/Source/WebCore/platform/network/qt/BlobUrlConversion.h
new file mode 100644
index 000000000..2dbd0a680
--- /dev/null
+++ b/Source/WebCore/platform/network/qt/BlobUrlConversion.h
@@ -0,0 +1,29 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2017 Konstantin Tokarev <annulen@yandex.ru>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+QT_BEGIN_NAMESPACE
+class QUrl;
+QT_END_NAMESPACE
+
+namespace WebCore {
+
+QUrl convertBlobToDataUrl(const QUrl&);
+
+}
diff --git a/Source/WebCore/platform/network/qt/CookieJarQt.cpp b/Source/WebCore/platform/network/qt/CookieJarQt.cpp
index 3b08c06cd..d1cf87fdd 100644
--- a/Source/WebCore/platform/network/qt/CookieJarQt.cpp
+++ b/Source/WebCore/platform/network/qt/CookieJarQt.cpp
@@ -42,12 +42,21 @@
#include <QNetworkCookie>
#include <QStringList>
#include <QVariant>
+#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
static SharedCookieJarQt* s_sharedCookieJarQt = 0;
+static void appendCookie(StringBuilder& builder, const QNetworkCookie& cookie)
+{
+ if (!builder.isEmpty())
+ builder.append("; ");
+ QByteArray rawData = cookie.toRawForm(QNetworkCookie::NameAndValueOnly);
+ builder.append(rawData.constData(), rawData.length());
+}
+
void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& value)
{
QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
@@ -59,7 +68,8 @@ void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstPar
if (!thirdPartyCookiePolicyPermits(session.context(), urlForCookies, firstPartyUrl))
return;
- QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(QString(value).toLatin1());
+ CString cookieString = value.latin1();
+ QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(QByteArray::fromRawData(cookieString.data(), cookieString.length()));
QList<QNetworkCookie>::Iterator it = cookies.begin();
while (it != cookies.end()) {
if (it->isHttpOnly())
@@ -86,14 +96,13 @@ String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty
if (cookies.isEmpty())
return String();
- QStringList resultCookies;
- foreach (const QNetworkCookie& networkCookie, cookies) {
- if (networkCookie.isHttpOnly())
+ StringBuilder builder;
+ for (const auto& cookie : cookies) {
+ if (cookie.isHttpOnly())
continue;
- resultCookies.append(QString::fromLatin1(networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData()));
+ appendCookie(builder, cookie);
}
-
- return resultCookies.join(QLatin1String("; "));
+ return builder.toString();
}
String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& url)
@@ -106,11 +115,10 @@ String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const
if (cookies.isEmpty())
return String();
- QStringList resultCookies;
- foreach (QNetworkCookie networkCookie, cookies)
- resultCookies.append(QString::fromLatin1(networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData()));
-
- return resultCookies.join(QLatin1String("; "));
+ StringBuilder builder;
+ for (const auto& cookie : cookies)
+ appendCookie(builder, cookie);
+ return builder.toString();
}
bool cookiesEnabled(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& /*url*/)
diff --git a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index cd096bfe7..1b60c5131 100644
--- a/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -647,7 +647,10 @@ void QNetworkReplyHandler::redirect(ResourceResponse& response, const QUrl& redi
{
ASSERT(!m_queue.deferSignals());
- QUrl newUrl = m_replyWrapper->reply()->url().resolved(redirection);
+ QUrl currentUrl = m_replyWrapper->reply()->url();
+ QUrl newUrl = currentUrl.resolved(redirection);
+ if (currentUrl.hasFragment())
+ newUrl.setFragment(currentUrl.fragment());
ResourceHandleClient* client = m_resourceHandle->client();
ASSERT(client);
diff --git a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
index 655724a4c..b7f9447bc 100644
--- a/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/Source/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -18,14 +18,11 @@
*/
#include "config.h"
-#include "NetworkingContext.h"
#include "ResourceRequest.h"
-#include "ThirdPartyCookiesQt.h"
-
-#include "BlobData.h"
-#include "BlobRegistryImpl.h"
-#include <qglobal.h>
+#include "BlobUrlConversion.h"
+#include "NetworkingContext.h"
+#include "ThirdPartyCookiesQt.h"
#include <QNetworkRequest>
#include <QUrl>
@@ -43,44 +40,11 @@ unsigned initializeMaximumHTTPConnectionCountPerHost()
return 6 * (1 + 3 + 2);
}
-static void appendBlobResolved(QByteArray& data, const QUrl& url, QString* contentType = 0)
+static QUrl toQUrl(const URL& url)
{
- RefPtr<BlobData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
- if (!blobData)
- return;
-
- if (contentType)
- *contentType = blobData->contentType();
-
- BlobDataItemList::const_iterator it = blobData->items().begin();
- const BlobDataItemList::const_iterator itend = blobData->items().end();
- for (; it != itend; ++it) {
- const BlobDataItem& blobItem = *it;
- if (blobItem.type() == BlobDataItem::Type::Data)
- data.append(reinterpret_cast<const char*>(blobItem.data().data()->data()) + static_cast<int>(blobItem.offset()), static_cast<int>(blobItem.length()));
- else if (blobItem.type() == BlobDataItem::Type::File) {
- // File types are not allowed here, so just ignore it.
- RELEASE_ASSERT_WITH_MESSAGE(false, "File types are not allowed here");
- } else
- ASSERT_NOT_REACHED();
- }
-}
-
-static void resolveBlobUrl(const QUrl& url, QUrl& resolvedUrl)
-{
- RefPtr<BlobData> blobData = static_cast<BlobRegistryImpl&>(blobRegistry()).getBlobDataFromURL(url);
- if (!blobData)
- return;
-
- QByteArray data;
- QString contentType;
- appendBlobResolved(data, url, &contentType);
-
- QString dataUri(QStringLiteral("data:"));
- dataUri.append(contentType);
- dataUri.append(QStringLiteral(";base64,"));
- dataUri.append(QString::fromLatin1(data.toBase64()));
- resolvedUrl = QUrl(dataUri);
+ if (url.protocolIsBlob())
+ return convertBlobToDataUrl(url);
+ return url;
}
static inline QByteArray stringToByteArray(const String& string)
@@ -93,11 +57,7 @@ static inline QByteArray stringToByteArray(const String& string)
QNetworkRequest ResourceRequest::toNetworkRequest(NetworkingContext *context) const
{
QNetworkRequest request;
- QUrl newurl = url();
-
- if (newurl.scheme() == QLatin1String("blob"))
- resolveBlobUrl(url(), newurl);
-
+ QUrl newurl = toQUrl(url());
request.setUrl(newurl);
request.setOriginatingObject(context ? context->originatingObject() : 0);
diff --git a/Source/WebCore/platform/qt/UserAgentQt.cpp b/Source/WebCore/platform/qt/UserAgentQt.cpp
index 4b8876220..fc5eab7a8 100644
--- a/Source/WebCore/platform/qt/UserAgentQt.cpp
+++ b/Source/WebCore/platform/qt/UserAgentQt.cpp
@@ -37,7 +37,7 @@ namespace WebCore {
This implementation returns the following value:
- "Mozilla/5.0 (%Platform%%Security%%Subplatform%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Version/9.0 Safari/%WebKitVersion%"
+ "Mozilla/5.0 (%Platform%%Security%%Subplatform%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Version/10.0 Safari/%WebKitVersion%"
In this string the following values are replaced the first time the function is called:
\list
@@ -58,7 +58,7 @@ String UserAgentQt::standardUserAgent(const String &applicationNameForUserAgent,
if (ua.isNull()) {
- ua = QStringLiteral("Mozilla/5.0 (%1%2%3) AppleWebKit/%4 (KHTML, like Gecko) %99 Version/9.0 Safari/%5");
+ ua = QStringLiteral("Mozilla/5.0 (%1%2%3) AppleWebKit/%4 (KHTML, like Gecko) %99 Version/10.0 Safari/%5");
// Platform.
ua = ua.arg(
diff --git a/Source/WebCore/rendering/line/BreakingContext.h b/Source/WebCore/rendering/line/BreakingContext.h
index 799d2c063..fff452898 100644
--- a/Source/WebCore/rendering/line/BreakingContext.h
+++ b/Source/WebCore/rendering/line/BreakingContext.h
@@ -559,9 +559,9 @@ inline void BreakingContext::handleReplaced()
m_ignoringSpaces = true;
}
if (downcast<RenderListMarker>(*m_current.renderer()).isInside())
- m_width.addUncommittedWidth(replacedLogicalWidth);
+ m_width.addUncommittedReplacedWidth(replacedLogicalWidth);
} else
- m_width.addUncommittedWidth(replacedLogicalWidth);
+ m_width.addUncommittedReplacedWidth(replacedLogicalWidth);
if (is<RenderRubyRun>(*m_current.renderer())) {
m_width.applyOverhang(downcast<RenderRubyRun>(m_current.renderer()), m_lastObject, m_nextObject);
downcast<RenderRubyRun>(m_current.renderer())->updatePriorContextFromCachedBreakIterator(m_renderTextInfo.lineBreakIterator);
@@ -748,7 +748,7 @@ inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
bool breakNBSP = m_autoWrap && m_currentStyle->nbspMode() == SPACE;
// Auto-wrapping text should wrap in the middle of a word only if it could not wrap before the word,
// which is only possible if the word is the first thing on the line.
- bool breakWords = m_currentStyle->breakWords() && ((m_autoWrap && !m_width.hasCommitted()) || m_currWS == PRE);
+ bool breakWords = m_currentStyle->breakWords() && ((m_autoWrap && (!m_width.committedWidth() && !m_width.hasCommittedReplaced())) || m_currWS == PRE);
bool midWordBreak = false;
bool breakAll = m_currentStyle->wordBreak() == BreakAllWordBreak && m_autoWrap;
bool keepAllWords = m_currentStyle->wordBreak() == KeepAllWordBreak;
diff --git a/Source/WebCore/rendering/line/LineWidth.cpp b/Source/WebCore/rendering/line/LineWidth.cpp
index 71e05cb23..b28406d63 100644
--- a/Source/WebCore/rendering/line/LineWidth.cpp
+++ b/Source/WebCore/rendering/line/LineWidth.cpp
@@ -128,6 +128,10 @@ void LineWidth::commit()
{
m_committedWidth += m_uncommittedWidth;
m_uncommittedWidth = 0;
+ if (m_hasUncommittedReplaced) {
+ m_hasCommittedReplaced = true;
+ m_hasUncommittedReplaced = false;
+ }
m_hasCommitted = true;
}
diff --git a/Source/WebCore/rendering/line/LineWidth.h b/Source/WebCore/rendering/line/LineWidth.h
index 370b3a0f8..bcb274c8e 100644
--- a/Source/WebCore/rendering/line/LineWidth.h
+++ b/Source/WebCore/rendering/line/LineWidth.h
@@ -60,6 +60,7 @@ public:
float logicalLeftOffset() const { return m_left; }
bool hasCommitted() const { return m_hasCommitted; }
+ bool hasCommittedReplaced() const { return m_hasCommittedReplaced; }
void updateAvailableWidth(LayoutUnit minimumHeight = 0);
void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&);
@@ -67,6 +68,11 @@ public:
{
m_uncommittedWidth += delta;
}
+ void addUncommittedReplacedWidth(float delta)
+ {
+ addUncommittedWidth(delta);
+ m_hasUncommittedReplaced = true;
+ }
void commit();
void applyOverhang(RenderRubyRun*, RenderObject* startRenderer, RenderObject* endRenderer);
void fitBelowFloats(bool isFirstLine = false);
@@ -92,6 +98,8 @@ private:
float m_availableWidth { 0 };
bool m_isFirstLine { true };
bool m_hasCommitted { false };
+ bool m_hasCommittedReplaced { false };
+ bool m_hasUncommittedReplaced { false };
IndentTextOrNot m_shouldIndentText;
};
diff --git a/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h b/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
index 6177281c3..0fd56cc65 100644
--- a/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
+++ b/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
@@ -68,6 +68,8 @@ public:
m_baseVal = nullptr;
else if (&property == m_animVal)
m_animVal = nullptr;
+ if (!m_baseVal && !m_animVal)
+ detachListWrappers(m_values.size());
}
int findItem(SVGProperty* property)