Bug 1463080 - Instrument inspection of "Edit HTML" in Inspector with event telemetry r?yulia
MozReview-Commit-ID: 156CmWuHOf1
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -65,16 +65,17 @@ function MarkupView(inspector, frame, co
EventEmitter.decorate(this);
this.inspector = inspector;
this.walker = this.inspector.walker;
this._frame = frame;
this.win = this._frame.contentWindow;
this.doc = this._frame.contentDocument;
this._elt = this.doc.querySelector("#root");
+ this.telemetry = this.inspector.telemetry;
this.maxChildren = Services.prefs.getIntPref("devtools.markup.pagesize",
DEFAULT_MAX_CHILDREN);
this.collapseAttributes = Services.prefs.getBoolPref(ATTR_COLLAPSE_ENABLED_PREF);
this.collapseAttributeLength = Services.prefs.getIntPref(ATTR_COLLAPSE_LENGTH_PREF);
// Creating the popup to be used to show CSS suggestions.
@@ -1522,24 +1523,31 @@ MarkupView.prototype = {
return;
}
// Load load and create HTML Editor as it is rarely used and fetch complex deps
if (!this.htmlEditor) {
let HTMLEditor = require("devtools/client/inspector/markup/views/html-editor");
this.htmlEditor = new HTMLEditor(this.doc);
}
this.htmlEditor.show(container.tagLine, oldValue);
+ const start = this.telemetry.msSystemNow();
this.htmlEditor.once("popuphidden", (commit, value) => {
// Need to focus the <html> element instead of the frame / window
// in order to give keyboard focus back to doc (from editor).
this.doc.documentElement.focus();
if (commit) {
this.updateNodeOuterHTML(node, value, oldValue);
}
+
+ const end = this.telemetry.msSystemNow();
+ this.telemetry.recordEvent("devtools.main", "edit_html", "inspector", null, {
+ "made_changes": commit,
+ "time_open": end - start
+ });
});
this.emit("begin-editing");
});
},
/**
* Expand or collapse the given node.
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -265,8 +265,19 @@ devtools.main:
notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
record_in_processes: ["main"]
description: User deactivates the responsive_design or split_console in the devtools toolbox.
release_channel_collection: opt-out
expiry_version: never
extra_keys:
host: "Toolbox host (positioning): bottom, side, window or other."
width: Toolbox width rounded up to the nearest 50px.
+ edit_html:
+ objects: ["inspector"]
+ bug_numbers: [1463080]
+ notification_emails: ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"]
+ record_in_processes: ["main"]
+ description: User is editing HTML via the context menu item in the markup view.
+ release_channel_collection: opt-out
+ expiry_version: never
+ extra_keys:
+ made_changes: Indicates whether changes were made.
+ time_open: The amount of time in ms that the HTML editor was open.