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

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

Issue 2648753002: Revert of Inline Document::allowExecutingScripts logic (Closed)
Patch Set: Created 3 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/Document.cpp ('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/ScriptLoader.cpp
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
index 44834edc586aef380afba00d9c11bd57b33e5dfa..ad91f9dc9d92335c7aeb0b8ea2deba54d71818dc 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -236,27 +236,13 @@
m_alreadyStarted = true;
- // 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
// FIXME: If script is parser inserted, verify it's still in the original
// document.
Document& elementDocument = m_element->document();
- // TODO(kouhei): Remove the following check which doesn't make any sense.
- if (!elementDocument.executingFrame())
- return false;
-
Document* contextDocument = elementDocument.contextDocument();
- if (!contextDocument)
- return false;
-
- LocalFrame* contextFrame = contextDocument->executingFrame();
- if (!contextFrame)
- return false;
- if (!contextFrame->script().canExecuteScripts(AboutToExecuteScript))
- return false;
-
- LocalFrame* elementFrame = elementDocument.frame();
+
+ if (!contextDocument || !contextDocument->allowExecutingScripts(m_element))
+ return false;
if (!isScriptForEventSupported())
return false;
@@ -310,16 +296,13 @@
} else if (client->hasSourceAttribute()) {
m_pendingScript = PendingScript::create(m_element, m_resource.get());
m_asyncExecType = ScriptRunner::Async;
- if (elementFrame) {
- // TODO(kouhei): I'm not sure below is correct. I think we should use
- // contextFrame rather than elementFrame.
- ScriptState* scriptState = ScriptState::forMainWorld(elementFrame);
- if (scriptState) {
+ LocalFrame* frame = m_element->document().frame();
+ if (frame) {
+ ScriptState* scriptState = ScriptState::forMainWorld(frame);
+ if (scriptState)
ScriptStreamer::startStreaming(
- m_pendingScript.get(), ScriptStreamer::Async,
- elementFrame->settings(), scriptState,
- elementFrame->frameScheduler()->loadingTaskRunner());
- }
+ m_pendingScript.get(), ScriptStreamer::Async, frame->settings(),
+ scriptState, frame->frameScheduler()->loadingTaskRunner());
}
contextDocument->scriptRunner()->queueScriptForExecution(this,
m_asyncExecType);
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698