Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 596b480b70f8526956264cc2d10b5f6511f0a351..a7c2bac25d61bd0987c33b08d9e8ea26fba4d6aa 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -303,14 +303,11 @@ Handle<Context> Bootstrapper::CreateEnvironment( |
v8::ExtensionConfiguration* extensions) { |
HandleScope scope(isolate_); |
Genesis genesis(isolate_, global_object, global_template, extensions); |
- if (!genesis.result().is_null()) { |
- Handle<Object> ctx(isolate_->global_handles()->Create(*genesis.result())); |
- Handle<Context> env = Handle<Context>::cast(ctx); |
- if (InstallExtensions(env, extensions)) { |
- return env; |
- } |
+ Handle<Context> env = genesis.result(); |
+ if (env.is_null() || !InstallExtensions(env, extensions)) { |
+ return Handle<Context>(); |
} |
- return Handle<Context>(); |
+ return scope.CloseAndEscape(env); |
} |