Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index a1ad16a46f33a70512cee69f29403959ec4230f1..79a9e926a560135266f2c6aa1124dbabb58d003e 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -146,30 +146,24 @@ void Context::set_global_proxy(JSObject* object) { |
* Lookups a property in an object environment, taking the unscopables into |
* account. This is used For HasBinding spec algorithms for ObjectEnvironment. |
*/ |
-static Maybe<PropertyAttributes> UnscopableLookup(LookupIterator* it) { |
+static Maybe<bool> UnscopableLookup(LookupIterator* it) { |
Isolate* isolate = it->isolate(); |
- Maybe<PropertyAttributes> attrs = JSReceiver::GetPropertyAttributes(it); |
- DCHECK(attrs.IsJust() || isolate->has_pending_exception()); |
- if (!attrs.IsJust() || attrs.FromJust() == ABSENT) return attrs; |
+ Maybe<bool> found = JSReceiver::HasProperty(it); |
+ if (!found.IsJust() || !found.FromJust()) return found; |
- Handle<Symbol> unscopables_symbol = isolate->factory()->unscopables_symbol(); |
- Handle<Object> receiver = it->GetReceiver(); |
Handle<Object> unscopables; |
- MaybeHandle<Object> maybe_unscopables = |
- Object::GetProperty(receiver, unscopables_symbol); |
- if (!maybe_unscopables.ToHandle(&unscopables)) { |
- return Nothing<PropertyAttributes>(); |
- } |
- if (!unscopables->IsJSReceiver()) return attrs; |
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
+ isolate, unscopables, |
+ Object::GetProperty(it->GetReceiver(), |
+ isolate->factory()->unscopables_symbol()), |
+ Nothing<bool>()); |
+ if (!unscopables->IsJSReceiver()) return Just(true); |
Handle<Object> blacklist; |
- MaybeHandle<Object> maybe_blacklist = |
- Object::GetProperty(unscopables, it->name()); |
- if (!maybe_blacklist.ToHandle(&blacklist)) { |
- DCHECK(isolate->has_pending_exception()); |
- return Nothing<PropertyAttributes>(); |
- } |
- return blacklist->BooleanValue() ? Just(ABSENT) : attrs; |
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, blacklist, |
+ Object::GetProperty(unscopables, it->name()), |
+ Nothing<bool>()); |
+ return Just(!blacklist->BooleanValue()); |
} |
static void GetAttributesAndBindingFlags(VariableMode mode, |
@@ -289,7 +283,15 @@ Handle<Object> Context::Lookup(Handle<String> name, |
maybe = Just(ABSENT); |
} else { |
LookupIterator it(object, name); |
- maybe = UnscopableLookup(&it); |
+ Maybe<bool> found = UnscopableLookup(&it); |
+ if (found.IsNothing()) { |
+ maybe = Nothing<PropertyAttributes>(); |
+ } else { |
+ // Luckily, consumers of |maybe| only care whether the property |
+ // was absent or not, so we can return a dummy |NONE| value |
+ // for its attributes when it was present. |
+ maybe = Just(found.FromJust() ? NONE : ABSENT); |
+ } |
} |
} else { |
maybe = JSReceiver::GetPropertyAttributes(object, name); |