fune/devtools/shared/specs/private-properties-iterator.js
Nicolas Chevobbe 602f42fbb5 Bug 1499679 - [devtools] Add PrivatePropertiesIterator actor to retrieve private properties of a given object. r=bomsy,devtools-backward-compat-reviewers.
This patch makes use of the new `getOwnPrivateProperties` method on DebuggerObject
to include private properties in object grip preview.

We're also adding a PrivatePropertiesIterator actor (and associated front) that
will allow us to retrieve all the private properties (e.g. when expanding an
object in the ObjectInspector).

A xpcshell test is added to ensure we do return the expected properties.

Differential Revision: https://phabricator.services.mozilla.com/D115702
2021-05-26 12:44:00 +00:00

42 lines
1.1 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
generateActorSpec,
Option,
RetVal,
types,
} = require("devtools/shared/protocol");
types.addDictType("privatepropertiesiterator.data", {
privateProperties: "array:privatepropertiesiterator.privateProperties",
});
types.addDictType("privatepropertiesiterator.privateProperties", {
name: "string",
descriptor: "nullable:object.descriptor",
});
const privatePropertiesIteratorSpec = generateActorSpec({
typeName: "privatePropertiesIterator",
methods: {
slice: {
request: {
start: Option(0, "number"),
count: Option(0, "number"),
},
response: RetVal("privatepropertiesiterator.data"),
},
all: {
request: {},
response: RetVal("privatepropertiesiterator.data"),
},
release: { release: true },
},
});
exports.privatePropertiesIteratorSpec = privatePropertiesIteratorSpec;