Bug 1478366 - Add a recordTelemetryEvent function to serviceContainer; r=miker.

This then can be used directly in the console, or passed to reps
and ObjectInspector so it can be called from there.

MozReview-Commit-ID: uQOiGuYbJK

--HG--
extra : rebase_source : a8a84b558dea69b7c2793b9e2d67a44a0809eb43
This commit is contained in:
Nicolas Chevobbe 2018-07-25 13:54:27 +02:00
Родитель 5e20dc8929
Коммит 0829b5c574
3 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -574,13 +574,10 @@ class JSTerm extends Component {
* received. * received.
*/ */
requestEvaluation(str, options = {}) { requestEvaluation(str, options = {}) {
const toolbox = gDevTools.getToolbox(this.hud.owner.target);
// Send telemetry event. If we are in the browser toolbox we send -1 as the // Send telemetry event. If we are in the browser toolbox we send -1 as the
// toolbox session id. // toolbox session id.
this._telemetry.recordEvent("devtools.main", "execute_js", "webconsole", null, { this.props.serviceContainer.recordTelemetryEvent("execute_js", {
"lines": str.split(/\n/).length, "lines": str.split(/\n/).length
"session_id": toolbox ? toolbox.sessionId : -1
}); });
let frameActor = null; let frameActor = null;

Просмотреть файл

@ -61,6 +61,7 @@ function getObjectInspector(grip, serviceContainer, override = {}) {
serviceContainer.hudProxy.releaseActor(actor); serviceContainer.hudProxy.releaseActor(actor);
}, },
onViewSourceInDebugger: serviceContainer.onViewSourceInDebugger, onViewSourceInDebugger: serviceContainer.onViewSourceInDebugger,
recordTelemetryEvent: serviceContainer.recordTelemetryEvent,
openLink: serviceContainer.openLink, openLink: serviceContainer.openLink,
}; };

Просмотреть файл

@ -109,6 +109,12 @@ WebConsoleOutputWrapper.prototype = {
if (hud && hud.owner && hud.owner.viewSource) { if (hud && hud.owner && hud.owner.viewSource) {
hud.owner.viewSource(frame.url, frame.line); hud.owner.viewSource(frame.url, frame.line);
} }
},
recordTelemetryEvent: (eventName, extra = {}) => {
this.telemetry.recordEvent("devtools.main", eventName, "webconsole", null, {
...extra,
"session_id": this.toolbox && this.toolbox.sessionId || -1
});
} }
}; };