From 6391fbb73e25d3f7af15213274c2a3bfe1bc7af5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 17 Jun 2024 11:04:05 +0200 Subject: Merging upstream version 115.12.0esr. Signed-off-by: Daniel Baumann --- .../downloads/test/unit/test_DownloadPaths.js | 68 +++++++++++----------- .../test/xpcshell/test_ext_downloads_urlencoded.js | 2 +- .../maintenanceservice_installer.nsi | 2 +- .../harness/telemetry_harness/fog_testcase.py | 2 + toolkit/content/aboutNetError.mjs | 3 +- toolkit/crashreporter/mozwer-rust/lib.rs | 28 +++++++-- toolkit/modules/RemotePageAccessManager.sys.mjs | 1 + .../update/docs/MaintenanceServiceTests.rst | 4 +- 8 files changed, 66 insertions(+), 44 deletions(-) (limited to 'toolkit') diff --git a/toolkit/components/downloads/test/unit/test_DownloadPaths.js b/toolkit/components/downloads/test/unit/test_DownloadPaths.js index 00fb070669..45be10256f 100644 --- a/toolkit/components/downloads/test/unit/test_DownloadPaths.js +++ b/toolkit/components/downloads/test/unit/test_DownloadPaths.js @@ -34,29 +34,29 @@ add_task(async function test_sanitize() { // Platform-dependent conversion of special characters to spaces. const kSpecialChars = 'A:*?|""<<>>;,+=[]B][=+,;>><<""|?*:C'; if (AppConstants.platform == "android") { - testSanitize(kSpecialChars, "A B C"); - testSanitize(" :: Website :: ", "Website"); - testSanitize("* Website!", "Website!"); - testSanitize("Website | Page!", "Website Page!"); - testSanitize("Directory Listing: /a/b/", "Directory Listing _a_b_"); + testSanitize(kSpecialChars, "A________________B________________C"); + testSanitize(" :: Website :: ", "__ Website __"); + testSanitize("* Website!", "_ Website!"); + testSanitize("Website | Page!", "Website _ Page!"); + testSanitize("Directory Listing: /a/b/", "Directory Listing_ _a_b_"); } else if (AppConstants.platform == "win") { - testSanitize(kSpecialChars, "A ;,+=[]B][=+,; C"); - testSanitize(" :: Website :: ", "Website"); - testSanitize("* Website!", "Website!"); - testSanitize("Website | Page!", "Website Page!"); - testSanitize("Directory Listing: /a/b/", "Directory Listing _a_b_"); + testSanitize(kSpecialChars, "A__________;,+=[]B][=+,;__________C"); + testSanitize(" :: Website :: ", "__ Website __"); + testSanitize("* Website!", "_ Website!"); + testSanitize("Website | Page!", "Website _ Page!"); + testSanitize("Directory Listing: /a/b/", "Directory Listing_ _a_b_"); } else if (AppConstants.platform == "macosx") { - testSanitize(kSpecialChars, "A ;,+=[]B][=+,; C"); - testSanitize(" :: Website :: ", "Website"); - testSanitize("* Website!", "Website!"); - testSanitize("Website | Page!", "Website Page!"); - testSanitize("Directory Listing: /a/b/", "Directory Listing _a_b_"); + testSanitize(kSpecialChars, "A__________;,+=[]B][=+,;__________C"); + testSanitize(" :: Website :: ", "__ Website __"); + testSanitize("* Website!", "_ Website!"); + testSanitize("Website | Page!", "Website _ Page!"); + testSanitize("Directory Listing: /a/b/", "Directory Listing_ _a_b_"); } else { - testSanitize(kSpecialChars, "A ;,+=[]B][=+,; C"); - testSanitize(" :: Website :: ", "Website"); - testSanitize("* Website!", "Website!"); - testSanitize("Website | Page!", "Website Page!"); - testSanitize("Directory Listing: /a/b/", "Directory Listing _a_b_"); + testSanitize(kSpecialChars, "A__________;,+=[]B][=+,;__________C"); + testSanitize(" :: Website :: ", "__ Website __"); + testSanitize("* Website!", "_ Website!"); + testSanitize("Website | Page!", "Website _ Page!"); + testSanitize("Directory Listing: /a/b/", "Directory Listing_ _a_b_"); } // Conversion of consecutive runs of slashes and backslashes to underscores. @@ -64,9 +64,9 @@ add_task(async function test_sanitize() { // Removal of leading and trailing whitespace and dots after conversion. testSanitize(" Website ", "Website"); - testSanitize(". . Website . Page . .", "Website . Page"); - testSanitize(" File . txt ", "File . txt"); - testSanitize("\f\n\r\t\v\x00\x1f\x7f\x80\x9f\xa0 . txt", "txt"); + testSanitize(". . Website . Page . .", "Website .Page"); + testSanitize(" File . txt ", "File .txt"); + testSanitize("\f\n\r\t\v\x00\x1f\x7f\x80\x9f\xa0 . txt", "_________ .txt"); testSanitize("\u1680\u180e\u2000\u2008\u200a . txt", "txt"); testSanitize("\u2028\u2029\u202f\u205f\u3000\ufeff . txt", "txt"); @@ -77,25 +77,25 @@ add_task(async function test_sanitize() { testSanitize(" . ", ""); // Stripping of BIDI formatting characters. - testSanitize("\u200e \u202b\u202c\u202d\u202etest\x7f\u200f", "_ ____test _"); - testSanitize("AB\x7f\u202a\x7f\u202a\x7fCD", "AB _ _ CD"); + testSanitize("\u200e \u202b\u202c\u202d\u202etest\x7f\u200f", "_ ____test__"); + testSanitize("AB\x7f\u202a\x7f\u202a\x7fCD", "AB_____CD"); // Stripping of colons: - testSanitize("foo:bar", "foo bar"); + testSanitize("foo:bar", "foo_bar"); // not compressing whitespaces. - testSanitize("foo : bar", "foo bar", { compressWhitespaces: false }); + testSanitize("foo : bar", "foo _ bar", { compressWhitespaces: false }); testSanitize("thing.lnk", "thing.lnk.download"); - testSanitize("thing.lnk\n", "thing.lnk.download"); + testSanitize("thing.lnk\n", "thing.lnk_"); testSanitize("thing.lnk", "thing.lnk", { allowInvalidFilenames: true, }); - testSanitize("thing.lnk\n", "thing.lnk", { + testSanitize("thing.lnk\n", "thing.lnk_", { allowInvalidFilenames: true, }); testSanitize("thing.URl", "thing.URl.download"); - testSanitize("thing.URl \n", "thing.URl", { + testSanitize("thing.URl \n", "thing.URl_", { allowInvalidFilenames: true, }); @@ -107,12 +107,12 @@ add_task(async function test_sanitize() { allowInvalidFilenames: true, }); - testSanitize("thing.local|", "thing.local.download"); - testSanitize("thing.lo|cal", "thing.lo cal"); - testSanitize('thing.local/*"', "thing.local_"); + testSanitize("thing.local|", "thing.local_"); + testSanitize("thing.lo|cal", "thing.lo_cal"); + testSanitize('thing.local/*"', "thing.local___"); testSanitize("thing.desktoP", "thing.desktoP.download"); - testSanitize("thing.desktoP \n", "thing.desktoP", { + testSanitize("thing.desktoP \n", "thing.desktoP_", { allowInvalidFilenames: true, }); }); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js index 03288fb5d5..7e9b3a4fee 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_downloads_urlencoded.js @@ -83,7 +83,7 @@ add_task(async function test_decoded_filename_download() { const FILE_NAME_DECODED_2 = "file\u{0001F6B2}encoded.txt"; const FILE_NAME_ENCODED_URL_2 = BASE + "/" + FILE_NAME_ENCODED_2; const FILE_NAME_ENCODED_3 = "file%X%20encode.txt"; - const FILE_NAME_DECODED_3 = "file%X encode.txt"; + const FILE_NAME_DECODED_3 = "file_X encode.txt"; const FILE_NAME_ENCODED_URL_3 = BASE + "/" + FILE_NAME_ENCODED_3; const FILE_NAME_ENCODED_4 = "file%E3%80%82encode.txt"; const FILE_NAME_DECODED_4 = "file\u3002encode.txt"; diff --git a/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi b/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi index 685458db0e..88e994b3bd 100644 --- a/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi +++ b/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi @@ -205,7 +205,7 @@ Section "MaintenanceService" ; These keys are used to bypass the installation dir is a valid installation ; check from the service so that tests can be run. WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation" - WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA" + WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1" WriteRegStr HKLM "${FallbackKey}\1" "name" "Mozilla Fake SPC" WriteRegStr HKLM "${FallbackKey}\1" "issuer" "Mozilla Fake CA" ${If} ${RunningX64} diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py index c5bc54e9d2..9bcf29d2f4 100644 --- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py +++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py @@ -55,6 +55,8 @@ class FOGTestCase(TelemetryTestCase): "logging.fog_control::*": 5, "logging.glean::*": 5, "logging.glean_core::*": 5, + # Slow down the user inactivity timeout (bug 1690728) + "dom.events.user_interaction_interval": 60000, } ) diff --git a/toolkit/content/aboutNetError.mjs b/toolkit/content/aboutNetError.mjs index b458a8ccab..943cf62244 100644 --- a/toolkit/content/aboutNetError.mjs +++ b/toolkit/content/aboutNetError.mjs @@ -396,7 +396,8 @@ function initPage() { }); longDesc = null; - document.getElementById("openInNewWindowContainer").hidden = false; + document.getElementById("openInNewWindowContainer").hidden = + RPMGetBoolPref("security.xfocsp.hideOpenInNewWindow"); const openInNewWindowButton = document.getElementById( "openInNewWindowButton" diff --git a/toolkit/crashreporter/mozwer-rust/lib.rs b/toolkit/crashreporter/mozwer-rust/lib.rs index 16889a0cce..735d98e973 100644 --- a/toolkit/crashreporter/mozwer-rust/lib.rs +++ b/toolkit/crashreporter/mozwer-rust/lib.rs @@ -12,7 +12,7 @@ use serde::Serialize; use serde_json::ser::to_writer; use std::convert::TryInto; use std::ffi::OsString; -use std::fs::{read_to_string, DirBuilder, File}; +use std::fs::{read_to_string, DirBuilder, File, OpenOptions}; use std::io::{BufRead, BufReader, Write}; use std::mem::{size_of, transmute, zeroed}; use std::os::windows::ffi::{OsStrExt, OsStringExt}; @@ -442,8 +442,7 @@ impl ApplicationInformation { let install_time = ApplicationInformation::get_install_time( &crash_reports_dir, &application_data.build_id, - ) - .unwrap_or("0".to_string()); + ); Ok(ApplicationInformation { install_path, @@ -514,10 +513,29 @@ impl ApplicationInformation { } } - fn get_install_time(crash_reports_path: &Path, build_id: &str) -> Result { + fn get_install_time(crash_reports_path: &Path, build_id: &str) -> String { let file_name = "InstallTime".to_owned() + build_id; let file_path = crash_reports_path.join(file_name); - read_to_string(file_path).map_err(|_e| ()) + + // If the file isn't present we'll attempt to atomically create it and + // populate it. This code essentially matches the corresponding code in + // nsExceptionHandler.cpp SetupExtraData(). + if let Ok(mut file) = OpenOptions::new() + .create_new(true) + .write(true) + .open(&file_path) + { + // SAFETY: No risks in calling `time()` with a null pointer. + let _ = write!(&mut file, "{}", unsafe { time(null_mut()) }.to_string()); + } + + // As a last resort, if we can't read the file we fall back to the + // current time. This might cause us to overstate the number of users + // affected by a crash, but given it's very unlikely to hit this particular + // path it won't be a problem. + // + // SAFETY: No risks in calling `time()` with a null pointer. + read_to_string(&file_path).unwrap_or(unsafe { time(null_mut()) }.to_string()) } } diff --git a/toolkit/modules/RemotePageAccessManager.sys.mjs b/toolkit/modules/RemotePageAccessManager.sys.mjs index d6795e9046..00eb239c8a 100644 --- a/toolkit/modules/RemotePageAccessManager.sys.mjs +++ b/toolkit/modules/RemotePageAccessManager.sys.mjs @@ -99,6 +99,7 @@ export let RemotePageAccessManager = { "security.certerror.hideAddException", "security.xfocsp.errorReporting.automatic", "security.xfocsp.errorReporting.enabled", + "security.xfocsp.hideOpenInNewWindow", "network.trr.display_fallback_warning", ], RPMSetBoolPref: [ diff --git a/toolkit/mozapps/update/docs/MaintenanceServiceTests.rst b/toolkit/mozapps/update/docs/MaintenanceServiceTests.rst index b954b572f8..65259c94d9 100644 --- a/toolkit/mozapps/update/docs/MaintenanceServiceTests.rst +++ b/toolkit/mozapps/update/docs/MaintenanceServiceTests.rst @@ -47,11 +47,11 @@ into the registry. [HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4] [HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4\0] - "issuer"="DigiCert SHA2 Assured ID Code Signing CA" + "issuer"="DigiCert Trusted G4 Code Signing RSA4096 SHA384 2021 CA1" "name"="Mozilla Corporation" [HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4\1] - "issuer"="DigiCert Assured ID Code Signing CA-1" + "issuer"="DigiCert SHA2 Assured ID Code Signing CA" "name"="Mozilla Corporation" [HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4\2] -- cgit v1.2.3