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

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

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

Powered by Google App Engine
This is Rietveld 408576698