Browse Source

5604487: Reland "[api] Deprecate v8::FunctionCallbackInfo::Holder() for real"

https://chromium-review.googlesource.com/c/v8/v8/+/5604487
John Kleinschmidt 10 months ago
parent
commit
098ebbb759

+ 1 - 0
patches/node/.patches

@@ -50,3 +50,4 @@ src_do_not_use_deprecated_v8_api.patch
 src_use_new_v8_api_to_define_stream_accessor.patch
 src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch
 test_update_v8-stats_test_for_v8_12_6.patch
+chore_remove_calls_to_v8_functioncallbackinfo_holder.patch

+ 24 - 0
patches/node/chore_remove_calls_to_v8_functioncallbackinfo_holder.patch

@@ -0,0 +1,24 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: John Kleinschmidt <[email protected]>
+Date: Mon, 10 Jun 2024 11:18:56 -0500
+Subject: chore: remove calls to v8::FunctionCallbackInfo::Holder()
+
+Use This() instead.
+Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5604487
+https://issues.chromium.org/issues/333672197
+
+This patch can be removed once Node addresses this change.
+
+diff --git a/src/node_internals.h b/src/node_internals.h
+index 6b4ec38bd092358a9433a1179dbe1e71f56aa387..0a9eaba5c71f711c58799d77a9de6072304deb9a 100644
+--- a/src/node_internals.h
++++ b/src/node_internals.h
+@@ -67,7 +67,7 @@ template <typename T, int (*F)(const typename T::HandleType*, sockaddr*, int*)>
+ void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
+   T* wrap;
+   ASSIGN_OR_RETURN_UNWRAP(&wrap,
+-                          args.Holder(),
++                          args.This(),
+                           args.GetReturnValue().Set(UV_EBADF));
+   CHECK(args[0]->IsObject());
+   sockaddr_storage storage;

+ 6 - 6
shell/common/api/electron_api_asar.cc

@@ -66,7 +66,7 @@ class Archive : public node::ObjectWrap {
   // Reads the offset and size of file.
   static void GetFileInfo(const v8::FunctionCallbackInfo<v8::Value>& args) {
     auto* isolate = args.GetIsolate();
-    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.Holder());
+    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.This());
 
     base::FilePath path;
     if (!gin::ConvertFromV8(isolate, args[0], &path)) {
@@ -104,7 +104,7 @@ class Archive : public node::ObjectWrap {
   // Returns a fake result of fs.stat(path).
   static void Stat(const v8::FunctionCallbackInfo<v8::Value>& args) {
     auto* isolate = args.GetIsolate();
-    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.Holder());
+    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.This());
     base::FilePath path;
     if (!gin::ConvertFromV8(isolate, args[0], &path)) {
       args.GetReturnValue().Set(v8::False(isolate));
@@ -127,7 +127,7 @@ class Archive : public node::ObjectWrap {
   // Returns all files under a directory.
   static void Readdir(const v8::FunctionCallbackInfo<v8::Value>& args) {
     auto* isolate = args.GetIsolate();
-    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.Holder());
+    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.This());
     base::FilePath path;
     if (!gin::ConvertFromV8(isolate, args[0], &path)) {
       args.GetReturnValue().Set(v8::False(isolate));
@@ -145,7 +145,7 @@ class Archive : public node::ObjectWrap {
   // Returns the path of file with symbol link resolved.
   static void Realpath(const v8::FunctionCallbackInfo<v8::Value>& args) {
     auto* isolate = args.GetIsolate();
-    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.Holder());
+    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.This());
     base::FilePath path;
     if (!gin::ConvertFromV8(isolate, args[0], &path)) {
       args.GetReturnValue().Set(v8::False(isolate));
@@ -163,7 +163,7 @@ class Archive : public node::ObjectWrap {
   // Copy the file out into a temporary file and returns the new path.
   static void CopyFileOut(const v8::FunctionCallbackInfo<v8::Value>& args) {
     auto* isolate = args.GetIsolate();
-    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.Holder());
+    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.This());
     base::FilePath path;
     if (!gin::ConvertFromV8(isolate, args[0], &path)) {
       args.GetReturnValue().Set(v8::False(isolate));
@@ -181,7 +181,7 @@ class Archive : public node::ObjectWrap {
   // Return the file descriptor.
   static void GetFD(const v8::FunctionCallbackInfo<v8::Value>& args) {
     auto* isolate = args.GetIsolate();
-    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.Holder());
+    auto* wrap = node::ObjectWrap::Unwrap<Archive>(args.This());
 
     args.GetReturnValue().Set(gin::ConvertToV8(
         isolate, wrap->archive_ ? wrap->archive_->GetUnsafeFD() : -1));

+ 2 - 2
shell/common/gin_helper/destroyable.cc

@@ -23,7 +23,7 @@ v8::Global<v8::FunctionTemplate>* GetIsDestroyedFunc() {
 }
 
 void DestroyFunc(const v8::FunctionCallbackInfo<v8::Value>& info) {
-  v8::Local<v8::Object> holder = info.Holder();
+  v8::Local<v8::Object> holder = info.This();
   if (Destroyable::IsDestroyed(holder))
     return;
 
@@ -35,7 +35,7 @@ void DestroyFunc(const v8::FunctionCallbackInfo<v8::Value>& info) {
 
 void IsDestroyedFunc(const v8::FunctionCallbackInfo<v8::Value>& info) {
   info.GetReturnValue().Set(gin::ConvertToV8(
-      info.GetIsolate(), Destroyable::IsDestroyed(info.Holder())));
+      info.GetIsolate(), Destroyable::IsDestroyed(info.This())));
 }
 
 }  // namespace