Bug 1874205 - [devtools] Prevents tracing content process targets. r=devtools-reviewers,nchevobbe

Let's avoid tracing content process targets for now as this would require some more work (bug 1874204).

Also ignore web extension documents as they are all running in the same process dedicated to WebExt.
(JavaScriptTracer class only support being instantiated once per thread and all these documents run on the same)
(bug 1874219)

Differential Revision: https://phabricator.services.mozilla.com/D200169
This commit is contained in:
Alexandre Poirot 2024-02-01 13:07:20 +00:00
Родитель 3b61cac1bd
Коммит b2cb2deb0c
2 изменённых файлов: 23 добавлений и 0 удалений

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

@ -17,6 +17,7 @@ const {
} = require("resource://devtools/server/tracer/tracer.jsm");
const { LOG_METHODS } = require("resource://devtools/server/actors/tracer.js");
const Targets = require("resource://devtools/server/actors/targets/index.js");
class TracingStateWatcher {
/**
@ -30,6 +31,11 @@ class TracingStateWatcher {
* This will be called for each resource.
*/
async watch(targetActor, { onAvailable }) {
// Bug 1874204: tracer doesn't support tracing content process from the browser toolbox just yet
if (targetActor.targetType == Targets.TYPES.PROCESS) {
return;
}
this.targetActor = targetActor;
this.onAvailable = onAvailable;
@ -43,6 +49,9 @@ class TracingStateWatcher {
* Stop watching for tracing state
*/
destroy() {
if (!this.tracingListener) {
return;
}
removeTracingListener(this.tracingListener);
}

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

@ -9,6 +9,7 @@ const {
TYPES,
getResourceWatcher,
} = require("resource://devtools/server/actors/resources/index.js");
const Targets = require("devtools/server/actors/targets/index");
loader.lazyRequireGetter(
this,
@ -189,6 +190,19 @@ class BaseTargetActor extends Actor {
}
return;
}
// Bug 1874204: For now, in the browser toolbox, only frame and workers are traced.
// Content process targets are ignored as they would also include each document/frame target.
// This would require some work to ignore FRAME targets from here, only in case of browser toolbox,
// and also handle all content process documents for DOM Event logging.
//
// Bug 1874219: Also ignore extensions for now as they are all running in the same process,
// whereas we can only spawn one tracer per thread.
if (
this.targetType == Targets.TYPES.PROCESS ||
this.url?.startsWith("moz-extension://")
) {
return;
}
const tracerActor = this.getTargetScopedActor("tracer");
tracerActor.startTracing(options.tracerOptions);
} else if (this.hasTargetScopedActor("tracer")) {