src: refactor Environment::GetCurrent(isolate) usage

Do not require an explicit `HandleScope`, or the ability to create
one, when using `Environment::GetCurrent()`.

`isolate->InContext()` is used as an indicator that it is probably
okay to create a `HandleScope`, see also the short discussion in
https://github.com/nodejs/node/pull/25775#pullrequestreview-197371049.

PR-URL: https://github.com/nodejs/node/pull/26376
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Anna Henningsen committed 2019-03-05 22:40:00 +01:00
1 parent cc4e8e0696
commit c2f620ab76
5 files changed
+13 -9

No files matched your search

-1
View File
@@ -314,7 +314,6 @@ void OnFatalError(const char* location, const char* message) {
}
#ifdef NODE_REPORT
Isolate* isolate = Isolate::GetCurrent();
HandleScope handle_scope(isolate);
Environment* env = Environment::GetCurrent(isolate);
if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) {
report::TriggerNodeReport(