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

Side by Side 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: Rebase again Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « Source/core/loader/WorkerThreadableLoader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 292
293 void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception State) 293 void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception State)
294 { 294 {
295 // FIXME: Need to trigger or update the timeout Timer here, if needed. http: //webkit.org/b/98156 295 // FIXME: Need to trigger or update the timeout Timer here, if needed. http: //webkit.org/b/98156
296 // XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set whi le fetching is in progress. If that occurs it will still be measured relative to the start of fetching." 296 // XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set whi le fetching is in progress. If that occurs it will still be measured relative to the start of fetching."
297 if (executionContext()->isDocument() && !m_async) { 297 if (executionContext()->isDocument() && !m_async) {
298 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document."); 298 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document.");
299 return; 299 return;
300 } 300 }
301
301 m_timeoutMilliseconds = timeout; 302 m_timeoutMilliseconds = timeout;
303
304 // From http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute:
305 // Note: This implies that the timeout attribute can be set while fetching i s in progress. If
306 // that occurs it will still be measured relative to the start of fetching.
307 //
308 // The timeout may be overridden after send.
309 if (m_loader)
310 m_loader->overrideTimeout(timeout);
302 } 311 }
303 312
304 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& exceptionState) 313 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& exceptionState)
305 { 314 {
306 if (m_state >= LOADING) { 315 if (m_state >= LOADING) {
307 exceptionState.throwDOMException(InvalidStateError, "The response type c annot be set if the object's state is LOADING or DONE."); 316 exceptionState.throwDOMException(InvalidStateError, "The response type c annot be set if the object's state is LOADING or DONE.");
308 return; 317 return;
309 } 318 }
310 319
311 // Newer functionality is not available to synchronous requests in window co ntexts, as a spec-mandated 320 // Newer functionality is not available to synchronous requests in window co ntexts, as a spec-mandated
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 { 1382 {
1374 visitor->trace(m_responseBlob); 1383 visitor->trace(m_responseBlob);
1375 visitor->trace(m_responseStream); 1384 visitor->trace(m_responseStream);
1376 visitor->trace(m_responseDocument); 1385 visitor->trace(m_responseDocument);
1377 visitor->trace(m_progressEventThrottle); 1386 visitor->trace(m_progressEventThrottle);
1378 visitor->trace(m_upload); 1387 visitor->trace(m_upload);
1379 XMLHttpRequestEventTarget::trace(visitor); 1388 XMLHttpRequestEventTarget::trace(visitor);
1380 } 1389 }
1381 1390
1382 } // namespace blink 1391 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/WorkerThreadableLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698