Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index 39cc41ea019a37bff37e21b26bed993b5b627160..edc265757bbc7db855da8ab6c3d24e5e2f13f39d 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -5131,24 +5131,17 @@ KURL Document::openSearchDescriptionURL() { |
void Document::currentScriptForBinding( |
HTMLScriptElementOrSVGScriptElement& scriptElement) const { |
- if (Element* script = currentScript()) { |
- if (script->isInV1ShadowTree()) |
- return; |
- if (isHTMLScriptElement(script)) |
- scriptElement.setHTMLScriptElement(toHTMLScriptElement(script)); |
- else if (isSVGScriptElement(script)) |
- scriptElement.setSVGScriptElement(toSVGScriptElement(script)); |
- } |
+ if (!m_currentScriptStack.isEmpty()) |
+ m_currentScriptStack.back()->setScriptElementForBinding(scriptElement); |
} |
-void Document::pushCurrentScript(Element* newCurrentScript) { |
- DCHECK(isHTMLScriptElement(newCurrentScript) || |
- isSVGScriptElement(newCurrentScript)); |
+void Document::pushCurrentScript(ScriptLoaderClient* newCurrentScript) { |
m_currentScriptStack.push_back(newCurrentScript); |
} |
-void Document::popCurrentScript() { |
+void Document::popCurrentScript(ScriptLoaderClient* script) { |
DCHECK(!m_currentScriptStack.isEmpty()); |
+ DCHECK(m_currentScriptStack.back().get() == script); |
hiroshige
2017/03/01 00:58:14
nit: DCHECK_EQ
Nate Chapin
2017/03/01 21:34:58
Done.
|
m_currentScriptStack.pop_back(); |
} |
@@ -5675,14 +5668,14 @@ bool Document::allowInlineEventHandler(Node* node, |
return true; |
} |
-bool Document::allowExecutingScripts(Node* node) { |
+bool Document::allowExecutingScripts(Document* document) { |
// FIXME: Eventually we'd like to evaluate scripts which are inserted into a |
// viewless document but this'll do for now. |
// See http://bugs.webkit.org/show_bug.cgi?id=5727 |
LocalFrame* frame = executingFrame(); |
if (!frame) |
return false; |
- if (!node->document().executingFrame()) |
+ if (!document->executingFrame()) |
return false; |
if (!canExecuteScripts(AboutToExecuteScript)) |
return false; |