diff --git a/src/env_properties.h b/src/env_properties.h index d9e18cbc4515ac..55116d463bb844 100644 --- a/src/env_properties.h +++ b/src/env_properties.h @@ -71,6 +71,9 @@ V(__dirname_string, "__dirname") \ V(ack_string, "ack") \ V(address_string, "address") \ + V(source_db_string, "sourceDb") \ + V(target_db_string, "targetDb") \ + V(progress_string, "progress") \ V(aliases_string, "aliases") \ V(alpn_callback_string, "ALPNCallback") \ V(args_string, "args") \ diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc index 50c4554667d38a..c1f4a8e09e141f 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc @@ -91,12 +91,11 @@ inline MaybeLocal CreateSQLiteError(Isolate* isolate, int errcode) { Environment* env = Environment::GetCurrent(isolate); if (!String::NewFromUtf8(isolate, errstr).ToLocal(&js_errmsg) || !CreateSQLiteError(isolate, errstr).ToLocal(&e) || - e->Set(isolate->GetCurrentContext(), + e->Set(env->context(), env->errcode_string(), Integer::New(isolate, errcode)) .IsNothing() || - e->Set(isolate->GetCurrentContext(), env->errstr_string(), js_errmsg) - .IsNothing()) { + e->Set(env->context(), env->errstr_string(), js_errmsg).IsNothing()) { return MaybeLocal(); } return e; @@ -772,16 +771,9 @@ void DatabaseSync::Backup(const FunctionCallbackInfo& args) { } Local options = args[1].As(); - Local progress_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "progress"); - Local rate_string = FIXED_ONE_BYTE_STRING(env->isolate(), "rate"); - Local target_db_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "targetDb"); - Local source_db_string = - FIXED_ONE_BYTE_STRING(env->isolate(), "sourceDb"); Local rateValue; - if (!options->Get(env->context(), rate_string).ToLocal(&rateValue)) { + if (!options->Get(env->context(), env->rate_string()).ToLocal(&rateValue)) { return; } @@ -797,7 +789,7 @@ void DatabaseSync::Backup(const FunctionCallbackInfo& args) { } Local sourceDbValue; - if (!options->Get(env->context(), source_db_string) + if (!options->Get(env->context(), env->source_db_string()) .ToLocal(&sourceDbValue)) { return; } @@ -815,7 +807,7 @@ void DatabaseSync::Backup(const FunctionCallbackInfo& args) { } Local targetDbValue; - if (!options->Get(env->context(), target_db_string) + if (!options->Get(env->context(), env->target_db_string()) .ToLocal(&targetDbValue)) { return; } @@ -833,7 +825,7 @@ void DatabaseSync::Backup(const FunctionCallbackInfo& args) { } Local progressValue; - if (!options->Get(env->context(), progress_string) + if (!options->Get(env->context(), env->progress_string()) .ToLocal(&progressValue)) { return; }