diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index fe124d44c644c5..f51efbdf503671 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -3070,12 +3070,12 @@ class V8_EXPORT Object : public Value { Local context, Local key); /** - * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. + * Returns Object.getOwnPropertyDescriptor as per ES2016 section 19.1.2.6. */ V8_DEPRECATED("Use maybe version", - Local GetOwnPropertyDescriptor(Local key)); + Local GetOwnPropertyDescriptor(Local key)); V8_WARN_UNUSED_RESULT MaybeLocal GetOwnPropertyDescriptor( - Local context, Local key); + Local context, Local key); V8_DEPRECATE_SOON("Use maybe version", bool Has(Local key)); /** diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index cacf469d0dd555..1b8bafacc29919 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -4530,12 +4530,11 @@ PropertyAttribute v8::Object::GetPropertyAttributes(v8::Local key) { .FromMaybe(static_cast(i::NONE)); } - MaybeLocal v8::Object::GetOwnPropertyDescriptor(Local context, - Local key) { + Local key) { PREPARE_FOR_EXECUTION(context, Object, GetOwnPropertyDescriptor, Value); i::Handle obj = Utils::OpenHandle(this); - i::Handle key_name = Utils::OpenHandle(*key); + i::Handle key_name = Utils::OpenHandle(*key); i::PropertyDescriptor desc; Maybe found = @@ -4548,8 +4547,7 @@ MaybeLocal v8::Object::GetOwnPropertyDescriptor(Local context, RETURN_ESCAPED(Utils::ToLocal(desc.ToObject(isolate))); } - -Local v8::Object::GetOwnPropertyDescriptor(Local key) { +Local v8::Object::GetOwnPropertyDescriptor(Local key) { auto context = ContextFromHeapObject(Utils::OpenHandle(this)); RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyDescriptor(context, key), Value); } diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index f2cbc7dabfe90f..81d2ff1b1ef4a8 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -24362,12 +24362,13 @@ TEST(GetOwnPropertyDescriptor) { v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); CompileRun( - "var x = { value : 13};" - "Object.defineProperty(x, 'p0', {value : 12});" - "Object.defineProperty(x, 'p1', {" - " set : function(value) { this.value = value; }," - " get : function() { return this.value; }," - "});"); + "var x = { value : 13};" + "Object.defineProperty(x, 'p0', {value : 12});" + "Object.defineProperty(x, Symbol.toStringTag, {value: 'foo'});" + "Object.defineProperty(x, 'p1', {" + " set : function(value) { this.value = value; }," + " get : function() { return this.value; }," + "});"); Local x = Local::Cast( env->Global()->Get(env.local(), v8_str("x")).ToLocalChecked()); Local desc = @@ -24401,6 +24402,14 @@ TEST(GetOwnPropertyDescriptor) { ->Equals(env.local(), get->Call(env.local(), x, 0, NULL).ToLocalChecked()) .FromJust()); + desc = + x->GetOwnPropertyDescriptor(env.local(), Symbol::GetToStringTag(isolate)) + .ToLocalChecked(); + CHECK(v8_str("foo") + ->Equals(env.local(), Local::Cast(desc) + ->Get(env.local(), v8_str("value")) + .ToLocalChecked()) + .FromJust()); }