fix(neon-sys): Fix getting buffer contents on legacy backend
Fixes
@@ -219,14 +219,19 @@ extern "C" bool Neon_ArrayBuffer_New(v8::Local<v8::ArrayBuffer> *out, v8::Isolat
return true;
}
+
extern "C" size_t Neon_ArrayBuffer_Data(v8::Isolate *isolate, void **base_out, v8::Local<v8::ArrayBuffer> buffer) {
+#if (V8_MAJOR_VERSION >= 8)
+ auto contents = buffer->GetBackingStore();
+ *base_out = contents->Data();
+ return contents->ByteLength();
+#else
v8::ArrayBuffer::Contents contents = buffer->GetContents();
*base_out = contents.Data();
-
return contents.ByteLength();
+#endif
}
-
extern "C" bool Neon_Tag_IsArrayBuffer(v8::Isolate *isolate, v8::Local<v8::Value> value) {
return value->IsArrayBuffer();
}
