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

Unified Diff: src/v8natives.js

Issue 1393713006: Don't compile functions in a context the caller doesn't have access to (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « src/runtime/runtime-compiler.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 34c35031b2601dd4c1ef614c877668d307502569..10a0566c295cb4d0dc6ffd3f171141ef97787fed 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1779,7 +1779,9 @@ function FunctionConstructor(arg1) { // length == 1
var global_proxy = %GlobalProxy(FunctionConstructor);
// Compile the string in the constructor and not a helper so that errors
// appear to come from here.
- var f = %_CallFunction(global_proxy, %CompileString(source, true));
+ var f = %CompileString(source, true);
+ if (!IS_FUNCTION(f)) return f;
+ f = %_CallFunction(global_proxy, f);
%FunctionMarkNameShouldPrintAsAnonymous(f);
return f;
}
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698