Index: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
index 800abaeba2f1045c1f6ff6d4db4f6a2cd8dfe1fc..3ee767049aea5b167880bbbfdfa8b004770b32c6 100644 |
--- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
+++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
@@ -448,7 +448,8 @@ void XMLDocumentParser::notifyFinished(Resource* unusedResource) { |
Element* e = m_scriptElement; |
m_scriptElement = nullptr; |
- ScriptLoader* scriptLoader = toScriptLoaderIfPossible(e); |
+ ScriptLoader* scriptLoader = |
+ ScriptLoaderClient::fromElementIfPossible(e)->loader(); |
DCHECK(scriptLoader); |
if (errorOccurred) { |
@@ -1029,8 +1030,7 @@ void XMLDocumentParser::startElementNs(const AtomicString& localName, |
newElement->beginParsingChildren(); |
- ScriptLoader* scriptLoader = toScriptLoaderIfPossible(newElement); |
- if (scriptLoader) |
+ if (newElement->isScriptElement()) |
m_scriptStartPosition = textPosition(); |
m_currentNode->parserAppendChild(newElement); |
@@ -1075,8 +1075,12 @@ void XMLDocumentParser::endElementNs() { |
if (m_currentNode->isElementNode()) |
toElement(n)->finishParsingChildren(); |
+ ScriptLoaderClient* scriptLoaderClient = |
+ n->isElementNode() |
+ ? ScriptLoaderClient::fromElementIfPossible(toElement(n)) |
+ : nullptr; |
if (!scriptingContentIsAllowed(getParserContentPolicy()) && |
- n->isElementNode() && toScriptLoaderIfPossible(toElement(n))) { |
+ scriptLoaderClient) { |
popCurrentNode(); |
n->remove(IGNORE_EXCEPTION_FOR_TESTING); |
return; |
@@ -1096,7 +1100,8 @@ void XMLDocumentParser::endElementNs() { |
return; |
} |
- ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); |
+ ScriptLoader* scriptLoader = |
+ scriptLoaderClient ? scriptLoaderClient->loader() : nullptr; |
if (!scriptLoader) { |
popCurrentNode(); |
return; |