summaryrefslogtreecommitdiffstats
path: root/devtools/server/actors/resources
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/server/actors/resources/index.js16
-rw-r--r--devtools/server/actors/resources/jstracer-state.js15
-rw-r--r--devtools/server/actors/resources/network-events.js8
-rw-r--r--devtools/server/actors/resources/sources.js2
-rw-r--r--devtools/server/actors/resources/utils/parent-process-storage.js11
5 files changed, 34 insertions, 18 deletions
diff --git a/devtools/server/actors/resources/index.js b/devtools/server/actors/resources/index.js
index e2857502ad..cfc941a161 100644
--- a/devtools/server/actors/resources/index.js
+++ b/devtools/server/actors/resources/index.js
@@ -390,6 +390,14 @@ exports.hasResourceTypesForTargets = hasResourceTypesForTargets;
* List of all type of resource to stop listening to.
*/
function unwatchResources(rootOrWatcherOrTargetActor, resourceTypes) {
+ // If we are given a target actor, filter out the resource types supported by the target.
+ // When using sharedData to pass types between processes, we are passing them for all target types.
+ const { targetType } = rootOrWatcherOrTargetActor;
+ // Only target actors usecase will have a target type.
+ // For Root and Watcher we process the `resourceTypes` list unfiltered.
+ if (targetType) {
+ resourceTypes = getResourceTypesForTargetType(resourceTypes, targetType);
+ }
for (const resourceType of resourceTypes) {
// Pull all info about this resource type from `Resources` global object
const { watchers } = getResourceTypeEntry(
@@ -415,6 +423,14 @@ exports.unwatchResources = unwatchResources;
* List of all type of resource to clear.
*/
function clearResources(rootOrWatcherOrTargetActor, resourceTypes) {
+ // If we are given a target actor, filter out the resource types supported by the target.
+ // When using sharedData to pass types between processes, we are passing them for all target types.
+ const { targetType } = rootOrWatcherOrTargetActor;
+ // Only target actors usecase will have a target type.
+ // For Root and Watcher we process the `resourceTypes` list unfiltered.
+ if (targetType) {
+ resourceTypes = getResourceTypesForTargetType(resourceTypes, targetType);
+ }
for (const resourceType of resourceTypes) {
const { watchers } = getResourceTypeEntry(
rootOrWatcherOrTargetActor,
diff --git a/devtools/server/actors/resources/jstracer-state.js b/devtools/server/actors/resources/jstracer-state.js
index 74491a6ced..1bb4723b55 100644
--- a/devtools/server/actors/resources/jstracer-state.js
+++ b/devtools/server/actors/resources/jstracer-state.js
@@ -8,13 +8,10 @@ const {
TYPES: { JSTRACER_STATE },
} = require("resource://devtools/server/actors/resources/index.js");
-// Bug 1827382, as this module can be used from the worker thread,
-// the following JSM may be loaded by the worker loader until
-// we have proper support for ESM from workers.
-const {
- addTracingListener,
- removeTracingListener,
-} = require("resource://devtools/server/tracer/tracer.jsm");
+const { JSTracer } = ChromeUtils.importESModule(
+ "resource://devtools/server/tracer/tracer.sys.mjs",
+ { global: "contextual" }
+);
const { LOG_METHODS } = require("resource://devtools/server/actors/tracer.js");
const Targets = require("resource://devtools/server/actors/targets/index.js");
@@ -42,7 +39,7 @@ class TracingStateWatcher {
this.tracingListener = {
onTracingToggled: this.onTracingToggled.bind(this),
};
- addTracingListener(this.tracingListener);
+ JSTracer.addTracingListener(this.tracingListener);
}
/**
@@ -52,7 +49,7 @@ class TracingStateWatcher {
if (!this.tracingListener) {
return;
}
- removeTracingListener(this.tracingListener);
+ JSTracer.removeTracingListener(this.tracingListener);
}
/**
diff --git a/devtools/server/actors/resources/network-events.js b/devtools/server/actors/resources/network-events.js
index 909c16e052..9401d835ff 100644
--- a/devtools/server/actors/resources/network-events.js
+++ b/devtools/server/actors/resources/network-events.js
@@ -9,9 +9,9 @@ const { isWindowGlobalPartOfContext } = ChromeUtils.importESModule(
"resource://devtools/server/actors/watcher/browsing-context-helpers.sys.mjs",
{ global: "contextual" }
);
-const { WatcherRegistry } = ChromeUtils.importESModule(
- "resource://devtools/server/actors/watcher/WatcherRegistry.sys.mjs",
- // WatcherRegistry needs to be a true singleton and loads ActorManagerParent
+const { ParentProcessWatcherRegistry } = ChromeUtils.importESModule(
+ "resource://devtools/server/actors/watcher/ParentProcessWatcherRegistry.sys.mjs",
+ // ParentProcessWatcherRegistry needs to be a true singleton and loads ActorManagerParent
// which also has to be a true singleton.
{ global: "shared" }
);
@@ -253,7 +253,7 @@ class NetworkEventWatcher {
// (i.e. the process where this Watcher runs)
const isParentProcessOnlyBrowserToolbox =
this.watcherActor.sessionContext.type == "all" &&
- !WatcherRegistry.isWatchingTargets(
+ !ParentProcessWatcherRegistry.isWatchingTargets(
this.watcherActor,
Targets.TYPES.FRAME
);
diff --git a/devtools/server/actors/resources/sources.js b/devtools/server/actors/resources/sources.js
index c4f0601106..63a5987e0e 100644
--- a/devtools/server/actors/resources/sources.js
+++ b/devtools/server/actors/resources/sources.js
@@ -44,6 +44,8 @@ class SourceWatcher {
this.sourcesManager = targetActor.sourcesManager;
this.onAvailable = onAvailable;
+ threadActor.attach({});
+
// Disable `ThreadActor.newSource` RDP event in order to avoid unnecessary traffic
threadActor.disableNewSourceEvents();
diff --git a/devtools/server/actors/resources/utils/parent-process-storage.js b/devtools/server/actors/resources/utils/parent-process-storage.js
index 760e6e4d38..1d3a3dd341 100644
--- a/devtools/server/actors/resources/utils/parent-process-storage.js
+++ b/devtools/server/actors/resources/utils/parent-process-storage.js
@@ -79,11 +79,12 @@ class ParentProcessStorage {
watcherActor.sessionContext;
await this._spawnActor(addonBrowsingContextID, addonInnerWindowId);
} else if (watcherActor.sessionContext.type == "all") {
- const parentProcessTargetActor =
- this.watcherActor.getTargetActorInParentProcess();
- const { browsingContextID, innerWindowId } =
- parentProcessTargetActor.form();
- await this._spawnActor(browsingContextID, innerWindowId);
+ // Note that there should be only one such target in the browser toolbox.
+ // The Parent Process Target Actor.
+ for (const targetActor of this.watcherActor.getTargetActorsInParentProcess()) {
+ const { browsingContextID, innerWindowId } = targetActor.form();
+ await this._spawnActor(browsingContextID, innerWindowId);
+ }
} else {
throw new Error(
"Unsupported session context type=" + watcherActor.sessionContext.type