Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

fix: add missing handlescope #332

Merged
merged 1 commit into from
Nov 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/async.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ void SetPasswordWorker::Execute() {
}

void SetPasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
deferred.Resolve(Env().Undefined());
}

void SetPasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -75,6 +77,7 @@ void GetPasswordWorker::Execute() {
}

void GetPasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
Napi::Value val = Env().Null();
if (success) {
val = Napi::String::New(Env(), password.data(),
Expand All @@ -84,6 +87,7 @@ void GetPasswordWorker::OnOK() {
}

void GetPasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -115,10 +119,12 @@ void DeletePasswordWorker::Execute() {
}

void DeletePasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
deferred.Resolve(Napi::Boolean::New(Env(), success));
}

void DeletePasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -150,6 +156,7 @@ void FindPasswordWorker::Execute() {
}

void FindPasswordWorker::OnOK() {
Napi::HandleScope scope(Env());
Napi::Value val = Env().Null();
if (success) {
val = Napi::String::New(Env(), password.data(),
Expand All @@ -159,6 +166,7 @@ void FindPasswordWorker::OnOK() {
}

void FindPasswordWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}

Expand Down Expand Up @@ -190,6 +198,7 @@ void FindCredentialsWorker::Execute() {
}

void FindCredentialsWorker::OnOK() {
Napi::HandleScope scope(Env());
Napi::Env env = Env();

if (success) {
Expand Down Expand Up @@ -228,5 +237,6 @@ void FindCredentialsWorker::OnOK() {
}

void FindCredentialsWorker::OnError(Napi::Error const &error) {
Napi::HandleScope scope(Env());
deferred.Reject(error.Value());
}