diff --git a/package-lock.json b/package-lock.json index 3bd3e17..5b3ab17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -202,7 +202,7 @@ "integrity": "sha1-uDx1fIAOaOHW78GjoaE/85/23NI=", "dev": true, "requires": { - "jasmine-node": "git+https://github.com/kevinsawicki/jasmine-node.git#81af4f953a2b7dfb5bde8331c05362a4b464c5ef", + "jasmine-node": "jasmine-node@git+https://github.com/kevinsawicki/jasmine-node.git#81af4f953a2b7dfb5bde8331c05362a4b464c5ef", "underscore-plus": "1.x", "walkdir": "0.0.7" } diff --git a/src/main.cc b/src/main.cc index 0318ac5..b834148 100644 --- a/src/main.cc +++ b/src/main.cc @@ -134,9 +134,15 @@ class Spellchecker : public Nan::ObjectWrap { uint32_t start = iter->start, end = iter->end; Local misspelled_range = Nan::New(); - misspelled_range->Set(Nan::New("start").ToLocalChecked(), Nan::New(start)); - misspelled_range->Set(Nan::New("end").ToLocalChecked(), Nan::New(end)); - result->Set(index, misspelled_range); + { + Isolate* isolate = misspelled_range->GetIsolate(); + Local context = isolate->GetCurrentContext(); + misspelled_range->Set(context, Nan::New("start").ToLocalChecked(), Nan::New(start)).Check(); + misspelled_range->Set(context, Nan::New("end").ToLocalChecked(), Nan::New(end)).Check(); + } + Isolate* isolate = result->GetIsolate(); + Local context = isolate->GetCurrentContext(); + result->Set(context, index, misspelled_range).Check(); } } @@ -220,7 +226,9 @@ class Spellchecker : public Nan::ObjectWrap { Local result = Nan::New(dictionaries.size()); for (size_t i = 0; i < dictionaries.size(); ++i) { const std::string& dict = dictionaries[i]; - result->Set(i, Nan::New(dict.data(), dict.size()).ToLocalChecked()); + Isolate* isolate = result->GetIsolate(); + Local context = isolate->GetCurrentContext(); + result->Set(context, i, Nan::New(dict.data(), dict.size()).ToLocalChecked()).Check(); } info.GetReturnValue().Set(result); @@ -246,7 +254,9 @@ class Spellchecker : public Nan::ObjectWrap { const std::string& word = corrections[i]; Nan::MaybeLocal val = Nan::New(word.data(), word.size()); - result->Set(i, val.ToLocalChecked()); + Isolate* isolate = result->GetIsolate(); + Local context = isolate->GetCurrentContext(); + result->Set(context, i, val.ToLocalChecked()).Check(); } info.GetReturnValue().Set(result); @@ -286,7 +296,7 @@ class Spellchecker : public Nan::ObjectWrap { Isolate* isolate = exports->GetIsolate(); Local context = isolate->GetCurrentContext(); - exports->Set(Nan::New("Spellchecker").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked()); + exports->Set(context, Nan::New("Spellchecker").ToLocalChecked(), tpl->GetFunction(context).ToLocalChecked()).Check(); } }; diff --git a/src/worker.cc b/src/worker.cc index fbae5ec..0314e91 100644 --- a/src/worker.cc +++ b/src/worker.cc @@ -35,9 +35,15 @@ void CheckSpellingWorker::HandleOKCallback() { uint32_t start = iter->start, end = iter->end; Local misspelled_range = Nan::New(); - misspelled_range->Set(Nan::New("start").ToLocalChecked(), Nan::New(start)); - misspelled_range->Set(Nan::New("end").ToLocalChecked(), Nan::New(end)); - result->Set(index, misspelled_range); + { + Isolate* isolate = misspelled_range->GetIsolate(); + Local context = isolate->GetCurrentContext(); + misspelled_range->Set(context, Nan::New("start").ToLocalChecked(), Nan::New(start)).Check(); + misspelled_range->Set(context, Nan::New("end").ToLocalChecked(), Nan::New(end)).Check(); + } + Isolate* isolate = result->GetIsolate(); + Local context = isolate->GetCurrentContext(); + result->Set(context, index, misspelled_range).Check(); } Local argv[] = { Nan::Null(), result };