summaryrefslogtreecommitdiffstats
path: root/devtools/server/actors/targets
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/server/actors/targets')
-rw-r--r--devtools/server/actors/targets/content-process.js12
-rw-r--r--devtools/server/actors/targets/session-data-processors/blackboxing.js2
-rw-r--r--devtools/server/actors/targets/session-data-processors/breakpoints.js14
-rw-r--r--devtools/server/actors/targets/session-data-processors/event-breakpoints.js2
-rw-r--r--devtools/server/actors/targets/session-data-processors/resources.js2
-rw-r--r--devtools/server/actors/targets/session-data-processors/target-configuration.js9
-rw-r--r--devtools/server/actors/targets/session-data-processors/thread-configuration.js21
-rw-r--r--devtools/server/actors/targets/session-data-processors/xhr-breakpoints.js2
-rw-r--r--devtools/server/actors/targets/target-actor-registry.sys.mjs2
-rw-r--r--devtools/server/actors/targets/window-global.js26
-rw-r--r--devtools/server/actors/targets/worker.js2
11 files changed, 52 insertions, 42 deletions
diff --git a/devtools/server/actors/targets/content-process.js b/devtools/server/actors/targets/content-process.js
index 56b1934ef1..cb6c34cea6 100644
--- a/devtools/server/actors/targets/content-process.js
+++ b/devtools/server/actors/targets/content-process.js
@@ -31,9 +31,7 @@ const {
} = require("resource://devtools/server/actors/targets/base-target-actor.js");
const { TargetActorRegistry } = ChromeUtils.importESModule(
"resource://devtools/server/actors/targets/target-actor-registry.sys.mjs",
- {
- loadInDevToolsLoader: false,
- }
+ { global: "shared" }
);
loader.lazyRequireGetter(
@@ -67,7 +65,7 @@ class ContentProcessTargetActor extends BaseTargetActor {
this.makeDebugger = makeDebugger.bind(null, {
findDebuggees: dbg =>
dbg.findAllGlobals().map(g => g.unsafeDereference()),
- shouldAddNewGlobalAsDebuggee: global => true,
+ shouldAddNewGlobalAsDebuggee: () => true,
});
const sandboxPrototype = {
@@ -149,7 +147,7 @@ class ContentProcessTargetActor extends BaseTargetActor {
}
if (!this.threadActor) {
- this.threadActor = new ThreadActor(this, null);
+ this.threadActor = new ThreadActor(this);
this.manage(this.threadActor);
}
if (!this.memoryActor) {
@@ -218,7 +216,7 @@ class ContentProcessTargetActor extends BaseTargetActor {
this.ensureWorkerList().workerPauser.setPauseServiceWorkers(request.origin);
}
- destroy() {
+ destroy({ isModeSwitching } = {}) {
// Avoid reentrancy. We will destroy the Transport when emitting "destroyed",
// which will force destroying all actors.
if (this.destroying) {
@@ -230,7 +228,7 @@ class ContentProcessTargetActor extends BaseTargetActor {
// otherwise you might have leaks reported when running browser_browser_toolbox_netmonitor.js in debug builds
Resources.unwatchAllResources(this);
- this.emit("destroyed");
+ this.emit("destroyed", { isModeSwitching });
super.destroy();
diff --git a/devtools/server/actors/targets/session-data-processors/blackboxing.js b/devtools/server/actors/targets/session-data-processors/blackboxing.js
index 70f4397a72..92bfa74569 100644
--- a/devtools/server/actors/targets/session-data-processors/blackboxing.js
+++ b/devtools/server/actors/targets/session-data-processors/blackboxing.js
@@ -20,7 +20,7 @@ module.exports = {
}
},
- removeSessionDataEntry(targetActor, entries, isDocumentCreation) {
+ removeSessionDataEntry(targetActor, entries) {
for (const { url, range } of entries) {
targetActor.sourcesManager.unblackBox(url, range);
}
diff --git a/devtools/server/actors/targets/session-data-processors/breakpoints.js b/devtools/server/actors/targets/session-data-processors/breakpoints.js
index ff7cb7ec0a..67c270654d 100644
--- a/devtools/server/actors/targets/session-data-processors/breakpoints.js
+++ b/devtools/server/actors/targets/session-data-processors/breakpoints.js
@@ -7,6 +7,7 @@
const {
STATES: THREAD_STATES,
} = require("resource://devtools/server/actors/thread.js");
+const Targets = require("resource://devtools/server/actors/targets/index.js");
module.exports = {
async addOrSetSessionDataEntry(
@@ -15,6 +16,17 @@ module.exports = {
isDocumentCreation,
updateType
) {
+ // When debugging the whole browser (via the Browser Toolbox), we instantiate both content process and window global (FRAME) targets.
+ // But the debugger will only use the content process target's thread actor.
+ // Thread actor, Sources and Breakpoints have to be only managed for the content process target,
+ // and we should explicitly ignore the window global target.
+ if (
+ targetActor.sessionContext.type == "all" &&
+ targetActor.targetType === Targets.TYPES.FRAME &&
+ targetActor.typeName != "parentProcessTarget"
+ ) {
+ return;
+ }
const { threadActor } = targetActor;
if (updateType == "set") {
threadActor.removeAllBreakpoints();
@@ -37,7 +49,7 @@ module.exports = {
}
},
- removeSessionDataEntry(targetActor, entries, isDocumentCreation) {
+ removeSessionDataEntry(targetActor, entries) {
for (const { location } of entries) {
targetActor.threadActor.removeBreakpoint(location);
}
diff --git a/devtools/server/actors/targets/session-data-processors/event-breakpoints.js b/devtools/server/actors/targets/session-data-processors/event-breakpoints.js
index c0a2fb7ffe..4eb9e4f3a8 100644
--- a/devtools/server/actors/targets/session-data-processors/event-breakpoints.js
+++ b/devtools/server/actors/targets/session-data-processors/event-breakpoints.js
@@ -30,7 +30,7 @@ module.exports = {
}
},
- removeSessionDataEntry(targetActor, entries, isDocumentCreation) {
+ removeSessionDataEntry(targetActor, entries) {
targetActor.threadActor.removeEventBreakpoints(entries);
},
};
diff --git a/devtools/server/actors/targets/session-data-processors/resources.js b/devtools/server/actors/targets/session-data-processors/resources.js
index 8f33ba8e0f..1e08397256 100644
--- a/devtools/server/actors/targets/session-data-processors/resources.js
+++ b/devtools/server/actors/targets/session-data-processors/resources.js
@@ -19,7 +19,7 @@ module.exports = {
await Resources.watchResources(targetActor, entries);
},
- removeSessionDataEntry(targetActor, entries, isDocumentCreation) {
+ removeSessionDataEntry(targetActor, entries) {
Resources.unwatchResources(targetActor, entries);
},
};
diff --git a/devtools/server/actors/targets/session-data-processors/target-configuration.js b/devtools/server/actors/targets/session-data-processors/target-configuration.js
index f68e82d69f..8f10692178 100644
--- a/devtools/server/actors/targets/session-data-processors/target-configuration.js
+++ b/devtools/server/actors/targets/session-data-processors/target-configuration.js
@@ -5,12 +5,7 @@
"use strict";
module.exports = {
- async addOrSetSessionDataEntry(
- targetActor,
- entries,
- isDocumentCreation,
- updateType
- ) {
+ async addOrSetSessionDataEntry(targetActor, entries, isDocumentCreation) {
// Only WindowGlobalTargetActor implements updateTargetConfiguration,
// skip targetActor data entry update for other targets.
if (typeof targetActor.updateTargetConfiguration == "function") {
@@ -26,7 +21,7 @@ module.exports = {
}
},
- removeSessionDataEntry(targetActor, entries, isDocumentCreation) {
+ removeSessionDataEntry() {
// configuration data entries are always added/updated, never removed.
},
};
diff --git a/devtools/server/actors/targets/session-data-processors/thread-configuration.js b/devtools/server/actors/targets/session-data-processors/thread-configuration.js
index 716d2a9b21..ad5c0fe024 100644
--- a/devtools/server/actors/targets/session-data-processors/thread-configuration.js
+++ b/devtools/server/actors/targets/session-data-processors/thread-configuration.js
@@ -7,14 +7,21 @@
const {
STATES: THREAD_STATES,
} = require("resource://devtools/server/actors/thread.js");
+const Targets = require("resource://devtools/server/actors/targets/index.js");
module.exports = {
- async addOrSetSessionDataEntry(
- targetActor,
- entries,
- isDocumentCreation,
- updateType
- ) {
+ async addOrSetSessionDataEntry(targetActor, entries) {
+ // When debugging the whole browser (via the Browser Toolbox), we instantiate both content process and window global (FRAME) targets.
+ // But the debugger will only use the content process target's thread actor.
+ // Thread actor, Sources and Breakpoints have to be only managed for the content process target,
+ // and we should explicitly ignore the window global target.
+ if (
+ targetActor.sessionContext.type == "all" &&
+ targetActor.targetType === Targets.TYPES.FRAME &&
+ targetActor.typeName != "parentProcessTarget"
+ ) {
+ return;
+ }
const threadOptions = {};
for (const { key, value } of entries) {
@@ -35,7 +42,7 @@ module.exports = {
}
},
- removeSessionDataEntry(targetActor, entries, isDocumentCreation) {
+ removeSessionDataEntry() {
// configuration data entries are always added/updated, never removed.
},
};
diff --git a/devtools/server/actors/targets/session-data-processors/xhr-breakpoints.js b/devtools/server/actors/targets/session-data-processors/xhr-breakpoints.js
index 7a0fd815aa..3bbcf54aaf 100644
--- a/devtools/server/actors/targets/session-data-processors/xhr-breakpoints.js
+++ b/devtools/server/actors/targets/session-data-processors/xhr-breakpoints.js
@@ -36,7 +36,7 @@ module.exports = {
);
},
- removeSessionDataEntry(targetActor, entries, isDocumentCreation) {
+ removeSessionDataEntry(targetActor, entries) {
for (const { path, method } of entries) {
targetActor.threadActor.removeXHRBreakpoint(path, method);
}
diff --git a/devtools/server/actors/targets/target-actor-registry.sys.mjs b/devtools/server/actors/targets/target-actor-registry.sys.mjs
index 4cb6d13868..25c1ac1234 100644
--- a/devtools/server/actors/targets/target-actor-registry.sys.mjs
+++ b/devtools/server/actors/targets/target-actor-registry.sys.mjs
@@ -24,7 +24,7 @@ export var TargetActorRegistry = {
xpcShellTargetActor = targetActor;
},
- unregisterXpcShellTargetActor(targetActor) {
+ unregisterXpcShellTargetActor() {
xpcShellTargetActor = null;
},
diff --git a/devtools/server/actors/targets/window-global.js b/devtools/server/actors/targets/window-global.js
index 5d2bb10164..6719f0518d 100644
--- a/devtools/server/actors/targets/window-global.js
+++ b/devtools/server/actors/targets/window-global.js
@@ -33,12 +33,11 @@ var makeDebugger = require("resource://devtools/server/actors/utils/make-debugge
const Targets = require("resource://devtools/server/actors/targets/index.js");
const { TargetActorRegistry } = ChromeUtils.importESModule(
"resource://devtools/server/actors/targets/target-actor-registry.sys.mjs",
- {
- loadInDevToolsLoader: false,
- }
+ { global: "shared" }
);
const { PrivateBrowsingUtils } = ChromeUtils.importESModule(
- "resource://gre/modules/PrivateBrowsingUtils.sys.mjs"
+ "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
+ { global: "contextual" }
);
const EXTENSION_CONTENT_SYS_MJS =
@@ -82,7 +81,7 @@ loader.lazyGetter(lazy, "ExtensionContent", () => {
// main loader. Note that the user of lazy.ExtensionContent elsewhere in
// this file (at webextensionsContentScriptGlobals) looks up the module
// via Cu.isESModuleLoaded, which also uses the main loader as desired.
- loadInDevToolsLoader: false,
+ global: "shared",
}).ExtensionContent;
});
@@ -888,7 +887,7 @@ class WindowGlobalTargetActor extends BaseTargetActor {
return {};
}
- listFrames(request) {
+ listFrames() {
const windows = this._docShellsToWindows(this.docShells);
return { frames: windows };
}
@@ -912,7 +911,7 @@ class WindowGlobalTargetActor extends BaseTargetActor {
);
}
- listWorkers(request) {
+ listWorkers() {
return this.ensureWorkerDescriptorActorList()
.getList()
.then(actors => {
@@ -960,7 +959,7 @@ class WindowGlobalTargetActor extends BaseTargetActor {
this.emit("workerListChanged");
}
- _onConsoleApiProfilerEvent(subject, topic, data) {
+ _onConsoleApiProfilerEvent() {
// TODO: We will receive console-api-profiler events for any browser running
// in the same process as this target. We should filter irrelevant events,
// but console-api-profiler currently doesn't emit any information to identify
@@ -977,7 +976,7 @@ class WindowGlobalTargetActor extends BaseTargetActor {
});
}
- observe(subject, topic, data) {
+ observe(subject, topic) {
// Ignore any event that comes before/after the actor is attached.
// That typically happens during Firefox shutdown.
if (this.isDestroyed()) {
@@ -1165,7 +1164,7 @@ class WindowGlobalTargetActor extends BaseTargetActor {
* This sets up the content window for being debugged
*/
_createThreadActor() {
- this.threadActor = new ThreadActor(this, this.window);
+ this.threadActor = new ThreadActor(this);
this.manage(this.threadActor);
}
@@ -1187,7 +1186,7 @@ class WindowGlobalTargetActor extends BaseTargetActor {
// Protocol Request Handlers
- detach(request) {
+ detach() {
// Destroy the actor in the next event loop in order
// to ensure responding to the `detach` request.
DevToolsUtils.executeSoon(() => {
@@ -1824,7 +1823,7 @@ class DebuggerProgressListener {
this._knownWindowIDs.delete(getWindowID(window));
}, "DebuggerProgressListener.prototype.onWindowHidden");
- observe = DevToolsUtils.makeInfallible(function (subject, topic) {
+ observe = DevToolsUtils.makeInfallible(function (subject) {
if (this._targetActor.isDestroyed()) {
return;
}
@@ -1859,8 +1858,7 @@ class DebuggerProgressListener {
onStateChange = DevToolsUtils.makeInfallible(function (
progress,
request,
- flag,
- status
+ flag
) {
if (this._targetActor.isDestroyed()) {
return;
diff --git a/devtools/server/actors/targets/worker.js b/devtools/server/actors/targets/worker.js
index cf5f7b83c9..20b60cfa24 100644
--- a/devtools/server/actors/targets/worker.js
+++ b/devtools/server/actors/targets/worker.js
@@ -72,7 +72,7 @@ class WorkerTargetActor extends BaseTargetActor {
});
// needed by the console actor
- this.threadActor = new ThreadActor(this, this.workerGlobal);
+ this.threadActor = new ThreadActor(this);
// needed by the thread actor to communicate with the console when evaluating logpoints.
this._consoleActor = new WebConsoleActor(this.conn, this);