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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 82cec3ae108b8db111ea29900d13d2138e06ad25..23687c66cd72f9cdc7ed7f221b6b4a1ee6af8d53 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -633,6 +633,15 @@ bool XMLHttpRequest::initSend(ExceptionState& exceptionState)
return false;
}
+ if (!m_async && exceptionState.isolate() && v8::MicrotasksScope::IsRunningMicrotasks(exceptionState.isolate())) {
+ Deprecation::countDeprecation(getExecutionContext(), UseCounter::During_Microtask_SyncXHR);
+ if (RuntimeEnabledFeatures::disableBlockingMethodsDuringMicrotasksEnabled()) {
+ exceptionState.throwDOMException(InvalidAccessError, "Cannot send() synchronous requests during microtask execution.");
+ return false;
+ }
+ }
+
+
m_error = false;
return true;
}

Powered by Google App Engine
This is Rietveld 408576698