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

Unified Diff: src/runtime.cc

Issue 19536: Fix issue 221:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 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 | « no previous file | test/mjsunit/regress/regress-221.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 1201)
+++ src/runtime.cc (working copy)
@@ -4061,7 +4061,9 @@
while (!context.is_null()) {
receiver = context->Lookup(Factory::eval_symbol(), FOLLOW_PROTOTYPE_CHAIN,
&index, &attributes);
- if (attributes != ABSENT) break;
+ // Stop search when eval is found or when the global context is
+ // reached.
+ if (attributes != ABSENT || context->IsGlobalContext()) break;
if (context->is_function_context()) {
context = Handle<Context>(Context::cast(context->closure()->context()));
} else {
@@ -4069,6 +4071,15 @@
}
}
+ // If eval could not be resolved, it has been deleted and we need to
+ // throw a reference error.
+ if (attributes == ABSENT) {
+ Handle<Object> name = Factory::eval_symbol();
+ Handle<Object> reference_error =
+ Factory::NewReferenceError("not_defined", HandleVector(&name, 1));
+ return Top::Throw(*reference_error);
+ }
+
if (context->IsGlobalContext()) {
// 'eval' is bound in the global context, but it may have been overwritten.
// Compare it to the builtin 'GlobalEval' function to make sure.
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-221.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698