gecko-dev/devtools/shared/specs/tracer.js
Alexandre Poirot cf6d19f16a Bug 1848159 - [devtools] Introduce an option to start tracing on next page load. r=devtools-reviewers,devtools-backward-compat-reviewers,nchevobbe
Because the JavaScript tracer is currently running in each process/thread/target actor independently,
it is more complex to make it record across navigations as it may be spawn in a distinct process.

While it is fine for stdout and webconsole outputs (we could just spawn many concurrent tracers in each process),
this is more complex for the experimental "profiler" output.
For now, the profiler output automatically stops on target destruction and will open the profiler result.

By having an option to start recording on next page load, it prevents starting the tracer and prevent logging traces
for the current WindowGlobal. It should help focus on the new document.
For the profiler output, it prevents having the profiler to show up for the previous WindowGlobal.

Sideby tweak:
* stop passing logMethod and consider, like other option to be coming from the preferences.
* fix confusing state when debugging a page running in the same process.

Differential Revision: https://phabricator.services.mozilla.com/D196874
2024-01-30 20:18:51 +00:00

35 lines
752 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
generateActorSpec,
Arg,
types,
} = require("resource://devtools/shared/protocol.js");
types.addDictType("tracer.start.options", {
logMethod: "string",
traceValues: "boolean",
traceOnNextInteraction: "boolean",
traceOnNextLoad: "boolean",
});
const tracerSpec = generateActorSpec({
typeName: "tracer",
methods: {
startTracing: {
request: {
options: Arg(0, "tracer.start.options"),
},
},
stopTracing: {
request: {},
},
},
});
exports.tracerSpec = tracerSpec;