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

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

Issue 288033006: Revert a series of wrong fixes for crbug.com/361011 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
« no previous file with comments | « Source/core/dom/ScriptLoader.h ('k') | Source/core/html/HTMLScriptElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ScriptLoader.cpp
diff --git a/Source/core/dom/ScriptLoader.cpp b/Source/core/dom/ScriptLoader.cpp
index 0b3ab8bf8fcc993c01c8f51619e28583f17470cb..9f9e33118f9207e8157b023740b900dfa6828fe5 100644
--- a/Source/core/dom/ScriptLoader.cpp
+++ b/Source/core/dom/ScriptLoader.cpp
@@ -363,15 +363,15 @@ void ScriptLoader::execute(ScriptResource* resource)
resource->removeClient(this);
}
-void ScriptLoader::cancel(Document* contextDocument)
+void ScriptLoader::notifyFinished(Resource* resource)
{
- if (!m_resource)
+ ASSERT(!m_willBeParserExecuted);
+
+ RefPtr<Document> elementDocument(m_element->document());
+ RefPtr<Document> contextDocument = elementDocument->contextDocument().get();
+ if (!contextDocument)
return;
- finishLoading(contextDocument, FinishWithCancel);
-}
-void ScriptLoader::notifyFinished(Resource* resource)
-{
// Resource possibly invokes this notifyFinished() more than
// once because ScriptLoader doesn't unsubscribe itself from
// Resource here and does it in execute() instead.
@@ -379,35 +379,17 @@ void ScriptLoader::notifyFinished(Resource* resource)
ASSERT_UNUSED(resource, resource == m_resource);
if (!m_resource)
return;
-
- RefPtr<Document> elementDocument(m_element->document());
- RefPtr<Document> contextDocument = elementDocument->contextDocument().get();
- finishLoading(contextDocument.get(), resource->errorOccurred() ? FinishWithError : FinishSuccessfully);
-}
-
-void ScriptLoader::finishLoading(Document* contextDocument, ScriptLoader::FinishType type)
-{
- if (!contextDocument)
- return;
-
- switch (type) {
- case FinishWithCancel:
- if (!m_willBeParserExecuted)
- contextDocument->scriptRunner()->notifyScriptLoadError(this, m_willExecuteInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION);
- stopLoadRequest();
- break;
- case FinishWithError:
- ASSERT(!m_willBeParserExecuted);
+ if (m_resource->errorOccurred()) {
dispatchErrorEvent();
contextDocument->scriptRunner()->notifyScriptLoadError(this, m_willExecuteInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION);
- m_resource = 0;
- break;
- case FinishSuccessfully:
- ASSERT(!m_willBeParserExecuted);
- contextDocument->scriptRunner()->notifyScriptReady(this, m_willExecuteInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION);
- m_resource = 0;
- break;
+ return;
}
+ if (m_willExecuteInOrder)
+ contextDocument->scriptRunner()->notifyScriptReady(this, ScriptRunner::IN_ORDER_EXECUTION);
+ else
+ contextDocument->scriptRunner()->notifyScriptReady(this, ScriptRunner::ASYNC_EXECUTION);
+
+ m_resource = 0;
}
bool ScriptLoader::ignoresLoadRequest() const
« no previous file with comments | « Source/core/dom/ScriptLoader.h ('k') | Source/core/html/HTMLScriptElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698