summaryrefslogtreecommitdiff
path: root/Source/WebCore/xml/XMLHttpRequest.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-27 21:51:42 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-27 21:51:42 +0200
commitbe01689f43cf6882cf670d33df49ead1f570c53a (patch)
tree4bb2161d8983b38e3e7ed37b4a50303bfd5e2e85 /Source/WebCore/xml/XMLHttpRequest.cpp
parenta89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (diff)
downloadqtwebkit-be01689f43cf6882cf670d33df49ead1f570c53a.tar.gz
Imported WebKit commit 8d6c5efc74f0222dfc7bcce8d845d4a2707ed9e6 (http://svn.webkit.org/repository/webkit/trunk@118629)
Diffstat (limited to 'Source/WebCore/xml/XMLHttpRequest.cpp')
-rw-r--r--Source/WebCore/xml/XMLHttpRequest.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp
index 0e9e0ab4b..be6b4c698 100644
--- a/Source/WebCore/xml/XMLHttpRequest.cpp
+++ b/Source/WebCore/xml/XMLHttpRequest.cpp
@@ -484,14 +484,22 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, Exc
return;
}
- // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated
- // attempt to discourage synchronous XHR use. responseType is one such piece of functionality.
- // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols
- // such as file: and data: still make sense to allow.
- if (!async && scriptExecutionContext()->isDocument() && url.protocolIsInHTTPFamily() && m_responseTypeCode != ResponseTypeDefault) {
- logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set.");
- ec = INVALID_ACCESS_ERR;
- return;
+ if (!async && scriptExecutionContext()->isDocument()) {
+ if (!document()->settings()->syncXHRInDocumentsEnabled()) {
+ logConsoleError(scriptExecutionContext(), "Synchronous XMLHttpRequests cannot be made in the current window context.");
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
+
+ // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated
+ // attempt to discourage synchronous XHR use. responseType is one such piece of functionality.
+ // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols
+ // such as file: and data: still make sense to allow.
+ if (url.protocolIsInHTTPFamily() && m_responseTypeCode != ResponseTypeDefault) {
+ logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set.");
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
}
m_method = uppercaseKnownHTTPMethod(method);