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

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

Issue 273993002: Allow XHR timeout attribute to be overridden after send(), per spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
Index: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 783654be701caef3da7d4b20308723f324f8f8c2..fc4c5112fd2c05acc6863800de87425a9ed3f863 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -336,7 +336,7 @@ Stream* XMLHttpRequest::responseStream()
return m_responseStream.get();
}
-void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exceptionState)
+void XMLHttpRequest::setTimeout(unsigned long timeoutMilliseconds, ExceptionState& exceptionState)
{
// FIXME: Need to trigger or update the timeout Timer here, if needed. http://webkit.org/b/98156
// XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set while fetching is in progress. If that occurs it will still be measured relative to the start of fetching."
@@ -344,7 +344,15 @@ void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception
exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document.");
return;
}
- m_timeoutMilliseconds = timeout;
+ m_timeoutMilliseconds = timeoutMilliseconds;
+
+ // From http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute:
+ // Note: This implies that the timeout attribute can be set while fetching is in progress. If
+ // that occurs it will still be measured relative to the start of fetching.
+ //
+ // The timeout may be overridden after send.
+ if (m_loader)
+ m_loader->overrideTimeout(timeoutMilliseconds);
}
void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& exceptionState)

Powered by Google App Engine
This is Rietveld 408576698