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

Side by Side Diff: Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 585873002: Show a warning when using sync xhr. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added needsrebaseline for win_rel. Created 6 years, 1 month 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/frame/UseCounter.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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 if (m_responseTypeCode != ResponseTypeDefault) { 600 if (m_responseTypeCode != ResponseTypeDefault) {
601 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type."); 601 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type.");
602 return; 602 return;
603 } 603 }
604 604
605 // Similarly, timeouts are disabled for synchronous requests as well. 605 // Similarly, timeouts are disabled for synchronous requests as well.
606 if (m_timeoutMilliseconds > 0) { 606 if (m_timeoutMilliseconds > 0) {
607 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout."); 607 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout.");
608 return; 608 return;
609 } 609 }
610
611 // Here we just warn that firing sync XHR's may affect responsiveness.
612 // Eventually sync xhr will be deprecated and an "InvalidAccessError" ex ception thrown.
613 // Refer : https://xhr.spec.whatwg.org/#sync-warning
614 // Use count for XHR synchronous requests on main thread only.
615 if (!document()->processingBeforeUnload())
616 UseCounter::countDeprecation(executionContext(), UseCounter::XMLHttp RequestSynchronousInNonWorkerOutsideBeforeUnload);
610 } 617 }
611 618
612 m_method = FetchUtils::normalizeMethod(method); 619 m_method = FetchUtils::normalizeMethod(method);
613 620
614 m_url = url; 621 m_url = url;
615 622
616 m_async = async; 623 m_async = async;
617 624
618 ASSERT(!m_loader); 625 ASSERT(!m_loader);
619 626
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 visitor->trace(m_responseDocument); 1662 visitor->trace(m_responseDocument);
1656 visitor->trace(m_responseDocumentParser); 1663 visitor->trace(m_responseDocumentParser);
1657 visitor->trace(m_progressEventThrottle); 1664 visitor->trace(m_progressEventThrottle);
1658 visitor->trace(m_upload); 1665 visitor->trace(m_upload);
1659 visitor->trace(m_blobLoader); 1666 visitor->trace(m_blobLoader);
1660 XMLHttpRequestEventTarget::trace(visitor); 1667 XMLHttpRequestEventTarget::trace(visitor);
1661 DocumentParserClient::trace(visitor); 1668 DocumentParserClient::trace(visitor);
1662 } 1669 }
1663 1670
1664 } // namespace blink 1671 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/UseCounter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698