summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/JavaScriptCore/dfg/DFGAbstractState.cpp6
-rw-r--r--Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp17
-rw-r--r--Source/JavaScriptCore/dfg/DFGOSREntry.cpp2
-rw-r--r--Source/JavaScriptCore/jsc.pro2
-rw-r--r--Source/ThirdParty/ANGLE/src/common/angleutils.h2
-rw-r--r--Source/WTF/WTF.pri2
-rw-r--r--Source/WTF/wtf/StringExtras.h2
-rw-r--r--Source/WTF/wtf/TypeTraits.h2
-rw-r--r--Source/WebCore/WebCore.pri4
-rw-r--r--Source/WebCore/dom/Document.cpp23
-rw-r--r--Source/WebCore/html/ImageDocument.cpp6
-rw-r--r--Source/WebCore/loader/CrossOriginAccessControl.cpp5
-rw-r--r--Source/WebCore/loader/DocumentThreadableLoader.cpp5
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.cpp9
-rw-r--r--Source/WebCore/loader/icon/IconController.cpp8
-rw-r--r--Source/WebCore/page/EventSource.cpp2
-rw-r--r--Source/WebCore/page/SecurityOrigin.cpp8
-rw-r--r--Source/WebCore/page/SecurityOrigin.h7
-rw-r--r--Source/WebCore/page/Settings.in1
-rw-r--r--Source/WebCore/platform/Length.h5
-rw-r--r--Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp54
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp40
-rw-r--r--Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h1
-rw-r--r--Source/WebCore/xml/XMLHttpRequest.cpp2
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.cpp5
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp2
-rw-r--r--Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h3
27 files changed, 175 insertions, 50 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
index eff653636..594097d1b 100644
--- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
+++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp
@@ -1079,10 +1079,8 @@ bool AbstractState::executeEffects(unsigned indexInBlock, Node* node)
clobberWorld(node->codeOrigin, indexInBlock);
SpeculatedType type = source.m_type;
- if (type & ~(SpecNumber | SpecString | SpecBoolean)) {
- type &= (SpecNumber | SpecString | SpecBoolean);
- type |= SpecString;
- }
+ if (type & ~(SpecNumber | SpecString | SpecBoolean))
+ type = (SpecTop & ~SpecCell) | SpecString;
destination.set(type);
break;
}
diff --git a/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp b/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp
index cbab4e8c8..ec7515eec 100644
--- a/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp
+++ b/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp
@@ -123,12 +123,9 @@ public:
bool changed = false;
// Record which arguments are known to escape no matter what.
- for (unsigned i = codeBlock()->inlineCallFrames().size(); i--;) {
- InlineCallFrame* inlineCallFrame = &codeBlock()->inlineCallFrames()[i];
- if (m_graph.m_executablesWhoseArgumentsEscaped.contains(
- m_graph.executableFor(inlineCallFrame)))
- m_createsArguments.add(inlineCallFrame);
- }
+ for (unsigned i = codeBlock()->inlineCallFrames().size(); i--;)
+ pruneObviousArgumentCreations(&codeBlock()->inlineCallFrames()[i]);
+ pruneObviousArgumentCreations(0); // the machine call frame.
// Create data for variable access datas that we will want to analyze.
for (unsigned i = m_graph.m_variableAccessData.size(); i--;) {
@@ -700,6 +697,14 @@ private:
NullableHashTraits<VariableAccessData*> > m_argumentsAliasing;
HashSet<VariableAccessData*> m_isLive;
+ void pruneObviousArgumentCreations(InlineCallFrame* inlineCallFrame)
+ {
+ ScriptExecutable* executable = jsCast<ScriptExecutable*>(m_graph.executableFor(inlineCallFrame));
+ if (m_graph.m_executablesWhoseArgumentsEscaped.contains(executable)
+ || executable->isStrictMode())
+ m_createsArguments.add(inlineCallFrame);
+ }
+
void observeBadArgumentsUse(Node* node)
{
if (!node)
diff --git a/Source/JavaScriptCore/dfg/DFGOSREntry.cpp b/Source/JavaScriptCore/dfg/DFGOSREntry.cpp
index 5739593ee..9b75e70ab 100644
--- a/Source/JavaScriptCore/dfg/DFGOSREntry.cpp
+++ b/Source/JavaScriptCore/dfg/DFGOSREntry.cpp
@@ -118,7 +118,7 @@ void* prepareOSREntry(ExecState* exec, CodeBlock* codeBlock, unsigned bytecodeIn
}
continue;
}
- if (!entry->m_expectedValues.local(local).validate(exec->registers()[local].jsValue())) {
+ if (!entry->m_expectedValues.local(local).isTop() && !entry->m_expectedValues.local(local).validate(exec->registers()[local].jsValue())) {
#if ENABLE(JIT_VERBOSE_OSR)
dataLog(" OSR failed because variable ", local, " is ", exec->registers()[local].jsValue(), ", expected ", entry->m_expectedValues.local(local), ".\n");
#endif
diff --git a/Source/JavaScriptCore/jsc.pro b/Source/JavaScriptCore/jsc.pro
index dfd73e825..91ebcc2a0 100644
--- a/Source/JavaScriptCore/jsc.pro
+++ b/Source/JavaScriptCore/jsc.pro
@@ -13,7 +13,7 @@ QT -= gui
win32-*: CONFIG += console
win32-msvc*: CONFIG += exceptions_off stl_off
-win32-msvc*|win32-icc: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32
+win32-msvc2005|win32-msvc2008|win32-msvc2010|win32-msvc2012|win32-msvc2013|win32-icc: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32
WEBKIT += javascriptcore wtf
diff --git a/Source/ThirdParty/ANGLE/src/common/angleutils.h b/Source/ThirdParty/ANGLE/src/common/angleutils.h
index 9761567fb..4736518e7 100644
--- a/Source/ThirdParty/ANGLE/src/common/angleutils.h
+++ b/Source/ThirdParty/ANGLE/src/common/angleutils.h
@@ -42,7 +42,7 @@ void SafeRelease(T& resource)
}
}
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
diff --git a/Source/WTF/WTF.pri b/Source/WTF/WTF.pri
index bb130f6a4..b4f7765ac 100644
--- a/Source/WTF/WTF.pri
+++ b/Source/WTF/WTF.pri
@@ -49,4 +49,4 @@ mac {
}
# MSVC is lacking stdint.h as well as inttypes.h.
-win32-msvc*|win32-icc|wince*: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32
+win32-msvc2005|win32-msvc2008|win32-msvc2010|win32-msvc2012|win32-msvc2013|win32-icc|wince*: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32
diff --git a/Source/WTF/wtf/StringExtras.h b/Source/WTF/wtf/StringExtras.h
index eaf0cf76a..1afd0f992 100644
--- a/Source/WTF/wtf/StringExtras.h
+++ b/Source/WTF/wtf/StringExtras.h
@@ -37,6 +37,7 @@
#if COMPILER(MSVC)
// FIXME: why a COMPILER check instead of OS? also, these should be HAVE checks
+#if _MSC_VER < 1900
inline int snprintf(char* buffer, size_t count, const char* format, ...)
{
int result;
@@ -52,6 +53,7 @@ inline int snprintf(char* buffer, size_t count, const char* format, ...)
return result;
}
+#endif
inline double wtf_vsnprintf(char* buffer, size_t count, const char* format, va_list args)
{
diff --git a/Source/WTF/wtf/TypeTraits.h b/Source/WTF/wtf/TypeTraits.h
index b9e46bc55..9df2c95cf 100644
--- a/Source/WTF/wtf/TypeTraits.h
+++ b/Source/WTF/wtf/TypeTraits.h
@@ -238,7 +238,7 @@ namespace WTF {
template <typename T> struct HasTrivialDestructor {
static const bool value = __has_trivial_destructor(T) || IsPod<RemoveConstVolatile<T> >::value;
};
-#elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
+#elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600 && _MSC_VER < 1900))
// GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace.
// VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace.
template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri
index 915a1a468..4e5e13cba 100644
--- a/Source/WebCore/WebCore.pri
+++ b/Source/WebCore/WebCore.pri
@@ -289,10 +289,12 @@ win32 {
}
# Remove whole program optimizations due to miscompilations
-win32-msvc2005|win32-msvc2008|win32-msvc2010|win32-msvc2012|win32-msvc2013|wince*:{
+win32-msvc2005|win32-msvc2008|win32-msvc2010|win32-msvc2012|win32-msvc2013|wince* {
QMAKE_CFLAGS_LTCG -= -GL
QMAKE_CXXFLAGS_LTCG -= -GL
+}
+win32-msvc*|wince* {
# Disable incremental linking for windows 32bit OS debug build as WebKit is so big
# that linker failes to link incrementally in debug mode.
ARCH = $$(PROCESSOR_ARCHITECTURE)
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 0e778e642..af63b141f 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -4572,12 +4572,22 @@ void Document::initSecurityContext()
if (settings->allowUniversalAccessFromFileURLs() || m_frame->loader()->client()->shouldForceUniversalAccessFromLocalURL(m_url)) {
// Some clients want local URLs to have universal access, but that setting is dangerous for other clients.
securityOrigin()->grantUniversalAccess();
- } else if (!settings->allowFileAccessFromFileURLs()) {
- // Some clients want local URLs to have even tighter restrictions by default, and not be able to access other local files.
- // FIXME 81578: The naming of this is confusing. Files with restricted access to other local files
- // still can have other privileges that can be remembered, thereby not making them unique origins.
- securityOrigin()->enforceFilePathSeparation();
+ } else {
+ if (!settings->allowRemoteAccessFromFileURLs())
+ securityOrigin()->denyCrossOriginRequests();
+ if (!settings->allowFileAccessFromFileURLs()) {
+ // Some clients want local URLs to have even tighter restrictions by default, and not be able to access other local files.
+ // FIXME 81578: The naming of this is confusing. Files with restricted access to other local files
+ // still can have other privileges that can be remembered, thereby not making them unique origins.
+ securityOrigin()->enforceFilePathSeparation();
+ }
}
+ } else if (securityOrigin()->isUnique()) {
+ Frame* ownerFrame = m_frame->tree()->parent();
+ if (!ownerFrame)
+ ownerFrame = m_frame->loader()->opener();
+ if (ownerFrame && !ownerFrame->document()->securityOrigin()->allowsCrossOriginRequests())
+ securityOrigin()->denyCrossOriginRequests();
}
securityOrigin()->setStorageBlockingPolicy(settings->storageBlockingPolicy());
}
@@ -4612,7 +4622,8 @@ void Document::initSecurityContext()
// but we're also sandboxed, the only thing we inherit is the ability
// to load local resources. This lets about:blank iframes in file://
// URL documents load images and other resources from the file system.
- if (ownerFrame->document()->securityOrigin()->canLoadLocalResources())
+ if (ownerFrame->document()->securityOrigin()->canLoadLocalResources() &&
+ !ownerFrame->document()->securityOrigin()->enforcesFilePathSeparation())
securityOrigin()->grantLoadLocalResources();
return;
}
diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp
index 7d9bcc589..594ccad90 100644
--- a/Source/WebCore/html/ImageDocument.cpp
+++ b/Source/WebCore/html/ImageDocument.cpp
@@ -135,6 +135,8 @@ void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, size_t)
return;
CachedImage* cachedImage = document()->cachedImage();
+ if (!cachedImage)
+ return;
RefPtr<ResourceBuffer> resourceData = frame->loader()->documentLoader()->mainResourceData();
cachedImage->addDataBuffer(resourceData.get());
@@ -143,8 +145,8 @@ void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, size_t)
void ImageDocumentParser::finish()
{
- if (!isStopped() && document()->imageElement()) {
- CachedImage* cachedImage = document()->cachedImage();
+ CachedImage* cachedImage = 0;
+ if (!isStopped() && document()->imageElement() && (cachedImage = document()->cachedImage())) {
RefPtr<ResourceBuffer> data = document()->frame()->loader()->documentLoader()->mainResourceData();
// If this is a multipart image, make a copy of the current part, since the resource data
diff --git a/Source/WebCore/loader/CrossOriginAccessControl.cpp b/Source/WebCore/loader/CrossOriginAccessControl.cpp
index 7b50dab0c..7d011906e 100644
--- a/Source/WebCore/loader/CrossOriginAccessControl.cpp
+++ b/Source/WebCore/loader/CrossOriginAccessControl.cpp
@@ -138,6 +138,11 @@ bool passesAccessControlCheck(const ResourceResponse& response, StoredCredential
AtomicallyInitializedStatic(AtomicString&, accessControlAllowOrigin = *new AtomicString("access-control-allow-origin", AtomicString::ConstructFromLiteral));
AtomicallyInitializedStatic(AtomicString&, accessControlAllowCredentials = *new AtomicString("access-control-allow-credentials", AtomicString::ConstructFromLiteral));
+ if (!securityOrigin->allowsCrossOriginRequests()) {
+ errorDescription = "Cannot make any cross origin requests from " + securityOrigin->toString() + ".";
+ return false;
+ }
+
// A wildcard Access-Control-Allow-Origin can not be used if credentials are to be sent,
// even with Access-Control-Allow-Credentials set to true.
const String& accessControlOriginString = response.httpHeaderField(accessControlAllowOrigin);
diff --git a/Source/WebCore/loader/DocumentThreadableLoader.cpp b/Source/WebCore/loader/DocumentThreadableLoader.cpp
index e8fe0185e..d51751ca5 100644
--- a/Source/WebCore/loader/DocumentThreadableLoader.cpp
+++ b/Source/WebCore/loader/DocumentThreadableLoader.cpp
@@ -127,6 +127,11 @@ void DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest(const Resource
return;
}
+ if (!securityOrigin()->allowsCrossOriginRequests()) {
+ m_client->didFailAccessControlCheck(ResourceError(errorDomainWebKitInternal, 0, request.url().string(), "Cross origin requests are not allowed from " + securityOrigin()->toString() + "."));
+ return;
+ }
+
loadRequest(request, DoSecurityCheck);
}
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 80e2f8de2..0735fc8ff 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -35,6 +35,8 @@
#include "CachedResourceRequest.h"
#include "CachedScript.h"
#include "CachedXSLStyleSheet.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
#include "Console.h"
#include "ContentSecurityPolicy.h"
#include "DOMWindow.h"
@@ -48,6 +50,7 @@
#include "LoaderStrategy.h"
#include "Logging.h"
#include "MemoryCache.h"
+#include "Page.h"
#include "PingLoader.h"
#include "PlatformStrategies.h"
#include "ResourceLoadScheduler.h"
@@ -409,6 +412,12 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
#endif
}
+ // SVG Images have unique security rules that prevent all subresource requests except for data urls.
+ if (type != CachedResource::MainResource && frame() && frame()->page()) {
+ if (frame()->page()->chrome().client()->isSVGImageChromeClient() && !url.protocolIsData())
+ return false;
+ }
+
// Last of all, check for insecure content. We do this last so that when
// folks block insecure content with a CSP policy, they don't get a warning.
// They'll still get a warning in the console about CSP blocking the load.
diff --git a/Source/WebCore/loader/icon/IconController.cpp b/Source/WebCore/loader/icon/IconController.cpp
index 8f23f6db1..a808352af 100644
--- a/Source/WebCore/loader/icon/IconController.cpp
+++ b/Source/WebCore/loader/icon/IconController.cpp
@@ -159,6 +159,10 @@ void IconController::startLoader()
}
if (iconDatabase().supportsAsynchronousMode()) {
+ // FIXME (<rdar://problem/9168605>) - We should support in-memory-only private browsing icons in asynchronous icon database mode.
+ if (iconDatabase().supportsAsynchronousMode() && m_frame->page()->settings()->privateBrowsingEnabled())
+ return;
+
m_frame->loader()->documentLoader()->getIconLoadDecisionForIconURL(urlString);
// Commit the icon url mapping to the database just in case we don't end up loading later.
commitToDatabase(iconURL);
@@ -202,10 +206,6 @@ void IconController::continueLoadWithDecision(IconLoadDecision iconLoadDecision)
{
ASSERT(iconLoadDecision != IconLoadUnknown);
- // FIXME (<rdar://problem/9168605>) - We should support in-memory-only private browsing icons in asynchronous icon database mode.
- if (iconDatabase().supportsAsynchronousMode() && m_frame->page()->settings()->privateBrowsingEnabled())
- return;
-
if (iconLoadDecision == IconLoadNo) {
KURL iconURL(url());
String urlString(iconURL.string());
diff --git a/Source/WebCore/page/EventSource.cpp b/Source/WebCore/page/EventSource.cpp
index 77a8e6f33..d3e6bbc6b 100644
--- a/Source/WebCore/page/EventSource.cpp
+++ b/Source/WebCore/page/EventSource.cpp
@@ -132,7 +132,7 @@ void EventSource::connect()
options.sniffContent = DoNotSniffContent;
options.allowCredentials = (origin->canRequest(m_url) || m_withCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
options.preflightPolicy = PreventPreflight;
- options.crossOriginRequestPolicy = UseAccessControl;
+ options.crossOriginRequestPolicy = origin->allowsCrossOriginRequests() ? UseAccessControl : DenyCrossOriginRequests;
options.dataBufferingPolicy = DoNotBufferData;
options.securityOrigin = origin;
diff --git a/Source/WebCore/page/SecurityOrigin.cpp b/Source/WebCore/page/SecurityOrigin.cpp
index cebc89684..ae2822aaa 100644
--- a/Source/WebCore/page/SecurityOrigin.cpp
+++ b/Source/WebCore/page/SecurityOrigin.cpp
@@ -127,6 +127,7 @@ SecurityOrigin::SecurityOrigin(const KURL& url)
, m_storageBlockingPolicy(AllowAllStorage)
, m_enforceFilePathSeparation(false)
, m_needsDatabaseIdentifierQuirkForFiles(false)
+ , m_deniedCORS(false)
{
// document.domain starts as m_host, but can be set by the DOM.
m_domain = m_host;
@@ -153,6 +154,7 @@ SecurityOrigin::SecurityOrigin()
, m_storageBlockingPolicy(AllowAllStorage)
, m_enforceFilePathSeparation(false)
, m_needsDatabaseIdentifierQuirkForFiles(false)
+ , m_deniedCORS(false)
{
}
@@ -169,6 +171,7 @@ SecurityOrigin::SecurityOrigin(const SecurityOrigin* other)
, m_storageBlockingPolicy(other->m_storageBlockingPolicy)
, m_enforceFilePathSeparation(other->m_enforceFilePathSeparation)
, m_needsDatabaseIdentifierQuirkForFiles(other->m_needsDatabaseIdentifierQuirkForFiles)
+ , m_deniedCORS(other->m_deniedCORS)
{
}
@@ -442,6 +445,11 @@ void SecurityOrigin::grantUniversalAccess()
m_universalAccess = true;
}
+void SecurityOrigin::denyCrossOriginRequests()
+{
+ m_deniedCORS = true;
+}
+
#if ENABLE(CACHE_PARTITIONING)
String SecurityOrigin::cachePartition() const
{
diff --git a/Source/WebCore/page/SecurityOrigin.h b/Source/WebCore/page/SecurityOrigin.h
index 8572f4ce4..980fcfffb 100644
--- a/Source/WebCore/page/SecurityOrigin.h
+++ b/Source/WebCore/page/SecurityOrigin.h
@@ -139,6 +139,11 @@ public:
// WARNING: This is an extremely powerful ability. Use with caution!
void grantUniversalAccess();
+ // Explicitly deny the ability to issue cross origin requests.
+ //
+ void denyCrossOriginRequests();
+ bool allowsCrossOriginRequests() const { return !m_deniedCORS; }
+
void setStorageBlockingPolicy(StorageBlockingPolicy policy) { m_storageBlockingPolicy = policy; }
#if ENABLE(CACHE_PARTITIONING)
@@ -173,6 +178,7 @@ public:
// FIXME 81578: The naming of this is confusing. Files with restricted access to other local files
// still can have other privileges that can be remembered, thereby not making them unique.
void enforceFilePathSeparation();
+ bool enforcesFilePathSeparation() const { return m_enforceFilePathSeparation; }
// Convert this SecurityOrigin into a string. The string
// representation of a SecurityOrigin is similar to a URL, except it
@@ -231,6 +237,7 @@ private:
StorageBlockingPolicy m_storageBlockingPolicy;
bool m_enforceFilePathSeparation;
bool m_needsDatabaseIdentifierQuirkForFiles;
+ bool m_deniedCORS;
};
} // namespace WebCore
diff --git a/Source/WebCore/page/Settings.in b/Source/WebCore/page/Settings.in
index dd51d6850..c66ab0be6 100644
--- a/Source/WebCore/page/Settings.in
+++ b/Source/WebCore/page/Settings.in
@@ -49,6 +49,7 @@ caretBrowsingEnabled initial=false
localStorageEnabled initial=false
allowUniversalAccessFromFileURLs initial=true
allowFileAccessFromFileURLs initial=true
+allowRemoteAccessFromFileURLs initial=true
javaScriptCanOpenWindowsAutomatically initial=false
supportsMultipleWindows initial=true
javaScriptCanAccessClipboard initial=false
diff --git a/Source/WebCore/platform/Length.h b/Source/WebCore/platform/Length.h
index 2f91550da..72263b045 100644
--- a/Source/WebCore/platform/Length.h
+++ b/Source/WebCore/platform/Length.h
@@ -233,6 +233,11 @@ public:
Length blend(const Length& from, double progress) const
{
// Blend two lengths to produce a new length that is in between them. Used for animation.
+ if (from.isUndefined())
+ return *this;
+ if (isUndefined())
+ return from;
+
if (from.type() == Calculated || type() == Calculated)
return blendMixedTypes(from, progress);
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index 0c9fddc83..43b546d18 100644
--- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -111,6 +111,18 @@ public:
GraphicsSurface::Flags m_surfaceFlags;
RefPtr<GraphicsSurface> m_graphicsSurface;
#endif
+
+ // Register as a child of a Qt context to make the necessary when it may be destroyed before the GraphicsContext3D instance
+ class QtContextWatcher : public QObject
+ {
+ public:
+ QtContextWatcher(QObject* ctx, GraphicsContext3DPrivate* watcher): QObject(ctx), m_watcher(watcher) { }
+ ~QtContextWatcher() { m_watcher->m_platformContext = 0; m_watcher->m_platformContextWatcher = 0; }
+
+ private:
+ GraphicsContext3DPrivate* m_watcher;
+ };
+ QtContextWatcher* m_platformContextWatcher;
};
bool GraphicsContext3DPrivate::isOpenGLES() const
@@ -149,11 +161,16 @@ GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, H
, m_surface(0)
, m_platformContext(0)
, m_surfaceOwner(0)
+ , m_platformContextWatcher(0)
{
if (renderStyle == GraphicsContext3D::RenderToCurrentGLContext) {
m_platformContext = QOpenGLContext::currentContext();
if (m_platformContext)
m_surface = m_platformContext->surface();
+
+ // Watcher needed to invalidate the GL context if destroyed before this instance
+ m_platformContextWatcher = new QtContextWatcher(m_platformContext, this);
+
initializeOpenGLFunctions();
return;
}
@@ -260,6 +277,9 @@ GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
#endif
delete m_surfaceOwner;
m_surfaceOwner = 0;
+
+ delete m_platformContextWatcher;
+ m_platformContextWatcher = 0;
}
#if USE(ACCELERATED_COMPOSITING)
@@ -363,6 +383,8 @@ void GraphicsContext3DPrivate::blitMultisampleFramebufferAndRestoreContext()
bool GraphicsContext3DPrivate::makeCurrentIfNeeded() const
{
+ if (!m_platformContext)
+ return false;
const QOpenGLContext* currentContext = QOpenGLContext::currentContext();
if (currentContext == m_platformContext)
return true;
@@ -404,6 +426,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi
, m_multisampleFBO(0)
, m_multisampleDepthStencilBuffer(0)
, m_multisampleColorBuffer(0)
+ , m_functions(0)
, m_private(adoptPtr(new GraphicsContext3DPrivate(this, hostWindow, renderStyle)))
, m_compiler(isGLES2Compliant() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT)
{
@@ -441,22 +464,23 @@ GraphicsContext3D::~GraphicsContext3D()
if (!m_private)
return;
- makeContextCurrent();
- m_functions->glDeleteTextures(1, &m_texture);
- m_functions->glDeleteFramebuffers(1, &m_fbo);
- if (m_attrs.antialias) {
- m_functions->glDeleteRenderbuffers(1, &m_multisampleColorBuffer);
- m_functions->glDeleteFramebuffers(1, &m_multisampleFBO);
- if (m_attrs.stencil || m_attrs.depth)
- m_functions->glDeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
- } else if (m_attrs.stencil || m_attrs.depth) {
- if (isGLES2Compliant()) {
- if (m_attrs.depth)
- m_functions->glDeleteRenderbuffers(1, &m_depthBuffer);
- if (m_attrs.stencil)
- m_functions->glDeleteRenderbuffers(1, &m_stencilBuffer);
+ if (makeContextCurrent()) {
+ m_functions->glDeleteTextures(1, &m_texture);
+ m_functions->glDeleteFramebuffers(1, &m_fbo);
+ if (m_attrs.antialias) {
+ m_functions->glDeleteRenderbuffers(1, &m_multisampleColorBuffer);
+ m_functions->glDeleteFramebuffers(1, &m_multisampleFBO);
+ if (m_attrs.stencil || m_attrs.depth)
+ m_functions->glDeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
+ } else if (m_attrs.stencil || m_attrs.depth) {
+ if (isGLES2Compliant()) {
+ if (m_attrs.depth)
+ m_functions->glDeleteRenderbuffers(1, &m_depthBuffer);
+ if (m_attrs.stencil)
+ m_functions->glDeleteRenderbuffers(1, &m_stencilBuffer);
+ }
+ m_functions->glDeleteRenderbuffers(1, &m_depthStencilBuffer);
}
- m_functions->glDeleteRenderbuffers(1, &m_depthStencilBuffer);
}
m_functions = 0;
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
index 0daf2f890..73a6afc02 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
@@ -48,6 +48,31 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
return adoptPtr(new GraphicsLayerTextureMapper(client));
}
+// A fallback layer to handle painting when we decide dynamically to avoid compositing due to layer size.
+class DirectPaintLayer : public TextureMapperPlatformLayer {
+public:
+ DirectPaintLayer(GraphicsLayer* sourceLayer) : m_sourceLayer(sourceLayer)
+ { }
+ void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix& modelViewMatrix, float opacity) OVERRIDE;
+
+private:
+ GraphicsLayer* m_sourceLayer;
+};
+
+void DirectPaintLayer::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
+{
+ GraphicsContext* context = textureMapper->graphicsContext();
+ context->save();
+ context->setAlpha(opacity);
+#if ENABLE(3D_RENDERING)
+ context->concat3DTransform(matrix);
+#else
+ context->concatCTM(matrix.toAffineTransform());
+#endif
+ m_sourceLayer->paintGraphicsLayerContents(*context, enclosingIntRect(targetRect));
+ context->restore();
+}
+
GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient* client)
: GraphicsLayer(client)
, m_layer(adoptPtr(new TextureMapperLayer()))
@@ -57,6 +82,7 @@ GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient* clie
, m_fixedToViewport(false)
, m_debugBorderWidth(0)
, m_contentsLayer(0)
+ , m_directLayer(0)
, m_animationStartTime(0)
, m_isScrollable(false)
{
@@ -79,7 +105,8 @@ GraphicsLayerTextureMapper::~GraphicsLayerTextureMapper()
{
if (m_contentsLayer)
m_contentsLayer->setClient(0);
-
+ delete m_directLayer;
+ m_directLayer = 0;
willBeDestroyed();
}
@@ -233,6 +260,15 @@ void GraphicsLayerTextureMapper::setSize(const FloatSize& value)
if (maskLayer())
maskLayer()->setSize(value);
notifyChange(SizeChange);
+
+ if (m_size.width() * m_size.height() <= 8192*8192) {
+ if (m_contentsLayer == m_directLayer)
+ setContentsToMedia(0);
+ } else if (!m_contentsLayer) {
+ if (!m_directLayer)
+ m_directLayer = new DirectPaintLayer(this);
+ setContentsToMedia(m_directLayer);
+ }
}
/* \reimp (GraphicsLayer.h)
@@ -627,7 +663,7 @@ void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
bool GraphicsLayerTextureMapper::shouldHaveBackingStore() const
{
- return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
+ return drawsContent() && contentsAreVisible() && !m_size.isEmpty() && !m_contentsLayer;
}
bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
index 16e4ebad0..548a95c29 100644
--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h
@@ -176,6 +176,7 @@ private:
float m_debugBorderWidth;
TextureMapperPlatformLayer* m_contentsLayer;
+ TextureMapperPlatformLayer* m_directLayer;
FloatRect m_needsDisplayRect;
GraphicsLayerAnimations m_animations;
double m_animationStartTime;
diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp
index 09e7fe582..853ec4756 100644
--- a/Source/WebCore/xml/XMLHttpRequest.cpp
+++ b/Source/WebCore/xml/XMLHttpRequest.cpp
@@ -784,7 +784,7 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec)
options.sniffContent = DoNotSniffContent;
options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight;
options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
- options.crossOriginRequestPolicy = UseAccessControl;
+ options.crossOriginRequestPolicy = securityOrigin()->allowsCrossOriginRequests() ? UseAccessControl : DenyCrossOriginRequests;
options.securityOrigin = securityOrigin();
#if ENABLE(RESOURCE_TIMING)
options.initiator = cachedResourceRequestInitiators().xmlhttprequest;
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp
index cb969a3df..f55b6d721 100644
--- a/Source/WebKit/qt/Api/qwebsettings.cpp
+++ b/Source/WebKit/qt/Api/qwebsettings.cpp
@@ -272,9 +272,10 @@ void QWebSettingsPrivate::apply()
global->attributes.value(QWebSettings::LocalStorageEnabled));
settings->setLocalStorageEnabled(value);
- value = attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls,
+ bool remoteAccess = attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls,
global->attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls));
- settings->setAllowUniversalAccessFromFileURLs(value);
+ settings->setAllowUniversalAccessFromFileURLs(remoteAccess);
+ settings->setAllowRemoteAccessFromFileURLs(remoteAccess);
value = attributes.value(QWebSettings::LocalContentCanAccessFileUrls,
global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls));
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
index 8ba625a82..591fa052d 100644
--- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
@@ -44,6 +44,7 @@
#include "ScriptController.h"
#include "ScrollbarThemeQStyle.h"
#include "SecurityPolicy.h"
+#include "Settings.h"
#include "qwebelement_p.h"
#include <JavaScriptCore/runtime/InitializeThreading.h>
@@ -104,6 +105,7 @@ Q_DECL_EXPORT void initializeWebCoreQt()
if (!WebCore::memoryCache()->disabled())
WebCore::memoryCache()->setDeadDecodedDataDeletionInterval(60);
WebCore::RuntimeEnabledFeatures::setCSSCompositingEnabled(true);
+ WebCore::Settings::setDefaultMinDOMTimerInterval(0.004);
initialized = true;
}
diff --git a/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h b/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h
index 69b49bdbf..975fa4025 100644
--- a/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h
+++ b/Source/WebKit/qt/WidgetSupport/QtFallbackWebPopup.h
@@ -22,6 +22,7 @@
#include "qwebkitplatformplugin.h"
#include <wtf/Platform.h>
+#include <QtCore/QPointer>
#ifndef QT_NO_COMBOBOX
@@ -56,7 +57,7 @@ private Q_SLOTS:
void deleteComboBox();
private:
- QtWebComboBox* m_combo;
+ QPointer<QtWebComboBox> m_combo;
const QWebPageAdapter* m_page;
QRect m_geometry;
QFont m_font;