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

Unified Diff: src/contexts.cc

Issue 2353623002: Filter out synthetic variables from with scopes (Closed)
Patch Set: Minimal fix Created 4 years, 3 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-5405.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 3447b42f47dc32d3f37055fc36d9fa30f365ab43..4fb3c833b773195f706c52bcec56cddd8d932ebe 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -261,8 +261,14 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
object->IsJSContextExtensionObject()) {
maybe = JSReceiver::GetOwnPropertyAttributes(object, name);
} else if (context->IsWithContext()) {
- // A with context will never bind "this".
- if (name->Equals(*isolate->factory()->this_string())) {
+ // A with context will never bind "this", but debug-eval may look into
+ // a with context when resolving "this". Other synthetic variables such
+ // as new.target may be resolved as DYNAMIC_LOCAL due to bug v8:5405 ,
+ // skipping them here serves as a workaround until a more thorough
+ // fix can be applied.
+ // TODO(v8:5405): Replace this check with a DCHECK when resolution of
+ // of synthetic variables does not go through this code path.
+ if (ScopeInfo::VariableIsSynthetic(*name)) {
maybe = Just(ABSENT);
} else {
LookupIterator it(object, name, object);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5405.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698