mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1849238 - Improve and rename JS::ObjectToCompletePropertyDescriptor. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D186504
This commit is contained in:
parent
e7dae1d581
commit
3d1f26d276
@ -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);
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user