summaryrefslogtreecommitdiffstats
path: root/devtools/server/actors/object
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
commit086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch)
treea4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /devtools/server/actors/object
parentAdding debian version 124.0.1-1. (diff)
downloadfirefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz
firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/actors/object')
-rw-r--r--devtools/server/actors/object/previewers.js24
-rw-r--r--devtools/server/actors/object/property-iterator.js32
2 files changed, 56 insertions, 0 deletions
diff --git a/devtools/server/actors/object/previewers.js b/devtools/server/actors/object/previewers.js
index 451858a826..55217a72ee 100644
--- a/devtools/server/actors/object/previewers.js
+++ b/devtools/server/actors/object/previewers.js
@@ -612,6 +612,30 @@ const previewers = {
return true;
},
],
+
+ CustomStateSet: [
+ function(objectActor, grip) {
+ const size = DevToolsUtils.getProperty(objectActor.obj, "size");
+ if (typeof size != "number") {
+ return false;
+ }
+
+ grip.preview = {
+ kind: "ArrayLike",
+ length: size,
+ };
+
+ const items = (grip.preview.items = []);
+ for (const item of PropertyIterators.enumCustomStateSetEntries(objectActor)) {
+ items.push(item);
+ if (items.length == OBJECT_PREVIEW_MAX_ITEMS) {
+ break;
+ }
+ }
+
+ return true;
+ },
+ ],
};
/**
diff --git a/devtools/server/actors/object/property-iterator.js b/devtools/server/actors/object/property-iterator.js
index 7bd2c0a704..e7a4d2c041 100644
--- a/devtools/server/actors/object/property-iterator.js
+++ b/devtools/server/actors/object/property-iterator.js
@@ -75,6 +75,8 @@ class PropertyIteratorActor extends Actor {
this.iterator = enumMidiInputMapEntries(objectActor);
} else if (cls == "MIDIOutputMap") {
this.iterator = enumMidiOutputMapEntries(objectActor);
+ } else if (cls == "CustomStateSet") {
+ this.iterator = enumCustomStateSetEntries(objectActor);
} else {
throw new Error(
"Unsupported class to enumerate entries from: " + cls
@@ -658,6 +660,35 @@ function enumWeakSetEntries(objectActor) {
};
}
+function enumCustomStateSetEntries(objectActor) {
+ let raw = objectActor.obj.unsafeDereference();
+ // We need to waive `raw` as we can't get the iterator from the Xray for SetLike (See Bug 1173651).
+ // We also need to waive Xrays on the result of the call to `values` as we don't have
+ // Xrays to Iterator objects (see Bug 1023984)
+ const values = Array.from(
+ waiveXrays(CustomStateSet.prototype.values.call(waiveXrays(raw)))
+ );
+
+ return {
+ [Symbol.iterator]: function*() {
+ for (const item of values) {
+ yield gripFromEntry(objectActor, item);
+ }
+ },
+ size: values.length,
+ propertyName(index) {
+ return index;
+ },
+ propertyDescription(index) {
+ const val = values[index];
+ return {
+ enumerable: true,
+ value: gripFromEntry(objectActor, val),
+ };
+ },
+ };
+}
+
/**
* Returns true if the parameter can be stored as a 32-bit unsigned integer.
* If so, it will be suitable for use as the length of an array object.
@@ -672,6 +703,7 @@ function isUint32(num) {
module.exports = {
PropertyIteratorActor,
+ enumCustomStateSetEntries,
enumMapEntries,
enumMidiInputMapEntries,
enumMidiOutputMapEntries,