Bug 1849238 - Improve and rename JS::ObjectToCompletePropertyDescriptor. r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D186504
This commit is contained in:
Tom Schuster 2023-08-29 13:26:01 +00:00
parent e7dae1d581
commit 3d1f26d276
2 changed files with 13 additions and 8 deletions

View File

@ -480,8 +480,13 @@ extern JS_PUBLIC_API bool JS_GetUCPropertyDescriptor(
namespace JS {
extern JS_PUBLIC_API bool ObjectToCompletePropertyDescriptor(
JSContext* cx, Handle<JSObject*> obj, Handle<Value> descriptor,
// https://tc39.es/ecma262/#sec-topropertydescriptor
// https://tc39.es/ecma262/#sec-completepropertydescriptor
//
// Implements ToPropertyDescriptor combined with CompletePropertyDescriptor,
// if the former is successful.
extern JS_PUBLIC_API bool ToCompletePropertyDescriptor(
JSContext* cx, Handle<Value> descriptor,
MutableHandle<PropertyDescriptor> desc);
/*

View File

@ -2042,13 +2042,13 @@ JS_PUBLIC_API bool JS::PropertySpecNameToPermanentId(JSContext* cx,
return true;
}
JS_PUBLIC_API bool JS::ObjectToCompletePropertyDescriptor(
JSContext* cx, HandleObject obj, HandleValue descObj,
JS_PUBLIC_API bool JS::ToCompletePropertyDescriptor(
JSContext* cx, HandleValue descriptor,
MutableHandle<PropertyDescriptor> desc) {
// |obj| can be in a different compartment here. The caller is responsible
// for wrapping it (see JS_WrapPropertyDescriptor).
cx->check(descObj);
if (!ToPropertyDescriptor(cx, descObj, true, desc)) {
AssertHeapIsIdle();
CHECK_THREAD(cx);
cx->check(descriptor);
if (!ToPropertyDescriptor(cx, descriptor, /* checkAccessors */ true, desc)) {
return false;
}
CompletePropertyDescriptor(desc);