summaryrefslogtreecommitdiffstats
path: root/devtools/shared/commands/resource/tests
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/shared/commands/resource/tests')
-rw-r--r--devtools/shared/commands/resource/tests/browser_resources_css_changes.js2
-rw-r--r--devtools/shared/commands/resource/tests/browser_resources_css_registered_properties.js2
-rw-r--r--devtools/shared/commands/resource/tests/browser_resources_network_events.js2
-rw-r--r--devtools/shared/commands/resource/tests/browser_resources_target_resources_race.js2
-rw-r--r--devtools/shared/commands/resource/tests/browser_resources_thread_states.js82
-rw-r--r--devtools/shared/commands/resource/tests/sse_frontend.html2
-rw-r--r--devtools/shared/commands/resource/tests/sse_frontend_iframe.html2
-rw-r--r--devtools/shared/commands/resource/tests/test_service_worker.js2
8 files changed, 89 insertions, 7 deletions
diff --git a/devtools/shared/commands/resource/tests/browser_resources_css_changes.js b/devtools/shared/commands/resource/tests/browser_resources_css_changes.js
index 22b11a8186..e116dbceb8 100644
--- a/devtools/shared/commands/resource/tests/browser_resources_css_changes.js
+++ b/devtools/shared/commands/resource/tests/browser_resources_css_changes.js
@@ -132,7 +132,7 @@ async function setProperty(rule, index, property, value) {
await modifications.apply();
}
-async function renameProperty(rule, index, oldName, newName, value) {
+async function renameProperty(rule, index, oldName, newName) {
const modifications = rule.startModifyingProperties({ isKnown: true });
modifications.renameProperty(index, oldName, newName);
await modifications.apply();
diff --git a/devtools/shared/commands/resource/tests/browser_resources_css_registered_properties.js b/devtools/shared/commands/resource/tests/browser_resources_css_registered_properties.js
index 1429b55167..b39d4419b1 100644
--- a/devtools/shared/commands/resource/tests/browser_resources_css_registered_properties.js
+++ b/devtools/shared/commands/resource/tests/browser_resources_css_registered_properties.js
@@ -74,7 +74,7 @@ add_task(async function () {
onAvailable,
});
await waitFor(() => targets.length === 2);
- const [topLevelTarget, iframeTarget] = targets.sort((a, b) =>
+ const [topLevelTarget, iframeTarget] = targets.sort((a, _) =>
a.isTopLevel ? -1 : 1
);
diff --git a/devtools/shared/commands/resource/tests/browser_resources_network_events.js b/devtools/shared/commands/resource/tests/browser_resources_network_events.js
index da355fd023..dd8211b478 100644
--- a/devtools/shared/commands/resource/tests/browser_resources_network_events.js
+++ b/devtools/shared/commands/resource/tests/browser_resources_network_events.js
@@ -128,7 +128,7 @@ add_task(async function testCanceledRequest() {
// from the parent process is much more reliable.
const observer = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
- observe(subject, topic, data) {
+ observe(subject) {
subject = subject.QueryInterface(Ci.nsIHttpChannel);
if (subject.URI.spec == requestUrl) {
subject.cancel(Cr.NS_BINDING_ABORTED);
diff --git a/devtools/shared/commands/resource/tests/browser_resources_target_resources_race.js b/devtools/shared/commands/resource/tests/browser_resources_target_resources_race.js
index 557d14380a..c319e3b9e2 100644
--- a/devtools/shared/commands/resource/tests/browser_resources_target_resources_race.js
+++ b/devtools/shared/commands/resource/tests/browser_resources_target_resources_race.js
@@ -29,7 +29,7 @@ add_task(async function () {
// Empty onAvailable callback for CSS MESSAGES, we only want to check that
// the second resource we watch correctly provides existing resources.
- const onCssMessageAvailable = resources => {};
+ const onCssMessageAvailable = () => {};
// First call to watchResources.
// We do not await on `watchPromise1` here, in order to simulate simultaneous
diff --git a/devtools/shared/commands/resource/tests/browser_resources_thread_states.js b/devtools/shared/commands/resource/tests/browser_resources_thread_states.js
index f915bb14d0..f9d49e227a 100644
--- a/devtools/shared/commands/resource/tests/browser_resources_thread_states.js
+++ b/devtools/shared/commands/resource/tests/browser_resources_thread_states.js
@@ -30,6 +30,9 @@ add_task(async function () {
// Check debugger statement for (remote) iframes
await checkDebuggerStatementInIframes();
+
+ // Check the behavior of THREAD_STATE against a multiprocess usecase
+ await testMultiprocessThreadState();
});
async function checkBreakpointBeforeWatchResources() {
@@ -507,6 +510,85 @@ async function checkDebuggerStatementInIframes() {
await client.close();
}
+async function testMultiprocessThreadState() {
+ // Ensure debugging the content processes and the tab
+ await pushPref("devtools.browsertoolbox.scope", "everything");
+
+ const { client, resourceCommand, targetCommand } =
+ await initMultiProcessResourceCommand();
+
+ info("Call watchResources");
+ const availableResources = [];
+ await resourceCommand.watchResources([resourceCommand.TYPES.SOURCE], {
+ onAvailable() {},
+ });
+ await resourceCommand.watchResources([resourceCommand.TYPES.THREAD_STATE], {
+ onAvailable: resources => availableResources.push(...resources),
+ });
+
+ is(
+ availableResources.length,
+ 0,
+ "Got no THREAD_STATE when calling watchResources"
+ );
+
+ const tab = await addTab(BREAKPOINT_TEST_URL);
+
+ info("Run the 'debugger' statement");
+ // Note that we do not wait for the resolution of spawn as it will be paused
+ const onResumed = ContentTask.spawn(tab.linkedBrowser, null, () => {
+ content.window.wrappedJSObject.runDebuggerStatement();
+ });
+
+ await waitFor(
+ () => availableResources.length == 1,
+ "Got the THREAD_STATE related to the debugger statement"
+ );
+ const threadState = availableResources.pop();
+ ok(threadState.targetFront.targetType, "process");
+ ok(threadState.targetFront.threadFront.state, "paused");
+
+ assertPausedResource(threadState, {
+ state: "paused",
+ why: {
+ type: "debuggerStatement",
+ },
+ frame: {
+ type: "call",
+ asyncCause: null,
+ state: "on-stack",
+ // this: object actor's form referring to `this` variable
+ displayName: "runDebuggerStatement",
+ // arguments: []
+ where: {
+ line: 17,
+ column: 6,
+ },
+ },
+ });
+
+ await threadState.targetFront.threadFront.resume();
+
+ await waitFor(
+ () => availableResources.length == 1,
+ "Wait until we receive the resumed event"
+ );
+
+ const resumed = availableResources.pop();
+
+ assertResumedResource(resumed);
+
+ // This is an important check, which verify that no unexpected pause happens.
+ // We might spawn a Thread Actor for the WindowGlobal target, which might pause the thread a second time,
+ // whereas we only expect the ContentProcess target actor to pause on all JS files of the related content process.
+ info("Wait for the content page thread to resume its execution");
+ await onResumed;
+ is(availableResources.length, 0, "There should be no other pause");
+
+ targetCommand.destroy();
+ await client.close();
+}
+
async function assertPausedResource(resource, expected) {
is(
resource.resourceType,
diff --git a/devtools/shared/commands/resource/tests/sse_frontend.html b/devtools/shared/commands/resource/tests/sse_frontend.html
index 3bdddbc5bc..359aad2215 100644
--- a/devtools/shared/commands/resource/tests/sse_frontend.html
+++ b/devtools/shared/commands/resource/tests/sse_frontend.html
@@ -18,7 +18,7 @@
function openConnection() {
return new Promise(resolve => {
const es = new EventSource("sse_backend.sjs");
- es.onmessage = function (e) {
+ es.onmessage = function () {
es.close();
resolve();
};
diff --git a/devtools/shared/commands/resource/tests/sse_frontend_iframe.html b/devtools/shared/commands/resource/tests/sse_frontend_iframe.html
index 477dca013d..1fe894cccc 100644
--- a/devtools/shared/commands/resource/tests/sse_frontend_iframe.html
+++ b/devtools/shared/commands/resource/tests/sse_frontend_iframe.html
@@ -18,7 +18,7 @@
function openConnection() {
return new Promise(resolve => {
const es = new EventSource("sse_backend.sjs");
- es.onmessage = function (e) {
+ es.onmessage = function () {
es.close();
resolve();
};
diff --git a/devtools/shared/commands/resource/tests/test_service_worker.js b/devtools/shared/commands/resource/tests/test_service_worker.js
index aabc3fda0f..0ed8942239 100644
--- a/devtools/shared/commands/resource/tests/test_service_worker.js
+++ b/devtools/shared/commands/resource/tests/test_service_worker.js
@@ -6,6 +6,6 @@
// We don't need any computation in the worker,
// but at least register a fetch listener so that
// we force instantiating the SW when loading the page.
-self.onfetch = function (event) {
+self.onfetch = function () {
// do nothing.
};