1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
10 } = require("resource://devtools/shared/protocol.js");
12 privatePropertiesIteratorSpec
,
13 } = require("resource://devtools/shared/specs/private-properties-iterator.js");
15 getAdHocFrontOrPrimitiveGrip
,
16 } = require("resource://devtools/client/fronts/object.js");
18 class PrivatePropertiesIteratorFront
extends FrontClassWithSpec(
19 privatePropertiesIteratorSpec
22 this.actorID
= data
.actor
;
23 this.count
= data
.count
;
26 async
slice(start
, count
) {
27 const result
= await
super.slice({ start
, count
});
28 return this._onResult(result
);
32 const result
= await
super.all();
33 return this._onResult(result
);
37 if (!result
.privateProperties
) {
41 // The result packet can have multiple properties that hold grips which we may need
42 // to turn into fronts.
43 const gripKeys
= ["value", "getterValue", "get", "set"];
45 result
.privateProperties
.forEach((item
, i
) => {
46 if (item
?.descriptor
) {
47 for (const gripKey
of gripKeys
) {
48 if (item
.descriptor
.hasOwnProperty(gripKey
)) {
49 result
.privateProperties
[i
].descriptor
[gripKey
] =
50 getAdHocFrontOrPrimitiveGrip(item
.descriptor
[gripKey
], this);
59 exports
.PrivatePropertiesIteratorFront
= PrivatePropertiesIteratorFront
;
60 registerFront(PrivatePropertiesIteratorFront
);