Switch away from deprecated v8::Object::SetAccessor() calls
Use SetNativeDataProperty() instead, as seen in the deprecation message
added in https://crrev.com/c/5006387.
Change-Id: I20ed62bfc9123c337a98bb43d467a6457b74d8b1
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/114370
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fxjs/cfx_v8_unittest.cpp b/fxjs/cfx_v8_unittest.cpp
index 0a2dca8..12b9f43 100644
--- a/fxjs/cfx_v8_unittest.cpp
+++ b/fxjs/cfx_v8_unittest.cpp
@@ -235,15 +235,15 @@
v8::Local<v8::Object> object = cfx_v8()->NewObject();
v8::Local<v8::String> name = cfx_v8()->NewString("clams");
- EXPECT_TRUE(
- object
- ->SetAccessor(context, name,
- [](v8::Local<v8::Name> property,
- const v8::PropertyCallbackInfo<v8::Value>& info) {
- getter_sentinel = true;
- info.GetIsolate()->ThrowException(property);
- })
- .FromJust());
+ EXPECT_TRUE(object
+ ->SetNativeDataProperty(
+ context, name,
+ [](v8::Local<v8::Name> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ getter_sentinel = true;
+ info.GetIsolate()->ThrowException(property);
+ })
+ .FromJust());
getter_sentinel = false;
EXPECT_TRUE(cfx_v8()->GetObjectProperty(object, "clams").IsEmpty());
EXPECT_TRUE(getter_sentinel);
@@ -257,15 +257,16 @@
v8::Local<v8::Object> object = cfx_v8()->NewObject();
v8::Local<v8::String> name = cfx_v8()->NewString("clams");
- EXPECT_TRUE(object
- ->SetAccessor(context, name, nullptr,
- [](v8::Local<v8::Name> property,
- v8::Local<v8::Value> value,
- const v8::PropertyCallbackInfo<void>& info) {
- setter_sentinel = true;
- info.GetIsolate()->ThrowException(property);
- })
- .FromJust());
+ EXPECT_TRUE(
+ object
+ ->SetNativeDataProperty(
+ context, name, nullptr,
+ [](v8::Local<v8::Name> property, v8::Local<v8::Value> value,
+ const v8::PropertyCallbackInfo<void>& info) {
+ setter_sentinel = true;
+ info.GetIsolate()->ThrowException(property);
+ })
+ .FromJust());
setter_sentinel = false;
cfx_v8()->PutObjectProperty(object, "clams", name);
EXPECT_TRUE(setter_sentinel);