diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /dom/security/test/https-first | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/security/test/https-first')
6 files changed, 67 insertions, 4 deletions
diff --git a/dom/security/test/https-first/browser_download_attribute.js b/dom/security/test/https-first/browser_download_attribute.js index 8165add998..ea4558cc84 100644 --- a/dom/security/test/https-first/browser_download_attribute.js +++ b/dom/security/test/https-first/browser_download_attribute.js @@ -31,7 +31,7 @@ let msgCounter = 0; function shouldConsoleTryUpgradeAndError() { // Waits until CONSOLE_ERROR_MESSAGE was logged. // Checks if download was tried via http:// - return new Promise((resolve, reject) => { + return new Promise(resolve => { function listener(msgObj) { let text = msgObj.message; // Verify upgrade messages diff --git a/dom/security/test/https-first/browser_httpsfirst.js b/dom/security/test/https-first/browser_httpsfirst.js index 733474dcc1..c4437f6051 100644 --- a/dom/security/test/https-first/browser_httpsfirst.js +++ b/dom/security/test/https-first/browser_httpsfirst.js @@ -31,6 +31,7 @@ add_task(async function () { await SpecialPowers.pushPrefEnv({ set: [["dom.security.https_first", false]], }); + Services.fog.testResetFOG(); await runPrefTest( "http://example.com", @@ -42,6 +43,23 @@ add_task(async function () { set: [["dom.security.https_first", true]], }); + for (const key of [ + "upgraded", + "upgradedSchemeless", + "downgraded", + "downgradedSchemeless", + "downgradedOnTimer", + "downgradedOnTimerSchemeless", + "downgradeTime", + "downgradeTimeSchemeless", + ]) { + is( + Glean.httpsfirst[key].testGetValue(), + null, + `No telemetry should have been recorded yet for ${key}` + ); + } + await runPrefTest( "http://example.com", "Should upgrade upgradeable website", @@ -71,4 +89,21 @@ add_task(async function () { "Should downgrade after timeout.", "http://" ); + + info("Checking expected telemetry"); + is(Glean.httpsfirst.upgraded.testGetValue(), 5); + is(Glean.httpsfirst.upgradedSchemeless.testGetValue(), null); + is(Glean.httpsfirst.downgraded.testGetValue(), 3); + is(Glean.httpsfirst.downgradedSchemeless.testGetValue(), null); + is(Glean.httpsfirst.downgradedOnTimer.testGetValue().numerator, 1); + is(Glean.httpsfirst.downgradedOnTimerSchemeless.testGetValue(), null); + const downgradeSeconds = + Glean.httpsfirst.downgradeTime.testGetValue().sum / 1_000_000_000; + ok( + downgradeSeconds > 2 && downgradeSeconds < 30, + `Summed downgrade time should be above 2 and below 30 seconds (is ${downgradeSeconds.toFixed( + 2 + )}s)` + ); + is(null, Glean.httpsfirst.downgradeTimeSchemeless.testGetValue()); }); diff --git a/dom/security/test/https-first/browser_mixed_content_download.js b/dom/security/test/https-first/browser_mixed_content_download.js index 09ea64cea8..919470a78e 100644 --- a/dom/security/test/https-first/browser_mixed_content_download.js +++ b/dom/security/test/https-first/browser_mixed_content_download.js @@ -57,7 +57,7 @@ const DOWNLOAD_URL = // falls back since download is not available via https let msgCounter = 0; function shouldConsoleError() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { function listener(msgObj) { let text = msgObj.message; if (text.includes(CONSOLE_UPGRADE_MESSAGE) && msgCounter == 0) { diff --git a/dom/security/test/https-first/browser_schemeless.js b/dom/security/test/https-first/browser_schemeless.js index 9687f15072..64b078983d 100644 --- a/dom/security/test/https-first/browser_schemeless.js +++ b/dom/security/test/https-first/browser_schemeless.js @@ -153,6 +153,7 @@ async function runTest(aInput, aDesc, aExpectedScheme) { add_task(async function () { requestLongerTimeout(10); + Services.fog.testResetFOG(); await SpecialPowers.pushPrefEnv({ set: [ @@ -183,9 +184,36 @@ add_task(async function () { "http" ); + for (const key of [ + "upgraded", + "upgradedSchemeless", + "downgraded", + "downgradedSchemeless", + "downgradedOnTimer", + "downgradedOnTimerSchemeless", + "downgradeTime", + "downgradeTimeSchemeless", + ]) { + is( + Glean.httpsfirst[key].testGetValue(), + null, + `No telemetry should have been recorded yet for ${key}` + ); + } + await runTest( "example.com", "Should upgrade upgradeable website without explicit scheme", "https" ); + + info("Checking expected telemetry"); + is(Glean.httpsfirst.upgraded.testGetValue(), null); + is(Glean.httpsfirst.upgradedSchemeless.testGetValue(), 5); + is(Glean.httpsfirst.downgraded.testGetValue(), null); + is(Glean.httpsfirst.downgradedSchemeless.testGetValue(), null); + is(Glean.httpsfirst.downgradedOnTimer.testGetValue(), null); + is(Glean.httpsfirst.downgradedOnTimerSchemeless.testGetValue(), null); + is(Glean.httpsfirst.downgradeTime.testGetValue(), null); + is(Glean.httpsfirst.downgradeTimeSchemeless.testGetValue(), null); }); diff --git a/dom/security/test/https-first/file_data_uri.html b/dom/security/test/https-first/file_data_uri.html index 69133e5079..e6d5744802 100644 --- a/dom/security/test/https-first/file_data_uri.html +++ b/dom/security/test/https-first/file_data_uri.html @@ -6,7 +6,7 @@ </head> <body> <script class="testbody" type="text/javascript"> - window.onload = (event) => { + window.onload = () => { let myLoc = window.location.href; window.opener.parent.postMessage({location: myLoc}, "*"); window.close(); diff --git a/dom/security/test/https-first/test_resource_upgrade.html b/dom/security/test/https-first/test_resource_upgrade.html index 66f65d9a04..275a6a23af 100644 --- a/dom/security/test/https-first/test_resource_upgrade.html +++ b/dom/security/test/https-first/test_resource_upgrade.html @@ -44,7 +44,7 @@ // returns after the server has received all the expected requests. var myXHR = new XMLHttpRequest(); myXHR.open("GET", "file_upgrade_insecure_server.sjs?queryresult"); - myXHR.onload = function (e) { + myXHR.onload = function () { var results = myXHR.responseText.split(","); for (var index in results) { checkResult(results[index]); |