diff options
Diffstat (limited to 'devtools/client/netmonitor')
11 files changed, 33 insertions, 18 deletions
diff --git a/devtools/client/netmonitor/initializer.js b/devtools/client/netmonitor/initializer.js index c6a8a246f5..24afadf434 100644 --- a/devtools/client/netmonitor/initializer.js +++ b/devtools/client/netmonitor/initializer.js @@ -9,8 +9,8 @@ * This script is the entry point of Network monitor panel. * See README.md for more information. */ -const { BrowserLoader } = ChromeUtils.import( - "resource://devtools/shared/loader/browser-loader.js" +const { BrowserLoader } = ChromeUtils.importESModule( + "resource://devtools/shared/loader/browser-loader.sys.mjs" ); const require = (window.windowRequire = BrowserLoader({ 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 index 2faaf01b73..08dbfbf068 100644 --- 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 @@ -7,7 +7,7 @@ * Basic tests for exporting Network panel content into HAR format. */ -const EXPECTED_REQUEST_HEADER_COUNT = 9; +const EXPECTED_REQUEST_HEADER_COUNT = 13; const EXPECTED_RESPONSE_HEADER_COUNT = 6; add_task(async function () { @@ -15,7 +15,7 @@ add_task(async function () { // (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); - const { tab, monitor, toolbox } = await initNetMonitor(SIMPLE_URL, { + const { tab, monitor, toolbox } = await initNetMonitor(HTTPS_SIMPLE_URL, { requestCount: 1, }); @@ -45,7 +45,7 @@ async function testSimpleReload({ tab, monitor, toolbox }) { const page = har.log.pages[0]; - is(page.title, SIMPLE_URL, "There must be some page title"); + is(page.title, HTTPS_SIMPLE_URL, "There must be some page title"); ok("onContentLoad" in page.pageTimings, "There must be onContentLoad time"); ok("onLoad" in page.pageTimings, "There must be onLoad time"); @@ -98,7 +98,7 @@ async function testManyReloads({ tab, monitor, toolbox }) { if (entry) { ok(entry, "Found the cancelled request"); is(entry.request.method, "GET", "Method is set"); - is(entry.request.url, SIMPLE_URL, "URL is set"); + is(entry.request.url, HTTPS_SIMPLE_URL, "URL is set"); // We always get the following headers: // "Host", "User-agent", "Accept", "Accept-Language", "Accept-Encoding", "Connection" // but are missing the three last headers: @@ -173,7 +173,7 @@ function assertNavigationRequestEntry(entry) { info("Assert that the entry relates to the navigation request"); Assert.greater(entry.time, 0, "Check the total time"); is(entry.request.method, "GET", "Check the method"); - is(entry.request.url, SIMPLE_URL, "Check the URL"); + is(entry.request.url, HTTPS_SIMPLE_URL, "Check the URL"); is( entry.request.headers.length, EXPECTED_REQUEST_HEADER_COUNT, diff --git a/devtools/client/netmonitor/src/har/test/browser_net_har_import.js b/devtools/client/netmonitor/src/har/test/browser_net_har_import.js index 44ae3a8e16..9d66674bd3 100644 --- a/devtools/client/netmonitor/src/har/test/browser_net_har_import.js +++ b/devtools/client/netmonitor/src/har/test/browser_net_har_import.js @@ -65,7 +65,7 @@ add_task(async () => { ); is( har2.log.entries[1]._securityState, - "insecure", + "secure", "There must be expected security state" ); is(har2.log.entries[2].response.status, 304, "There must be expected status"); diff --git a/devtools/client/netmonitor/src/har/test/head.js b/devtools/client/netmonitor/src/har/test/head.js index b41ea580fd..abf34c1ffb 100644 --- a/devtools/client/netmonitor/src/har/test/head.js +++ b/devtools/client/netmonitor/src/har/test/head.js @@ -13,7 +13,7 @@ Services.scriptloader.loadSubScript(netMonitorHead, this); // Directory with HAR related test files. const HAR_EXAMPLE_URL = - "http://example.com/browser/devtools/client/netmonitor/src/har/test/"; + "https://example.com/browser/devtools/client/netmonitor/src/har/test/"; /** * Trigger a "copy all as har" from the context menu of the requests list. diff --git a/devtools/client/netmonitor/test/browser_net_cached-status.js b/devtools/client/netmonitor/test/browser_net_cached-status.js index b41362b398..d6dd5519c5 100644 --- a/devtools/client/netmonitor/test/browser_net_cached-status.js +++ b/devtools/client/netmonitor/test/browser_net_cached-status.js @@ -10,6 +10,9 @@ add_task(async function () { // Disable rcwn to make cache behavior deterministic. await pushPref("network.http.rcwn.enabled", false); + // performing http to https redirects, hence we do not + // want https-first to interfere with that test + await pushPref("dom.security.https_first", false); const { tab, monitor } = await initNetMonitor(STATUS_CODES_URL, { enableCache: true, diff --git a/devtools/client/netmonitor/test/browser_net_copy_as_powershell.js b/devtools/client/netmonitor/test/browser_net_copy_as_powershell.js index 5785b89929..8160b10cfa 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_as_powershell.js +++ b/devtools/client/netmonitor/test/browser_net_copy_as_powershell.js @@ -19,7 +19,7 @@ add_task(async function () { -Headers @{ "Accept" = "*/*" "Accept-Language" = "en-US" - "Accept-Encoding" = "gzip, deflate, br" + "Accept-Encoding" = "gzip, deflate, br, zstd" "X-Custom-Header-1" = "Custom value" "X-Custom-Header-2" = "8.8.8.8" "X-Custom-Header-3" = "Mon, 3 Mar 2014 11:11:11 GMT" @@ -42,7 +42,7 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://example.com/browser/devtools/cl -Headers @{ "Accept" = "*/*" "Accept-Language" = "en-US" - "Accept-Encoding" = "gzip, deflate, br" + "Accept-Encoding" = "gzip, deflate, br, zstd" "X-Custom-Header-1" = "Custom value" "X-Custom-Header-2" = "8.8.8.8" "X-Custom-Header-3" = "Mon, 3 Mar 2014 11:11:11 GMT" @@ -66,7 +66,7 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://example.com/browser/devtools/cl -Headers @{ "Accept" = "*/*" "Accept-Language" = "en-US" - "Accept-Encoding" = "gzip, deflate, br" + "Accept-Encoding" = "gzip, deflate, br, zstd" "X-Custom-Header-1" = "Custom value" "X-Custom-Header-2" = "8.8.8.8" "X-Custom-Header-3" = "Mon, 3 Mar 2014 11:11:11 GMT" @@ -95,7 +95,7 @@ Invoke-WebRequest -UseBasicParsing -Uri "https://example.com/browser/devtools/cl -Headers @{ "Accept" = "*/*" "Accept-Language" = "en-US" - "Accept-Encoding" = "gzip, deflate, br" + "Accept-Encoding" = "gzip, deflate, br, zstd" "X-Custom-Header-1" = "Custom value" "X-Custom-Header-2" = "8.8.8.8" "X-Custom-Header-3" = "Mon, 3 Mar 2014 11:11:11 GMT" diff --git a/devtools/client/netmonitor/test/browser_net_copy_headers.js b/devtools/client/netmonitor/test/browser_net_copy_headers.js index cd6499d93b..458a19af97 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_headers.js +++ b/devtools/client/netmonitor/test/browser_net_copy_headers.js @@ -47,6 +47,7 @@ add_task(async function () { "Accept-Encoding: gzip, deflate", "Connection: keep-alive", "Upgrade-Insecure-Requests: 1", + "Priority: u=1", "Pragma: no-cache", "Cache-Control: no-cache", ].join("\n"); diff --git a/devtools/client/netmonitor/test/browser_net_headers_sorted.js b/devtools/client/netmonitor/test/browser_net_headers_sorted.js index 2965ea8d3c..ea12b1c67e 100644 --- a/devtools/client/netmonitor/test/browser_net_headers_sorted.js +++ b/devtools/client/netmonitor/test/browser_net_headers_sorted.js @@ -71,6 +71,7 @@ async function verifyHeaders(monitor) { "Cookie", "Host", "Pragma", + "Priority", "Sec-Fetch-Dest", "Sec-Fetch-Mode", "Sec-Fetch-Site", @@ -144,6 +145,7 @@ async function verifyRawHeaders(monitor) { "Sec-Fetch-Dest", "Sec-Fetch-Mode", "Sec-Fetch-Site", + "Priority", "Pragma", "Cache-Control", ]; diff --git a/devtools/client/netmonitor/test/browser_net_http3_request_details.js b/devtools/client/netmonitor/test/browser_net_http3_request_details.js index 9ceb9dba88..6a6c5973c9 100644 --- a/devtools/client/netmonitor/test/browser_net_http3_request_details.js +++ b/devtools/client/netmonitor/test/browser_net_http3_request_details.js @@ -74,8 +74,8 @@ add_task(async function () { // The Text-Encoding header is not consistently displayed, exclude it from // the assertion. See Bug 1830053. headers.filter(cell => cell.textContent != "TE").length, - 25, - "There should be 25 header values displayed in this tabpanel." + 26, + "There should be 26 header values displayed in this tabpanel." ); const headersTable = tabpanel.querySelector(".accordion"); diff --git a/devtools/client/netmonitor/test/browser_net_resend.js b/devtools/client/netmonitor/test/browser_net_resend.js index cc3c212988..9150bfe3ba 100644 --- a/devtools/client/netmonitor/test/browser_net_resend.js +++ b/devtools/client/netmonitor/test/browser_net_resend.js @@ -60,14 +60,23 @@ async function testResendRequest() { "The resent request has the same url and query parameters and the first request" ); + // The priority header only appears when the urgency and incremental values + // are not both default values (u=3 and i=false). In this case the original + // request has no priority header and the resent request does, hence we subtract one. is( firstResend.originalResource.requestHeaders.headers.length, - firstResend.newResource.requestHeaders.headers.length, + firstResend.newResource.requestHeaders.headers.length - 1, "The no of headers are the same" ); + // Because a resent request has a different purpose and principal it will + // also have a different CoS flag (meaning a different priority header). + // So we can't compare the original and resent request's priority and skip it. firstResend.originalResource.requestHeaders.headers.forEach( ({ name, value }) => { + if (name === "Priority") { + return; + } const foundHeader = firstResend.newResource.requestHeaders.headers.find( header => header.name == name ); diff --git a/devtools/client/netmonitor/test/browser_net_simple-request-details.js b/devtools/client/netmonitor/test/browser_net_simple-request-details.js index e52a0b101a..e7d07f392c 100644 --- a/devtools/client/netmonitor/test/browser_net_simple-request-details.js +++ b/devtools/client/netmonitor/test/browser_net_simple-request-details.js @@ -137,8 +137,8 @@ add_task(async function () { is( tabpanel.querySelectorAll(".accordion .treeLabelCell").length, - 23, - "There should be 23 header values displayed in this tabpanel." + 24, + "There should be 24 header values displayed in this tabpanel." ); const headersTable = tabpanel.querySelector(".accordion"); |