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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ---------------------------------------------------------------------------- 9 // ----------------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 var body = (n > 0) ? TO_STRING(args[n - 1]) : ''; 1772 var body = (n > 0) ? TO_STRING(args[n - 1]) : '';
1773 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; 1773 return '(' + function_token + '(' + p + ') {\n' + body + '\n})';
1774 } 1774 }
1775 1775
1776 1776
1777 function FunctionConstructor(arg1) { // length == 1 1777 function FunctionConstructor(arg1) { // length == 1
1778 var source = NewFunctionString(arguments, 'function'); 1778 var source = NewFunctionString(arguments, 'function');
1779 var global_proxy = %GlobalProxy(FunctionConstructor); 1779 var global_proxy = %GlobalProxy(FunctionConstructor);
1780 // Compile the string in the constructor and not a helper so that errors 1780 // Compile the string in the constructor and not a helper so that errors
1781 // appear to come from here. 1781 // appear to come from here.
1782 var f = %_CallFunction(global_proxy, %CompileString(source, true)); 1782 var f = %CompileString(source, true);
1783 if (!IS_FUNCTION(f)) return f;
1784 f = %_CallFunction(global_proxy, f);
1783 %FunctionMarkNameShouldPrintAsAnonymous(f); 1785 %FunctionMarkNameShouldPrintAsAnonymous(f);
1784 return f; 1786 return f;
1785 } 1787 }
1786 1788
1787 1789
1788 // ---------------------------------------------------------------------------- 1790 // ----------------------------------------------------------------------------
1789 1791
1790 %SetCode(GlobalFunction, FunctionConstructor); 1792 %SetCode(GlobalFunction, FunctionConstructor);
1791 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction, 1793 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction,
1792 DONT_ENUM); 1794 DONT_ENUM);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 %InstallToContext([ 1843 %InstallToContext([
1842 "global_eval_fun", GlobalEval, 1844 "global_eval_fun", GlobalEval,
1843 "object_value_of", ObjectValueOf, 1845 "object_value_of", ObjectValueOf,
1844 "object_to_string", ObjectToString, 1846 "object_to_string", ObjectToString,
1845 "object_define_own_property", DefineOwnPropertyFromAPI, 1847 "object_define_own_property", DefineOwnPropertyFromAPI,
1846 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, 1848 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor,
1847 "to_complete_property_descriptor", ToCompletePropertyDescriptor, 1849 "to_complete_property_descriptor", ToCompletePropertyDescriptor,
1848 ]); 1850 ]);
1849 1851
1850 }) 1852 })
OLDNEW
« 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