summaryrefslogtreecommitdiffstats
path: root/devtools/server/actors/resources
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /devtools/server/actors/resources
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/actors/resources')
-rw-r--r--devtools/server/actors/resources/extensions-backgroundscript-status.js2
-rw-r--r--devtools/server/actors/resources/network-events-content.js14
-rw-r--r--devtools/server/actors/resources/network-events-stacktraces.js19
-rw-r--r--devtools/server/actors/resources/network-events.js27
-rw-r--r--devtools/server/actors/resources/parent-process-document-event.js2
-rw-r--r--devtools/server/actors/resources/server-sent-events.js2
-rw-r--r--devtools/server/actors/resources/sources.js14
-rw-r--r--devtools/server/actors/resources/storage/extension-storage.js10
-rw-r--r--devtools/server/actors/resources/storage/indexed-db.js12
-rw-r--r--devtools/server/actors/resources/thread-states.js18
-rw-r--r--devtools/server/actors/resources/utils/content-process-storage.js12
-rw-r--r--devtools/server/actors/resources/utils/nsi-console-listener-watcher.js10
-rw-r--r--devtools/server/actors/resources/utils/parent-process-storage.js3
-rw-r--r--devtools/server/actors/resources/websockets.js4
14 files changed, 91 insertions, 58 deletions
diff --git a/devtools/server/actors/resources/extensions-backgroundscript-status.js b/devtools/server/actors/resources/extensions-backgroundscript-status.js
index 08f51a23f5..f6c7b3067d 100644
--- a/devtools/server/actors/resources/extensions-backgroundscript-status.js
+++ b/devtools/server/actors/resources/extensions-backgroundscript-status.js
@@ -35,7 +35,7 @@ class ExtensionsBackgroundScriptStatusWatcher {
Services.obs.addObserver(this, "extension:background-script-status");
}
- observe(subject, topic, data) {
+ observe(subject, topic) {
switch (topic) {
case "extension:background-script-status": {
const { addonId, isRunning } = subject.wrappedJSObject;
diff --git a/devtools/server/actors/resources/network-events-content.js b/devtools/server/actors/resources/network-events-content.js
index 5135583fab..2b4b09dfa7 100644
--- a/devtools/server/actors/resources/network-events-content.js
+++ b/devtools/server/actors/resources/network-events-content.js
@@ -13,10 +13,14 @@ loader.lazyRequireGetter(
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- NetworkUtils:
- "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ NetworkUtils:
+ "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
+ },
+ { global: "contextual" }
+);
/**
* Handles network events from the content process
@@ -64,7 +68,7 @@ class NetworkEventContentWatcher {
this.networkEvents.clear();
}
- httpFailedOpeningRequest(subject, topic) {
+ httpFailedOpeningRequest(subject) {
const channel = subject.QueryInterface(Ci.nsIHttpChannel);
// Ignore preload requests to avoid duplicity request entries in
diff --git a/devtools/server/actors/resources/network-events-stacktraces.js b/devtools/server/actors/resources/network-events-stacktraces.js
index a458278680..da082069f5 100644
--- a/devtools/server/actors/resources/network-events-stacktraces.js
+++ b/devtools/server/actors/resources/network-events-stacktraces.js
@@ -17,10 +17,14 @@ loader.lazyRequireGetter(
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- NetworkUtils:
- "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ NetworkUtils:
+ "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
+ },
+ { global: "contextual" }
+);
class NetworkEventStackTracesWatcher {
/**
@@ -53,11 +57,8 @@ class NetworkEventStackTracesWatcher {
/**
* Stop watching for network event's strack traces related to a given Target Actor.
- *
- * @param TargetActor targetActor
- * The target actor from which we should stop observing the strack traces
*/
- destroy(targetActor) {
+ destroy() {
this.clear();
Services.obs.removeObserver(this, "http-on-opening-request");
Services.obs.removeObserver(this, "document-on-opening-request");
@@ -65,7 +66,7 @@ class NetworkEventStackTracesWatcher {
ChannelEventSinkFactory.getService().unregisterCollector(this);
}
- onChannelRedirect(oldChannel, newChannel, flags) {
+ onChannelRedirect(oldChannel, newChannel) {
// We can be called with any nsIChannel, but are interested only in HTTP channels
try {
oldChannel.QueryInterface(Ci.nsIHttpChannel);
diff --git a/devtools/server/actors/resources/network-events.js b/devtools/server/actors/resources/network-events.js
index c1440f2c8d..909c16e052 100644
--- a/devtools/server/actors/resources/network-events.js
+++ b/devtools/server/actors/resources/network-events.js
@@ -6,26 +6,29 @@
const { Pool } = require("resource://devtools/shared/protocol/Pool.js");
const { isWindowGlobalPartOfContext } = ChromeUtils.importESModule(
- "resource://devtools/server/actors/watcher/browsing-context-helpers.sys.mjs"
+ "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
- // which also has to be a true singleton.
- loadInDevToolsLoader: false,
- }
+ // WatcherRegistry needs to be a true singleton and loads ActorManagerParent
+ // which also has to be a true singleton.
+ { global: "shared" }
);
const Targets = require("resource://devtools/server/actors/targets/index.js");
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- NetworkObserver:
- "resource://devtools/shared/network-observer/NetworkObserver.sys.mjs",
- NetworkUtils:
- "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ NetworkObserver:
+ "resource://devtools/shared/network-observer/NetworkObserver.sys.mjs",
+ NetworkUtils:
+ "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
+ },
+ { global: "contextual" }
+);
loader.lazyRequireGetter(
this,
diff --git a/devtools/server/actors/resources/parent-process-document-event.js b/devtools/server/actors/resources/parent-process-document-event.js
index e156a32fe5..27f929190c 100644
--- a/devtools/server/actors/resources/parent-process-document-event.js
+++ b/devtools/server/actors/resources/parent-process-document-event.js
@@ -98,7 +98,7 @@ class ParentProcessDocumentEventWatcher {
return Promise.resolve();
}
- onStateChange(progress, request, flag, status) {
+ onStateChange(progress, request, flag) {
const isStart = flag & Ci.nsIWebProgressListener.STATE_START;
const isDocument = flag & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT;
if (isDocument && isStart) {
diff --git a/devtools/server/actors/resources/server-sent-events.js b/devtools/server/actors/resources/server-sent-events.js
index 5b16f8bb9f..894bbc76bc 100644
--- a/devtools/server/actors/resources/server-sent-events.js
+++ b/devtools/server/actors/resources/server-sent-events.js
@@ -102,7 +102,7 @@ class ServerSentEventWatcher {
}
// nsIEventSourceEventService specific functions
- eventSourceConnectionOpened(httpChannelId) {}
+ eventSourceConnectionOpened() {}
eventSourceConnectionClosed(httpChannelId) {
const resource = ServerSentEventWatcher.createResource(
diff --git a/devtools/server/actors/resources/sources.js b/devtools/server/actors/resources/sources.js
index 6b3ab1d5e1..c4f0601106 100644
--- a/devtools/server/actors/resources/sources.js
+++ b/devtools/server/actors/resources/sources.js
@@ -69,13 +69,13 @@ class SourceWatcher {
// Before fetching all sources, process existing ones.
// The ThreadActor is already up and running before this code runs
// and have sources already registered and for which newSource event already fired.
- onAvailable(
- threadActor.sourcesManager.iter().map(s => {
- const resource = s.form();
- resource.resourceType = SOURCE;
- return resource;
- })
- );
+ const sources = [];
+ for (const sourceActor of threadActor.sourcesManager.iter()) {
+ const resource = sourceActor.form();
+ resource.resourceType = SOURCE;
+ sources.push(resource);
+ }
+ onAvailable(sources);
// Requesting all sources should end up emitting newSource on threadActor.sourcesManager
threadActor.addAllSources();
diff --git a/devtools/server/actors/resources/storage/extension-storage.js b/devtools/server/actors/resources/storage/extension-storage.js
index d14d3320c7..be98c917b3 100644
--- a/devtools/server/actors/resources/storage/extension-storage.js
+++ b/devtools/server/actors/resources/storage/extension-storage.js
@@ -13,25 +13,25 @@ const {
const {
LongStringActor,
} = require("resource://devtools/server/actors/string.js");
-// Use loadInDevToolsLoader: false for these extension modules, because these
+// Use global: "shared" for these extension modules, because these
// are singletons with shared state, and we must not create a new instance if a
// dedicated loader was used to load this module.
loader.lazyGetter(this, "ExtensionParent", () => {
return ChromeUtils.importESModule(
"resource://gre/modules/ExtensionParent.sys.mjs",
- { loadInDevToolsLoader: false }
+ { global: "shared" }
).ExtensionParent;
});
loader.lazyGetter(this, "ExtensionProcessScript", () => {
return ChromeUtils.importESModule(
"resource://gre/modules/ExtensionProcessScript.sys.mjs",
- { loadInDevToolsLoader: false }
+ { global: "shared" }
).ExtensionProcessScript;
});
loader.lazyGetter(this, "ExtensionStorageIDB", () => {
return ChromeUtils.importESModule(
"resource://gre/modules/ExtensionStorageIDB.sys.mjs",
- { loadInDevToolsLoader: false }
+ { global: "shared" }
).ExtensionStorageIDB;
});
@@ -310,7 +310,7 @@ class ExtensionStorageActor extends BaseStorageActor {
});
}
- async editItem({ host, field, items, oldValue }) {
+ async editItem({ host, items }) {
const db = this.dbConnectionForHost.get(host);
if (!db) {
return;
diff --git a/devtools/server/actors/resources/storage/indexed-db.js b/devtools/server/actors/resources/storage/indexed-db.js
index 8ded705c4f..05c523ac57 100644
--- a/devtools/server/actors/resources/storage/indexed-db.js
+++ b/devtools/server/actors/resources/storage/indexed-db.js
@@ -30,9 +30,13 @@ loader.lazyGetter(this, "indexedDBForStorage", () => {
}
});
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- Sqlite: "resource://gre/modules/Sqlite.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ Sqlite: "resource://gre/modules/Sqlite.sys.mjs",
+ },
+ { global: "contextual" }
+);
/**
* An async method equivalent to setTimeout but using Promises
@@ -882,7 +886,7 @@ class IndexedDBStorageActor extends BaseStorageActor {
const { name } = this.splitNameAndStorage(dbName);
const request = this.openWithPrincipal(principal, name, storage);
- return new Promise((resolve, reject) => {
+ return new Promise(resolve => {
let { objectStore, id, index, offset, size } = requestOptions;
const data = [];
let db;
diff --git a/devtools/server/actors/resources/thread-states.js b/devtools/server/actors/resources/thread-states.js
index 9ac79088d2..11aef81734 100644
--- a/devtools/server/actors/resources/thread-states.js
+++ b/devtools/server/actors/resources/thread-states.js
@@ -7,6 +7,7 @@
const {
TYPES: { THREAD_STATE },
} = require("resource://devtools/server/actors/resources/index.js");
+const Targets = require("resource://devtools/server/actors/targets/index.js");
const {
PAUSE_REASONS,
@@ -48,6 +49,18 @@ class BreakpointWatcher {
* This will be called for each resource.
*/
async watch(targetActor, { onAvailable }) {
+ // 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;
this.threadActor = threadActor;
this.onAvailable = onAvailable;
@@ -87,6 +100,9 @@ class BreakpointWatcher {
* Stop watching for breakpoints
*/
destroy() {
+ if (!this.threadActor) {
+ return;
+ }
this.threadActor.off("paused", this.onPaused);
this.threadActor.off("resumed", this.onResumed);
}
@@ -116,7 +132,7 @@ class BreakpointWatcher {
]);
}
- onResumed(packet) {
+ onResumed() {
// NOTE: resumed events are suppressed while interrupted
// to prevent unintentional behavior.
if (this.isInterrupted) {
diff --git a/devtools/server/actors/resources/utils/content-process-storage.js b/devtools/server/actors/resources/utils/content-process-storage.js
index 7e126ce3f7..80d7e319a8 100644
--- a/devtools/server/actors/resources/utils/content-process-storage.js
+++ b/devtools/server/actors/resources/utils/content-process-storage.js
@@ -7,10 +7,14 @@
const EventEmitter = require("resource://devtools/shared/event-emitter.js");
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- getAddonIdForWindowGlobal:
- "resource://devtools/server/actors/watcher/browsing-context-helpers.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ getAddonIdForWindowGlobal:
+ "resource://devtools/server/actors/watcher/browsing-context-helpers.sys.mjs",
+ },
+ { global: "contextual" }
+);
// ms of delay to throttle updates
const BATCH_DELAY = 200;
diff --git a/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js b/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js
index 8d1ed43612..d4bde43818 100644
--- a/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js
+++ b/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js
@@ -79,7 +79,7 @@ class nsIConsoleListenerWatcher {
* @param {TargetActor} targetActor
* @return {Boolean}
*/
- shouldHandleTarget(targetActor) {
+ shouldHandleTarget() {
return true;
}
@@ -91,7 +91,7 @@ class nsIConsoleListenerWatcher {
* @param {nsIScriptError|nsIConsoleMessage} message
* @return {Boolean}
*/
- shouldHandleMessage(targetActor, message) {
+ shouldHandleMessage() {
throw new Error(
"'shouldHandleMessage' should be implemented in the class that extends nsIConsoleListenerWatcher"
);
@@ -101,12 +101,12 @@ class nsIConsoleListenerWatcher {
* Prepare the resource to be sent to the client. This should be implemented on the
* child class.
*
- * @param targetActor
- * @param nsIScriptError|nsIConsoleMessage message
+ * @param _targetActor
+ * @param nsIScriptError|nsIConsoleMessage _message
* @return object
* The object you can send to the remote client.
*/
- buildResource(targetActor, message) {
+ buildResource(_targetActor, _message) {
throw new Error(
"'buildResource' should be implemented in the class that extends nsIConsoleListenerWatcher"
);
diff --git a/devtools/server/actors/resources/utils/parent-process-storage.js b/devtools/server/actors/resources/utils/parent-process-storage.js
index 423d13b6b5..760e6e4d38 100644
--- a/devtools/server/actors/resources/utils/parent-process-storage.js
+++ b/devtools/server/actors/resources/utils/parent-process-storage.js
@@ -6,7 +6,8 @@
const EventEmitter = require("resource://devtools/shared/event-emitter.js");
const { isWindowGlobalPartOfContext } = ChromeUtils.importESModule(
- "resource://devtools/server/actors/watcher/browsing-context-helpers.sys.mjs"
+ "resource://devtools/server/actors/watcher/browsing-context-helpers.sys.mjs",
+ { global: "contextual" }
);
// ms of delay to throttle updates
diff --git a/devtools/server/actors/resources/websockets.js b/devtools/server/actors/resources/websockets.js
index 5845357a9c..58507f9fbb 100644
--- a/devtools/server/actors/resources/websockets.js
+++ b/devtools/server/actors/resources/websockets.js
@@ -97,7 +97,7 @@ class WebSocketWatcher {
}
// methods for the nsIWebSocketEventService
- webSocketCreated(webSocketSerialID, uri, protocols) {}
+ webSocketCreated() {}
webSocketOpened(
webSocketSerialID,
@@ -117,7 +117,7 @@ class WebSocketWatcher {
this.onAvailable([resource]);
}
- webSocketMessageAvailable(webSocketSerialID, data, messageType) {}
+ webSocketMessageAvailable() {}
webSocketClosed(webSocketSerialID, wasClean, code, reason) {
const httpChannelId = this.connections.get(webSocketSerialID);