Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: src/accessors.cc

Issue 1162363005: Remove usage of to-be-deprecated APIs from v8 core (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index 4527001fc11c3d254f820fe1799f505f582d4ccb..711d6dc11f3321b3d075186d0281e588b93a7e29 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 < 0 || slot >= context->length()) {
+ Handle<String> name = v8::Utils::OpenHandle(*property);
+
+ Handle<Object> exception = isolate->factory()->NewReferenceError(
+ MessageTemplate::kNotDefined, name);
+ isolate->ScheduleThrow(*exception);
+ return;
+ }
+ 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 < 0 || slot >= context->length()) {
+ 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(
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698