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

Unified Diff: Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 648423003: Enforce ScriptForbiddenScope and make it non-fatal. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Consistify Created 6 years, 2 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 | « Source/bindings/core/v8/V8RecursionScope.h ('k') | Source/core/dom/Microtask.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6a7ba598a0e6f5171f32c7a57f5b22c6e6f697ca 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::Local<v8::Value>();
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::Local<v8::Value>();
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();
« no previous file with comments | « Source/bindings/core/v8/V8RecursionScope.h ('k') | Source/core/dom/Microtask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698