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

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: Remove further mentions of "preflight failure" from test case Created 6 years, 5 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 340 }
341 341
342 void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception State) 342 void XMLHttpRequest::setTimeout(unsigned long timeout, ExceptionState& exception State)
343 { 343 {
344 // FIXME: Need to trigger or update the timeout Timer here, if needed. http: //webkit.org/b/98156 344 // FIXME: Need to trigger or update the timeout Timer here, if needed. http: //webkit.org/b/98156
345 // 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." 345 // 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."
346 if (executionContext()->isDocument() && !m_async) { 346 if (executionContext()->isDocument() && !m_async) {
347 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document."); 347 exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document.");
348 return; 348 return;
349 } 349 }
350
350 m_timeoutMilliseconds = timeout; 351 m_timeoutMilliseconds = timeout;
352
353 // From http://www.w3.org/TR/XMLHttpRequest/#the-timeout-attribute:
354 // Note: This implies that the timeout attribute can be set while fetching i s in progress. If
355 // that occurs it will still be measured relative to the start of fetching.
356 //
357 // The timeout may be overridden after send.
358 if (m_loader)
359 m_loader->overrideTimeout(timeout);
351 } 360 }
352 361
353 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& exceptionState) 362 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionState& exceptionState)
354 { 363 {
355 if (m_state >= LOADING) { 364 if (m_state >= LOADING) {
356 exceptionState.throwDOMException(InvalidStateError, "The response type c annot be set if the object's state is LOADING or DONE."); 365 exceptionState.throwDOMException(InvalidStateError, "The response type c annot be set if the object's state is LOADING or DONE.");
357 return; 366 return;
358 } 367 }
359 368
360 // Newer functionality is not available to synchronous requests in window co ntexts, as a spec-mandated 369 // Newer functionality is not available to synchronous requests in window co ntexts, as a spec-mandated
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 { 1472 {
1464 visitor->trace(m_responseBlob); 1473 visitor->trace(m_responseBlob);
1465 visitor->trace(m_responseStream); 1474 visitor->trace(m_responseStream);
1466 visitor->trace(m_responseDocument); 1475 visitor->trace(m_responseDocument);
1467 visitor->trace(m_progressEventThrottle); 1476 visitor->trace(m_progressEventThrottle);
1468 visitor->trace(m_upload); 1477 visitor->trace(m_upload);
1469 XMLHttpRequestEventTarget::trace(visitor); 1478 XMLHttpRequestEventTarget::trace(visitor);
1470 } 1479 }
1471 1480
1472 } // namespace WebCore 1481 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698