1
0
forked from nikkuss/pkgs

fix(grimoire): electron 41 with sqlite3 patch

This commit is contained in:
2026-07-20 14:28:22 +01:00
parent d5c2b45a90
commit eef6db3224
2 changed files with 139 additions and 89 deletions
@@ -0,0 +1,47 @@
--- a/src/util/macros.cpp 2026-07-20 13:25:03.226579751 +0100
+++ b/src/util/macros.cpp 2026-07-20 13:25:43.980692531 +0100
@@ -11,6 +11,19 @@
#define GET_PROTOTYPE(obj) ((obj)->GetPrototype())
#endif
+// PropertyCallbackInfo::This() and Holder() were removed; use HolderV2().
+// Tracking bug for V8 API removals: http://crbug.com/333672197
+// V8 head has since restored Holder() and deprecated HolderV2():
+// https://chromium.googlesource.com/v8/v8/+/main/include/v8-function-callback.h
+// V8_INLINE Local<Object> Holder() const;
+// V8_DEPRECATE_SOON("Use Holder().")
+// V8_INLINE Local<Object> HolderV2() const;
+#if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
+#define PROPERTY_HOLDER(info) (info).HolderV2()
+#else
+#define PROPERTY_HOLDER(info) (info).This()
+#endif
+
#define EasyIsolate v8::Isolate* isolate = v8::Isolate::GetCurrent()
#define OnlyIsolate info.GetIsolate()
#define OnlyContext isolate->GetCurrentContext()
--- a/src/objects/database.cpp 2026-07-20 13:25:03.229579774 +0100
+++ b/src/objects/database.cpp 2026-07-20 13:25:52.605028002 +0100
@@ -408,10 +408,10 @@
}
NODE_GETTER(Database::JS_open) {
- info.GetReturnValue().Set(Unwrap<Database>(info.This())->open);
+ info.GetReturnValue().Set(Unwrap<Database>(PROPERTY_HOLDER(info))->open);
}
NODE_GETTER(Database::JS_inTransaction) {
- Database* db = Unwrap<Database>(info.This());
+ Database* db = Unwrap<Database>(PROPERTY_HOLDER(info));
info.GetReturnValue().Set(db->open && !static_cast<bool>(sqlite3_get_autocommit(db->db_handle)));
}
--- a/src/objects/statement.cpp 2026-07-20 13:25:03.231579789 +0100
+++ b/src/objects/statement.cpp 2026-07-20 13:25:52.606984847 +0100
@@ -378,6 +378,6 @@
}
NODE_GETTER(Statement::JS_busy) {
- Statement* stmt = Unwrap<Statement>(info.This());
+ Statement* stmt = Unwrap<Statement>(PROPERTY_HOLDER(info));
info.GetReturnValue().Set(stmt->alive && stmt->locked);
}