Index: Source/bindings/core/v8/V8ScriptRunner.cpp |
diff --git a/Source/bindings/core/v8/V8ScriptRunner.cpp b/Source/bindings/core/v8/V8ScriptRunner.cpp |
index 4eb508e5149393ff45214aee112672112ea064cf..295a561de0c400f5b2507af80f3e68418626e952 100644 |
--- a/Source/bindings/core/v8/V8ScriptRunner.cpp |
+++ b/Source/bindings/core/v8/V8ScriptRunner.cpp |
@@ -35,6 +35,7 @@ |
#include "core/dom/ExecutionContext.h" |
#include "core/fetch/CachedMetadata.h" |
#include "core/fetch/ScriptResource.h" |
+#include "platform/ScriptForbiddenScope.h" |
#include "platform/TraceEvent.h" |
namespace blink { |
@@ -175,6 +176,8 @@ v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc |
// Run the script and keep track of the current recursion depth. |
v8::Local<v8::Value> result; |
{ |
+ if (ScriptForbiddenScope::isScriptForbidden()) |
+ return v8::Undefined(isolate); |
haraken
2014/10/14 05:55:29
v8::Undefined(isolate) => return v8::Local<v8::Val
dcheng
2014/10/14 06:42:08
Done.
|
V8RecursionScope recursionScope(isolate); |
result = script->Run(); |
} |
@@ -220,6 +223,8 @@ v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Handle<v8::Function> funct |
RELEASE_ASSERT(!context->isIteratingOverObservers()); |
+ if (ScriptForbiddenScope::isScriptForbidden()) |
+ return v8::Undefined(isolate); |
haraken
2014/10/14 05:55:29
v8::Undefined(isolate) => return v8::Local<v8::Val
dcheng
2014/10/14 06:42:08
Done.
|
V8RecursionScope recursionScope(isolate); |
v8::Local<v8::Value> result = function->Call(receiver, argc, args); |
crashIfV8IsDead(); |
@@ -273,6 +278,8 @@ v8::Local<v8::Object> V8ScriptRunner::instantiateObjectInDocument(v8::Isolate* i |
{ |
TRACE_EVENT0("v8", "v8.newInstance"); |
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
+ if (ScriptForbiddenScope::isScriptForbidden()) |
+ return v8::Local<v8::Object>(); |
V8RecursionScope scope(isolate); |
v8::Local<v8::Object> result = function->NewInstance(argc, argv); |
crashIfV8IsDead(); |