diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:01:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:01:59 +0000 |
commit | 85310221f0512bf1aeefc49ead8a1e11bda55990 (patch) | |
tree | 70a3efbfee6c7cbeb626185b35166d2c376b4bb8 /toolkit | |
parent | Adding upstream version 126.0. (diff) | |
download | firefox-85310221f0512bf1aeefc49ead8a1e11bda55990.tar.xz firefox-85310221f0512bf1aeefc49ead8a1e11bda55990.zip |
Adding upstream version 126.0.1.upstream/126.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit')
7 files changed, 73 insertions, 44 deletions
diff --git a/toolkit/components/pdfjs/content/web/viewer-geckoview.mjs b/toolkit/components/pdfjs/content/web/viewer-geckoview.mjs index c309f8cf12..feda69146e 100644 --- a/toolkit/components/pdfjs/content/web/viewer-geckoview.mjs +++ b/toolkit/components/pdfjs/content/web/viewer-geckoview.mjs @@ -5646,7 +5646,6 @@ class PDFPageView { this.renderingState = RenderingStates.RUNNING; const canvasWrapper = document.createElement("div"); canvasWrapper.classList.add("canvasWrapper"); - canvasWrapper.setAttribute("aria-hidden", true); this.#addLayer(canvasWrapper, "canvasWrapper"); if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) { this._accessibilityManager ||= new TextAccessibilityManager(); diff --git a/toolkit/components/pdfjs/content/web/viewer.mjs b/toolkit/components/pdfjs/content/web/viewer.mjs index 864140b624..5202de12c7 100644 --- a/toolkit/components/pdfjs/content/web/viewer.mjs +++ b/toolkit/components/pdfjs/content/web/viewer.mjs @@ -8219,7 +8219,6 @@ class PDFPageView { this.renderingState = RenderingStates.RUNNING; const canvasWrapper = document.createElement("div"); canvasWrapper.classList.add("canvasWrapper"); - canvasWrapper.setAttribute("aria-hidden", true); this.#addLayer(canvasWrapper, "canvasWrapper"); if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) { this._accessibilityManager ||= new TextAccessibilityManager(); diff --git a/toolkit/crashreporter/client/app/src/config.rs b/toolkit/crashreporter/client/app/src/config.rs index 4e919395e2..7eef674ea8 100644 --- a/toolkit/crashreporter/client/app/src/config.rs +++ b/toolkit/crashreporter/client/app/src/config.rs @@ -370,40 +370,16 @@ impl Config { // sense that if it were to rely on anything, it would be the `Config` (and that may change in // the future). pub fn sibling_program_path<N: AsRef<OsStr>>(&self, program: N) -> PathBuf { - // Expect shouldn't ever panic here because we need more than one argument to run - // the program in the first place (we've already previously iterated args). - // - // We use argv[0] rather than `std::env::current_exe` because `current_exe` doesn't define - // how symlinks are treated, and we want to support running directly from the local build - // directory (which uses symlinks on linux and macos). - let self_path = PathBuf::from(std::env::args_os().next().expect("failed to get argv[0]")); + let self_path = self_path(); let exe_extension = self_path.extension().unwrap_or_default(); - - let mut program_path = self_path.clone(); - // Pop the executable off to get the parent directory. - program_path.pop(); - program_path.push(program.as_ref()); - program_path.set_extension(exe_extension); - - if !program_path.exists() && cfg!(all(not(mock), target_os = "macos")) { - // On macOS the crash reporter client is shipped as an application bundle contained - // within Firefox's main application bundle. So when it's invoked its current working - // directory looks like: - // Firefox.app/Contents/MacOS/crashreporter.app/Contents/MacOS/ - // The other applications we ship with Firefox are stored in the main bundle - // (Firefox.app/Contents/MacOS/) so we we need to go back three directories - // to reach them. - - // 4 pops: 1 for the path that was just pushed, and 3 more for - // `crashreporter.app/Contents/MacOS`. - for _ in 0..4 { - program_path.pop(); - } - program_path.push(program.as_ref()); - program_path.set_extension(exe_extension); + if !exe_extension.is_empty() { + let mut p = program.as_ref().to_os_string(); + p.push("."); + p.push(exe_extension); + sibling_path(p) + } else { + sibling_path(program) } - - program_path } cfg_if::cfg_if! { @@ -508,6 +484,52 @@ impl Config { } } +/// Get the path of a file that is a sibling of the crashreporter. +/// +/// On MacOS, this assumes that the crashreporter is its own application bundle within the main +/// program bundle. On other platforms this assumes siblings reside in the same directory as +/// the crashreporter. +/// +/// The returned path isn't guaranteed to exist. +pub fn sibling_path<N: AsRef<OsStr>>(file: N) -> PathBuf { + // Expect shouldn't ever panic here because we need more than one argument to run + // the program in the first place (we've already previously iterated args). + // + // We use argv[0] rather than `std::env::current_exe` because `current_exe` doesn't define + // how symlinks are treated, and we want to support running directly from the local build + // directory (which uses symlinks on linux and macos). + let dir_path = { + let mut path = self_path(); + // Pop the executable off to get the parent directory. + path.pop(); + path + }; + + let mut path = dir_path.join(file.as_ref()); + + if !path.exists() && cfg!(all(not(mock), target_os = "macos")) { + // On macOS the crash reporter client is shipped as an application bundle contained + // within Firefox's main application bundle. So when it's invoked its current working + // directory looks like: + // Firefox.app/Contents/MacOS/crashreporter.app/Contents/MacOS/ + // The other applications we ship with Firefox are stored in the main bundle + // (Firefox.app/Contents/MacOS/) so we we need to go back three directories + // to reach them. + path = dir_path; + // 3 pops for `crashreporter.app/Contents/MacOS`. + for _ in 0..3 { + path.pop(); + } + path.push(file.as_ref()); + } + + path +} + +fn self_path() -> PathBuf { + PathBuf::from(std::env::args_os().next().expect("failed to get argv[0]")) +} + fn env_bool<K: AsRef<OsStr>>(name: K) -> bool { std::env::var(name).map(|s| !s.is_empty()).unwrap_or(false) } diff --git a/toolkit/crashreporter/client/app/src/lang/omnijar.rs b/toolkit/crashreporter/client/app/src/lang/omnijar.rs index 2d2c34dd8d..b6a4e90aa4 100644 --- a/toolkit/crashreporter/client/app/src/lang/omnijar.rs +++ b/toolkit/crashreporter/client/app/src/lang/omnijar.rs @@ -3,8 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use super::language_info::LanguageInfo; +use crate::config::sibling_path; use crate::std::{ - env::current_exe, fs::File, io::{BufRead, BufReader, Read}, path::Path, @@ -16,9 +16,11 @@ use zip::read::ZipArchive; /// /// Returns (locale name, fluent definitions). pub fn read() -> anyhow::Result<LanguageInfo> { - let mut path = current_exe().context("failed to get current executable")?; - path.pop(); - path.push("omni.ja"); + let mut path = sibling_path(if cfg!(target_os = "macos") { + "../Resources/omni.ja" + } else { + "omni.ja" + }); let mut zip = read_omnijar_file(&path)?; let locales = { @@ -52,11 +54,16 @@ pub fn read() -> anyhow::Result<LanguageInfo> { path.push("omni.ja"); let ftl_branding = 'branding: { - for locale in &locales { - match read_branding(&locale, &mut zip) { - Ok(v) => break 'branding v, - Err(e) => log::warn!("failed to read branding from omnijar: {e:#}"), + match read_omnijar_file(&path) { + Ok(mut zip) => { + for locale in &locales { + match read_branding(&locale, &mut zip) { + Ok(v) => break 'branding v, + Err(e) => log::warn!("failed to read branding from omnijar: {e:#}"), + } + } } + Err(e) => log::warn!("failed to read browser omnijar: {e:#}"), } log::info!("using fallback branding info"); LanguageInfo::default().ftl_branding diff --git a/toolkit/crashreporter/client/app/src/net/legacy_telemetry.rs b/toolkit/crashreporter/client/app/src/net/legacy_telemetry.rs index 680f1614b0..9b04f08164 100644 --- a/toolkit/crashreporter/client/app/src/net/legacy_telemetry.rs +++ b/toolkit/crashreporter/client/app/src/net/legacy_telemetry.rs @@ -20,6 +20,7 @@ include!(concat!(env!("OUT_DIR"), "/ping_annotations.rs")); #[derive(Serialize)] #[serde(tag = "type", rename_all = "camelCase")] pub enum Ping<'a> { + #[serde(rename_all = "camelCase")] Crash { id: Uuid, version: u64, diff --git a/toolkit/crashreporter/client/app/src/std/env.rs b/toolkit/crashreporter/client/app/src/std/env.rs index edc22ded8d..77d9d4aecc 100644 --- a/toolkit/crashreporter/client/app/src/std/env.rs +++ b/toolkit/crashreporter/client/app/src/std/env.rs @@ -40,6 +40,7 @@ pub fn args_os() -> ArgsOs { }) } +#[allow(unused)] pub fn current_exe() -> std::io::Result<super::path::PathBuf> { Ok(MockCurrentExe.get(|r| r.clone().into())) } diff --git a/toolkit/crashreporter/client/app/src/test.rs b/toolkit/crashreporter/client/app/src/test.rs index 42d2334bca..8b97765468 100644 --- a/toolkit/crashreporter/client/app/src/test.rs +++ b/toolkit/crashreporter/client/app/src/test.rs @@ -311,8 +311,8 @@ impl AssertFiles { "type": "crash", "id": MOCK_PING_UUID, "version": 4, - "creation_date": MOCK_CURRENT_TIME, - "client_id": "telemetry_client", + "creationDate": MOCK_CURRENT_TIME, + "clientId": "telemetry_client", "payload": { "sessionId": "telemetry_session", "version": 1, |