File tree Expand file tree Collapse file tree 5 files changed +30
-0
lines changed
Expand file tree Collapse file tree 5 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1212#include < node_object_wrap.h>
1313#include < node_buffer.h>
1414
15+ // v8::Object::GetPrototype has been deprecated. See http://crbug.com/333672197
16+ #if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
17+ #define USE_GETPROTOTYPEV2
18+ #endif
19+
1520struct Addon ;
1621class Database ;
1722class Statement ;
@@ -46,7 +51,12 @@ class Backup;
4651#include " objects/statement-iterator.cpp"
4752
4853NODE_MODULE_INIT (/* exports, context */ ) {
54+ #if defined(NODE_MODULE_VERSION) && NODE_MODULE_VERSION >= 140
55+ // Use Isolate::GetCurrent as stated in deprecation message within v8_context.h 13.9.72320122
56+ v8::Isolate* isolate = v8::Isolate::GetCurrent ();
57+ #else
4958 v8::Isolate* isolate = context->GetIsolate ();
59+ #endif
5060 v8::HandleScope scope (isolate);
5161 Addon::ConfigureURI ();
5262
Original file line number Diff line number Diff line change @@ -363,7 +363,11 @@ NODE_METHOD(Statement::JS_columns) {
363363 );
364364 columns.emplace_back (
365365 v8::Object::New (isolate,
366+ #ifdef USE_GETPROTOTYPEV2
367+ v8::Object::New (isolate)->GetPrototypeV2 (),
368+ #else
366369 v8::Object::New (isolate)->GetPrototype (),
370+ #endif
367371 keys.data (),
368372 values.data (),
369373 keys.size ()
Original file line number Diff line number Diff line change @@ -33,10 +33,18 @@ class Binder {
3333 };
3434
3535 static bool IsPlainObject (v8::Isolate* isolate, v8::Local<v8::Object> obj) {
36+ #ifdef USE_GETPROTOTYPEV2
37+ v8::Local<v8::Value> proto = obj->GetPrototypeV2 ();
38+ #else
3639 v8::Local<v8::Value> proto = obj->GetPrototype ();
40+ #endif
3741 v8::Local<v8::Context> ctx = obj->GetCreationContext ().ToLocalChecked ();
3842 ctx->Enter ();
43+ #ifdef USE_GETPROTOTYPEV2
44+ v8::Local<v8::Value> baseProto = v8::Object::New (isolate)->GetPrototypeV2 ();
45+ #else
3946 v8::Local<v8::Value> baseProto = v8::Object::New (isolate)->GetPrototype ();
47+ #endif
4048 ctx->Exit ();
4149 return proto->StrictEquals (baseProto) || proto->StrictEquals (v8::Null (isolate));
4250 }
Original file line number Diff line number Diff line change @@ -146,7 +146,11 @@ namespace Data {
146146 }
147147 return v8::Object::New (
148148 isolate,
149+ #ifdef USE_GETPROTOTYPEV2
150+ v8::Object::New (isolate)->GetPrototypeV2 (),
151+ #else
149152 v8::Object::New (isolate)->GetPrototype (),
153+ #endif
150154 keys.data (),
151155 values.data (),
152156 column_count
Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ class RowBuilder {
3333 }
3434
3535 return v8::Object::New (isolate,
36+ #ifdef USE_GETPROTOTYPEV2
37+ v8::Object::New (isolate)->GetPrototypeV2 (),
38+ #else
3639 v8::Object::New (isolate)->GetPrototype (),
40+ #endif
3741 keys.data (),
3842 values.data (),
3943 column_count
You can’t perform that action at this time.
0 commit comments