summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /devtools/server/tests
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/tests')
-rw-r--r--devtools/server/tests/browser/browser_inspector-anonymous.js4
-rw-r--r--devtools/server/tests/browser/doc_accessibility_keyboard_audit.html6
-rw-r--r--devtools/server/tests/browser/doc_accessibility_text_label_audit.html72
-rw-r--r--devtools/server/tests/browser/head.js2
-rw-r--r--devtools/server/tests/xpcshell/head_dbg.js29
-rw-r--r--devtools/server/tests/xpcshell/test_addon_debugging_connect.js4
-rw-r--r--devtools/server/tests/xpcshell/test_getRuleText.js41
-rw-r--r--devtools/server/tests/xpcshell/test_sessionDataHelpers.js5
-rw-r--r--devtools/server/tests/xpcshell/test_xpcshell_debugging.js16
-rw-r--r--devtools/server/tests/xpcshell/testactors.js36
10 files changed, 132 insertions, 83 deletions
diff --git a/devtools/server/tests/browser/browser_inspector-anonymous.js b/devtools/server/tests/browser/browser_inspector-anonymous.js
index 024b7af1bb..526a3a5572 100644
--- a/devtools/server/tests/browser/browser_inspector-anonymous.js
+++ b/devtools/server/tests/browser/browser_inspector-anonymous.js
@@ -7,11 +7,11 @@
add_task(async function () {
await SpecialPowers.pushPermissions([
- { type: "allowXULXBL", allow: true, context: MAIN_DOMAIN },
+ { type: "allowXULXBL", allow: true, context: MAIN_DOMAIN_HTTPS },
]);
const { walker } = await initInspectorFront(
- MAIN_DOMAIN + "inspector-traversal-data.html"
+ MAIN_DOMAIN_HTTPS + "inspector-traversal-data.html"
);
await testXBLAnonymousInHTMLDocument(walker);
diff --git a/devtools/server/tests/browser/doc_accessibility_keyboard_audit.html b/devtools/server/tests/browser/doc_accessibility_keyboard_audit.html
index 00c002efe9..c4991a5f40 100644
--- a/devtools/server/tests/browser/doc_accessibility_keyboard_audit.html
+++ b/devtools/server/tests/browser/doc_accessibility_keyboard_audit.html
@@ -95,8 +95,10 @@
<div role="grid" aria-label="Interactive grid">
<div id="columnheader-1" role="columnheader"></div>
<div id="rowheader-1" role="rowheader"></div>
- <div id="gridcell-1" role="gridcell"></div>
- <div id="gridcell-2" role="gridcell" tabindex="0"></div>
+ <div role="row">
+ <div id="gridcell-1" role="gridcell"></div>
+ <div id="gridcell-2" role="gridcell" tabindex="0"></div>
+ </div>
</div>
<div role="table" aria-label="Non-interactive table">
<div id="columnheader-2" role="columnheader"></div>
diff --git a/devtools/server/tests/browser/doc_accessibility_text_label_audit.html b/devtools/server/tests/browser/doc_accessibility_text_label_audit.html
index 982cc5c243..24a23c96f0 100644
--- a/devtools/server/tests/browser/doc_accessibility_text_label_audit.html
+++ b/devtools/server/tests/browser/doc_accessibility_text_label_audit.html
@@ -61,13 +61,17 @@
<tr><th id="rowheader-7" scope="row" aria-labelledby="columnheader-7-label"></th></tr>
</tbody>
</table>
- <div role="columnheader" id="columnheader-8">Film Title</div>
- <div role="columnheader" id="columnheader-9"></div>
- <div role="columnheader" id="columnheader-10">&nbsp;</div>
- <div role="columnheader" id="columnheader-11" aria-label="Worldwide Gross"></div>
- <div role="columnheader" id="columnheader-12" aria-label=""></div>
- <div role="columnheader" id="columnheader-13" aria-label=" "></div>
- <div role="columnheader" id="columnheader-14" aria-labelledby="columnheader-7-label"></div>
+ <div role="grid">
+ <div role="row">
+ <div role="columnheader" id="columnheader-8">Film Title</div>
+ <div role="columnheader" id="columnheader-9"></div>
+ <div role="columnheader" id="columnheader-10">&nbsp;</div>
+ <div role="columnheader" id="columnheader-11" aria-label="Worldwide Gross"></div>
+ <div role="columnheader" id="columnheader-12" aria-label=""></div>
+ <div role="columnheader" id="columnheader-13" aria-label=" "></div>
+ <div role="columnheader" id="columnheader-14" aria-labelledby="columnheader-7-label"></div>
+ </div>
+ </div>
<label for="combobox-1">Choose a pet:</label>
<select id="combobox-1">
<option id="combobox-option-1" value="">--Please choose an option--</option>
@@ -263,14 +267,16 @@
<mi><mglyph id="mglyph-5" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAJklEQVRIie3NMREAAAgAoe9fWls4eAzMVM0xoVAoFAqFQqFQ+C9chp4NHvu+4Q4AAAAASUVORK5CYII=" alt=""/></mi>
<mi><mglyph id="mglyph-6" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAJklEQVRIie3NMREAAAgAoe9fWls4eAzMVM0xoVAoFAqFQqFQ+C9chp4NHvu+4Q4AAAAASUVORK5CYII=" aria-labelledby="mglyph-6-label"/></mi>
</math>
- <span id="menuitem-1" role="menuitem"></span>
- <span id="menuitem-2" aria-label="" role="menuitem"></span>
- <span id="menuitem-3" aria-label="Menu Item" role="menuitem"></span>
- <p id="menuitem-4-label">Menu Item</p>
- <span id="menuitem-4" aria-labelledby="menuitem-4-label" role="menuitem"></span>
- <p id="menuitem-5-label"></p>
- <span id="menuitem-5" aria-labelledby="menuitem-5-label" role="menuitem"></span>
- <span id="menuitem-6" role="menuitem">Menu Item</span>
+ <div role="menu">
+ <span id="menuitem-1" role="menuitem"></span>
+ <span id="menuitem-2" aria-label="" role="menuitem"></span>
+ <span id="menuitem-3" aria-label="Menu Item" role="menuitem"></span>
+ <p id="menuitem-4-label">Menu Item</p>
+ <span id="menuitem-4" aria-labelledby="menuitem-4-label" role="menuitem"></span>
+ <p id="menuitem-5-label"></p>
+ <span id="menuitem-5" aria-labelledby="menuitem-5-label" role="menuitem"></span>
+ <span id="menuitem-6" role="menuitem">Menu Item</span>
+ </div>
<label for="listbox-1">Choose a pet:</label>
<select id="listbox-1" size="6">
<option id="option-1" value="">--Please choose an option--</option>
@@ -299,14 +305,16 @@
<p id="option-15-label"> </p>
<div role="option" id="option-15" aria-labelledby="option-15-label"></div>
</div>
- <span id="treeitem-1" role="treeitem"></span>
- <span id="treeitem-2" aria-label="" role="treeitem"></span>
- <span id="treeitem-3" aria-label="Tree Item" role="treeitem"></span>
- <p id="treeitem-4-label">Tree Item</p>
- <span id="treeitem-4" aria-labelledby="treeitem-4-label" role="treeitem"></span>
- <p id="treeitem-5-label"></p>
- <span id="treeitem-5" aria-labelledby="treeitem-5-label" role="treeitem"></span>
- <span id="treeitem-6" role="treeitem">Tree Item</span>
+ <div role="tree">
+ <span id="treeitem-1" role="treeitem"></span>
+ <span id="treeitem-2" aria-label="" role="treeitem"></span>
+ <span id="treeitem-3" aria-label="Tree Item" role="treeitem"></span>
+ <p id="treeitem-4-label">Tree Item</p>
+ <span id="treeitem-4" aria-labelledby="treeitem-4-label" role="treeitem"></span>
+ <p id="treeitem-5-label"></p>
+ <span id="treeitem-5" aria-labelledby="treeitem-5-label" role="treeitem"></span>
+ <span id="treeitem-6" role="treeitem">Tree Item</span>
+ </div>
<div role="tablist">
<span id="tab-1" role="tab"></span>
<span id="tab-2" aria-label="" role="tab"></span>
@@ -368,13 +376,17 @@
<div id="menuitemradio-2" role="menuitemradio"></div>
<div id="menuitemradio-3" role="menuitemradio">&nbsp;</div>
</div>
- <div role="rowheader" id="rowheader-8">Toy Story 3</div>
- <div role="rowheader" id="rowheader-9"></div>
- <div role="rowheader" id="rowheader-10">&nbsp;</div>
- <div role="rowheader" id="rowheader-11" aria-label="Alladin"></div>
- <div role="rowheader" id="rowheader-12" aria-label=""></div>
- <div role="rowheader" id="rowheader-13" aria-label=" "></div>
- <div role="rowheader" id="rowheader-14" aria-labelledby="columnheader-7-label"></div>
+ <div role="grid">
+ <div role="row">
+ <div role="rowheader" id="rowheader-8">Toy Story 3</div>
+ <div role="rowheader" id="rowheader-9"></div>
+ <div role="rowheader" id="rowheader-10">&nbsp;</div>
+ <div role="rowheader" id="rowheader-11" aria-label="Alladin"></div>
+ <div role="rowheader" id="rowheader-12" aria-label=""></div>
+ <div role="rowheader" id="rowheader-13" aria-label=" "></div>
+ <div role="rowheader" id="rowheader-14" aria-labelledby="columnheader-7-label"></div>
+ </div>
+ </div>
<label>Slider label: <input type="range" id="slider-1"></label>
<input type="range" id="slider-2">
<input type="range" id="slider-3" aria-label="Slider label:">
diff --git a/devtools/server/tests/browser/head.js b/devtools/server/tests/browser/head.js
index aba6d578f2..a0363fe6d5 100644
--- a/devtools/server/tests/browser/head.js
+++ b/devtools/server/tests/browser/head.js
@@ -23,7 +23,9 @@ const {
const PATH = "browser/devtools/server/tests/browser/";
const TEST_DOMAIN = "http://test1.example.org";
+const TEST_DOMAIN_HTTPS = "https://test1.example.org";
const MAIN_DOMAIN = `${TEST_DOMAIN}/${PATH}`;
+const MAIN_DOMAIN_HTTPS = `${TEST_DOMAIN_HTTPS}/${PATH}`;
const ALT_DOMAIN = "http://sectest1.example.org/" + PATH;
const ALT_DOMAIN_SECURED = "https://sectest1.example.org:443/" + PATH;
diff --git a/devtools/server/tests/xpcshell/head_dbg.js b/devtools/server/tests/xpcshell/head_dbg.js
index 7161d5eaea..e8547f15b8 100644
--- a/devtools/server/tests/xpcshell/head_dbg.js
+++ b/devtools/server/tests/xpcshell/head_dbg.js
@@ -22,8 +22,8 @@ appInfo.updateAppInfo({
const { require, loader } = ChromeUtils.importESModule(
"resource://devtools/shared/loader/Loader.sys.mjs"
);
-const { worker } = ChromeUtils.import(
- "resource://devtools/shared/loader/worker-loader.js"
+const { worker } = ChromeUtils.importESModule(
+ "resource://devtools/shared/loader/worker-loader.sys.mjs"
);
const { NetUtil } = ChromeUtils.importESModule(
@@ -250,11 +250,6 @@ function waitForNewSource(threadFront, url) {
});
}
-function attachThread(targetFront, options = {}) {
- dump("Attaching to thread.\n");
- return targetFront.attachThread(options);
-}
-
function resume(threadFront) {
dump("Resuming thread.\n");
return threadFront.resume();
@@ -445,10 +440,14 @@ async function attachTestTab(client, title) {
async function attachTestThread(client, title) {
const commands = await attachTestTab(client, title);
const targetFront = commands.targetCommand.targetFront;
- const threadFront = await targetFront.getFront("thread");
- await targetFront.attachThread({
- autoBlackBox: true,
+
+ // Pass any configuration, in order to ensure starting all the thread actors
+ // and have them to handle debugger statements.
+ await commands.threadConfigurationCommand.updateConfiguration({
+ skipBreakpoints: false,
});
+
+ const threadFront = await targetFront.getFront("thread");
Assert.equal(threadFront.state, "attached", "Thread front is attached");
return { targetFront, threadFront, commands };
}
@@ -856,7 +855,15 @@ async function setupTestFromUrl(url) {
const targetFront = await descriptorFront.getTarget();
- const threadFront = await attachThread(targetFront);
+ const commands = await createCommandsDictionary(descriptorFront);
+
+ // Pass any configuration, in order to ensure starting all the thread actor
+ // and have it to notify about all sources
+ await commands.threadConfigurationCommand.updateConfiguration({
+ skipBreakpoints: false,
+ });
+
+ const threadFront = await targetFront.getFront("thread");
const sourceUrl = getFileUrl(url);
const promise = waitForNewSource(threadFront, sourceUrl);
diff --git a/devtools/server/tests/xpcshell/test_addon_debugging_connect.js b/devtools/server/tests/xpcshell/test_addon_debugging_connect.js
index 221e73d256..f0318378c9 100644
--- a/devtools/server/tests/xpcshell/test_addon_debugging_connect.js
+++ b/devtools/server/tests/xpcshell/test_addon_debugging_connect.js
@@ -53,7 +53,7 @@ function promiseFrameUpdate(front, matcher = () => true) {
add_task(
{
// This test needs to run only when the extension are running in a separate
- // child process, otherwise attachThread would pause the main process and this
+ // child process, otherwise the thread actor would pause the main process and this
// test would get stuck.
skip_if: () => !WebExtensionPolicy.useRemoteWebExtensions,
},
@@ -90,7 +90,7 @@ add_task(
.pop();
ok(backgroundPageFrame, "Found the frame for the background page");
- const threadFront = await addonTarget.attachThread();
+ const threadFront = await addonTarget.getFront("thread");
ok(threadFront, "Got a threadFront for the target addon");
equal(threadFront.paused, false, "The addon threadActor isn't paused");
diff --git a/devtools/server/tests/xpcshell/test_getRuleText.js b/devtools/server/tests/xpcshell/test_getRuleText.js
index bc89da974c..6e67a5f85b 100644
--- a/devtools/server/tests/xpcshell/test_getRuleText.js
+++ b/devtools/server/tests/xpcshell/test_getRuleText.js
@@ -39,7 +39,7 @@ const TEST_DATA = [
input: "#id{color:red;background:yellow;}",
line: 1,
column: 1,
- expected: { offset: 4, text: "color:red;background:yellow;" },
+ expected: "color:red;background:yellow;",
},
{
desc: "Multiple rules test case",
@@ -48,14 +48,14 @@ const TEST_DATA = [
"{ position:absolute; line-height: 45px}",
line: 1,
column: 34,
- expected: { offset: 56, text: " position:absolute; line-height: 45px" },
+ expected: " position:absolute; line-height: 45px",
},
{
desc: "Unclosed rule",
input: "#id{color:red;background:yellow;",
line: 1,
column: 1,
- expected: { offset: 4, text: "color:red;background:yellow;" },
+ expected: "color:red;background:yellow;",
},
{
desc: "Multi-lines CSS",
@@ -72,7 +72,7 @@ const TEST_DATA = [
].join("\n"),
line: 7,
column: 1,
- expected: { offset: 116, text: "\n color: purple;\n" },
+ expected: "\n color: purple;\n",
},
{
desc: "Multi-lines CSS and multi-line rule",
@@ -98,75 +98,64 @@ const TEST_DATA = [
].join("\n"),
line: 5,
column: 1,
- expected: {
- offset: 30,
- text: "\n margin: 0;\n padding: 15px 15px 2px 15px;\n color: red;\n",
- },
+ expected:
+ "\n margin: 0;\n padding: 15px 15px 2px 15px;\n color: red;\n",
},
{
desc: "Content string containing a } character",
input: " #id{border:1px solid red;content: '}';color:red;}",
line: 1,
column: 4,
- expected: {
- offset: 7,
- text: "border:1px solid red;content: '}';color:red;",
- },
+ expected: "border:1px solid red;content: '}';color:red;",
},
{
desc: "Attribute selector containing a { character",
input: `div[data-x="{"]{color: gold}`,
line: 1,
column: 1,
- expected: {
- offset: 16,
- text: "color: gold",
- },
+ expected: "color: gold",
},
{
desc: "Rule contains no tokens",
input: "div{}",
line: 1,
column: 1,
- expected: { offset: 4, text: "" },
+ expected: "",
},
{
desc: "Rule contains invalid declaration",
input: `#id{color;}`,
line: 1,
column: 1,
- expected: { offset: 4, text: "color;" },
+ expected: "color;",
},
{
desc: "Rule contains invalid declaration",
input: `#id{-}`,
line: 1,
column: 1,
- expected: { offset: 4, text: "-" },
+ expected: "-",
},
{
desc: "Rule contains nested rule",
input: `#id{background: gold; .nested{color:blue;} color: tomato; }`,
line: 1,
column: 1,
- expected: {
- offset: 4,
- text: "background: gold; .nested{color:blue;} color: tomato; ",
- },
+ expected: "background: gold; .nested{color:blue;} color: tomato; ",
},
{
desc: "Rule contains nested rule with invalid declaration",
input: `#id{.nested{color;}}`,
line: 1,
column: 1,
- expected: { offset: 4, text: ".nested{color;}" },
+ expected: ".nested{color;}",
},
{
desc: "Rule contains unicode chars",
input: `#id /*🙃*/ {content: "☃️";}`,
line: 1,
column: 1,
- expected: { offset: 12, text: `content: "☃️";` },
+ expected: `content: "☃️";`,
},
];
@@ -192,7 +181,7 @@ function run_test() {
}
}
if (output) {
- deepEqual(output, test.expected);
+ Assert.equal(output, test.expected);
}
}
}
diff --git a/devtools/server/tests/xpcshell/test_sessionDataHelpers.js b/devtools/server/tests/xpcshell/test_sessionDataHelpers.js
index e0dcc3b21b..0c17937a69 100644
--- a/devtools/server/tests/xpcshell/test_sessionDataHelpers.js
+++ b/devtools/server/tests/xpcshell/test_sessionDataHelpers.js
@@ -7,8 +7,9 @@
"use strict";
-const { SessionDataHelpers } = ChromeUtils.import(
- "resource://devtools/server/actors/watcher/SessionDataHelpers.jsm"
+const { SessionDataHelpers } = ChromeUtils.importESModule(
+ "resource://devtools/server/actors/watcher/SessionDataHelpers.sys.mjs",
+ { global: "contextual" }
);
const { SUPPORTED_DATA } = SessionDataHelpers;
const { TARGETS } = SUPPORTED_DATA;
diff --git a/devtools/server/tests/xpcshell/test_xpcshell_debugging.js b/devtools/server/tests/xpcshell/test_xpcshell_debugging.js
index ff54d7390d..12d38b923d 100644
--- a/devtools/server/tests/xpcshell/test_xpcshell_debugging.js
+++ b/devtools/server/tests/xpcshell/test_xpcshell_debugging.js
@@ -35,11 +35,17 @@ add_task(async function () {
);
// Even though we have no tabs, getMainProcess gives us the chrome debugger.
- const targetDescriptor = await client.mainRoot.getMainProcess();
- const front = await targetDescriptor.getTarget();
- const watcher = await targetDescriptor.getWatcher();
+ const commands = await CommandsFactory.forMainProcess({ client });
+ await commands.targetCommand.startListening();
- const threadFront = await front.attachThread();
+ // We have to pass at least one valid thread configuration in order to initialize
+ // the thread actor and make it pause on breakpoint/debugger statements.
+ await commands.threadConfigurationCommand.updateConfiguration({
+ skipBreakpoints: false,
+ });
+ const threadFront = await commands.targetCommand.targetFront.getFront(
+ "thread"
+ );
// Checks that the thread actor initializes immediately and that _setupDevToolsServer
// callback gets called.
@@ -72,7 +78,7 @@ add_task(async function () {
);
info("Dynamically add a breakpoint after the debugger statement");
- const breakpointsFront = await watcher.getBreakpointListActor();
+ const breakpointsFront = await commands.watcherFront.getBreakpointListActor();
await breakpointsFront.setBreakpoint(
{ sourceUrl: testFile.path, line: 11, column: 0 },
{}
diff --git a/devtools/server/tests/xpcshell/testactors.js b/devtools/server/tests/xpcshell/testactors.js
index bbcd8abe6e..6df7f0ce88 100644
--- a/devtools/server/tests/xpcshell/testactors.js
+++ b/devtools/server/tests/xpcshell/testactors.js
@@ -8,6 +8,9 @@ const {
createExtraActors,
} = require("resource://devtools/shared/protocol/lazy-pool.js");
const { RootActor } = require("resource://devtools/server/actors/root.js");
+const {
+ WatcherActor,
+} = require("resource://devtools/server/actors/watcher.js");
const { ThreadActor } = require("resource://devtools/server/actors/thread.js");
const {
DevToolsServer,
@@ -30,6 +33,14 @@ const Targets = require("resource://devtools/server/actors/targets/index.js");
const {
createContentProcessSessionContext,
} = require("resource://devtools/server/actors/watcher/session-context.js");
+const { TargetActorRegistry } = ChromeUtils.importESModule(
+ "resource://devtools/server/actors/targets/target-actor-registry.sys.mjs",
+ { global: "shared" }
+);
+const {
+ BaseTargetActor,
+} = require("resource://devtools/server/actors/targets/base-target-actor.js");
+const Resources = require("resource://devtools/server/actors/resources/index.js");
var gTestGlobals = new Set();
DevToolsServer.addTestGlobal = function (global) {
@@ -78,6 +89,9 @@ function TestTabList(connection) {
const actor = new TestTargetActor(connection, global);
this._descriptorActorPool.manage(actor);
+ // Register the target actor, so that the Watcher actor can have access to it.
+ TargetActorRegistry.registerXpcShellTargetActor(actor);
+
const descriptorActor = new TestDescriptorActor(connection, actor);
this._descriptorActorPool.manage(descriptorActor);
@@ -134,7 +148,9 @@ class TestDescriptorActor extends protocol.Actor {
form() {
const form = {
actor: this.actorID,
- traits: {},
+ traits: {
+ watcher: true,
+ },
selected: this.selected,
title: this._targetActor.title,
url: this._targetActor.url,
@@ -143,6 +159,20 @@ class TestDescriptorActor extends protocol.Actor {
return form;
}
+ getWatcher() {
+ const sessionContext = {
+ type: "all",
+ supportedTargets: {},
+ supportedResources: [
+ Resources.TYPES.SOURCE,
+ Resources.TYPES.CONSOLE_MESSAGE,
+ Resources.TYPES.THREAD_STATE,
+ ],
+ };
+ const watcherActor = new WatcherActor(this.conn, sessionContext);
+ return watcherActor;
+ }
+
getFavicon() {
return "";
}
@@ -152,9 +182,9 @@ class TestDescriptorActor extends protocol.Actor {
}
}
-class TestTargetActor extends protocol.Actor {
+class TestTargetActor extends BaseTargetActor {
constructor(conn, global) {
- super(conn, windowGlobalTargetSpec);
+ super(conn, Targets.TYPES.FRAME, windowGlobalTargetSpec);
this.sessionContext = createContentProcessSessionContext();
this._global = global;