| 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);
|
|
|