Bug 1470128 - Instrument inspector shadowdom support;r=pbro
MozReview-Commit-ID: JCknoaPiSlR
--- a/devtools/client/inspector/markup/views/markup-container.js
+++ b/devtools/client/inspector/markup/views/markup-container.js
@@ -69,16 +69,20 @@ MarkupContainer.prototype = {
this.elt.addEventListener("mousedown", this._onMouseDown);
this.elt.addEventListener("dblclick", this._onToggle);
if (this.expander) {
this.expander.addEventListener("click", this._onToggle);
}
// Marking the node as shown or hidden
this.updateIsDisplayed();
+
+ if (node.isShadowRoot) {
+ this.markup.telemetry.scalarSet("devtools.shadowdom.shadow_root_displayed", true);
+ }
},
buildMarkup: function() {
this.elt = this.win.document.createElement("li");
this.elt.classList.add("child", "collapsed");
this.elt.setAttribute("role", "presentation");
this.tagLine = this.win.document.createElement("div");
@@ -327,16 +331,20 @@ MarkupContainer.prototype = {
this.elt.classList.add("collapsed");
this.expander.removeAttribute("open");
this.markup.emit("collapsed");
}
if (this.showExpander) {
this.tagLine.setAttribute("aria-expanded", this.expanded);
}
+
+ if (this.node.isShadowRoot) {
+ this.markup.telemetry.scalarSet("devtools.shadowdom.shadow_root_expanded", true);
+ }
},
/**
* Expanding a node means cloning its "inline" closing tag into a new
* tag-line that the user can interact with and showing the children.
*/
showCloseTagLine: function() {
// Only element containers display a closing tag line. #document has no closing line.
--- a/devtools/client/inspector/markup/views/slotted-node-container.js
+++ b/devtools/client/inspector/markup/views/slotted-node-container.js
@@ -34,19 +34,19 @@ SlottedNodeContainer.prototype = extend(
event.stopPropagation();
},
onContainerClick: async function(event) {
if (!event.target.classList.contains("reveal-link")) {
return;
}
- this.markup.inspector.selection.setNodeFront(this.node, {
- reason: "reveal-from-slot"
- });
+ const reason = "reveal-from-slot";
+ this.markup.inspector.selection.setNodeFront(this.node, { reason });
+ this.markup.telemetry.scalarSet("devtools.shadowdom.reveal_link_clicked", true);
},
isDraggable: function() {
return false;
},
isSlotted: function() {
return true;
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -943,16 +943,60 @@ devtools.inspector:
keyed: true
notification_emails:
- dev-developer-tools@lists.mozilla.org
- gl@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
+devtools.shadowdom:
+ shadow_root_displayed:
+ bug_numbers:
+ - 1470128
+ description: >
+ Whether the markup view displayed any #shadow-root element in the UI.
+ expires: "66"
+ kind: boolean
+ notification_emails:
+ - dev-developer-tools@lists.mozilla.org
+ - jdescottes@mozilla.com
+ release_channel_collection: opt-out
+ record_in_processes:
+ - 'main'
+
+ shadow_root_expanded:
+ bug_numbers:
+ - 1470128
+ description: >
+ Whether the user expanded any #shadow-root element.
+ expires: "66"
+ kind: boolean
+ notification_emails:
+ - dev-developer-tools@lists.mozilla.org
+ - jdescottes@mozilla.com
+ release_channel_collection: opt-out
+ record_in_processes:
+ - 'main'
+
+ reveal_link_clicked:
+ bug_numbers:
+ - 1470128
+ description: >
+ Whether the user clicked on any "reveal" link. "reveal" links are displayed in
+ shadow dom trees in the markup view.
+ expires: "66"
+ kind: boolean
+ notification_emails:
+ - dev-developer-tools@lists.mozilla.org
+ - jdescottes@mozilla.com
+ release_channel_collection: opt-out
+ record_in_processes:
+ - 'main'
+
devtools:
current_theme:
bug_numbers:
- 1396811
description: >
Number of times DevTools was opened, keyed by theme.
expires: never
kind: uint