summaryrefslogtreecommitdiffstats
path: root/devtools/shared/network-observer
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/shared/network-observer')
-rw-r--r--devtools/shared/network-observer/NetworkHelper.sys.mjs17
-rw-r--r--devtools/shared/network-observer/NetworkObserver.sys.mjs43
-rw-r--r--devtools/shared/network-observer/NetworkResponseListener.sys.mjs33
-rw-r--r--devtools/shared/network-observer/NetworkUtils.sys.mjs12
-rw-r--r--devtools/shared/network-observer/test/browser/browser_networkobserver_auth_listener.js6
-rw-r--r--devtools/shared/network-observer/test/browser/doc_network-observer-missing-service-worker.html4
-rw-r--r--devtools/shared/network-observer/test/browser/doc_network-observer.html2
-rw-r--r--devtools/shared/network-observer/test/browser/head.js2
8 files changed, 65 insertions, 54 deletions
diff --git a/devtools/shared/network-observer/NetworkHelper.sys.mjs b/devtools/shared/network-observer/NetworkHelper.sys.mjs
index f225e51e08..a64512436f 100644
--- a/devtools/shared/network-observer/NetworkHelper.sys.mjs
+++ b/devtools/shared/network-observer/NetworkHelper.sys.mjs
@@ -62,18 +62,23 @@
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- DevToolsInfaillibleUtils:
- "resource://devtools/shared/DevToolsInfaillibleUtils.sys.mjs",
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ DevToolsInfaillibleUtils:
+ "resource://devtools/shared/DevToolsInfaillibleUtils.sys.mjs",
- NetUtil: "resource://gre/modules/NetUtil.sys.mjs",
-});
+ NetUtil: "resource://gre/modules/NetUtil.sys.mjs",
+ },
+ { global: "contextual" }
+);
// It would make sense to put this in the above
// ChromeUtils.defineESModuleGetters, but that doesn't seem to work.
ChromeUtils.defineLazyGetter(lazy, "certDecoder", () => {
const { parse, pemToDER } = ChromeUtils.importESModule(
- "chrome://global/content/certviewer/certDecoder.mjs"
+ "chrome://global/content/certviewer/certDecoder.mjs",
+ { global: "contextual" }
);
return { parse, pemToDER };
});
diff --git a/devtools/shared/network-observer/NetworkObserver.sys.mjs b/devtools/shared/network-observer/NetworkObserver.sys.mjs
index 35e66c9d5b..8375fb4714 100644
--- a/devtools/shared/network-observer/NetworkObserver.sys.mjs
+++ b/devtools/shared/network-observer/NetworkObserver.sys.mjs
@@ -10,7 +10,7 @@
// Enable logging all platform events this module listen to
const DEBUG_PLATFORM_EVENTS = false;
// Enables defining criteria to filter the logs
-const DEBUG_PLATFORM_EVENTS_FILTER = (eventName, channel) => {
+const DEBUG_PLATFORM_EVENTS_FILTER = () => {
// e.g return eventName == "HTTP_TRANSACTION:REQUEST_HEADER" && channel.URI.spec == "http://foo.com";
return true;
};
@@ -19,23 +19,28 @@ const lazy = {};
import { DevToolsInfaillibleUtils } from "resource://devtools/shared/DevToolsInfaillibleUtils.sys.mjs";
-ChromeUtils.defineESModuleGetters(lazy, {
- ChannelMap: "resource://devtools/shared/network-observer/ChannelMap.sys.mjs",
- NetworkAuthListener:
- "resource://devtools/shared/network-observer/NetworkAuthListener.sys.mjs",
- NetworkHelper:
- "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
- NetworkOverride:
- "resource://devtools/shared/network-observer/NetworkOverride.sys.mjs",
- NetworkResponseListener:
- "resource://devtools/shared/network-observer/NetworkResponseListener.sys.mjs",
- NetworkThrottleManager:
- "resource://devtools/shared/network-observer/NetworkThrottleManager.sys.mjs",
- NetworkUtils:
- "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
- wildcardToRegExp:
- "resource://devtools/shared/network-observer/WildcardToRegexp.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ ChannelMap:
+ "resource://devtools/shared/network-observer/ChannelMap.sys.mjs",
+ NetworkAuthListener:
+ "resource://devtools/shared/network-observer/NetworkAuthListener.sys.mjs",
+ NetworkHelper:
+ "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
+ NetworkOverride:
+ "resource://devtools/shared/network-observer/NetworkOverride.sys.mjs",
+ NetworkResponseListener:
+ "resource://devtools/shared/network-observer/NetworkResponseListener.sys.mjs",
+ NetworkThrottleManager:
+ "resource://devtools/shared/network-observer/NetworkThrottleManager.sys.mjs",
+ NetworkUtils:
+ "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
+ wildcardToRegExp:
+ "resource://devtools/shared/network-observer/WildcardToRegexp.sys.mjs",
+ },
+ { global: "contextual" }
+);
const gActivityDistributor = Cc[
"@mozilla.org/network/http-activity-distributor;1"
@@ -267,7 +272,7 @@ export class NetworkObserver {
}
#serviceWorkerRequest = DevToolsInfaillibleUtils.makeInfallible(
- (subject, topic, data) => {
+ (subject, topic) => {
const channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (this.#ignoreChannelFunction(channel)) {
diff --git a/devtools/shared/network-observer/NetworkResponseListener.sys.mjs b/devtools/shared/network-observer/NetworkResponseListener.sys.mjs
index 642773c8b2..31546203ca 100644
--- a/devtools/shared/network-observer/NetworkResponseListener.sys.mjs
+++ b/devtools/shared/network-observer/NetworkResponseListener.sys.mjs
@@ -4,15 +4,19 @@
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- NetUtil: "resource://gre/modules/NetUtil.sys.mjs",
- NetworkHelper:
- "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
- NetworkUtils:
- "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
- getResponseCacheObject:
- "resource://devtools/shared/platform/CacheEntry.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ NetUtil: "resource://gre/modules/NetUtil.sys.mjs",
+ NetworkHelper:
+ "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
+ NetworkUtils:
+ "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs",
+ getResponseCacheObject:
+ "resource://devtools/shared/platform/CacheEntry.sys.mjs",
+ },
+ { global: "contextual" }
+);
// Network logging
@@ -77,14 +81,9 @@ export class NetworkResponseListener {
*
* @type {nsIInputStream}
*/
+ // eslint-disable-next-line no-unused-private-class-members
#inputStream = null;
/**
- * Explicit flag to check if this listener was already destroyed.
- *
- * @type {boolean}
- */
- #isDestroyed = false;
- /**
* Internal promise used to hold the completion of #getSecurityInfo.
*
* @type {Promise}
@@ -412,7 +411,7 @@ export class NetworkResponseListener {
* Handle progress event as data is transferred. This is used to record the
* size on the wire, which may be compressed / encoded.
*/
- onProgress(request, progress, progressMax) {
+ onProgress(request, progress) {
this.#bodySize = progress;
// Need to forward as well to keep things like Download Manager's progress
@@ -553,8 +552,6 @@ export class NetworkResponseListener {
this.#inputStream = null;
this.#converter = null;
this.#request = null;
-
- this.#isDestroyed = true;
}
/**
diff --git a/devtools/shared/network-observer/NetworkUtils.sys.mjs b/devtools/shared/network-observer/NetworkUtils.sys.mjs
index 6f564a9b1a..8a2525e1e7 100644
--- a/devtools/shared/network-observer/NetworkUtils.sys.mjs
+++ b/devtools/shared/network-observer/NetworkUtils.sys.mjs
@@ -4,10 +4,14 @@
const lazy = {};
-ChromeUtils.defineESModuleGetters(lazy, {
- NetworkHelper:
- "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
-});
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ NetworkHelper:
+ "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
+ },
+ { global: "contextual" }
+);
ChromeUtils.defineLazyGetter(lazy, "tpFlagsMask", () => {
const trackingProtectionLevel2Enabled = Services.prefs
diff --git a/devtools/shared/network-observer/test/browser/browser_networkobserver_auth_listener.js b/devtools/shared/network-observer/test/browser/browser_networkobserver_auth_listener.js
index e3492c10ad..2071029350 100644
--- a/devtools/shared/network-observer/test/browser/browser_networkobserver_auth_listener.js
+++ b/devtools/shared/network-observer/test/browser/browser_networkobserver_auth_listener.js
@@ -71,7 +71,7 @@ add_task(async function testAuthRequestWithoutListener() {
const events = [];
const networkObserver = new NetworkObserver({
ignoreChannelFunction: channel => channel.URI.spec !== AUTH_URL,
- onNetworkEvent: event => {
+ onNetworkEvent: () => {
const owner = new AuthForwardingOwner();
events.push(owner);
return owner;
@@ -115,7 +115,7 @@ add_task(async function testAuthRequestWithForwardingListener() {
const events = [];
const networkObserver = new NetworkObserver({
ignoreChannelFunction: channel => channel.URI.spec !== AUTH_URL,
- onNetworkEvent: event => {
+ onNetworkEvent: () => {
info("waitForNetworkEvents received a new event");
const owner = new AuthForwardingOwner();
events.push(owner);
@@ -167,7 +167,7 @@ add_task(async function testAuthRequestWithCancellingListener() {
const events = [];
const networkObserver = new NetworkObserver({
ignoreChannelFunction: channel => channel.URI.spec !== AUTH_URL,
- onNetworkEvent: event => {
+ onNetworkEvent: () => {
const owner = new AuthCancellingOwner();
events.push(owner);
return owner;
diff --git a/devtools/shared/network-observer/test/browser/doc_network-observer-missing-service-worker.html b/devtools/shared/network-observer/test/browser/doc_network-observer-missing-service-worker.html
index 396e51677c..791190a1b3 100644
--- a/devtools/shared/network-observer/test/browser/doc_network-observer-missing-service-worker.html
+++ b/devtools/shared/network-observer/test/browser/doc_network-observer-missing-service-worker.html
@@ -21,9 +21,9 @@
// NOTE: This service worker file does not exist which enables testing
// that a 404 requests is received.
return sw.register("serviceworker-missing.js")
- .then(registration => {
+ .then(() => {
throw new Error("The Service Worker file should not exist");
- }).catch(err => {
+ }).catch(() => {
console.log("Registration failed as expected");
});
}
diff --git a/devtools/shared/network-observer/test/browser/doc_network-observer.html b/devtools/shared/network-observer/test/browser/doc_network-observer.html
index 2ca400e0ae..78d751dfac 100644
--- a/devtools/shared/network-observer/test/browser/doc_network-observer.html
+++ b/devtools/shared/network-observer/test/browser/doc_network-observer.html
@@ -36,7 +36,7 @@
}, { once: true });
}
});
- }).catch(err => {
+ }).catch(() => {
console.error("Registration failed");
});
}
diff --git a/devtools/shared/network-observer/test/browser/head.js b/devtools/shared/network-observer/test/browser/head.js
index deb7becff6..0c26e248aa 100644
--- a/devtools/shared/network-observer/test/browser/head.js
+++ b/devtools/shared/network-observer/test/browser/head.js
@@ -84,7 +84,7 @@ class NetworkEventOwner {
* Create a simple network event owner, with mock implementations of all
* the expected APIs for a NetworkEventOwner.
*/
-function createNetworkEventOwner(event) {
+function createNetworkEventOwner() {
return new NetworkEventOwner();
}