commit f69e7f7cec491994d0f03f43f15f7c3d8210d094
parent f0a6bbfae19706df20268a4b206f88e7e5f69866
Author: Julian Descottes <jdescottes@mozilla.com>
Date: Mon, 10 Nov 2025 23:06:35 +0000
Bug 1991020 - [devtools] Isolate copy all as har test frequently failing r=devtools-reviewers,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D272048
Diffstat:
4 files changed, 47 insertions(+), 20 deletions(-)
diff --git a/devtools/client/netmonitor/src/har/test/browser.toml b/devtools/client/netmonitor/src/har/test/browser.toml
@@ -20,6 +20,11 @@ skip-if = [
"os == 'linux' && os_version == '24.04' && processor == 'x86_64' && display == 'x11' && debug && http3", # Bug 1829298
]
+["browser_net_har_copy_all_as_har_cached.js"]
+skip-if = [
+ "os == 'linux' && os_version == '24.04' && processor == 'x86_64' && display == 'x11' && debug && http3", # Bug 1829298
+]
+
["browser_net_har_import.js"]
skip-if = [
"os == 'mac' && os_version == '14.70' && processor == 'x86_64' && debug", # Bug 1767273
diff --git a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js
@@ -18,32 +18,12 @@ add_task(async function () {
info("Starting test... ");
- await testWithEnabledCache();
await testSimpleReload();
await testResponseBodyLimits();
await testManyReloads();
await testClearedRequests();
});
-// Test covers a fix (see Bug 1995694) where reloading pages with js sources when the cache is enabled
-// throws an error which then causes copy all as har to break (see Bug 1995746).
-async function testWithEnabledCache() {
- info("Tests multiple reloads of html which contains a JS bundle");
- const { monitor } = await initNetMonitor(SOURCEMAP_URL, {
- enableCache: true,
- });
-
- // Reload the browser at least 4 times to trigger the error
- let runs = 4;
- while (runs > 0) {
- await reloadBrowser();
- --runs;
- }
- const har = await copyAllAsHARWithContextMenu(monitor);
- isnot(har.log, null, "The HAR log must exist");
- await teardown(monitor);
-}
-
async function testSimpleReload() {
info("Test with a simple page reload");
const { tab, monitor, toolbox } = await initNetMonitor(HTTPS_SIMPLE_URL, {
diff --git a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har_cached.js b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har_cached.js
@@ -0,0 +1,38 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * Test covers a fix (see Bug 1995694) where reloading pages with js sources
+ * when the cache is enabled throws an error which then causes copy all as har
+ * to break (see Bug 1995746).
+ */
+
+add_task(async function () {
+ // Disable tcp fast open, because it is setting a response header indicator
+ // (bug 1352274). TCP Fast Open is not present on all platforms therefore the
+ // number of response headers will vary depending on the platform.
+ await pushPref("network.tcp.tcp_fastopen_enable", false);
+
+ info("Tests multiple reloads of html which contains a JS bundle");
+ const { monitor } = await initNetMonitor(SOURCEMAP_URL, {
+ enableCache: true,
+ });
+
+ info("Reload the browser at least 4 times to trigger the error");
+ let runs = 4;
+ while (runs > 0) {
+ const wait = waitForNetworkEvents(monitor, 4);
+ info(`Reload the browser (run ${5 - runs})`);
+ await reloadBrowser();
+ info(`Wait for network events (run ${5 - runs})`);
+ await wait;
+ --runs;
+ }
+
+ info("Try to copy all as HAR");
+ const har = await copyAllAsHARWithContextMenu(monitor);
+ isnot(har.log, null, "The HAR log must exist");
+ await teardown(monitor);
+});
diff --git a/devtools/client/shared/test/shared-head.js b/devtools/client/shared/test/shared-head.js
@@ -894,6 +894,8 @@ function _watchForPanelReload(toolbox, toolId) {
info("Waiting for inspector updates after page reload");
await onReloaded;
+
+ info("Received 'reloaded' event for inspector");
};
} else if (
["netmonitor", "accessibility", "webconsole", "jsdebugger"].includes(toolId)
@@ -902,6 +904,8 @@ function _watchForPanelReload(toolbox, toolId) {
return async function () {
info(`Waiting for ${toolId} updates after page reload`);
await onReloaded;
+
+ info(`Received 'reloaded' event for ${toolId}`);
};
}
return null;