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

Unified Diff: Source/core/dom/ScriptRunner.cpp

Issue 936333005: ScriptRunner: ASSERT -> RELEASE_ASSERT. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: . Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ScriptRunner.cpp
diff --git a/Source/core/dom/ScriptRunner.cpp b/Source/core/dom/ScriptRunner.cpp
index 88ed1e1c360659213e8affaf7f2ffebd37670c3f..cc987c65e46cbe63a6535f8cbe99b810a43965b6 100644
--- a/Source/core/dom/ScriptRunner.cpp
+++ b/Source/core/dom/ScriptRunner.cpp
@@ -90,13 +90,17 @@ void ScriptRunner::notifyScriptReady(ScriptLoader* scriptLoader, ExecutionType e
{
switch (executionType) {
case ASYNC_EXECUTION:
- ASSERT(m_pendingAsyncScripts.contains(scriptLoader));
+ // RELEASE_ASSERT makes us crash in a controlled way in error cases
+ // where the ScriptLoader is associated with the wrong ScriptRunner
+ // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries
+ // to detach).
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_pendingAsyncScripts.contains(scriptLoader));
m_scriptsToExecuteSoon.append(scriptLoader);
m_pendingAsyncScripts.remove(scriptLoader);
break;
case IN_ORDER_EXECUTION:
- ASSERT(!m_scriptsToExecuteInOrder.isEmpty());
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_scriptsToExecuteInOrder.isEmpty());
break;
}
m_timer.startOneShot(0, FROM_HERE);
@@ -106,14 +110,18 @@ void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy
{
switch (executionType) {
case ASYNC_EXECUTION:
- ASSERT(m_pendingAsyncScripts.contains(scriptLoader));
+ // RELEASE_ASSERT makes us crash in a controlled way in error cases
+ // where the ScriptLoader is associated with the wrong ScriptRunner
+ // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries
+ // to detach).
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_pendingAsyncScripts.contains(scriptLoader));
m_pendingAsyncScripts.remove(scriptLoader);
scriptLoader->detach();
m_document->decrementLoadEventDelayCount();
break;
case IN_ORDER_EXECUTION:
- ASSERT(!m_scriptsToExecuteInOrder.isEmpty());
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_scriptsToExecuteInOrder.isEmpty());
break;
}
}
« 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