Support Node.js 14
This commit is contained in:
parent
83bee418d2
commit
bd9007eee0
3
build.c
3
build.c
@ -36,7 +36,8 @@ struct node_version {
|
||||
{"v10.17.0", "64"},
|
||||
{"v11.15.0", "67"},
|
||||
{"v12.13.0", "72"},
|
||||
{"v13.1.0", "79"}
|
||||
{"v13.1.0", "79"},
|
||||
{"v14.0.0", "83"}
|
||||
};
|
||||
|
||||
/* Downloads headers, creates folders */
|
||||
|
@ -114,7 +114,7 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
|
||||
CallJS(isolate, Local<Function>::New(isolate, messagePf), 3, argv);
|
||||
|
||||
/* Important: we clear the ArrayBuffer to make sure it is not invalidly used after return */
|
||||
messageArrayBuffer->Neuter();
|
||||
NeuterArrayBuffer(messageArrayBuffer);
|
||||
};
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
|
||||
delete perSocketData->socketPf;
|
||||
|
||||
/* Again, here we clear the buffer to avoid strange bugs */
|
||||
messageArrayBuffer->Neuter();
|
||||
NeuterArrayBuffer(messageArrayBuffer);
|
||||
};
|
||||
|
||||
app->template ws<PerSocketData>(std::string(pattern.getString()), std::move(behavior));
|
||||
|
@ -49,7 +49,7 @@ struct HttpResponseWrapper {
|
||||
Local<Value> argv[] = {dataArrayBuffer, Boolean::New(isolate, last)};
|
||||
CallJS(isolate, Local<Function>::New(isolate, p), 2, argv);
|
||||
|
||||
dataArrayBuffer->Neuter();
|
||||
NeuterArrayBuffer(dataArrayBuffer);
|
||||
});
|
||||
|
||||
args.GetReturnValue().Set(args.Holder());
|
||||
|
@ -40,6 +40,16 @@ bool BooleanValue(Isolate *isolate, Local<Value> value) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void NeuterArrayBuffer(Local<ArrayBuffer> ab) {
|
||||
#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0)
|
||||
/* Old */
|
||||
ab->Neuter();
|
||||
#else
|
||||
/* Node.js 12, 13 */
|
||||
ab->Detach();
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "Utilities.h"
|
||||
#include "WebSocketWrapper.h"
|
||||
#include "HttpResponseWrapper.h"
|
||||
|
Loading…
Reference in New Issue
Block a user