Bug 1756941 - Rename getOwnPropertiesLength into getOwnPropertyNamesLength. r=jandem

Depends on D139709

Differential Revision: https://phabricator.services.mozilla.com/D140309
This commit is contained in:
nchevobbe 2022-03-04 15:45:18 +00:00
parent 6617df9161
commit e43696e781
5 changed files with 15 additions and 15 deletions

View File

@ -204,7 +204,7 @@ const proto = {
}
try {
return this.obj.getOwnPropertiesLength();
return this.obj.getOwnPropertyNamesLength();
} catch (err) {
// The above can throw when the debuggee does not subsume the object's
// compartment, or for some WrappedNatives like Cu.Sandbox.

View File

@ -197,7 +197,7 @@ struct MOZ_STACK_CLASS DebuggerObject::CallData {
bool getPropertyMethod();
bool setPropertyMethod();
bool getOwnPropertyNamesMethod();
bool getOwnPropertiesLengthMethod();
bool getOwnPropertyNamesLengthMethod();
bool getOwnPropertySymbolsMethod();
bool getOwnPrivatePropertiesMethod();
bool getOwnPropertyDescriptorMethod();
@ -783,10 +783,10 @@ bool DebuggerObject::CallData::getOwnPropertyNamesMethod() {
return true;
}
bool DebuggerObject::CallData::getOwnPropertiesLengthMethod() {
bool DebuggerObject::CallData::getOwnPropertyNamesLengthMethod() {
size_t ownPropertiesLength;
if (!DebuggerObject::getOwnPropertiesLength(cx, object,
&ownPropertiesLength)) {
if (!DebuggerObject::getOwnPropertyNamesLength(cx, object,
&ownPropertiesLength)) {
return false;
}
@ -1508,7 +1508,8 @@ const JSFunctionSpec DebuggerObject::methods_[] = {
JS_DEBUG_FN("getProperty", getPropertyMethod, 0),
JS_DEBUG_FN("setProperty", setPropertyMethod, 0),
JS_DEBUG_FN("getOwnPropertyNames", getOwnPropertyNamesMethod, 0),
JS_DEBUG_FN("getOwnPropertiesLength", getOwnPropertiesLengthMethod, 0),
JS_DEBUG_FN("getOwnPropertyNamesLength", getOwnPropertyNamesLengthMethod,
0),
JS_DEBUG_FN("getOwnPropertySymbols", getOwnPropertySymbolsMethod, 0),
JS_DEBUG_FN("getOwnPrivateProperties", getOwnPrivatePropertiesMethod, 0),
JS_DEBUG_FN("getOwnPropertyDescriptor", getOwnPropertyDescriptorMethod, 1),
@ -1982,9 +1983,9 @@ bool DebuggerObject::getOwnPropertyNames(JSContext* cx,
}
/* static */
bool DebuggerObject::getOwnPropertiesLength(JSContext* cx,
HandleDebuggerObject object,
size_t* result) {
bool DebuggerObject::getOwnPropertyNamesLength(JSContext* cx,
HandleDebuggerObject object,
size_t* result) {
RootedObject referent(cx, object->referent());
RootedIdVector ids(cx);

View File

@ -105,9 +105,8 @@ class DebuggerObject : public NativeObject {
[[nodiscard]] static bool getOwnPropertyNames(JSContext* cx,
HandleDebuggerObject object,
MutableHandleIdVector result);
[[nodiscard]] static bool getOwnPropertiesLength(JSContext* cx,
HandleDebuggerObject object,
size_t* result);
[[nodiscard]] static bool getOwnPropertyNamesLength(
JSContext* cx, HandleDebuggerObject object, size_t* result);
[[nodiscard]] static bool getOwnPropertySymbols(JSContext* cx,
HandleDebuggerObject object,
MutableHandleIdVector result);

View File

@ -380,7 +380,7 @@ if <code>Object.getOwnPropertyNames(<i>referent</i>)</code> had been
called in the debuggee, and the result copied in the scope of the
debugger's global object.
### `getOwnPropertiesLength()`
### `getOwnPropertyNamesLength()`
Return the number of the referent's own properties.
### `getOwnPropertySymbols()`

View File

@ -1,4 +1,4 @@
// Basic getOwnPropertiesLength tests.
// Basic getOwnPropertyNamesLength tests.
var g = newGlobal({ newCompartment: true });
var dbg = Debugger();
@ -10,7 +10,7 @@ function testGetOwnPropertyLength(code) {
g.eval(`obj = ${code}`);
const length = gobj
.getOwnPropertyDescriptor("obj")
.value.getOwnPropertiesLength();
.value.getOwnPropertyNamesLength();
assertEq(length, expected, `Expected result for: ${code}`);
}