Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index 58f23e70065c5b88ce936c93c663cdafc9e7f101..0fddfdf5058a1ee35daf5df1b915401bd3f558ba 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -124,7 +124,8 @@ Handle<Object> Context::Lookup(Handle<String> name, |
if (context->IsNativeContext() || |
context->IsWithContext() || |
(context->IsFunctionContext() && context->has_extension())) { |
- Handle<JSObject> object(JSObject::cast(context->extension()), isolate); |
+ Handle<JSReceiver> object( |
+ JSReceiver::cast(context->extension()), isolate); |
// Context extension objects needs to behave as if they have no |
// prototype. So even if we want to follow prototype chains, we need |
// to only do a local lookup for context extension objects. |
@@ -134,6 +135,8 @@ Handle<Object> Context::Lookup(Handle<String> name, |
} else { |
*attributes = object->GetPropertyAttribute(*name); |
} |
+ if (isolate->has_pending_exception()) return Handle<Object>(); |
+ |
if (*attributes != ABSENT) { |
if (FLAG_trace_contexts) { |
PrintF("=> found property in context object %p\n", |