| Index: src/d8.cc
|
| diff --git a/src/d8.cc b/src/d8.cc
|
| index c46df53851a5fef9e39d1b02c829d8d7073a4308..3b3a0ef7c9f204026afdf62b55f38ad50d7b047e 100644
|
| --- a/src/d8.cc
|
| +++ b/src/d8.cc
|
| @@ -474,6 +474,7 @@ void Shell::RealmGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| // Realm.create() creates a new realm and returns its index.
|
| void Shell::RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| Isolate* isolate = args.GetIsolate();
|
| + TryCatch try_catch(isolate);
|
| PerIsolateData* data = PerIsolateData::Get(isolate);
|
| Persistent<Context>* old_realms = data->realms_;
|
| int index = data->realm_count_;
|
| @@ -483,8 +484,13 @@ void Shell::RealmCreate(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| }
|
| delete[] old_realms;
|
| Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
|
| - data->realms_[index].Reset(
|
| - isolate, Context::New(isolate, NULL, global_template));
|
| + Local<Context> context = Context::New(isolate, NULL, global_template);
|
| + if (context.IsEmpty()) {
|
| + DCHECK(try_catch.HasCaught());
|
| + try_catch.ReThrow();
|
| + return;
|
| + }
|
| + data->realms_[index].Reset(isolate, context);
|
| args.GetReturnValue().Set(index);
|
| }
|
|
|
|
|