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

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

Issue 1940253002: Disallow certain blocking DOM calls during microtask execution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 7 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 bool XMLHttpRequest::initSend(ExceptionState& exceptionState) 626 bool XMLHttpRequest::initSend(ExceptionState& exceptionState)
627 { 627 {
628 if (!getExecutionContext()) 628 if (!getExecutionContext())
629 return false; 629 return false;
630 630
631 if (m_state != OPENED || m_loader) { 631 if (m_state != OPENED || m_loader) {
632 exceptionState.throwDOMException(InvalidStateError, "The object's state must be OPENED."); 632 exceptionState.throwDOMException(InvalidStateError, "The object's state must be OPENED.");
633 return false; 633 return false;
634 } 634 }
635 635
636 if (!m_async && exceptionState.isolate() && v8::MicrotasksScope::IsRunningMi crotasks(exceptionState.isolate())) {
637 Deprecation::countDeprecation(getExecutionContext(), UseCounter::During_ Microtask_SyncXHR);
638 if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnable d()) {
639 exceptionState.throwDOMException(InvalidAccessError, "Cannot send() synchronous requests during microtask execution.");
640 return false;
641 }
642 }
643
644
636 m_error = false; 645 m_error = false;
637 return true; 646 return true;
638 } 647 }
639 648
640 void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrSt ringOrFormData& body, ExceptionState& exceptionState) 649 void XMLHttpRequest::send(const ArrayBufferOrArrayBufferViewOrBlobOrDocumentOrSt ringOrFormData& body, ExceptionState& exceptionState)
641 { 650 {
642 InspectorInstrumentation::willSendXMLHttpRequest(getExecutionContext(), url( )); 651 InspectorInstrumentation::willSendXMLHttpRequest(getExecutionContext(), url( ));
643 652
644 if (body.isNull()) { 653 if (body.isNull()) {
645 send(String(), exceptionState); 654 send(String(), exceptionState);
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 visitor->trace(m_responseArrayBuffer); 1714 visitor->trace(m_responseArrayBuffer);
1706 visitor->trace(m_progressEventThrottle); 1715 visitor->trace(m_progressEventThrottle);
1707 visitor->trace(m_upload); 1716 visitor->trace(m_upload);
1708 visitor->trace(m_blobLoader); 1717 visitor->trace(m_blobLoader);
1709 XMLHttpRequestEventTarget::trace(visitor); 1718 XMLHttpRequestEventTarget::trace(visitor);
1710 DocumentParserClient::trace(visitor); 1719 DocumentParserClient::trace(visitor);
1711 ActiveDOMObject::trace(visitor); 1720 ActiveDOMObject::trace(visitor);
1712 } 1721 }
1713 1722
1714 } // namespace blink 1723 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698