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

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

Powered by Google App Engine
This is Rietveld 408576698