| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 7a2d46c4b4315a96ad86ef7cb8c79458fef66b9b..66c09b060f7de54aa8dfefe214795813abf31137 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -11336,11 +11336,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) {
|
| // by creating correct wrapper object based on the calling frame's
|
| // native context.
|
| it.Advance();
|
| - Handle<Context> calling_frames_native_context(
|
| - Context::cast(Context::cast(it.frame()->context())->native_context()));
|
| - ASSERT(!receiver->IsUndefined() && !receiver->IsNull());
|
| - receiver =
|
| - isolate->factory()->ToObject(receiver, calling_frames_native_context);
|
| + if (receiver->IsUndefined() || receiver->IsNull()) {
|
| + Context* context = function->context();
|
| + receiver = handle(context->global_object()->global_receiver());
|
| + } else {
|
| + Context* context = Context::cast(it.frame()->context());
|
| + Handle<Context> native_context(Context::cast(context->native_context()));
|
| + receiver = isolate->factory()->ToObject(receiver, native_context);
|
| + }
|
| }
|
| details->set(kFrameDetailsReceiverIndex, *receiver);
|
|
|
|
|