summaryrefslogtreecommitdiffstats
path: root/devtools/server/actors/inspector/walker.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /devtools/server/actors/inspector/walker.js
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/actors/inspector/walker.js')
-rw-r--r--devtools/server/actors/inspector/walker.js44
1 files changed, 36 insertions, 8 deletions
diff --git a/devtools/server/actors/inspector/walker.js b/devtools/server/actors/inspector/walker.js
index f8da1385e9..50df1720b7 100644
--- a/devtools/server/actors/inspector/walker.js
+++ b/devtools/server/actors/inspector/walker.js
@@ -111,11 +111,9 @@ if (!isWorker) {
() =>
ChromeUtils.importESModule(
"resource://gre/modules/ContentDOMReference.sys.mjs",
- {
- // ContentDOMReference needs to be retrieved from the shared global
- // since it is a shared singleton.
- loadInDevToolsLoader: false,
- }
+ // ContentDOMReference needs to be retrieved from the shared global
+ // since it is a shared singleton.
+ { global: "shared" }
).ContentDOMReference
);
}
@@ -341,7 +339,11 @@ class WalkerActor extends Actor {
return {
actor: this.actorID,
root: this.rootNode.form(),
- traits: {},
+ traits: {
+ // @backward-compat { version 125 } Indicate to the client that it can use getIdrefNode.
+ // This trait can be removed once 125 hits release.
+ hasGetIdrefNode: true,
+ },
};
}
@@ -524,7 +526,7 @@ class WalkerActor extends Actor {
* When a custom element is defined, send a customElementDefined mutation for all the
* NodeActors using this tag name.
*/
- onCustomElementDefined({ name, actors }) {
+ onCustomElementDefined({ actors }) {
actors.forEach(actor =>
this.queueMutation({
target: actor.actorID,
@@ -534,7 +536,7 @@ class WalkerActor extends Actor {
);
}
- _onReflows(reflows) {
+ _onReflows() {
// Going through the nodes the walker knows about, see which ones have had their
// containerType, display, scrollable or overflow state changed and send events if any.
const containerTypeChanges = [];
@@ -1070,6 +1072,32 @@ class WalkerActor extends Actor {
}
/**
+ * Return the node in the baseNode rootNode matching the passed id referenced in a
+ * idref/idreflist attribute, as those are scoped within a shadow root.
+ *
+ * @param NodeActor baseNode
+ * @param string id
+ */
+ getIdrefNode(baseNode, id) {
+ if (isNodeDead(baseNode)) {
+ return {};
+ }
+
+ // Get the document or the shadow root for baseNode
+ const rootNode = baseNode.rawNode.getRootNode({ composed: false });
+ if (!rootNode) {
+ return {};
+ }
+
+ const node = rootNode.getElementById(id);
+ if (!node) {
+ return {};
+ }
+
+ return this.attachElement(node);
+ }
+
+ /**
* Get a list of nodes that match the given selector in all known frames of
* the current content page.
* @param {String} selector.