Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 if (m_responseTypeCode != ResponseTypeDefault) { | 583 if (m_responseTypeCode != ResponseTypeDefault) { |
| 584 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type."); | 584 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type."); |
| 585 return; | 585 return; |
| 586 } | 586 } |
| 587 | 587 |
| 588 // Similarly, timeouts are disabled for synchronous requests as well. | 588 // Similarly, timeouts are disabled for synchronous requests as well. |
| 589 if (m_timeoutMilliseconds > 0) { | 589 if (m_timeoutMilliseconds > 0) { |
| 590 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout."); | 590 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout."); |
| 591 return; | 591 return; |
| 592 } | 592 } |
| 593 | |
| 594 // Here we just warn that firing sync XHR's may affect responsiveness. | |
| 595 // Eventually sync xhr will be deprecated and an "InvalidAccessError" ex ception thrown. | |
| 596 // Refer : https://xhr.spec.whatwg.org/#sync-warning | |
| 597 if (!executionContext()->inBeforeUnloadEvent() && !document()->didWarnAb outSyncXHROnce()) { | |
|
Mike West
2014/10/01 12:00:44
You can avoid the "didWarnAbout..." flag by using
Mayur Kankanwadi
2014/10/06 12:48:16
Done.
| |
| 598 document()->setWarnedAboutSyncXHROnce(); | |
| 599 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessa geSource, WarningMessageLevel, | |
| 600 "Avoid synchronous requests as it hampers user experience due to unr esponsiveness of the web page. Refer https://xhr.spec.whatwg.org/#sync-warning." )); | |
| 601 } | |
| 593 } | 602 } |
| 594 | 603 |
| 595 m_method = uppercaseKnownHTTPMethod(method); | 604 m_method = uppercaseKnownHTTPMethod(method); |
| 596 | 605 |
| 597 m_url = url; | 606 m_url = url; |
| 598 | 607 |
| 599 m_async = async; | 608 m_async = async; |
| 600 | 609 |
| 601 ASSERT(!m_loader); | 610 ASSERT(!m_loader); |
| 602 | 611 |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1570 visitor->trace(m_responseStream); | 1579 visitor->trace(m_responseStream); |
| 1571 visitor->trace(m_streamSource); | 1580 visitor->trace(m_streamSource); |
| 1572 visitor->trace(m_responseDocument); | 1581 visitor->trace(m_responseDocument); |
| 1573 visitor->trace(m_responseDocumentParser); | 1582 visitor->trace(m_responseDocumentParser); |
| 1574 visitor->trace(m_progressEventThrottle); | 1583 visitor->trace(m_progressEventThrottle); |
| 1575 visitor->trace(m_upload); | 1584 visitor->trace(m_upload); |
| 1576 XMLHttpRequestEventTarget::trace(visitor); | 1585 XMLHttpRequestEventTarget::trace(visitor); |
| 1577 } | 1586 } |
| 1578 | 1587 |
| 1579 } // namespace blink | 1588 } // namespace blink |
| OLD | NEW |