src: use HandleScope in StreamReq::Done()

Fixes: https://github.com/nodejs/node/issues/38707

PR-URL: https://github.com/nodejs/node/pull/38720
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Darshan Sen authored and Richard Lau committed 2021-07-19 07:17:06 -04:00
1 parent f50d45961e
commit ee66cfca79
2 files changed
+14

No files matched your search

+1
View File
@@ -279,6 +279,7 @@ void StreamReq::Done(int status, const char* error_str) {
AsyncWrap* async_wrap = GetAsyncWrap();
Environment* env = async_wrap->env();
if (error_str != nullptr) {
v8::HandleScope handle_scope(env->isolate());
async_wrap->object()->Set(env->context(),
env->error_string(),
OneByteString(env->isolate(), error_str))
@@ -0,0 +1,13 @@
'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const https = require('https');
const request = https.get('https://example.com');
request.on('socket', (socket) => {
socket.unref();
});