Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Unified Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 46913002: Have XHR.getResponseHeader() return null in initial ready states. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test code consistency Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/getResponseHeader-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index bf143dbbb77b80c40c0960584e52c898be7ffa69..1e074eee1ad2183462c1e321614bed168531eb72 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -1057,10 +1057,8 @@ String XMLHttpRequest::getRequestHeader(const AtomicString& name) const
String XMLHttpRequest::getAllResponseHeaders(ExceptionState& es) const
{
- if (m_state < HEADERS_RECEIVED) {
- es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("getAllResponseHeaders", "XMLHttpRequest", "the object's state must not be UNSENT or OPENED."));
+ if (m_state < HEADERS_RECEIVED || m_error)
return "";
- }
StringBuilder stringBuilder;
@@ -1093,10 +1091,8 @@ String XMLHttpRequest::getAllResponseHeaders(ExceptionState& es) const
String XMLHttpRequest::getResponseHeader(const AtomicString& name, ExceptionState& es) const
{
- if (m_state < HEADERS_RECEIVED) {
- es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute("getResponseHeader", "XMLHttpRequest", "the object's state must not be UNSENT or OPENED."));
+ if (m_state < HEADERS_RECEIVED || m_error)
return String();
- }
// See comment in getAllResponseHeaders above.
if (isSetCookieHeader(name) && !securityOrigin()->canLoadLocalResources()) {
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/getResponseHeader-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698