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 { namespace JS {
extern JS_PUBLIC_API bool ObjectToCompletePropertyDescriptor( // https://tc39.es/ecma262/#sec-topropertydescriptor
JSContext* cx, Handle<JSObject*> obj, Handle<Value> descriptor, // 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); MutableHandle<PropertyDescriptor> desc);
/* /*

View File

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