summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/xml
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/xml')
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp36
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h1
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp8
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XPathPath.h3
-rw-r--r--src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp2
5 files changed, 38 insertions, 12 deletions
diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp
index 59cacbd..5e20252 100644
--- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp
+++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.cpp
@@ -22,6 +22,7 @@
#include "config.h"
#include "XMLHttpRequest.h"
+#include "Cache.h"
#include "CString.h"
#include "CrossOriginAccessControl.h"
#include "CrossOriginPreflightResultCache.h"
@@ -145,6 +146,7 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context)
, m_uploadComplete(false)
, m_sameOriginRequest(true)
, m_inPreflight(false)
+ , m_didTellLoaderAboutRequest(false)
, m_receivedLength(0)
, m_lastSendLineNumber(0)
, m_exceptionCode(0)
@@ -154,6 +156,10 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context)
XMLHttpRequest::~XMLHttpRequest()
{
+ if (m_didTellLoaderAboutRequest) {
+ cache()->loader()->nonCacheRequestComplete(m_url);
+ m_didTellLoaderAboutRequest = false;
+ }
if (m_upload)
m_upload->disconnectXMLHttpRequest();
}
@@ -681,6 +687,16 @@ void XMLHttpRequest::loadRequestAsynchronously(ResourceRequest& request)
// a request is in progress because we need to keep the listeners alive,
// and they are referenced by the JavaScript wrapper.
setPendingActivity(this);
+
+ // For now we should only balance the nonCached request count for main-thread XHRs and not
+ // Worker XHRs, as the Cache is not thread-safe.
+ // This will become irrelevant after https://bugs.webkit.org/show_bug.cgi?id=27165 is resolved.
+ if (!scriptExecutionContext()->isWorkerContext()) {
+ ASSERT(isMainThread());
+ ASSERT(!m_didTellLoaderAboutRequest);
+ cache()->loader()->nonCacheRequestInFlight(m_url);
+ m_didTellLoaderAboutRequest = true;
+ }
}
}
@@ -788,9 +804,9 @@ void XMLHttpRequest::dropProtection()
// can't be recouped until the load is done, so only
// report the extra cost at that point.
- if (JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext()))
- if (DOMObject* wrapper = getCachedDOMObjectWrapper(*globalObject->globalData(), this))
- JSC::Heap::heap(wrapper)->reportExtraMemoryCost(m_responseText.size() * 2);
+ if (JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext()))
+ if (DOMObject* wrapper = getCachedDOMObjectWrapper(*globalObject->globalData(), this))
+ JSC::Heap::heap(wrapper)->reportExtraMemoryCost(m_responseText.size() * 2);
#endif
unsetPendingActivity(this);
@@ -807,7 +823,7 @@ static void reportUnsafeUsage(ScriptExecutionContext* context, const String& mes
return;
// FIXME: It's not good to report the bad usage without indicating what source line it came from.
// We should pass additional parameters so we can tell the console where the mistake occurred.
- context->addMessage(ConsoleDestination, JSMessageSource, ErrorMessageLevel, message, 1, String());
+ context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String());
}
void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec)
@@ -961,6 +977,11 @@ String XMLHttpRequest::statusText(ExceptionCode& ec) const
void XMLHttpRequest::didFail(const ResourceError& error)
{
+ if (m_didTellLoaderAboutRequest) {
+ cache()->loader()->nonCacheRequestComplete(m_url);
+ m_didTellLoaderAboutRequest = false;
+ }
+
// If we are already in an error state, for instance we called abort(), bail out early.
if (m_error)
return;
@@ -982,6 +1003,11 @@ void XMLHttpRequest::didFailRedirectCheck()
void XMLHttpRequest::didFinishLoading(unsigned long identifier)
{
+ if (m_didTellLoaderAboutRequest) {
+ cache()->loader()->nonCacheRequestComplete(m_url);
+ m_didTellLoaderAboutRequest = false;
+ }
+
if (m_error)
return;
@@ -997,7 +1023,7 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier)
m_responseText += m_decoder->flush();
scriptExecutionContext()->resourceRetrievedByXMLHttpRequest(identifier, m_responseText);
- scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageLevel, "XHR finished loading: \"" + m_url + "\".", m_lastSendLineNumber, m_lastSendURL);
+ scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + m_url + "\".", m_lastSendLineNumber, m_lastSendURL);
bool hadLoader = m_loader;
m_loader = 0;
diff --git a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h
index 6955c11..d581d3d 100644
--- a/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h
+++ b/src/3rdparty/webkit/WebCore/xml/XMLHttpRequest.h
@@ -225,6 +225,7 @@ private:
bool m_sameOriginRequest;
bool m_allowAccess;
bool m_inPreflight;
+ bool m_didTellLoaderAboutRequest;
// Used for onprogress tracking
long long m_receivedLength;
diff --git a/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp b/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp
index 1f1d985..da39443 100644
--- a/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp
+++ b/src/3rdparty/webkit/WebCore/xml/XPathFunctions.cpp
@@ -667,12 +667,12 @@ Value FunRound::evaluate() const
return round(arg(0)->evaluate().toNumber());
}
-struct FunctionMapping {
- const char *name;
- FunctionRec function;
-};
static void createFunctionMap()
{
+ struct FunctionMapping {
+ const char *name;
+ FunctionRec function;
+ };
static const FunctionMapping functions[] = {
{ "boolean", { &createFunBoolean, 1 } },
{ "ceiling", { &createFunCeiling, 1 } },
diff --git a/src/3rdparty/webkit/WebCore/xml/XPathPath.h b/src/3rdparty/webkit/WebCore/xml/XPathPath.h
index dc77971..7dd17d9 100644
--- a/src/3rdparty/webkit/WebCore/xml/XPathPath.h
+++ b/src/3rdparty/webkit/WebCore/xml/XPathPath.h
@@ -72,8 +72,7 @@ namespace WebCore {
bool m_absolute;
};
- class Path : public Expression
- {
+ class Path : public Expression {
public:
Path(Filter*, LocationPath*);
virtual ~Path();
diff --git a/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp b/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp
index 3865124..a26fe77 100644
--- a/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp
+++ b/src/3rdparty/webkit/WebCore/xml/XSLTProcessor.cpp
@@ -99,7 +99,7 @@ void XSLTProcessor::parseErrorFunc(void* userData, xmlError* error)
break;
}
- console->addMessage(XMLMessageSource, level, error->message, error->line, error->file);
+ console->addMessage(XMLMessageSource, LogMessageType, level, error->message, error->line, error->file);
}
// FIXME: There seems to be no way to control the ctxt pointer for loading here, thus we have globals.