| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3a3eb68 commit 2178007
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,6 +63,10 @@ using v8::UnboundModuleScript; | |||
| 63 | 63 | using v8::Undefined; | |
| 64 | 64 | using v8::Value; | |
| 65 | 65 | ||
| 66 | + inline bool DataIsString(Local<Data> data) { | ||
| 67 | + return data->IsValue() && data.As<Value>()->IsString(); | ||
| 68 | + } | ||
| 69 | + | ||
| 66 | 70 | void ModuleCacheKey::MemoryInfo(MemoryTracker* tracker) const { | |
| 67 | 71 | tracker->TrackField("specifier", specifier); | |
| 68 | 72 | tracker->TrackField("import_attributes", import_attributes); | |
@@ -83,6 +87,9 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context, | |||
| 83 | 87 | ||
| 84 | 88 | for (int i = 0; i < import_attributes->Length(); | |
| 85 | 89 | i += elements_per_attribute) { | |
| 90 | + DCHECK(DataIsString(import_attributes->Get(context, i))); | ||
| 91 | + DCHECK(DataIsString(import_attributes->Get(context, i + 1))); | ||
| 92 | + | ||
| 86 | 93 | Local<String> v8_key = import_attributes->Get(context, i).As<String>(); | |
| 87 | 94 | Local<String> v8_value = | |
| 88 | 95 | import_attributes->Get(context, i + 1).As<String>(); | |
@@ -488,9 +495,14 @@ static Local<Object> createImportAttributesContainer( | |||
| 488 | 495 | LocalVector<Value> values(isolate, num_attributes); | |
| 489 | 496 | ||
| 490 | 497 | for (int i = 0; i < raw_attributes->Length(); i += elements_per_attribute) { | |
| 498 | + Local<Data> key = raw_attributes->Get(realm->context(), i); | ||
| 499 | + Local<Data> value = raw_attributes->Get(realm->context(), i + 1); | ||
| 500 | + DCHECK(DataIsString(key)); | ||
| 501 | + DCHECK(DataIsString(value)); | ||
| 502 | + | ||
| 491 | 503 | int idx = i / elements_per_attribute; | |
| 492 | - names[idx] = raw_attributes->Get(realm->context(), i).As<Name>(); | ||
| 493 | - values[idx] = raw_attributes->Get(realm->context(), i + 1).As<Value>(); | ||
| 504 | + names[idx] = key.As<String>(); | ||
| 505 | + values[idx] = value.As<String>(); | ||
| 494 | 506 | } | |
| 495 | 507 | ||
| 496 | 508 | Local<Object> attributes = Object::New( | |
@@ -507,6 +519,7 @@ static Local<Array> createModuleRequestsContainer( | |||
| 507 | 519 | LocalVector<Value> requests(isolate, raw_requests->Length()); | |
| 508 | 520 | ||
| 509 | 521 | for (int i = 0; i < raw_requests->Length(); i++) { | |
| 522 | + DCHECK(raw_requests->Get(context, i)->IsModuleRequest()); | ||
| 510 | 523 | Local<ModuleRequest> module_request = | |
| 511 | 524 | raw_requests->Get(realm->context(), i).As<ModuleRequest>(); | |
| 512 | 525 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments