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

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

Issue 1642863002: Let notifyScriptLoadError() handle already detached ScriptLoaders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased up to r372058 Created 4 years, 11 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 | « third_party/WebKit/Source/core/dom/ScriptRunner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/ScriptRunner.cpp
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
index 9dddabdc5796785e9f83b3120304a81cc51e71e9..c10c779a8dbf1a00c9c7e3f6b24e302c87fd7726 100644
--- a/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptRunner.cpp
@@ -42,6 +42,7 @@ ScriptRunner::ScriptRunner(Document* document)
, m_numberOfInOrderScriptsWithPendingNotification(0)
, m_isSuspended(false)
#if !ENABLE(OILPAN)
+ , m_isDisposed(false)
, m_weakPointerFactoryForTasks(this)
#endif
{
@@ -97,6 +98,7 @@ void ScriptRunner::dispose()
m_pendingAsyncScripts.clear();
m_inOrderScriptsToExecuteSoon.clear();
m_asyncScriptsToExecuteSoon.clear();
+ m_isDisposed = true;
m_numberOfInOrderScriptsWithPendingNotification = 0;
}
#endif
@@ -204,12 +206,21 @@ void ScriptRunner::notifyScriptLoadError(ScriptLoader* scriptLoader, ExecutionTy
// 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));
+ bool foundLoader = m_pendingAsyncScripts.contains(scriptLoader);
+#if !ENABLE(OILPAN)
+ // If the ScriptRunner has been disposed of, no pending scripts remain.
+ foundLoader = foundLoader || m_isDisposed;
+#endif
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(foundLoader);
m_pendingAsyncScripts.remove(scriptLoader);
break;
}
case IN_ORDER_EXECUTION:
- RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(removePendingInOrderScript(scriptLoader));
+ bool foundLoader = removePendingInOrderScript(scriptLoader);
+#if !ENABLE(OILPAN)
+ foundLoader = foundLoader || m_isDisposed;
+#endif
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(foundLoader);
break;
}
scriptLoader->detach();
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698