diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /devtools/shared/commands/resource/tests | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/shared/commands/resource/tests')
4 files changed, 54 insertions, 30 deletions
diff --git a/devtools/shared/commands/resource/tests/browser_resources_last_private_context_exit.js b/devtools/shared/commands/resource/tests/browser_resources_last_private_context_exit.js index 1e2d894be3..738e70bc2d 100644 --- a/devtools/shared/commands/resource/tests/browser_resources_last_private_context_exit.js +++ b/devtools/shared/commands/resource/tests/browser_resources_last_private_context_exit.js @@ -66,7 +66,7 @@ add_task(async function () { }); info("Close the second private window"); - secondPrivateWindow.BrowserTryToCloseWindow(); + secondPrivateWindow.BrowserCommands.tryToCloseWindow(); // Let a chance to an unexpected async event to be fired await wait(1000); @@ -80,7 +80,7 @@ add_task(async function () { info( "close the private window and check if LAST_PRIVATE_CONTEXT_EXIT resource is sent" ); - privateWindow.BrowserTryToCloseWindow(); + privateWindow.BrowserCommands.tryToCloseWindow(); info("Wait for LAST_PRIVATE_CONTEXT_EXIT"); await waitFor(() => availableResources.length == 1); diff --git a/devtools/shared/commands/resource/tests/browser_resources_network_events_parent_process.js b/devtools/shared/commands/resource/tests/browser_resources_network_events_parent_process.js index c5b3e436db..0c8583aa97 100644 --- a/devtools/shared/commands/resource/tests/browser_resources_network_events_parent_process.js +++ b/devtools/shared/commands/resource/tests/browser_resources_network_events_parent_process.js @@ -32,6 +32,10 @@ const FETCH_URI = "https://example.com/document-builder.sjs?html=foo"; const uuid = `${Date.now()}-${Math.random()}`; const IMAGE_URI = URL_ROOT_SSL + "test_image.png?" + uuid; +// Loading the content page might also trigger priviledge image requests from the firefox UI, this seems to +// happen when a new tab is created for the page. +const ignoreRequestPatterns = "file:///"; + add_task(async function testParentProcessRequests() { // The test expects the main process commands instance to receive resources // for content process requests. @@ -46,6 +50,9 @@ add_task(async function testParentProcessRequests() { const onAvailable = resources => { for (const resource of resources) { if (resource.resourceType == resourceCommand.TYPES.NETWORK_EVENT) { + if (resource.url.startsWith(ignoreRequestPatterns)) { + return; + } receivedNetworkEvents.push(resource); } else if ( resource.resourceType == resourceCommand.TYPES.NETWORK_EVENT_STACKTRACE diff --git a/devtools/shared/commands/resource/tests/browser_resources_stylesheets.js b/devtools/shared/commands/resource/tests/browser_resources_stylesheets.js index ec81e8118d..6c4f2e867a 100644 --- a/devtools/shared/commands/resource/tests/browser_resources_stylesheets.js +++ b/devtools/shared/commands/resource/tests/browser_resources_stylesheets.js @@ -118,6 +118,8 @@ const ADDITIONAL_FROM_ACTOR_RESOURCE = { }; add_task(async function () { + // Enable @property + await pushPref("layout.css.properties-and-values.enabled", true); await testResourceAvailableDestroyedFeature(); await testResourceUpdateFeature(); await testNestedResourceUpdateFeature(); @@ -496,13 +498,18 @@ async function testNestedResourceUpdateFeature() { } } } + } + @property --my-property { + syntax: "<color>"; + inherits: true; + initial-value: #f06; }`, false ); await waitUntil(() => updates.length === 3); is( updates.at(-1).resource.ruleCount, - 7, + 8, "Resource in update has expected ruleCount" ); @@ -554,6 +561,10 @@ async function testNestedResourceUpdateFeature() { type: "container", conditionText: "root (width > 10px)", }, + { + type: "property", + propertyName: "--my-property", + }, ]; assertAtRules(targetUpdate.resource.atRules, expectedAtRules); @@ -562,7 +573,7 @@ async function testNestedResourceUpdateFeature() { const styleSheetResult = await getStyleSheetResult(tab); is( styleSheetResult.ruleCount, - 7, + 8, "ruleCount of actual stylesheet is updated correctly" ); assertAtRules(styleSheetResult.atRules, expectedAtRules); @@ -620,6 +631,11 @@ async function getStyleSheetResult(tab) { type: "support", conditionText: rule.conditionText, }); + } else if (rule instanceof content.CSSPropertyRule) { + atRules.push({ + type: "property", + propertyName: rule.name, + }); } if (rule.cssRules) { @@ -655,6 +671,8 @@ function assertAtRules(atRules, expectedAtRules) { is(atRule.matches, expected.matches, "matches is correct"); } else if (expected.type === "layer") { is(atRule.layerName, expected.layerName, "layerName is correct"); + } else if (expected.type === "property") { + is(atRule.propertyName, expected.propertyName, "propertyName is correct"); } if (expected.line !== undefined) { 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 f9d49e227a..fb4848c4c3 100644 --- a/devtools/shared/commands/resource/tests/browser_resources_thread_states.js +++ b/devtools/shared/commands/resource/tests/browser_resources_thread_states.js @@ -42,9 +42,8 @@ async function checkBreakpointBeforeWatchResources() { const tab = await addTab(BREAKPOINT_TEST_URL); - const { client, resourceCommand, targetCommand } = await initResourceCommand( - tab - ); + const { commands, resourceCommand, targetCommand } = + await initResourceCommand(tab); // Ensure that the target front is initialized early from TargetCommand.onTargetAvailable // By the time `initResourceCommand` resolves, it should already be initialized. @@ -53,6 +52,11 @@ async function checkBreakpointBeforeWatchResources() { ); await targetCommand.targetFront.initialized; + // We have to ensure passing any thread configuration in order to have breakpoints being handled. + await commands.threadConfigurationCommand.updateConfiguration({ + skipBreakpoints: false, + }); + info("Run the 'debugger' statement"); // Note that we do not wait for the resolution of spawn as it will be paused ContentTask.spawn(tab.linkedBrowser, null, () => { @@ -104,7 +108,7 @@ async function checkBreakpointBeforeWatchResources() { assertResumedResource(resumed); targetCommand.destroy(); - await client.close(); + await commands.destroy(); } async function checkBreakpointAfterWatchResources() { @@ -114,9 +118,8 @@ async function checkBreakpointAfterWatchResources() { const tab = await addTab(BREAKPOINT_TEST_URL); - const { client, resourceCommand, targetCommand } = await initResourceCommand( - tab - ); + const { commands, resourceCommand, targetCommand } = + await initResourceCommand(tab); info("Call watchResources"); const availableResources = []; @@ -176,7 +179,7 @@ async function checkBreakpointAfterWatchResources() { assertResumedResource(resumed); targetCommand.destroy(); - await client.close(); + await commands.destroy(); } async function checkRealBreakpoint() { @@ -186,9 +189,8 @@ async function checkRealBreakpoint() { const tab = await addTab(BREAKPOINT_TEST_URL); - const { client, resourceCommand, targetCommand } = await initResourceCommand( - tab - ); + const { commands, resourceCommand, targetCommand } = + await initResourceCommand(tab); info("Call watchResources"); const availableResources = []; @@ -258,7 +260,7 @@ async function checkRealBreakpoint() { assertResumedResource(resumed); targetCommand.destroy(); - await client.close(); + await commands.destroy(); } async function checkPauseOnException() { @@ -342,9 +344,8 @@ async function checkSetBeforeWatch() { const tab = await addTab(BREAKPOINT_TEST_URL); - const { client, resourceCommand, targetCommand } = await initResourceCommand( - tab - ); + const { commands, resourceCommand, targetCommand } = + await initResourceCommand(tab); // Instantiate the thread front in order to be able to set a breakpoint before watching for thread state info("Attach the top level thread actor"); @@ -381,10 +382,9 @@ async function checkSetBeforeWatch() { onAvailable: resources => availableResources.push(...resources), }); - await waitFor( - () => availableResources.length == 1, - "Got the THREAD_STATE related to the debugger statement" - ); + await waitFor(() => { + return availableResources.length == 1; + }, "Got the THREAD_STATE related to the debugger statement"); const threadState = availableResources.pop(); assertPausedResource(threadState, { @@ -418,7 +418,7 @@ async function checkSetBeforeWatch() { assertResumedResource(resumed); targetCommand.destroy(); - await client.close(); + await commands.destroy(); } async function checkDebuggerStatementInIframes() { @@ -426,9 +426,8 @@ async function checkDebuggerStatementInIframes() { const tab = await addTab(BREAKPOINT_TEST_URL); - const { client, resourceCommand, targetCommand } = await initResourceCommand( - tab - ); + const { commands, resourceCommand, targetCommand } = + await initResourceCommand(tab); info("Call watchResources"); const availableResources = []; @@ -507,14 +506,14 @@ async function checkDebuggerStatementInIframes() { assertResumedResource(resumed); targetCommand.destroy(); - await client.close(); + await commands.destroy(); } async function testMultiprocessThreadState() { // Ensure debugging the content processes and the tab await pushPref("devtools.browsertoolbox.scope", "everything"); - const { client, resourceCommand, targetCommand } = + const { commands, resourceCommand, targetCommand } = await initMultiProcessResourceCommand(); info("Call watchResources"); @@ -586,7 +585,7 @@ async function testMultiprocessThreadState() { is(availableResources.length, 0, "There should be no other pause"); targetCommand.destroy(); - await client.close(); + await commands.destroy(); } async function assertPausedResource(resource, expected) { |