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

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: Reset m_requestStartedSeconds in a few extra places +fix bitrot Created 6 years, 6 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
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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 337 }
338 338
339 void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception State) 339 void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception State)
340 { 340 {
341 // FIXME: Need to trigger or update the timeout Timer here, if needed. http: //webkit.org/b/98156 341 // FIXME: Need to trigger or update the timeout Timer here, if needed. http: //webkit.org/b/98156
342 // 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." 342 // 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."
343 if (executionContext()->isDocument() && !m_async) { 343 if (executionContext()->isDocument() && !m_async) {
344 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document."); 344 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document.");
345 return; 345 return;
346 } 346 }
347
347 m_timeoutMilliseconds = timeout; 348 m_timeoutMilliseconds = timeout;
349
350 // From http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute:
351 // Note: This implies that the timeout attribute can be set while fetching i s in progress. If
352 // that occurs it will still be measured relative to the start of fetching.
353 //
354 // The timeout may be overridden after send.
355 if (m_loader)
356 m_loader->overrideTimeout(timeout);
348 } 357 }
349 358
350 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& exceptionState) 359 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& exceptionState)
351 { 360 {
352 if (m_state >= LOADING) { 361 if (m_state >= LOADING) {
353 exceptionState.throwDOMException(InvalidStateError, "The response type c annot be set if the object's state is LOADING or DONE."); 362 exceptionState.throwDOMException(InvalidStateError, "The response type c annot be set if the object's state is LOADING or DONE.");
354 return; 363 return;
355 } 364 }
356 365
357 // Newer functionality is not available to synchronous requests in window co ntexts, as a spec-mandated 366 // Newer functionality is not available to synchronous requests in window co ntexts, as a spec-mandated
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 { 1419 {
1411 visitor->trace(m_responseBlob); 1420 visitor->trace(m_responseBlob);
1412 visitor->trace(m_responseStream); 1421 visitor->trace(m_responseStream);
1413 visitor->trace(m_responseDocument); 1422 visitor->trace(m_responseDocument);
1414 visitor->trace(m_progressEventThrottle); 1423 visitor->trace(m_progressEventThrottle);
1415 visitor->trace(m_upload); 1424 visitor->trace(m_upload);
1416 XMLHttpRequestEventTarget::trace(visitor); 1425 XMLHttpRequestEventTarget::trace(visitor);
1417 } 1426 }
1418 1427
1419 } // namespace WebCore 1428 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698