зеркало из https://github.com/microsoft/CCF.git
minor v8 changes (#3344)
This commit is contained in:
Родитель
3f67461a32
Коммит
40e11a5ba8
|
@ -309,14 +309,18 @@ namespace ccf::v8_tmpl
|
|||
crypto::Pem pub = k->public_key_pem();
|
||||
|
||||
v8::Local<v8::Object> value = v8::Object::New(isolate);
|
||||
value->Set(
|
||||
context,
|
||||
v8_util::to_v8_str(isolate, "privateKey"),
|
||||
v8_util::to_v8_str(isolate, prv.str()));
|
||||
value->Set(
|
||||
context,
|
||||
v8_util::to_v8_str(isolate, "publicKey"),
|
||||
v8_util::to_v8_str(isolate, pub.str()));
|
||||
value
|
||||
->Set(
|
||||
context,
|
||||
v8_util::to_v8_str(isolate, "privateKey"),
|
||||
v8_util::to_v8_str(isolate, prv.str()))
|
||||
.Check();
|
||||
value
|
||||
->Set(
|
||||
context,
|
||||
v8_util::to_v8_str(isolate, "publicKey"),
|
||||
v8_util::to_v8_str(isolate, pub.str()))
|
||||
.Check();
|
||||
|
||||
info.GetReturnValue().Set(value);
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@ namespace ccf::v8_tmpl
|
|||
}
|
||||
|
||||
template <class T>
|
||||
void set_internal_field_count(v8::Local<v8::ObjectTemplate> tmpl)
|
||||
static void set_internal_field_count(v8::Local<v8::ObjectTemplate> tmpl)
|
||||
{
|
||||
static_assert(std::is_enum_v<T>, "T must be an enum class");
|
||||
tmpl->SetInternalFieldCount(static_cast<int>(T::END));
|
||||
}
|
||||
|
||||
template <class T, size_t N = static_cast<size_t>(T::END)>
|
||||
void set_internal_fields(
|
||||
static void set_internal_fields(
|
||||
v8::Local<v8::Object> obj, const std::array<std::pair<T, void*>, N>& fields)
|
||||
{
|
||||
static_assert(std::is_enum_v<T>, "T must be an enum value");
|
||||
|
@ -53,7 +53,7 @@ namespace ccf::v8_tmpl
|
|||
}
|
||||
|
||||
template <class T>
|
||||
void* get_internal_field(v8::Local<v8::Object> obj, T enum_value)
|
||||
static void* get_internal_field(v8::Local<v8::Object> obj, T enum_value)
|
||||
{
|
||||
static_assert(std::is_enum_v<T>, "T must be an enum value");
|
||||
return obj->GetAlignedPointerFromInternalField(
|
||||
|
|
|
@ -333,6 +333,9 @@ namespace ccf
|
|||
v8::HandleScope handle_scope(isolate_);
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate_);
|
||||
context->SetAlignedPointerInEmbedderData(kContextEmbedderDataField, this);
|
||||
context->SetAlignedPointerInEmbedderData(
|
||||
kFinalizerEmbedderDataField, nullptr);
|
||||
context->SetAlignedPointerInEmbedderData(kModuleEmbedderDataField, nullptr);
|
||||
context->Enter();
|
||||
context_.Reset(isolate_, context);
|
||||
}
|
||||
|
@ -378,7 +381,7 @@ namespace ccf
|
|||
v8::Local<v8::Context> context = get_context();
|
||||
context->Global()
|
||||
->Set(context, v8_util::to_v8_istr(isolate_, name), value)
|
||||
.FromJust();
|
||||
.Check();
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> V8Context::run(
|
||||
|
|
|
@ -54,11 +54,8 @@ def test_module_import(network, args):
|
|||
|
||||
|
||||
@reqs.description("Test dynamic module import")
|
||||
@reqs.installed_package("libjs_v8")
|
||||
def test_dynamic_module_import(network, args):
|
||||
if args.package != "libjs_v8":
|
||||
LOG.warning("Skipping test_dynamic_endpoints, requires V8")
|
||||
return network
|
||||
|
||||
primary, _ = network.find_nodes()
|
||||
|
||||
# Update JS app, deploying modules _and_ app script that imports module
|
||||
|
@ -74,11 +71,8 @@ def test_dynamic_module_import(network, args):
|
|||
|
||||
|
||||
@reqs.description("Test module bytecode caching")
|
||||
@reqs.installed_package("libjs_generic")
|
||||
def test_bytecode_cache(network, args):
|
||||
if args.package == "libjs_v8":
|
||||
LOG.warning("Skipping test_bytecode_cache, not supported on V8")
|
||||
return network
|
||||
|
||||
primary, _ = network.find_nodes()
|
||||
|
||||
bundle_dir = os.path.join(THIS_DIR, "basic-module-import")
|
||||
|
|
Загрузка…
Ссылка в новой задаче