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

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: Created 6 years, 3 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
« no previous file with comments | « no previous file | 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 if (m_responseTypeCode != ResponseTypeDefault) { 585 if (m_responseTypeCode != ResponseTypeDefault) {
586 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type."); 586 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests from a document must not set a response type.");
587 return; 587 return;
588 } 588 }
589 589
590 // Similarly, timeouts are disabled for synchronous requests as well. 590 // Similarly, timeouts are disabled for synchronous requests as well.
591 if (m_timeoutMilliseconds > 0) { 591 if (m_timeoutMilliseconds > 0) {
592 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout."); 592 exceptionState.throwDOMException(InvalidAccessError, "Synchronous re quests must not set a timeout.");
593 return; 593 return;
594 } 594 }
595
596 // Here we just warn that firing sync XHR's may affect responsiveness.
597 // Eventually sync xhr will be deprecated and an "InvalidAccessError" ex ception thrown.
598 // Refer : https://xhr.spec.whatwg.org/#sync-warning
599 executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSo urce, WarningMessageLevel
600 , "Avoid synchronous requests as it hampers user experience due to u nresponsiveness of the web page.Refer https://xhr.spec.whatwg.org/#sync-warning. "));
tyoshino (SeeGerritForStatus) 2014/09/19 11:03:10 Insert a space between "page." and "Refer" Please
Mayur Kankanwadi 2014/09/19 11:24:17 Done.
595 } 601 }
596 602
597 m_method = uppercaseKnownHTTPMethod(method); 603 m_method = uppercaseKnownHTTPMethod(method);
598 604
599 m_url = url; 605 m_url = url;
600 606
601 m_async = async; 607 m_async = async;
602 608
603 ASSERT(!m_loader); 609 ASSERT(!m_loader);
604 610
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 visitor->trace(m_responseStream); 1555 visitor->trace(m_responseStream);
1550 visitor->trace(m_streamSource); 1556 visitor->trace(m_streamSource);
1551 visitor->trace(m_responseDocument); 1557 visitor->trace(m_responseDocument);
1552 visitor->trace(m_responseDocumentParser); 1558 visitor->trace(m_responseDocumentParser);
1553 visitor->trace(m_progressEventThrottle); 1559 visitor->trace(m_progressEventThrottle);
1554 visitor->trace(m_upload); 1560 visitor->trace(m_upload);
1555 XMLHttpRequestEventTarget::trace(visitor); 1561 XMLHttpRequestEventTarget::trace(visitor);
1556 } 1562 }
1557 1563
1558 } // namespace blink 1564 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698