Hand copies of ArrayBuffers where we have to

This commit is contained in:
Alex Hultman
2021-10-28 21:12:15 +02:00
parent dabb0e9ebd
commit 88efc09f21
3 changed files with 12 additions and 13 deletions

View File

@@ -106,8 +106,7 @@ struct HttpResponseWrapper {
if (res) {
std::string_view ip = res->getRemoteAddress();
/* Todo: we need to pass a copy here */
args.GetReturnValue().Set(ArrayBuffer_New(isolate, (void *) ip.data(), ip.length()/*, ArrayBufferCreationMode::kInternalized*/));
args.GetReturnValue().Set(ArrayBuffer_NewCopy(isolate, (void *) ip.data(), ip.length()));
}
}
@@ -119,8 +118,7 @@ struct HttpResponseWrapper {
if (res) {
std::string_view ip = res->getRemoteAddressAsText();
/* Todo: we need to pass a copy here */
args.GetReturnValue().Set(ArrayBuffer_New(isolate, (void *) ip.data(), ip.length()/*, ArrayBufferCreationMode::kInternalized*/));
args.GetReturnValue().Set(ArrayBuffer_NewCopy(isolate, (void *) ip.data(), ip.length()));
}
}
@@ -132,8 +130,7 @@ struct HttpResponseWrapper {
if (res) {
std::string_view ip = res->getProxiedRemoteAddress();
/* Todo: we need to pass a copy here */
args.GetReturnValue().Set(ArrayBuffer_New(isolate, (void *) ip.data(), ip.length()/*, ArrayBufferCreationMode::kInternalized*/));
args.GetReturnValue().Set(ArrayBuffer_NewCopy(isolate, (void *) ip.data(), ip.length()));
}
}
@@ -145,8 +142,7 @@ struct HttpResponseWrapper {
if (res) {
std::string_view ip = res->getProxiedRemoteAddressAsText();
/* Todo: we need to pass a copy here */
args.GetReturnValue().Set(ArrayBuffer_New(isolate, (void *) ip.data(), ip.length()/*, ArrayBufferCreationMode::kInternalized*/));
args.GetReturnValue().Set(ArrayBuffer_NewCopy(isolate, (void *) ip.data(), ip.length()));
}
}