Chromium Code Reviews| Index: src/accessors.cc |
| diff --git a/src/accessors.cc b/src/accessors.cc |
| index 4527001fc11c3d254f820fe1799f505f582d4ccb..e84e937b926d497618348bee4bcb05784c194836 100644 |
| --- a/src/accessors.cc |
| +++ b/src/accessors.cc |
| @@ -1402,9 +1402,19 @@ static void ModuleGetExport( |
| JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); |
| Context* context = Context::cast(instance->context()); |
| DCHECK(context->IsModuleContext()); |
| - int slot = info.Data()->Int32Value(); |
| - Object* value = context->get(slot); |
| Isolate* isolate = instance->GetIsolate(); |
| + int slot = info.Data() |
| + ->Int32Value(info.GetIsolate()->GetCurrentContext()) |
| + .FromMaybe(-1); |
| + if (slot == -1) { |
| + Handle<String> name = v8::Utils::OpenHandle(*property); |
| + |
| + Handle<Object> exception = isolate->factory()->NewReferenceError( |
| + MessageTemplate::kNotDefined, name); |
| + isolate->ScheduleThrow(*exception); |
| + return; |
| + } |
|
vogelheim
2015/06/03 08:23:13
I don't think I understand the logic here:
Previo
jochen (gone - plz use gerrit)
2015/06/03 09:43:57
fair enough
i'm now checking for other invalid va
|
| + Object* value = context->get(slot); |
| if (value->IsTheHole()) { |
| Handle<String> name = v8::Utils::OpenHandle(*property); |
| @@ -1424,9 +1434,18 @@ static void ModuleSetExport( |
| JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); |
| Context* context = Context::cast(instance->context()); |
| DCHECK(context->IsModuleContext()); |
| - int slot = info.Data()->Int32Value(); |
| + Isolate* isolate = instance->GetIsolate(); |
| + int slot = info.Data() |
| + ->Int32Value(info.GetIsolate()->GetCurrentContext()) |
| + .FromMaybe(-1); |
| + if (slot == -1) { |
| + Handle<String> name = v8::Utils::OpenHandle(*property); |
| + Handle<Object> exception = isolate->factory()->NewReferenceError( |
| + MessageTemplate::kNotDefined, name); |
| + isolate->ScheduleThrow(*exception); |
| + return; |
| + } |
| Object* old_value = context->get(slot); |
| - Isolate* isolate = context->GetIsolate(); |
| if (old_value->IsTheHole()) { |
| Handle<String> name = v8::Utils::OpenHandle(*property); |
| Handle<Object> exception = isolate->factory()->NewReferenceError( |