From 054cbcd6eb2885e91a61e491da5b38e1a5d25855 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 4 Sep 2024 08:56:14 -0500 Subject: [PATCH] fix: don't use deprecate-soon class v8::String::Value (#43518) * fix: remove use of deprecated v8::String::Value Upstream marked v8::String::Value as `V8_DEPRECATE_SOON` last month, so let's stop using it. The replacement code mostly does the same as v8::String::Value(); but since our test only cares about the length and not the contents, we get a small perf win of not needing to allocate a char array and not needing to call Local::String::Write(). Upstream V8_DEPRECATE_SOON: Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5667299kkk v8::String::Value() implementation: https://chromium.googlesource.com/v8/v8/+/20226b740bfa1a1e46dff80363232dfd3da50de8/src/api/api.cc#10883 History on why we used it: https://github.com/electron/electron/pull/19792/commits/80c1a9739d191d2e393e56e2b254fb72bf6859e9 https://github.com/electron/electron/pull/19792/commits/f49ed30f7205d7295ab035c6f1b3702cf7e3217c * Update shell/common/gin_converters/file_path_converter.h Co-authored-by: Robo * fixup! Update shell/common/gin_converters/file_path_converter.h do not return success for all non-Null non-Strings --------- Co-authored-by: Robo --- shell/common/gin_converters/file_path_converter.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shell/common/gin_converters/file_path_converter.h b/shell/common/gin_converters/file_path_converter.h index 2341ff599bcb..e8780b8f8c7f 100644 --- a/shell/common/gin_converters/file_path_converter.h +++ b/shell/common/gin_converters/file_path_converter.h @@ -23,9 +23,8 @@ struct Converter { if (val->IsNull()) return true; - v8::String::Value str(isolate, val); - if (str.length() == 0) { - *out = base::FilePath(); + if (val->IsString() && v8::Local::Cast(val)->Length() == 0) { + *out = {}; return true; }