| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 30baacb commit 94363bb
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -775,13 +775,18 @@ inline void Environment::ThrowRangeError(const char* errmsg) { | |||
| 775 | 775 | ThrowError(v8::Exception::RangeError, errmsg); | |
| 776 | 776 | } | |
| 777 | 777 | ||
| 778 | - inline void Environment::ThrowError( | ||
| 779 | - v8::Local<v8::Value> (*fun)(v8::Local<v8::String>), | ||
| 780 | - const char* errmsg) { | ||
| 778 | + inline void Environment::ThrowError(V8ExceptionConstructorOld fun, | ||
| 779 | + const char* errmsg) { | ||
| 781 | 780 | v8::HandleScope handle_scope(isolate()); | |
| 782 | 781 | isolate()->ThrowException(fun(OneByteString(isolate(), errmsg))); | |
| 783 | 782 | } | |
| 784 | 783 | ||
| 784 | + inline void Environment::ThrowError(V8ExceptionConstructorNew fun, | ||
| 785 | + const char* errmsg) { | ||
| 786 | + v8::HandleScope handle_scope(isolate()); | ||
| 787 | + isolate()->ThrowException(fun(OneByteString(isolate(), errmsg), {})); | ||
| 788 | + } | ||
| 789 | + | ||
| 785 | 790 | inline void Environment::ThrowErrnoException(int errorno, | |
| 786 | 791 | const char* syscall, | |
| 787 | 792 | const char* message, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1016,8 +1016,14 @@ class Environment : public MemoryRetainer { | |||
| 1016 | 1016 | }; | |
| 1017 | 1017 | ||
| 1018 | 1018 | private: | |
| 1019 | - inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>), | ||
| 1020 | - const char* errmsg); | ||
| 1019 | + // V8 has changed the constructor of exceptions, support both APIs before Node | ||
| 1020 | + // updates to V8 12.1. | ||
| 1021 | + using V8ExceptionConstructorOld = | ||
| 1022 | + v8::Local<v8::Value> (*)(v8::Local<v8::String>); | ||
| 1023 | + using V8ExceptionConstructorNew = | ||
| 1024 | + v8::Local<v8::Value> (*)(v8::Local<v8::String>, v8::Local<v8::Value>); | ||
| 1025 | + inline void ThrowError(V8ExceptionConstructorOld fun, const char* errmsg); | ||
| 1026 | + inline void ThrowError(V8ExceptionConstructorNew fun, const char* errmsg); | ||
| 1021 | 1027 | void TrackContext(v8::Local<v8::Context> context); | |
| 1022 | 1028 | void UntrackContext(v8::Local<v8::Context> context); | |
| 1023 | 1029 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -968,11 +968,8 @@ napi_define_class(napi_env env, | |||
| 968 | 968 | env, p->setter, p->data, &setter_tpl)); | |
| 969 | 969 | } | |
| 970 | 970 | ||
| 971 | - tpl->PrototypeTemplate()->SetAccessorProperty(property_name, | ||
| 972 | - getter_tpl, | ||
| 973 | - setter_tpl, | ||
| 974 | - attributes, | ||
| 975 | - v8::AccessControl::DEFAULT); | ||
| 971 | + tpl->PrototypeTemplate()->SetAccessorProperty( | ||
| 972 | + property_name, getter_tpl, setter_tpl, attributes); | ||
| 976 | 973 | } else if (p->method != nullptr) { | |
| 977 | 974 | v8::Local<v8::FunctionTemplate> t; | |
| 978 | 975 | STATUS_CALL(v8impl::FunctionCallbackWrapper::NewTemplate( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -680,37 +680,38 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, | |||
| 680 | 680 | Local<ObjectTemplate> target) { | |
| 681 | 681 | Isolate* isolate = isolate_data->isolate(); | |
| 682 | 682 | ||
| 683 | - target->SetAccessor(isolate_data->config_string(), | ||
| 684 | - ConfigStringGetter, | ||
| 685 | - nullptr, | ||
| 686 | - Local<Value>(), | ||
| 687 | - DEFAULT, | ||
| 688 | - None, | ||
| 689 | - SideEffectType::kHasNoSideEffect); | ||
| 690 | - | ||
| 691 | - target->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"), | ||
| 692 | - BuiltinIdsGetter, | ||
| 693 | - nullptr, | ||
| 694 | - Local<Value>(), | ||
| 695 | - DEFAULT, | ||
| 696 | - None, | ||
| 697 | - SideEffectType::kHasNoSideEffect); | ||
| 698 | - | ||
| 699 | - target->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "builtinCategories"), | ||
| 700 | - GetBuiltinCategories, | ||
| 701 | - nullptr, | ||
| 702 | - Local<Value>(), | ||
| 703 | - DEFAULT, | ||
| 704 | - None, | ||
| 705 | - SideEffectType::kHasNoSideEffect); | ||
| 706 | - | ||
| 707 | - target->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "natives"), | ||
| 708 | - GetNatives, | ||
| 709 | - nullptr, | ||
| 710 | - Local<Value>(), | ||
| 711 | - DEFAULT, | ||
| 712 | - None, | ||
| 713 | - SideEffectType::kHasNoSideEffect); | ||
| 683 | + target->SetNativeDataProperty(isolate_data->config_string(), | ||
| 684 | + ConfigStringGetter, | ||
| 685 | + nullptr, | ||
| 686 | + Local<Value>(), | ||
| 687 | + None, | ||
| 688 | + DEFAULT, | ||
| 689 | + SideEffectType::kHasNoSideEffect); | ||
| 690 | + | ||
| 691 | + target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"), | ||
| 692 | + BuiltinIdsGetter, | ||
| 693 | + nullptr, | ||
| 694 | + Local<Value>(), | ||
| 695 | + None, | ||
| 696 | + DEFAULT, | ||
| 697 | + SideEffectType::kHasNoSideEffect); | ||
| 698 | + | ||
| 699 | + target->SetNativeDataProperty( | ||
| 700 | + FIXED_ONE_BYTE_STRING(isolate, "builtinCategories"), | ||
| 701 | + GetBuiltinCategories, | ||
| 702 | + nullptr, | ||
| 703 | + Local<Value>(), | ||
| 704 | + None, | ||
| 705 | + DEFAULT, | ||
| 706 | + SideEffectType::kHasNoSideEffect); | ||
| 707 | + | ||
| 708 | + target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"), | ||
| 709 | + GetNatives, | ||
| 710 | + nullptr, | ||
| 711 | + Local<Value>(), | ||
| 712 | + None, | ||
| 713 | + DEFAULT, | ||
| 714 | + SideEffectType::kHasNoSideEffect); | ||
| 714 | 715 | ||
| 715 | 716 | SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage); | |
| 716 | 717 | SetMethod(isolate, target, "compileFunction", BuiltinLoader::CompileFunction); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments