| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -497,7 +497,7 @@ class NodeInspectorClient : public V8InspectorClient { | |||
| 497 | 497 | Isolate* isolate = env_->isolate(); | |
| 498 | 498 | Local<Context> context = env_->context(); | |
| 499 | 499 | ||
| 500 | - int script_id = message->GetScriptOrigin().ScriptID()->Value(); | ||
| 500 | + int script_id = message->GetScriptOrigin().ScriptId(); | ||
| 501 | 501 | ||
| 502 | 502 | Local<v8::StackTrace> stack_trace = message->GetStackTrace(); | |
| 503 | 503 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,17 +26,20 @@ using v8::Array; | |||
| 26 | 26 | using v8::ArrayBufferView; | |
| 27 | 27 | using v8::Context; | |
| 28 | 28 | using v8::EscapableHandleScope; | |
| 29 | + using v8::FixedArray; | ||
| 29 | 30 | using v8::Function; | |
| 30 | 31 | using v8::FunctionCallbackInfo; | |
| 31 | 32 | using v8::FunctionTemplate; | |
| 32 | 33 | using v8::HandleScope; | |
| 34 | + using v8::Int32; | ||
| 33 | 35 | using v8::Integer; | |
| 34 | 36 | using v8::IntegrityLevel; | |
| 35 | 37 | using v8::Isolate; | |
| 36 | 38 | using v8::Local; | |
| 37 | 39 | using v8::MaybeLocal; | |
| 38 | 40 | using v8::MicrotaskQueue; | |
| 39 | 41 | using v8::Module; | |
| 42 | + using v8::ModuleRequest; | ||
| 40 | 43 | using v8::Number; | |
| 41 | 44 | using v8::Object; | |
| 42 | 45 | using v8::PrimitiveArray; | |
@@ -128,8 +131,8 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) { | |||
| 128 | 131 | context = contextify_context->context(); | |
| 129 | 132 | } | |
| 130 | 133 | ||
| 131 | - Local<Integer> line_offset; | ||
| 132 | - Local<Integer> column_offset; | ||
| 134 | + int line_offset = 0; | ||
| 135 | + int column_offset = 0; | ||
| 133 | 136 | ||
| 134 | 137 | bool synthetic = args[2]->IsArray(); | |
| 135 | 138 | if (synthetic) { | |
@@ -139,9 +142,9 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) { | |||
| 139 | 142 | // new ModuleWrap(url, context, source, lineOffset, columOffset, cachedData) | |
| 140 | 143 | CHECK(args[2]->IsString()); | |
| 141 | 144 | CHECK(args[3]->IsNumber()); | |
| 142 | - line_offset = args[3].As<Integer>(); | ||
| 145 | + line_offset = args[3].As<Int32>()->Value(); | ||
| 143 | 146 | CHECK(args[4]->IsNumber()); | |
| 144 | - column_offset = args[4].As<Integer>(); | ||
| 147 | + column_offset = args[4].As<Int32>()->Value(); | ||
| 145 | 148 | } | |
| 146 | 149 | ||
| 147 | 150 | Local<PrimitiveArray> host_defined_options = | |
@@ -185,14 +188,14 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) { | |||
| 185 | 188 | ||
| 186 | 189 | Local<String> source_text = args[2].As<String>(); | |
| 187 | 190 | ScriptOrigin origin(url, | |
| 188 | - line_offset, // line offset | ||
| 189 | - column_offset, // column offset | ||
| 190 | - True(isolate), // is cross origin | ||
| 191 | - Local<Integer>(), // script id | ||
| 191 | + line_offset, | ||
| 192 | + column_offset, | ||
| 193 | + true, // is cross origin | ||
| 194 | + -1, // script id | ||
| 192 | 195 | Local<Value>(), // source map URL | |
| 193 | - False(isolate), // is opaque (?) | ||
| 194 | - False(isolate), // is WASM | ||
| 195 | - True(isolate), // is ES Module | ||
| 196 | + false, // is opaque (?) | ||
| 197 | + false, // is WASM | ||
| 198 | + true, // is ES Module | ||
| 196 | 199 | host_defined_options); | |
| 197 | 200 | ScriptCompiler::Source source(source_text, origin, cached_data); | |
| 198 | 201 | ScriptCompiler::CompileOptions options; | |
@@ -270,12 +273,15 @@ void ModuleWrap::Link(const FunctionCallbackInfo<Value>& args) { | |||
| 270 | 273 | Local<Context> mod_context = obj->context(); | |
| 271 | 274 | Local<Module> module = obj->module_.Get(isolate); | |
| 272 | 275 | ||
| 273 | - const int module_requests_length = module->GetModuleRequestsLength(); | ||
| 276 | + Local<FixedArray> module_requests = module->GetModuleRequests(); | ||
| 277 | + const int module_requests_length = module_requests->Length(); | ||
| 274 | 278 | MaybeStackBuffer<Local<Value>, 16> promises(module_requests_length); | |
| 275 | 279 | ||
| 276 | 280 | // call the dependency resolve callbacks | |
| 277 | 281 | for (int i = 0; i < module_requests_length; i++) { | |
| 278 | - Local<String> specifier = module->GetModuleRequest(i); | ||
| 282 | + Local<ModuleRequest> module_request = | ||
| 283 | + module_requests->Get(env->context(), i).As<ModuleRequest>(); | ||
| 284 | + Local<String> specifier = module_request->GetSpecifier(); | ||
| 279 | 285 | Utf8Value specifier_utf8(env->isolate(), specifier); | |
| 280 | 286 | std::string specifier_std(*specifier_utf8, specifier_utf8.length()); | |
| 281 | 287 | ||
@@ -311,7 +317,7 @@ void ModuleWrap::Instantiate(const FunctionCallbackInfo<Value>& args) { | |||
| 311 | 317 | Local<Context> context = obj->context(); | |
| 312 | 318 | Local<Module> module = obj->module_.Get(isolate); | |
| 313 | 319 | TryCatchScope try_catch(env); | |
| 314 | - USE(module->InstantiateModule(context, ResolveCallback)); | ||
| 320 | + USE(module->InstantiateModule(context, ResolveModuleCallback)); | ||
| 315 | 321 | ||
| 316 | 322 | // clear resolve cache on instantiate | |
| 317 | 323 | obj->resolve_cache_.clear(); | |
@@ -453,12 +459,16 @@ void ModuleWrap::GetStaticDependencySpecifiers( | |||
| 453 | 459 | ||
| 454 | 460 | Local<Module> module = obj->module_.Get(env->isolate()); | |
| 455 | 461 | ||
| 456 | - int count = module->GetModuleRequestsLength(); | ||
| 462 | + Local<FixedArray> module_requests = module->GetModuleRequests(); | ||
| 463 | + int count = module_requests->Length(); | ||
| 457 | 464 | ||
| 458 | 465 | MaybeStackBuffer<Local<Value>, 16> specifiers(count); | |
| 459 | 466 | ||
| 460 | - for (int i = 0; i < count; i++) | ||
| 461 | - specifiers[i] = module->GetModuleRequest(i); | ||
| 467 | + for (int i = 0; i < count; i++) { | ||
| 468 | + Local<ModuleRequest> module_request = | ||
| 469 | + module_requests->Get(env->context(), i).As<ModuleRequest>(); | ||
| 470 | + specifiers[i] = module_request->GetSpecifier(); | ||
| 471 | + } | ||
| 462 | 472 | ||
| 463 | 473 | args.GetReturnValue().Set( | |
| 464 | 474 | Array::New(env->isolate(), specifiers.out(), count)); | |
@@ -473,9 +483,11 @@ void ModuleWrap::GetError(const FunctionCallbackInfo<Value>& args) { | |||
| 473 | 483 | args.GetReturnValue().Set(module->GetException()); | |
| 474 | 484 | } | |
| 475 | 485 | ||
| 476 | - MaybeLocal<Module> ModuleWrap::ResolveCallback(Local<Context> context, | ||
| 477 | - Local<String> specifier, | ||
| 478 | - Local<Module> referrer) { | ||
| 486 | + MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( | ||
| 487 | + Local<Context> context, | ||
| 488 | + Local<String> specifier, | ||
| 489 | + Local<FixedArray> import_assertions, | ||
| 490 | + Local<Module> referrer) { | ||
| 479 | 491 | Environment* env = Environment::GetCurrent(context); | |
| 480 | 492 | if (env == nullptr) { | |
| 481 | 493 | Isolate* isolate = context->GetIsolate(); | |
@@ -524,14 +536,14 @@ static MaybeLocal<Promise> ImportModuleDynamically( | |||
| 524 | 536 | Local<Context> context, | |
| 525 | 537 | Local<ScriptOrModule> referrer, | |
| 526 | 538 | Local<String> specifier) { | |
| 527 | - Isolate* iso = context->GetIsolate(); | ||
| 539 | + Isolate* isolate = context->GetIsolate(); | ||
| 528 | 540 | Environment* env = Environment::GetCurrent(context); | |
| 529 | 541 | if (env == nullptr) { | |
| 530 | - THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(iso); | ||
| 542 | + THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate); | ||
| 531 | 543 | return MaybeLocal<Promise>(); | |
| 532 | 544 | } | |
| 533 | 545 | ||
| 534 | - EscapableHandleScope handle_scope(iso); | ||
| 546 | + EscapableHandleScope handle_scope(isolate); | ||
| 535 | 547 | ||
| 536 | 548 | Local<Function> import_callback = | |
| 537 | 549 | env->host_import_module_dynamically_callback(); | |
@@ -550,11 +562,11 @@ static MaybeLocal<Promise> ImportModuleDynamically( | |||
| 550 | 562 | ||
| 551 | 563 | Local<Value> object; | |
| 552 | 564 | ||
| 553 | - int type = options->Get(iso, HostDefinedOptions::kType) | ||
| 565 | + int type = options->Get(isolate, HostDefinedOptions::kType) | ||
| 554 | 566 | .As<Number>() | |
| 555 | 567 | ->Int32Value(context) | |
| 556 | 568 | .ToChecked(); | |
| 557 | - uint32_t id = options->Get(iso, HostDefinedOptions::kID) | ||
| 569 | + uint32_t id = options->Get(isolate, HostDefinedOptions::kID) | ||
| 558 | 570 | .As<Number>() | |
| 559 | 571 | ->Uint32Value(context) | |
| 560 | 572 | .ToChecked(); | |
@@ -580,7 +592,7 @@ static MaybeLocal<Promise> ImportModuleDynamically( | |||
| 580 | 592 | Local<Value> result; | |
| 581 | 593 | if (import_callback->Call( | |
| 582 | 594 | context, | |
| 583 | - Undefined(iso), | ||
| 595 | + Undefined(isolate), | ||
| 584 | 596 | arraysize(import_args), | |
| 585 | 597 | import_args).ToLocal(&result)) { | |
| 586 | 598 | CHECK(result->IsPromise()); | |
@@ -592,16 +604,16 @@ static MaybeLocal<Promise> ImportModuleDynamically( | |||
| 592 | 604 | ||
| 593 | 605 | void ModuleWrap::SetImportModuleDynamicallyCallback( | |
| 594 | 606 | const FunctionCallbackInfo<Value>& args) { | |
| 595 | - Isolate* iso = args.GetIsolate(); | ||
| 607 | + Isolate* isolate = args.GetIsolate(); | ||
| 596 | 608 | Environment* env = Environment::GetCurrent(args); | |
| 597 | - HandleScope handle_scope(iso); | ||
| 609 | + HandleScope handle_scope(isolate); | ||
| 598 | 610 | ||
| 599 | 611 | CHECK_EQ(args.Length(), 1); | |
| 600 | 612 | CHECK(args[0]->IsFunction()); | |
| 601 | 613 | Local<Function> import_callback = args[0].As<Function>(); | |
| 602 | 614 | env->set_host_import_module_dynamically_callback(import_callback); | |
| 603 | 615 | ||
| 604 | - iso->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically); | ||
| 616 | + isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically); | ||
| 605 | 617 | } | |
| 606 | 618 | ||
| 607 | 619 | void ModuleWrap::HostInitializeImportMetaObjectCallback( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,9 +93,10 @@ class ModuleWrap : public BaseObject { | |||
| 93 | 93 | const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 94 | 94 | static void CreateCachedData(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 95 | 95 | ||
| 96 | - static v8::MaybeLocal<v8::Module> ResolveCallback( | ||
| 96 | + static v8::MaybeLocal<v8::Module> ResolveModuleCallback( | ||
| 97 | 97 | v8::Local<v8::Context> context, | |
| 98 | 98 | v8::Local<v8::String> specifier, | |
| 99 | + v8::Local<v8::FixedArray> import_assertions, | ||
| 99 | 100 | v8::Local<v8::Module> referrer); | |
| 100 | 101 | static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>); | |
| 101 | 102 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,6 @@ using v8::FunctionTemplate; | |||
| 47 | 47 | using v8::HandleScope; | |
| 48 | 48 | using v8::IndexedPropertyHandlerConfiguration; | |
| 49 | 49 | using v8::Int32; | |
| 50 | - using v8::Integer; | ||
| 51 | 50 | using v8::Isolate; | |
| 52 | 51 | using v8::Local; | |
| 53 | 52 | using v8::Maybe; | |
@@ -678,8 +677,8 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) { | |||
| 678 | 677 | CHECK(args[1]->IsString()); | |
| 679 | 678 | Local<String> filename = args[1].As<String>(); | |
| 680 | 679 | ||
| 681 | - Local<Integer> line_offset; | ||
| 682 | - Local<Integer> column_offset; | ||
| 680 | + int line_offset = 0; | ||
| 681 | + int column_offset = 0; | ||
| 683 | 682 | Local<ArrayBufferView> cached_data_buf; | |
| 684 | 683 | bool produce_cached_data = false; | |
| 685 | 684 | Local<Context> parsing_context = context; | |
@@ -689,9 +688,9 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) { | |||
| 689 | 688 | // cachedData, produceCachedData, parsingContext) | |
| 690 | 689 | CHECK_EQ(argc, 7); | |
| 691 | 690 | CHECK(args[2]->IsNumber()); | |
| 692 | - line_offset = args[2].As<Integer>(); | ||
| 691 | + line_offset = args[2].As<Int32>()->Value(); | ||
| 693 | 692 | CHECK(args[3]->IsNumber()); | |
| 694 | - column_offset = args[3].As<Integer>(); | ||
| 693 | + column_offset = args[3].As<Int32>()->Value(); | ||
| 695 | 694 | if (!args[4]->IsUndefined()) { | |
| 696 | 695 | CHECK(args[4]->IsArrayBufferView()); | |
| 697 | 696 | cached_data_buf = args[4].As<ArrayBufferView>(); | |
@@ -706,9 +705,6 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) { | |||
| 706 | 705 | CHECK_NOT_NULL(sandbox); | |
| 707 | 706 | parsing_context = sandbox->context(); | |
| 708 | 707 | } | |
| 709 | - } else { | ||
| 710 | - line_offset = Integer::New(isolate, 0); | ||
| 711 | - column_offset = Integer::New(isolate, 0); | ||
| 712 | 708 | } | |
| 713 | 709 | ||
| 714 | 710 | ContextifyScript* contextify_script = | |
@@ -742,12 +738,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) { | |||
| 742 | 738 | ScriptOrigin origin(filename, | |
| 743 | 739 | line_offset, // line offset | |
| 744 | 740 | column_offset, // column offset | |
| 745 | - True(isolate), // is cross origin | ||
| 746 | - Local<Integer>(), // script id | ||
| 741 | + true, // is cross origin | ||
| 742 | + -1, // script id | ||
| 747 | 743 | Local<Value>(), // source map URL | |
| 748 | - False(isolate), // is opaque (?) | ||
| 749 | - False(isolate), // is WASM | ||
| 750 | - False(isolate), // is ES Module | ||
| 744 | + false, // is opaque (?) | ||
| 745 | + false, // is WASM | ||
| 746 | + false, // is ES Module | ||
| 751 | 747 | host_defined_options); | |
| 752 | 748 | ScriptCompiler::Source source(code, origin, cached_data); | |
| 753 | 749 | ScriptCompiler::CompileOptions compile_options = | |
@@ -1037,11 +1033,11 @@ void ContextifyContext::CompileFunction( | |||
| 1037 | 1033 | ||
| 1038 | 1034 | // Argument 3: line offset | |
| 1039 | 1035 | CHECK(args[2]->IsNumber()); | |
| 1040 | - Local<Integer> line_offset = args[2].As<Integer>(); | ||
| 1036 | + int line_offset = args[2].As<Int32>()->Value(); | ||
| 1041 | 1037 | ||
| 1042 | 1038 | // Argument 4: column offset | |
| 1043 | 1039 | CHECK(args[3]->IsNumber()); | |
| 1044 | - Local<Integer> column_offset = args[3].As<Integer>(); | ||
| 1040 | + int column_offset = args[3].As<Int32>()->Value(); | ||
| 1045 | 1041 | ||
| 1046 | 1042 | // Argument 5: cached data (optional) | |
| 1047 | 1043 | Local<ArrayBufferView> cached_data_buf; | |
@@ -1106,12 +1102,12 @@ void ContextifyContext::CompileFunction( | |||
| 1106 | 1102 | ScriptOrigin origin(filename, | |
| 1107 | 1103 | line_offset, // line offset | |
| 1108 | 1104 | column_offset, // column offset | |
| 1109 | - True(isolate), // is cross origin | ||
| 1110 | - Local<Integer>(), // script id | ||
| 1105 | + true, // is cross origin | ||
| 1106 | + -1, // script id | ||
| 1111 | 1107 | Local<Value>(), // source map URL | |
| 1112 | - False(isolate), // is opaque (?) | ||
| 1113 | - False(isolate), // is WASM | ||
| 1114 | - False(isolate), // is ES Module | ||
| 1108 | + false, // is opaque (?) | ||
| 1109 | + false, // is WASM | ||
| 1110 | + false, // is ES Module | ||
| 1115 | 1111 | host_defined_options); | |
| 1116 | 1112 | ||
| 1117 | 1113 | ScriptCompiler::Source source(code, origin, cached_data); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -98,8 +98,8 @@ static std::string GetErrorSource(Isolate* isolate, | |||
| 98 | 98 | const char* filename_string = *filename; | |
| 99 | 99 | int linenum = message->GetLineNumber(context).FromJust(); | |
| 100 | 100 | ||
| 101 | - int script_start = (linenum - origin.ResourceLineOffset()->Value()) == 1 | ||
| 102 | - ? origin.ResourceColumnOffset()->Value() | ||
| 101 | + int script_start = (linenum - origin.LineOffset()) == 1 | ||
| 102 | + ? origin.ColumnOffset() | ||
| 103 | 103 | : 0; | |
| 104 | 104 | int start = message->GetStartColumn(context).FromMaybe(0); | |
| 105 | 105 | int end = message->GetEndColumn(context).FromMaybe(0); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ namespace native_module { | |||
| 7 | 7 | using v8::Context; | |
| 8 | 8 | using v8::EscapableHandleScope; | |
| 9 | 9 | using v8::Function; | |
| 10 | - using v8::Integer; | ||
| 11 | 10 | using v8::Isolate; | |
| 12 | 11 | using v8::Local; | |
| 13 | 12 | using v8::MaybeLocal; | |
@@ -260,9 +259,7 @@ MaybeLocal<Function> NativeModuleLoader::LookupAndCompile( | |||
| 260 | 259 | std::string filename_s = std::string("node:") + id; | |
| 261 | 260 | Local<String> filename = | |
| 262 | 261 | OneByteString(isolate, filename_s.c_str(), filename_s.size()); | |
| 263 | - Local<Integer> line_offset = Integer::New(isolate, 0); | ||
| 264 | - Local<Integer> column_offset = Integer::New(isolate, 0); | ||
| 265 | - ScriptOrigin origin(filename, line_offset, column_offset, True(isolate)); | ||
| 262 | + ScriptOrigin origin(filename, 0, 0, true); | ||
| 266 | 263 | ||
| 267 | 264 | ScriptCompiler::CachedData* cached_data = nullptr; | |
| 268 | 265 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments