diff options
Diffstat (limited to 'WebCore/bindings/ScriptControllerBase.cpp')
-rw-r--r-- | WebCore/bindings/ScriptControllerBase.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/WebCore/bindings/ScriptControllerBase.cpp b/WebCore/bindings/ScriptControllerBase.cpp index 72c9f45..f1217e3 100644 --- a/WebCore/bindings/ScriptControllerBase.cpp +++ b/WebCore/bindings/ScriptControllerBase.cpp @@ -22,6 +22,7 @@ #include "ScriptController.h" #include "Frame.h" +#include "FrameLoaderClient.h" #include "Page.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" @@ -30,6 +31,15 @@ namespace WebCore { +bool ScriptController::canExecuteScripts() +{ + if (m_frame->loader()->isSandboxed(SandboxScripts)) + return false; + + Settings* settings = m_frame->settings(); + return m_frame->loader()->client()->allowJavaScript(settings && settings->isJavaScriptEnabled()); +} + ScriptValue ScriptController::executeScript(const String& script, bool forceUserGesture) { return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url())); @@ -37,7 +47,7 @@ ScriptValue ScriptController::executeScript(const String& script, bool forceUser ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode) { - if (!isEnabled() || isPaused()) + if (!canExecuteScripts() || isPaused()) return ScriptValue(); bool wasInExecuteScript = m_inExecuteScript; |