Index: third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
index 7fda4b6f4821e38913621465e1cb542ccf6c97e5..c95bc45590983abac27325cd9bf1fc9c06c20b18 100644 |
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
@@ -26,9 +26,9 @@ |
#include "bindings/core/v8/ScriptController.h" |
#include "bindings/core/v8/ScriptSourceCode.h" |
-#include "bindings/core/v8/V8Binding.h" |
#include "core/HTMLNames.h" |
#include "core/SVGNames.h" |
+#include "core/dom/ClassicPendingScript.h" |
#include "core/dom/ClassicScript.h" |
#include "core/dom/Document.h" |
#include "core/dom/DocumentParserTiming.h" |
@@ -323,7 +323,8 @@ bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, |
// completion to be able to remove it from the memory cache. |
if (m_documentWriteIntervention == |
DocumentWriteIntervention::FetchDocWrittenScriptDeferIdle) { |
- m_pendingScript = PendingScript::create(m_element.get(), m_resource.get()); |
+ m_pendingScript = |
+ ClassicPendingScript::create(m_element.get(), m_resource.get()); |
m_pendingScript->watchForLoad(this); |
return true; |
} |
@@ -409,7 +410,8 @@ bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, |
// "Add the element to the end of the list of scripts that will execute |
// in order as soon as possible associated with the node document of the |
// script element at the time the prepare a script algorithm started." |
- m_pendingScript = PendingScript::create(m_element.get(), m_resource.get()); |
+ m_pendingScript = |
+ ClassicPendingScript::create(m_element.get(), m_resource.get()); |
m_asyncExecType = ScriptRunner::InOrder; |
// TODO(hiroshige): Here |contextDocument| is used as "node document" |
// while Step 14 uses |elementDocument| as "node document". Fix this. |
@@ -431,7 +433,8 @@ bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, |
// "The element must be added to the set of scripts that will execute |
// as soon as possible of the node document of the script element at the |
// time the prepare a script algorithm started." |
- m_pendingScript = PendingScript::create(m_element.get(), m_resource.get()); |
+ m_pendingScript = |
+ ClassicPendingScript::create(m_element.get(), m_resource.get()); |
m_asyncExecType = ScriptRunner::Async; |
m_pendingScript->startStreamingIfPossible(&m_element->document(), |
ScriptStreamer::Async); |
@@ -691,13 +694,14 @@ bool ScriptLoader::doExecuteScript(const Script* script) { |
void ScriptLoader::execute() { |
DCHECK(!m_willBeParserExecuted); |
DCHECK(m_asyncExecType != ScriptRunner::None); |
- DCHECK(m_pendingScript->resource()); |
+ DCHECK(m_pendingScript->isExternal()); |
bool errorOccurred = false; |
Script* script = m_pendingScript->getSource(KURL(), errorOccurred); |
+ const bool wasCanceled = m_pendingScript->wasCanceled(); |
detachPendingScript(); |
if (errorOccurred) { |
dispatchErrorEvent(); |
- } else if (!m_resource->wasCanceled()) { |
+ } else if (!wasCanceled) { |
if (executeScript(script)) |
dispatchLoadEvent(); |
else |
@@ -709,7 +713,7 @@ void ScriptLoader::execute() { |
void ScriptLoader::pendingScriptFinished(PendingScript* pendingScript) { |
DCHECK(!m_willBeParserExecuted); |
DCHECK_EQ(m_pendingScript, pendingScript); |
- DCHECK_EQ(pendingScript->resource(), m_resource); |
+ // DCHECK_EQ(pendingScript->resource(), m_resource); |
hiroshige
2017/04/07 22:40:40
Previously I thought this has a slight chance of f
|
// We do not need this script in the memory cache. The primary goals of |
// sending this fetch request are to let the third party server know |
@@ -717,7 +721,7 @@ void ScriptLoader::pendingScriptFinished(PendingScript* pendingScript) { |
// cache for subsequent uses. |
if (m_documentWriteIntervention == |
DocumentWriteIntervention::FetchDocWrittenScriptDeferIdle) { |
- memoryCache()->remove(m_pendingScript->resource()); |
+ // memoryCache()->remove(m_pendingScript->resource()); |
m_pendingScript->stopWatchingForLoad(); |
return; |
} |