diff --git a/www-client/iceweasel/iceweasel-137.0.1.recipe b/www-client/iceweasel/iceweasel-138.0.1.recipe similarity index 96% rename from www-client/iceweasel/iceweasel-137.0.1.recipe rename to www-client/iceweasel/iceweasel-138.0.1.recipe index 3627ed8e6..536a12648 100644 --- a/www-client/iceweasel/iceweasel-137.0.1.recipe +++ b/www-client/iceweasel/iceweasel-138.0.1.recipe @@ -7,7 +7,7 @@ COPYRIGHT="1995-2025 Mozilla Developers and Contributors" LICENSE="MPL v2.0" REVISION="1" SOURCE_URI="https://ftp.mozilla.org/pub/firefox/releases/$portVersion/source/firefox-$portVersion.source.tar.xz" -CHECKSUM_SHA256="081da8602e19c97b1de4c89a24ddade9d14d38a31eac75dcdb854f0cdd2e0be4" +CHECKSUM_SHA256="9894b96203876f847637af20f961cd4494ff1f2d85e4c096a7f358f54d9ecb2b" SOURCE_DIR="firefox-$portVersion" PATCHES=" iceweasel-$portVersion.patchset @@ -51,6 +51,8 @@ REQUIRES=" BUILD_REQUIRES=" haiku_devel + setuptools_python310 + setuptools_rust_python310 devel:libdbus_1 devel:libdbus_glib_1 devel:libevent diff --git a/www-client/iceweasel/patches/iceweasel-137.0.1.patchset b/www-client/iceweasel/patches/iceweasel-138.0.1.patchset similarity index 98% rename from www-client/iceweasel/patches/iceweasel-137.0.1.patchset rename to www-client/iceweasel/patches/iceweasel-138.0.1.patchset index 44d473c8d..9d80aa880 100644 --- a/www-client/iceweasel/patches/iceweasel-137.0.1.patchset +++ b/www-client/iceweasel/patches/iceweasel-138.0.1.patchset @@ -1,6 +1,6 @@ -From 3dab2a31d7a13387221b49bf3d19ba544fafcc65 Mon Sep 17 00:00:00 2001 +From eaec14d7b33f86ed450f90397eac5be5d89b8432 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Wed, 2 Apr 2025 15:27:57 +1000 +Date: Wed, 7 May 2025 10:18:43 +1000 Subject: Add Haiku build support Based on patches sourced from https://github.com/kenz-gelsoft/gecko-dev/ @@ -11,12 +11,13 @@ Based on patches sourced from https://github.com/kenz-gelsoft/gecko-dev/ - Fixed build with WebRTC enabled. - Implemented WebRTC modules for desktop capture and video capture. - Made additional modifications for Haiku compatibility. +- Implement remote server diff --git a/Cargo.lock b/Cargo.lock -index c91f39b..1afc921 100644 +index 38508ff..4c0ff17 100644 --- a/Cargo.lock +++ b/Cargo.lock -@@ -3576,7 +3576,6 @@ dependencies = [ +@@ -3657,7 +3657,6 @@ dependencies = [ name = "lmdb-rkv-sys" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -25,7 +26,7 @@ index c91f39b..1afc921 100644 "cc", "libc", diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js -index 97acbf8..1a83004 100644 +index 89b8b83..3a4a918 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -15,7 +15,9 @@ @@ -39,7 +40,7 @@ index 97acbf8..1a83004 100644 #endif #endif -@@ -273,7 +275,7 @@ pref("browser.fixup.domainsuffixwhitelist.local", true); +@@ -272,7 +274,7 @@ pref("browser.fixup.domainsuffixwhitelist.local", true); // search string, that may contain a valid host, to a search engine. pref("browser.fixup.dns_first_for_single_words", false); @@ -48,7 +49,7 @@ index 97acbf8..1a83004 100644 pref("general.autoScroll", false); #else pref("general.autoScroll", true); -@@ -1090,7 +1092,7 @@ pref("security.allow_parent_unrestricted_js_loads", false); +@@ -1084,7 +1086,7 @@ pref("security.allow_parent_unrestricted_js_loads", false); pref("browser.tabs.min_inactive_duration_before_unload", 600000); // Does middleclick paste of clipboard to new tab button @@ -126,10 +127,10 @@ index 11b51ae..7c04ddf 100644 LIBRARY_DEFINES["MOZ_HAS_MOZGLUE"] = True if not CONFIG["MOZ_GLUE_IN_PROGRAM"]: diff --git a/build/gn_processor.py b/build/gn_processor.py -index 2ba8b92..843a60e 100644 +index c3b9e85..9af7945 100644 --- a/build/gn_processor.py +++ b/build/gn_processor.py -@@ -185,6 +185,7 @@ def filter_gn_config(path, gn_result, sandbox_vars, input_vars, gn_target): +@@ -184,6 +184,7 @@ def filter_gn_config(path, gn_result, sandbox_vars, input_vars, gn_target): "loong64": "loongarch64", } oses = { @@ -137,7 +138,7 @@ index 2ba8b92..843a60e 100644 "android": "Android", "linux": "Linux", "mac": "Darwin", -@@ -780,7 +781,7 @@ def main(): +@@ -779,7 +780,7 @@ def main(): vars_set = [] for is_debug in (True, False): @@ -146,7 +147,7 @@ index 2ba8b92..843a60e 100644 target_cpus = ["x64"] if target_os in ("android", "linux", "mac", "win", "openbsd"): target_cpus.append("arm64") -@@ -797,7 +798,7 @@ def main(): +@@ -796,7 +797,7 @@ def main(): "host_cpu": "x64", "is_debug": is_debug, "target_cpu": target_cpu, @@ -155,7 +156,7 @@ index 2ba8b92..843a60e 100644 } if target_os == "linux": for use_x11 in (True, False): -@@ -806,6 +807,10 @@ def main(): +@@ -805,6 +806,10 @@ def main(): else: if target_os == "openbsd": vars["use_x11"] = True @@ -167,7 +168,7 @@ index 2ba8b92..843a60e 100644 preprocessor = load_preprocessor(config.get("preprocessing_script", None)) diff --git a/build/moz.configure/bindgen.configure b/build/moz.configure/bindgen.configure -index 53f0e6e..ecd20e7 100644 +index 2738f77..806ce8d 100644 --- a/build/moz.configure/bindgen.configure +++ b/build/moz.configure/bindgen.configure @@ -203,7 +203,7 @@ def bindgen_libclang_path(libclang_path, clang, library_name_info, host): @@ -222,10 +223,10 @@ index 9bf4bb2..4c911a3 100644 def target_is_solaris(target): if target.kernel == "SunOS": diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure -index cbaf3b4..84fd8e0 100644 +index 8fa9277..c6eb2ec 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure -@@ -2937,7 +2937,7 @@ def security_hardening_cflags( +@@ -2943,7 +2943,7 @@ def security_hardening_cflags( if ( c_compiler.type == "clang" and c_compiler.version >= "11.0.1" @@ -547,10 +548,10 @@ index ab0faee..f9c9389 100644 std::string fullPath = directory + libraryName; diff --git a/gfx/layers/wr/IpcResourceUpdateQueue.cpp b/gfx/layers/wr/IpcResourceUpdateQueue.cpp -index d19dc7f..dcbd9e3 100644 +index 1c04ba7..c6257e0 100644 --- a/gfx/layers/wr/IpcResourceUpdateQueue.cpp +++ b/gfx/layers/wr/IpcResourceUpdateQueue.cpp -@@ -51,7 +51,8 @@ layers::OffsetRange ShmSegmentsWriter::Write(Range aBytes) { +@@ -50,7 +50,8 @@ layers::OffsetRange ShmSegmentsWriter::Write(Range aBytes) { const size_t start = mCursor; const size_t length = aBytes.length(); @@ -716,10 +717,10 @@ index 1ff12f6..b49b16a 100644 # define HAVE_PIPE2 1 #endif diff --git a/js/src/moz.build b/js/src/moz.build -index 1ad7d71..6459242 100644 +index 8ce0179..2e86330 100644 --- a/js/src/moz.build +++ b/js/src/moz.build -@@ -508,6 +508,11 @@ elif CONFIG["OS_ARCH"] == "WASI": +@@ -507,6 +507,11 @@ elif CONFIG["OS_ARCH"] == "WASI": "threading/noop/NoopThread.cpp", ] else: @@ -1826,7 +1827,7 @@ index fd6c684..92f7eb2 100644 # We allow warnings for third-party code that can be updated from upstream. diff --git a/mfbt/Assertions.h b/mfbt/Assertions.h -index 611c2b4..bfe08ba 100644 +index a21ee9d..68d78f3 100644 --- a/mfbt/Assertions.h +++ b/mfbt/Assertions.h @@ -231,7 +231,7 @@ MOZ_NoReturn(int aLine) { @@ -1839,10 +1840,10 @@ index 611c2b4..bfe08ba 100644 # define MOZ_REALLY_CRASH(line) __builtin_trap() diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml -index 8597446..9e51ece 100644 +index a8ba391..7e1cc81 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml -@@ -11069,6 +11069,8 @@ +@@ -11167,6 +11167,8 @@ value: true #elif defined(XP_SOLARIS) value: true @@ -1851,7 +1852,7 @@ index 8597446..9e51ece 100644 #else value: false #endif -@@ -11113,6 +11115,8 @@ +@@ -11211,6 +11213,8 @@ value: true #elif defined(XP_SOLARIS) value: true @@ -1860,7 +1861,7 @@ index 8597446..9e51ece 100644 #else value: false #endif -@@ -11146,6 +11150,8 @@ +@@ -11244,6 +11248,8 @@ value: true #elif defined(XP_SOLARIS) value: true @@ -1869,7 +1870,7 @@ index 8597446..9e51ece 100644 #else value: false #endif -@@ -11165,6 +11171,8 @@ +@@ -11263,6 +11269,8 @@ value: true #elif defined(XP_SOLARIS) value: true @@ -1878,7 +1879,7 @@ index 8597446..9e51ece 100644 #else value: false #endif -@@ -11184,6 +11192,8 @@ +@@ -11282,6 +11290,8 @@ value: true #elif defined(XP_SOLARIS) value: true @@ -1887,7 +1888,7 @@ index 8597446..9e51ece 100644 #else value: false #endif -@@ -11203,6 +11213,8 @@ +@@ -11301,6 +11311,8 @@ value: true #elif defined(XP_SOLARIS) value: true @@ -1896,7 +1897,7 @@ index 8597446..9e51ece 100644 #else value: false #endif -@@ -11234,6 +11246,8 @@ +@@ -11332,6 +11344,8 @@ value: true #elif defined(XP_SOLARIS) value: true @@ -1905,7 +1906,7 @@ index 8597446..9e51ece 100644 #else value: false #endif -@@ -12215,6 +12229,8 @@ +@@ -12323,6 +12337,8 @@ type: bool #if defined(MOZ_WIDGET_ANDROID) value: true @@ -1915,10 +1916,10 @@ index 8597446..9e51ece 100644 value: false #endif diff --git a/moz.configure b/moz.configure -index 1c81efe..9ce1db9 100755 +index 5e9cc42..c5a79e2 100755 --- a/moz.configure +++ b/moz.configure -@@ -855,6 +855,8 @@ def strip_flags(flags, profiling, target): +@@ -865,6 +865,8 @@ def strip_flags(flags, profiling, target): # On Darwin, it tries to strip things it can't, so we need to limit its scope. elif target.kernel == "Darwin": return ["-x", "-S"] @@ -2031,7 +2032,7 @@ index 6f87118..d26267d 100644 #include #include diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp -index ff93236..60c7976 100644 +index b2778ad..553fdfc 100644 --- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -320,7 +320,7 @@ struct DumpLeakedURLs { @@ -2207,10 +2208,10 @@ index f9fa0f6..7bb78a9 100644 long pageSize = sysconf(_SC_PAGESIZE); long pageCount = sysconf(_SC_PHYS_PAGES); diff --git a/python/mach/mach/site.py b/python/mach/mach/site.py -index cfce1e2..ac90531 100644 +index 8f49a78..c69c15b 100644 --- a/python/mach/mach/site.py +++ b/python/mach/mach/site.py -@@ -1471,6 +1471,14 @@ def _create_venv_with_pthfile( +@@ -1472,6 +1472,14 @@ def _create_venv_with_pthfile( _ensure_python_exe(Path(target_venv.python_path).parent) @@ -2354,6 +2355,22 @@ index 25f43bb..967aee7 100644 "kFreeBSD": "__FreeBSD_kernel__", "Linux": "__linux__", "NetBSD": "__NetBSD__", +diff --git a/python/sites/mach.txt b/python/sites/mach.txt +index 6e3db1c..b282ffa 100644 +--- a/python/sites/mach.txt ++++ b/python/sites/mach.txt +@@ -104,9 +104,9 @@ vendored:third_party/python/wheel + vendored:third_party/python/zipp + # glean-sdk may not be installable if a wheel isn't available + # and it has to be built from source. +-pypi-optional:glean-sdk==63.1.0:telemetry will not be collected ++#pypi-optional:glean-sdk==63.1.0:telemetry will not be collected + # Mach gracefully handles the case where `psutil` is unavailable. + # We aren't (yet) able to pin packages in automation, so we have to + # support down to the oldest locally-installed version (5.4.2). +-pypi-optional:psutil>=5.4.2,<=5.9.4:telemetry will be missing some data ++#pypi-optional:psutil>=5.4.2,<=5.9.4:telemetry will be missing some data + pypi-optional:zstandard>=0.11.1,<=0.23.0:zstd archives will not be possible to extract diff --git a/security/certverifier/ExtendedValidation.cpp b/security/certverifier/ExtendedValidation.cpp index 63f3018..f717d4c 100644 --- a/security/certverifier/ExtendedValidation.cpp @@ -2369,10 +2386,10 @@ index 63f3018..f717d4c 100644 unsigned char certFingerprint[SHA256_LENGTH]; srv = PK11_HashBuf(SEC_OID_SHA256, certFingerprint, cert->derCert.data, diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml -index ed1dce3..41dfaf7 100644 +index 5f1c993..be358d4 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml -@@ -2445,6 +2445,12 @@ criteria = "safe-to-deploy" +@@ -2502,6 +2502,12 @@ criteria = "safe-to-deploy" delta = "6.0.1 -> 6.0.2" notes = "I'm the author of the changes in this version of the crate." @@ -2385,7 +2402,7 @@ index ed1dce3..41dfaf7 100644 [[audits.goblin]] who = "Jan-Erik Rediger " criteria = "safe-to-deploy" -@@ -3100,6 +3106,12 @@ criteria = "safe-to-deploy" +@@ -3178,6 +3184,12 @@ criteria = "safe-to-deploy" version = "0.14.0" notes = "Victor and Myk developed this crate at Mozilla." @@ -2399,10 +2416,10 @@ index ed1dce3..41dfaf7 100644 who = "Mike Hommey " criteria = "safe-to-deploy" diff --git a/supply-chain/config.toml b/supply-chain/config.toml -index 97d3b52..afa2a07 100644 +index d507a95..5e54223 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml -@@ -68,6 +68,10 @@ notes = "Used for testing." +@@ -76,6 +76,10 @@ notes = "Used for testing." dependency-criteria = { tokio-reactor = [], tokio-threadpool = [] } notes = "The dependencies on tokio-reactor and tokio-threadpools are just a hack to pin the version used by audioipc-{client,server}. Suppress vetting on those for the same reasons behind the policy entries." @@ -2413,7 +2430,7 @@ index 97d3b52..afa2a07 100644 [policy.gluesmith] criteria = "safe-to-run" notes = "Used for fuzzing." -@@ -92,6 +96,10 @@ notes = "This crate has two testing-only dependencies which are specified as reg +@@ -100,6 +104,10 @@ notes = "This crate has two testing-only dependencies which are specified as reg audit-as-crates-io = false notes = "This override is an api-compatible fork with an orthogonal implementation." @@ -2562,7 +2579,7 @@ index 9f3dac4..e5ef5a8 100644 *handle = dlopen(lib_name, flags); if (!*handle) { diff --git a/third_party/libwebrtc/BUILD.gn b/third_party/libwebrtc/BUILD.gn -index 14c47ef..9919577 100644 +index 2ee5384..3a0fc9d 100644 --- a/third_party/libwebrtc/BUILD.gn +++ b/third_party/libwebrtc/BUILD.gn @@ -210,7 +210,7 @@ config("common_inherited_config") { @@ -2594,7 +2611,7 @@ index 14c47ef..9919577 100644 defines += [ "WEBRTC_WIN" ] } diff --git a/third_party/libwebrtc/modules/desktop_capture/BUILD.gn b/third_party/libwebrtc/modules/desktop_capture/BUILD.gn -index 2f99e3f..db00c83 100644 +index 2245146..02d76c6 100644 --- a/third_party/libwebrtc/modules/desktop_capture/BUILD.gn +++ b/third_party/libwebrtc/modules/desktop_capture/BUILD.gn @@ -354,6 +354,19 @@ rtc_library("desktop_capture") { @@ -2617,7 +2634,7 @@ index 2f99e3f..db00c83 100644 if (rtc_use_x11_extensions) { sources += [ "linux/x11/mouse_cursor_monitor_x11.cc", -@@ -393,7 +406,7 @@ rtc_library("desktop_capture") { +@@ -396,7 +409,7 @@ rtc_library("desktop_capture") { } if (!is_win && !is_mac && !rtc_use_x11_extensions && !rtc_use_pipewire && @@ -2993,7 +3010,7 @@ index 0000000..a89b4a1 + +} // namespace webrtc diff --git a/third_party/libwebrtc/modules/video_capture/BUILD.gn b/third_party/libwebrtc/modules/video_capture/BUILD.gn -index 60e1919..5985062 100644 +index 42a5011..0e44e00 100644 --- a/third_party/libwebrtc/modules/video_capture/BUILD.gn +++ b/third_party/libwebrtc/modules/video_capture/BUILD.gn @@ -137,6 +137,20 @@ if (!build_with_chromium || is_linux || is_chromeos) { @@ -3570,10 +3587,10 @@ index 0d12966..1fef378 100644 #else return videocapturemodule::VideoCaptureImpl::CreateDeviceInfo(options); diff --git a/third_party/libwebrtc/rtc_base/BUILD.gn b/third_party/libwebrtc/rtc_base/BUILD.gn -index 50c0526..420e84a 100644 +index 87c62f0..abcafc9 100644 --- a/third_party/libwebrtc/rtc_base/BUILD.gn +++ b/third_party/libwebrtc/rtc_base/BUILD.gn -@@ -1139,6 +1139,10 @@ rtc_library("ifaddrs_converter") { +@@ -1146,6 +1146,10 @@ rtc_library("ifaddrs_converter") { "ifaddrs_converter.h", ] } @@ -3601,7 +3618,7 @@ index d9c7829..8a8165d 100644 if (!filename_.empty()) { #if defined(WEBRTC_ANDROID) diff --git a/third_party/libwebrtc/rtc_base/physical_socket_server.cc b/third_party/libwebrtc/rtc_base/physical_socket_server.cc -index c316b10..35e025f 100644 +index 35aa5d7..90afb82 100644 --- a/third_party/libwebrtc/rtc_base/physical_socket_server.cc +++ b/third_party/libwebrtc/rtc_base/physical_socket_server.cc @@ -75,7 +75,7 @@ typedef void* SockOptArg; @@ -3756,7 +3773,7 @@ index 62e1694..70186bb 100644 if (is_win) { diff --git a/third_party/libwebrtc/webrtc.gni b/third_party/libwebrtc/webrtc.gni -index 7155b1d..4b76d92 100644 +index 4b41090..1fbeb1b 100644 --- a/third_party/libwebrtc/webrtc.gni +++ b/third_party/libwebrtc/webrtc.gni @@ -145,7 +145,7 @@ declare_args() { @@ -4451,1069 +4468,6 @@ index d5c0aca..506a7b1 100644 else: UNIFIED_SOURCES += ["ProcInfo_linux.cpp"] elif toolkit == "windows": -diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build -index 841bab1..6a58715 100644 ---- a/toolkit/library/moz.build -+++ b/toolkit/library/moz.build -@@ -344,6 +344,10 @@ if CONFIG["OS_ARCH"] == "Darwin": - "-weak_framework MediaPlayer", - ] - -+if CONFIG["OS_ARCH"] == "Haiku": -+ OS_LIBS += [ -+ "be", -+ ] - - if CONFIG["OS_ARCH"] == "WINNT": - OS_LIBS += [ -diff --git a/toolkit/library/rust/moz.build b/toolkit/library/rust/moz.build -index 34c94a1..56edb0a 100644 ---- a/toolkit/library/rust/moz.build -+++ b/toolkit/library/rust/moz.build -@@ -8,6 +8,12 @@ include("gkrust-features.mozbuild") - - RustLibrary("gkrust", gkrust_features, is_gkrust=True) - -+if CONFIG["OS_ARCH"] == "Haiku": -+ # Rust 1.83+ requires arc4random_buf() -+ OS_LIBS += [ -+ "bsd" -+ ] -+ - for feature in gkrust_features: - # We don't want to enable refcount logging during rusttests, since the - # relevant FFI symbols wouldn't be found. -diff --git a/toolkit/modules/ShortcutUtils.sys.mjs b/toolkit/modules/ShortcutUtils.sys.mjs -index 360a7db..69b089f 100644 ---- a/toolkit/modules/ShortcutUtils.sys.mjs -+++ b/toolkit/modules/ShortcutUtils.sys.mjs -@@ -64,7 +64,7 @@ export var ShortcutUtils = { - let elemString = ""; - let haveCloverLeaf = false; - if (elemMod.match("accel")) { -- if (Services.appinfo.OS == "Darwin") { -+ if (Services.appinfo.OS == "Darwin" || Services.appinfo.OS == "Haiku") { - haveCloverLeaf = true; - } else { - elemString += -@@ -73,7 +73,7 @@ export var ShortcutUtils = { - } - } - if (elemMod.match("access")) { -- if (Services.appinfo.OS == "Darwin") { -+ if (Services.appinfo.OS == "Darwin" || Services.appinfo.OS == "Haiku") { - elemString += - lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + - lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -@@ -94,14 +94,26 @@ export var ShortcutUtils = { - lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); - } - if (elemMod.match("alt")) { -- elemString += -- lazy.PlatformKeys.GetStringFromName("VK_ALT") + -- lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ if (Services.appinfo.OS == "Haiku") { -+ elemString += -+ lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + -+ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ } else { -+ elemString += -+ lazy.PlatformKeys.GetStringFromName("VK_ALT") + -+ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ } - } - if (elemMod.match("ctrl") || elemMod.match("control")) { -- elemString += -- lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + -- lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ if (Services.appinfo.OS == "Haiku") { -+ elemString += -+ lazy.PlatformKeys.GetStringFromName("VK_ALT") + -+ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ } else { -+ elemString += -+ lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + -+ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ } - } - if (elemMod.match("meta") && this.metaKeyIsCommandKey()) { - elemString += -@@ -110,9 +122,15 @@ export var ShortcutUtils = { - } - - if (haveCloverLeaf) { -- elemString += -- lazy.PlatformKeys.GetStringFromName("VK_COMMAND_OR_WIN") + -- lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ if (Services.appinfo.OS == "Haiku") { -+ elemString += -+ lazy.PlatformKeys.GetStringFromName("VK_ALT") + -+ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ } else { -+ elemString += -+ lazy.PlatformKeys.GetStringFromName("VK_COMMAND_OR_WIN") + -+ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); -+ } - } - - return elemString; -diff --git a/toolkit/moz.configure b/toolkit/moz.configure -index e5e5176..b14c7eb 100644 ---- a/toolkit/moz.configure -+++ b/toolkit/moz.configure -@@ -299,6 +299,8 @@ def audio_backends_default(target): - return ("sndio",) - elif target.kernel == "Darwin": - return ("audiounit",) -+ elif target.os == "Haiku": -+ return ("haiku",) - elif target.os == "NetBSD": - return ("sunaudio",) - elif target.os == "SunOS": -@@ -316,6 +318,7 @@ option( - "aaudio", - "alsa", - "audiounit", -+ "haiku", - "jack", - "opensl", - "oss", -@@ -354,6 +357,11 @@ def imply_audiounit(values, target): - return any("audiounit" in value for value in values) or None - - -+@depends("--enable-audio-backends") -+def imply_haiku(values): -+ return any("haiku" in value for value in values) or None -+ -+ - @depends("--enable-audio-backends") - def imply_jack(values): - return any("jack" in value for value in values) or None -@@ -417,6 +425,8 @@ imply_option( - - set_config("MOZ_AUDIOUNIT_RUST", imply_audiounit, when="--enable-audio-backends") - -+set_config("MOZ_HAIKU", imply_haiku, when="--enable-audio-backends") -+ - imply_option( - "--enable-jack", imply_jack, reason="--enable-audio-backends", when=use_pkg_config - ) -@@ -3061,6 +3071,7 @@ def forkserver_default(target, build_project): - (target.os == "GNU" and target.kernel == "Linux") - or target.os == "FreeBSD" - or target.os == "OpenBSD" -+ or target.os == "Haiku" - ) - - -@@ -3661,7 +3672,7 @@ with only_when(compile_environment): - - @depends(target) - def default_user_appdir(target): -- if target.kernel in ("WINNT", "Darwin"): -+ if target.kernel in ("WINNT", "Darwin", "Haiku"): - return "Mozilla" - return ".mozilla" - -diff --git a/toolkit/system/gnome/moz.build b/toolkit/system/gnome/moz.build -index aa2df2b..a42f897 100644 ---- a/toolkit/system/gnome/moz.build -+++ b/toolkit/system/gnome/moz.build -@@ -7,8 +7,12 @@ - with Files("**"): - BUG_COMPONENT = ("Firefox", "Shell Integration") - -+if CONFIG["OS_ARCH"] != "Haiku": -+ SOURCES += [ -+ "nsAlertsIconListener.cpp", -+ ] -+ - SOURCES += [ -- "nsAlertsIconListener.cpp", - "nsSystemAlertsService.cpp", - ] - -diff --git a/toolkit/system/gnome/nsGIOService.cpp b/toolkit/system/gnome/nsGIOService.cpp -index fd173f9..839d9f4 100644 ---- a/toolkit/system/gnome/nsGIOService.cpp -+++ b/toolkit/system/gnome/nsGIOService.cpp -@@ -399,6 +399,32 @@ gboolean g_app_info_launch_default_for_uri_openbsd(const char* uri, - } - #endif - -+#ifdef __HAIKU__ -+ -+gboolean g_app_info_launch_uris_haiku(GAppInfo* mApp, const char* uri, -+ GAppLaunchContext* context, -+ GError** error) { -+ gchar* command = g_strdup_printf("open '%s'", uri); -+ auto releaseCommand = MakeScopeExit([&] { g_free(command); }); -+ -+ int result = system(command); -+ -+ if (result != 0) { -+ g_set_error(error, G_IO_ERROR, G_IO_ERROR_FAILED, -+ "Failed to open URI '%s' using 'open' utility", uri); -+ return FALSE; -+ } -+ return TRUE; -+} -+ -+gboolean g_app_info_launch_default_for_uri_haiku(const char* uri, -+ GAppLaunchContext* context, -+ GError** error) { -+ return g_app_info_launch_uris_haiku(NULL, uri, context, error); -+} -+ -+#endif // __HAIKU__ -+ - static NS_IMETHODIMP LaunchWithURIImpl(RefPtr aInfo, nsIURI* aUri, - const char* aXDGToken = nullptr) { - GList uris = {0}; -@@ -412,6 +438,10 @@ static NS_IMETHODIMP LaunchWithURIImpl(RefPtr aInfo, nsIURI* aUri, - gboolean result = g_app_info_launch_uris_openbsd( - aInfo, spec.get(), GetLaunchContext(aXDGToken).get(), - getter_Transfers(error)); -+#elif defined(__HAIKU__) -+ gboolean result = g_app_info_launch_uris_haiku( -+ aInfo, spec.get(), GetLaunchContext(aXDGToken).get(), -+ getter_Transfers(error)); - #else - gboolean result = g_app_info_launch_uris( - aInfo, &uris, GetLaunchContext(aXDGToken).get(), getter_Transfers(error)); -@@ -802,6 +832,9 @@ static nsresult ShowURIImpl(nsIURI* aURI, const char* aXDGToken = nullptr) { - #ifdef __OpenBSD__ - if (!g_app_info_launch_default_for_uri_openbsd( - spec.get(), GetLaunchContext(aXDGToken).get(), -+#elif defined(__HAIKU__) -+ if (!g_app_info_launch_default_for_uri_haiku( -+ spec.get(), GetLaunchContext(aXDGToken).get(), - #else - if (!g_app_info_launch_default_for_uri(spec.get(), - GetLaunchContext(aXDGToken).get(), -@@ -837,6 +870,9 @@ static nsresult LaunchPathImpl(const nsACString& aPath, - #ifdef __OpenBSD__ - g_app_info_launch_default_for_uri_openbsd(spec.get(), - GetLaunchContext(aXDGToken).get(), -+#elif defined(__HAIKU__) -+ g_app_info_launch_default_for_uri_haiku(spec.get(), -+ GetLaunchContext(aXDGToken).get(), - #else - g_app_info_launch_default_for_uri(spec.get(), - GetLaunchContext(aXDGToken).get(), -diff --git a/toolkit/system/haiku/moz.build b/toolkit/system/haiku/moz.build -new file mode 100644 -index 0000000..8c3bf79 ---- /dev/null -+++ b/toolkit/system/haiku/moz.build -@@ -0,0 +1,26 @@ -+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -+# vim: set filetype=python: -+# This Source Code Form is subject to the terms of the Mozilla Public -+# License, v. 2.0. If a copy of the MPL was not distributed with this -+# file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ -+with Files("**"): -+ BUG_COMPONENT = ("Firefox", "Shell Integration") -+ -+if CONFIG["OS_ARCH"] == "Haiku": -+ SOURCES += [ -+ "nsAlertsIconListener.cpp", -+ ] -+ OS_LIBS += [ -+ 'be', -+ ] -+ -+ -+FINAL_LIBRARY = "xul" -+ -+LOCAL_INCLUDES += [ -+ "/toolkit/components/build/", -+] -+ -+CXXFLAGS += CONFIG["GLIB_CFLAGS"] -+CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"] -diff --git a/toolkit/system/haiku/nsAlertsIconListener.cpp b/toolkit/system/haiku/nsAlertsIconListener.cpp -new file mode 100644 -index 0000000..e90fe1c ---- /dev/null -+++ b/toolkit/system/haiku/nsAlertsIconListener.cpp -@@ -0,0 +1,302 @@ -+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */ -+/* This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -+ -+#include "../gnome/nsSystemAlertsService.h" -+ -+#include "nsAlertsIconListener.h" -+#include "imgIContainer.h" -+#include "imgIRequest.h" -+#include "nsServiceManagerUtils.h" -+#include "nsIAlertsService.h" -+#include "nsICancelable.h" -+#include "nsImageToPixbuf.h" -+#include "nsIStringBundle.h" -+#include "nsIObserverService.h" -+#include "nsCRT.h" -+#include "mozilla/XREAppData.h" -+#include "mozilla/GRefPtr.h" -+#include "mozilla/GUniquePtr.h" -+#include "mozilla/UniquePtrExtensions.h" -+ -+#include -+#include -+#include -+ -+#include "mozilla/UniquePtr.h" -+ -+using namespace mozilla; -+extern const StaticXREAppData* gAppData; -+ -+NS_IMPL_ISUPPORTS(nsAlertsIconListener, nsIAlertNotificationImageListener, -+ nsIObserver, nsISupportsWeakReference) -+ -+GdkPixbuf* nsAlertsIconListener::GetPixbufFromImgRequest(imgIRequest* aRequest) { -+ nsCOMPtr image; -+ nsresult rv = aRequest->GetImage(getter_AddRefs(image)); -+ if (NS_FAILED(rv) || !image) { -+ return nullptr; -+ } -+ -+ RefPtr pixbuf = nsImageToPixbuf::ImageToPixbuf(image); -+ if (!pixbuf) { -+ return nullptr; -+ } -+ -+ return pixbuf.forget().take(); -+} -+ -+ -+BBitmap* nsAlertsIconListener::PixbufToBitmap(GdkPixbuf* aPixbuf) { -+ if (!aPixbuf) { -+ return nullptr; -+ } -+ -+ GdkPixbuf* pixbufToUse = aPixbuf; -+ RefPtr scaledPixbuf; -+ -+ int width = gdk_pixbuf_get_width(aPixbuf); -+ int height = gdk_pixbuf_get_height(aPixbuf); -+ -+ const int maxWidth = 64; -+ const int maxHeight = 64; -+ -+ if (width > maxWidth || height > maxHeight) { -+ double ratio = std::min(static_cast(maxWidth) / width, -+ static_cast(maxHeight) / height); -+ int newWidth = std::max(1, static_cast(std::round(width * ratio))); -+ int newHeight = std::max(1, static_cast(std::round(height * ratio))); -+ -+ scaledPixbuf = gdk_pixbuf_scale_simple( -+ aPixbuf, newWidth, newHeight, GDK_INTERP_BILINEAR); -+ -+ if (!scaledPixbuf) { -+ fprintf(stderr, "PixbufToBitmap: Failed to scale pixbuf\n"); -+ return nullptr; -+ } -+ pixbufToUse = scaledPixbuf.get(); -+ width = newWidth; -+ height = newHeight; -+ } -+ -+ int n_channels = gdk_pixbuf_get_n_channels(pixbufToUse); -+ bool has_alpha = gdk_pixbuf_get_has_alpha(pixbufToUse); -+ -+ if (width <= 0 || height <= 0) { -+ return nullptr; -+ } -+ -+ if (n_channels != 4 || !has_alpha) { -+ fprintf(stderr, "PixbufToBitmap: Expected 4 channels (RGBA) after potential scaling, got %d\n", n_channels); -+ return nullptr; -+ } -+ -+ BRect bounds(0, 0, width - 1, height - 1); -+ BBitmap* bitmap = new BBitmap(bounds, B_RGBA32); -+ -+ if (!bitmap || bitmap->InitCheck() != B_OK) { -+ delete bitmap; -+ return nullptr; -+ } -+ -+ guchar* pixbufPixels = gdk_pixbuf_get_pixels(pixbufToUse); -+ int pixbufRowstride = gdk_pixbuf_get_rowstride(pixbufToUse); -+ uint8* bitmapPixels = (uint8*)bitmap->Bits(); -+ uint32 bitmapRowstride = bitmap->BytesPerRow(); -+ -+ for (int y = 0; y < height; ++y) { -+ guchar* p = pixbufPixels + y * pixbufRowstride; -+ uint8* b = bitmapPixels + y * bitmapRowstride; -+ for (int x = 0; x < width; ++x) { -+ uint8 r = p[0]; -+ uint8 g = p[1]; -+ uint8 b_ = p[2]; -+ uint8 a = p[3]; -+ -+ b[0] = b_; -+ b[1] = g; -+ b[2] = r; -+ b[3] = a; -+ -+ p += 4; -+ b += 4; -+ } -+ } -+ -+ return bitmap; -+} -+ -+ -+nsAlertsIconListener::nsAlertsIconListener( -+ nsSystemAlertsService* aBackend, nsIAlertNotification* aAlertNotification, -+ const nsAString& aAlertName) -+ : mAlertName(aAlertName), -+ mBackend(aBackend), -+ mAlertNotification(aAlertNotification) { -+} -+ -+nsAlertsIconListener::~nsAlertsIconListener() { -+ mBackend->RemoveListener(mAlertName, this); -+} -+ -+NS_IMETHODIMP -+nsAlertsIconListener::OnImageMissing(nsISupports*) { -+ return ShowAlert(nullptr); -+} -+ -+NS_IMETHODIMP -+nsAlertsIconListener::OnImageReady(nsISupports*, imgIRequest* aRequest) { -+ GdkPixbuf* pixbuf = GetPixbufFromImgRequest(aRequest); -+ if (!pixbuf) { -+ fprintf(stderr, "Failed to get GdkPixbuf from image request\n"); -+ return ShowAlert(nullptr); -+ } -+ -+ BBitmap* iconBitmap = PixbufToBitmap(pixbuf); -+ -+ g_object_unref(pixbuf); -+ -+ if (!iconBitmap) { -+ fprintf(stderr, "Failed to convert GdkPixbuf to BBitmap (possibly after scaling)\n"); -+ } -+ -+ nsresult rv = ShowAlert(iconBitmap); -+ return rv; -+} -+ -+nsresult nsAlertsIconListener::ShowAlert(BBitmap* aIconBitmap) { -+ mozilla::UniquePtr iconBitmap(aIconBitmap); -+ -+ if (!mBackend->IsActiveListener(mAlertName, this)) return NS_OK; -+ -+ notification_type type = B_INFORMATION_NOTIFICATION; -+ -+ BNotification notification(type); -+ if (notification.InitCheck() != B_OK) { -+ fprintf(stderr, "Failed to initialize BNotification\n"); -+ return NS_ERROR_FAILURE; -+ } -+ -+ nsCOMPtr bundleService = -+ do_GetService(NS_STRINGBUNDLE_CONTRACTID); -+ -+ nsAutoCString appShortName; -+ if (bundleService) { -+ nsCOMPtr bundle; -+ bundleService->CreateBundle("chrome://branding/locale/brand.properties", -+ getter_AddRefs(bundle)); -+ nsAutoString appName; -+ -+ if (bundle) { -+ bundle->GetStringFromName("brandShortName", appName); -+ CopyUTF16toUTF8(appName, appShortName); -+ } else { -+ NS_WARNING( -+ "brand.properties not present, using default application name"); -+ appShortName.AssignLiteral("Mozilla"); -+ } -+ } else { -+ appShortName.AssignLiteral("Mozilla"); -+ } -+ -+ notification.SetGroup(appShortName.get()); -+ -+ if (!mAlertTitle.IsEmpty()) { -+ notification.SetTitle(mAlertTitle.get()); -+ } else { -+ notification.SetTitle("Notification"); -+ } -+ -+ if (!mAlertText.IsEmpty()) { -+ notification.SetContent(mAlertText.get()); -+ } -+ -+ if (!mAlertCookie.IsEmpty()) { -+ nsCString cookieStr = NS_ConvertUTF16toUTF8(mAlertCookie); -+ if (!cookieStr.IsEmpty()) { -+ notification.SetMessageID(cookieStr.get()); -+ } -+ } -+ -+ if (iconBitmap) { -+ notification.SetIcon(iconBitmap.get()); -+ } -+ -+ bigtime_t timeout = mAlertRequiresInteraction ? 15000000 : -1; -+ -+ status_t sendStatus = notification.Send(timeout); -+ if (sendStatus != B_OK) { -+ fprintf(stderr, "Failed to send BNotification: %s\n", strerror(sendStatus)); -+ } -+ -+ nsCOMPtr obsServ = -+ do_GetService("@mozilla.org/observer-service;1"); -+ if (obsServ) obsServ->AddObserver(this, "quit-application", true); -+ -+ if (mAlertListener) -+ mAlertListener->Observe(nullptr, "alertshow", mAlertCookie.get()); -+ -+ return NS_OK; -+} -+ -+void nsAlertsIconListener::SendCallback() { -+ if (mAlertListener) -+ mAlertListener->Observe(nullptr, "alertclickcallback", mAlertCookie.get()); -+} -+ -+void nsAlertsIconListener::SendClosed() { -+ NotifyFinished(); -+} -+ -+NS_IMETHODIMP -+nsAlertsIconListener::Observe(nsISupports* aSubject, const char* aTopic, -+ const char16_t* aData) { -+ if (!nsCRT::strcmp(aTopic, "quit-application")) { -+ Release(); -+ } -+ return NS_OK; -+} -+ -+nsresult nsAlertsIconListener::Close() { -+ if (mIconRequest) { -+ mIconRequest->Cancel(NS_BINDING_ABORTED); -+ mIconRequest = nullptr; -+ } -+ NotifyFinished(); -+ return NS_OK; -+} -+ -+nsresult nsAlertsIconListener::InitAlertAsync(nsIAlertNotification* aAlert, -+ nsIObserver* aAlertListener) { -+ nsresult rv = aAlert->GetTextClickable(&mAlertHasAction); -+ NS_ENSURE_SUCCESS(rv, rv); -+ -+ rv = aAlert->GetSilent(&mAlertIsSilent); -+ NS_ENSURE_SUCCESS(rv, rv); -+ -+ rv = aAlert->GetRequireInteraction(&mAlertRequiresInteraction); -+ NS_ENSURE_SUCCESS(rv, rv); -+ -+ nsAutoString title; -+ rv = aAlert->GetTitle(title); -+ NS_ENSURE_SUCCESS(rv, rv); -+ CopyUTF16toUTF8(title, mAlertTitle); -+ -+ nsAutoString text; -+ rv = aAlert->GetText(text); -+ NS_ENSURE_SUCCESS(rv, rv); -+ CopyUTF16toUTF8(text, mAlertText); -+ -+ mAlertListener = aAlertListener; -+ -+ rv = aAlert->GetCookie(mAlertCookie); -+ NS_ENSURE_SUCCESS(rv, rv); -+ -+ return aAlert->LoadImage(0, this, nullptr, getter_AddRefs(mIconRequest)); -+} -+ -+void nsAlertsIconListener::NotifyFinished() { -+ if (mAlertListener) -+ mAlertListener->Observe(nullptr, "alertfinished", mAlertCookie.get()); -+} -diff --git a/toolkit/system/haiku/nsAlertsIconListener.h b/toolkit/system/haiku/nsAlertsIconListener.h -new file mode 100644 -index 0000000..257cc1f ---- /dev/null -+++ b/toolkit/system/haiku/nsAlertsIconListener.h -@@ -0,0 +1,74 @@ -+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -+/* This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -+ -+#ifndef nsAlertsIconListener_h__ -+#define nsAlertsIconListener_h__ -+ -+#include "nsCOMPtr.h" -+#include "nsIAlertsService.h" -+#include "nsString.h" -+#include "nsIObserver.h" -+#include "nsWeakReference.h" -+ -+#include -+ -+#pragma GCC visibility push(default) -+#include -+#include -+#include -+#include -+#pragma GCC visibility pop -+ -+class nsIAlertNotification; -+class nsICancelable; -+class nsSystemAlertsService; -+class imgIRequest; -+ -+class nsAlertsIconListener : public nsIAlertNotificationImageListener, -+ public nsIObserver, -+ public nsSupportsWeakReference { -+ public: -+ NS_DECL_ISUPPORTS -+ NS_DECL_NSIALERTNOTIFICATIONIMAGELISTENER -+ NS_DECL_NSIOBSERVER -+ -+ nsAlertsIconListener(nsSystemAlertsService* aBackend, -+ nsIAlertNotification* aAlertNotification, -+ const nsAString& aAlertName); -+ -+ nsresult InitAlertAsync(nsIAlertNotification* aAlert, -+ nsIObserver* aAlertListener); -+ nsresult Close(); -+ -+ void SendCallback(); -+ void SendClosed(); -+ -+ protected: -+ virtual ~nsAlertsIconListener(); -+ -+ static BBitmap* PixbufToBitmap(GdkPixbuf* aPixbuf); -+ static GdkPixbuf* GetPixbufFromImgRequest(imgIRequest* aRequest); -+ -+ nsCOMPtr mIconRequest; -+ nsCString mAlertTitle; -+ nsCString mAlertText; -+ -+ nsCOMPtr mAlertListener; -+ nsString mAlertCookie; -+ nsString mAlertName; -+ -+ RefPtr mBackend; -+ nsCOMPtr mAlertNotification; -+ -+ bool mAlertHasAction; -+ bool mAlertIsSilent; -+ bool mAlertRequiresInteraction; -+ -+ nsresult ShowAlert(BBitmap* aIconBitmap = nullptr); -+ -+ void NotifyFinished(); -+}; -+ -+#endif -diff --git a/toolkit/themes/shared/popup.css b/toolkit/themes/shared/popup.css -index ed0caa9..42b7ae1 100644 ---- a/toolkit/themes/shared/popup.css -+++ b/toolkit/themes/shared/popup.css -@@ -59,6 +59,12 @@ panel { - --panel-shadow-margin: 0px; - } - -+ /* Disable border-radius and shadow for Haiku popups */ -+ @media (-moz-platform: linux) { -+ --panel-border-radius: 0px; -+ --panel-shadow-margin: 0px; -+ } -+ - @media (-moz-platform: macos) { - appearance: auto; - -moz-default-appearance: menupopup; -diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild -index c50b7f3..19f155c 100644 ---- a/toolkit/toolkit.mozbuild -+++ b/toolkit/toolkit.mozbuild -@@ -145,6 +145,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - DIRS += [ - "/media/mozva", - "/toolkit/system/gnome", -+ "/toolkit/system/haiku", - ] - - if CONFIG["ENABLE_WEBDRIVER"]: -diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp -index bdd95b8..62d98ad 100644 ---- a/toolkit/xre/nsAppRunner.cpp -+++ b/toolkit/xre/nsAppRunner.cpp -@@ -344,14 +344,16 @@ MOZ_CONSTINIT nsString gProcessStartupShortcut; - # ifdef MOZ_WAYLAND - # include - # include "mozilla/widget/nsWaylandDisplay.h" --# include "wayland-proxy.h" -+# ifndef XP_HAIKU -+# include "wayland-proxy.h" -+# endif /* !XP_HAIKU */ - # endif - # ifdef MOZ_X11 - # include - # endif /* MOZ_X11 */ - #endif - --#if defined(MOZ_WAYLAND) -+#if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) - MOZ_RUNINIT std::unique_ptr gWaylandProxy; - #endif - -@@ -431,6 +433,9 @@ static void UnexpectedExit() { - - #if defined(MOZ_WAYLAND) - bool IsWaylandEnabled() { -+#ifdef XP_HAIKU -+ return true; -+#else - static bool isWaylandEnabled = []() { - const char* waylandDisplay = PR_GetEnv("WAYLAND_DISPLAY"); - if (!waylandDisplay) { -@@ -461,6 +466,7 @@ bool IsWaylandEnabled() { - return !gtk_check_version(3, 24, 30); - }(); - return isWaylandEnabled; -+#endif // !XP_HAIKU - } - #else - bool IsWaylandEnabled() { return false; } -@@ -3773,7 +3779,7 @@ class XREMain { - #endif - }; - --#if defined(XP_UNIX) && !defined(ANDROID) -+#if defined(XP_UNIX) && !defined(ANDROID) && !defined(XP_HAIKU) - static SmprintfPointer FormatUid(uid_t aId) { - if (const auto pw = getpwuid(aId)) { - return mozilla::Smprintf("%s", pw->pw_name); -@@ -3822,7 +3828,7 @@ static bool CheckForUserMismatch() { - } - return false; - } --#else // !XP_UNIX || ANDROID -+#else // !XP_UNIX || ANDROID || XP_HAIKU - static bool CheckForUserMismatch() { return false; } - #endif - -@@ -4815,7 +4821,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) { - // display_name is owned by gdk. - display_name = gdk_get_display_arg_name(); - bool waylandEnabled = IsWaylandEnabled(); --# ifdef MOZ_WAYLAND -+# if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) - if (!display_name) { - auto* proxyEnv = getenv("MOZ_DISABLE_WAYLAND_PROXY"); - bool disableWaylandProxy = proxyEnv && *proxyEnv; -@@ -4870,7 +4876,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) { - } else { - gdk_display_manager_open_display(gdk_display_manager_get(), nullptr); - } --# if defined(MOZ_WAYLAND) -+# if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) - // We want to use proxy for main connection only so - // restore original Wayland display for next potential Wayland connections - // from gfx probe code and so on. -@@ -6156,7 +6162,9 @@ int XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) { - if (!gfxPlatform::IsHeadless()) { - # ifdef MOZ_WAYLAND - WaylandDisplayRelease(); -+# ifndef XP_HAIKU - gWaylandProxy = nullptr; -+# endif // !XP_HAIKU - # endif - } - #endif -diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp -index 146a586..10b7fb6 100644 ---- a/toolkit/xre/nsSigHandlers.cpp -+++ b/toolkit/xre/nsSigHandlers.cpp -@@ -43,7 +43,9 @@ - # endif - - # ifdef MOZ_WAYLAND --# include "wayland-proxy.h" -+# ifndef XP_HAIKU -+# include "wayland-proxy.h" -+# endif /* !XP_HAIKU */ - # endif - - // Note: some tests manipulate this value. -@@ -180,7 +182,7 @@ static bool IsCrashyGtkMessage(const nsACString& aMessage) { - static void HandleGLibMessage(GLogLevelFlags aLogLevel, - const nsDependentCString& aMessage) { - if (MOZ_UNLIKELY(IsCrashyGtkMessage(aMessage))) { --# ifdef MOZ_WAYLAND -+# if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) - MOZ_CRASH_UNSAFE_PRINTF( - "(%s) %s Proxy: %s", - mozilla::widget::GetDesktopEnvironmentIdentifier().get(), -diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp -index 3b4612e..118fa5e 100644 ---- a/toolkit/xre/nsXREDirProvider.cpp -+++ b/toolkit/xre/nsXREDirProvider.cpp -@@ -80,6 +80,10 @@ - #ifdef XP_IOS - # include "UIKitDirProvider.h" - #endif -+#ifdef XP_HAIKU -+# include -+# include -+#endif - - #if defined(XP_MACOSX) - # define APP_REGISTRY_NAME "Application Registry" -@@ -365,7 +369,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, - } else if (!strcmp(aProperty, XRE_USER_NATIVE_MANIFESTS)) { - rv = GetUserDataDirectoryHome(getter_AddRefs(file), false); - NS_ENSURE_SUCCESS(rv, rv); --# if defined(XP_MACOSX) -+# if defined(XP_MACOSX) || defined(XP_HAIKU) - rv = file->AppendNative("Mozilla"_ns); - # else // defined(XP_MACOSX) - rv = file->AppendNative(".mozilla"_ns); -@@ -1081,6 +1085,12 @@ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, - NS_ENSURE_SUCCESS(rv, rv); - - MOZ_TRY(NS_NewLocalFile(path, getter_AddRefs(localDir))); -+#elif defined(XP_HAIKU) -+ nsresult rv; -+ BPath settingsDir; -+ status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &settingsDir); -+ if (status != B_OK) return NS_ERROR_FAILURE; -+ rv = NS_NewNativeLocalFile(nsDependentCString(settingsDir.Path()), getter_AddRefs(localDir)); - #elif defined(XP_UNIX) - const char* homeDir = getenv("HOME"); - if (!homeDir || !*homeDir) return NS_ERROR_FAILURE; -@@ -1190,7 +1200,7 @@ nsresult nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile) { - - nsresult rv; - --#if defined(XP_MACOSX) || defined(XP_WIN) -+#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_HAIKU) - - static const char* const sXR = "Mozilla"; - rv = aFile->AppendNative(nsDependentCString(sXR)); -@@ -1249,7 +1259,7 @@ nsresult nsXREDirProvider::AppendProfilePath(nsIFile* aFile, bool aLocal) { - } - NS_ENSURE_SUCCESS(rv, rv); - --#elif defined(XP_WIN) -+#elif defined(XP_WIN) || defined(XP_HAIKU) - if (!profile.IsEmpty()) { - rv = AppendProfileString(aFile, profile.get()); - } else { -diff --git a/tools/profiler/core/ProfilerUtils.cpp b/tools/profiler/core/ProfilerUtils.cpp -index 4c53061..76d3561 100644 ---- a/tools/profiler/core/ProfilerUtils.cpp -+++ b/tools/profiler/core/ProfilerUtils.cpp -@@ -88,6 +88,15 @@ ProfilerThreadId profiler_current_thread_id() { - return ProfilerThreadId::FromNativeId(id); - } - -+// ------------------------------------------------------- Haiku -+# elif defined(XP_HAIKU) -+ -+# include -+ -+ProfilerThreadId profiler_current_thread_id() { -+ return ProfilerThreadId::FromNativeId(find_thread(NULL)); -+} -+ - // ------------------------------------------------------- Others - # else - -diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build -index a3d475e..ced2c38 100644 ---- a/widget/gtk/moz.build -+++ b/widget/gtk/moz.build -@@ -23,7 +23,9 @@ if CONFIG["COMPILE_ENVIRONMENT"]: - DIRS += ["mozgtk"] - - if CONFIG["MOZ_WAYLAND"]: -- DIRS += ["wayland", "mozwayland", "../../third_party/wayland-proxy"] -+ DIRS += ["wayland", "mozwayland"] -+ if CONFIG["OS_ARCH"] != "Haiku": -+ DIRS += ["../../third_party/wayland-proxy"] - - if CONFIG["MOZ_ENABLE_VAAPI"]: - DIRS += ["vaapitest"] -diff --git a/widget/gtk/nsWaylandDisplay.cpp b/widget/gtk/nsWaylandDisplay.cpp -index e5b974b..3b65ec6 100644 ---- a/widget/gtk/nsWaylandDisplay.cpp -+++ b/widget/gtk/nsWaylandDisplay.cpp -@@ -20,7 +20,9 @@ - #include "WidgetUtilsGtk.h" - #include "nsGtkKeyUtils.h" - #include "nsWindow.h" --#include "wayland-proxy.h" -+#ifndef XP_HAIKU -+# include "wayland-proxy.h" -+#endif /* !XP_HAIKU */ - - namespace mozilla::widget { - -@@ -247,6 +249,7 @@ static const struct moz_wl_pointer_listener pointer_listener = { - }; - - void nsWaylandDisplay::SetPointer(wl_pointer* aPointer) { -+#ifndef XP_HAIKU - // Don't even try on such old interface - if (wl_proxy_get_version((struct wl_proxy*)aPointer) < - WL_POINTER_RELEASE_SINCE_VERSION) { -@@ -271,6 +274,7 @@ void nsWaylandDisplay::SetPointer(wl_pointer* aPointer) { - zwp_pointer_gesture_hold_v1_add_listener(mPointerGestureHold, - &gesture_hold_listener, this); - } -+#endif - } - - void nsWaylandDisplay::RemovePointer() { -@@ -631,19 +635,22 @@ static void WlLogHandler(const char* format, va_list args) { - if (strstr(error, "still attached")) { - return; - } -- -+#ifndef XP_HAIKU - MOZ_CRASH_UNSAFE_PRINTF("(%s) %s Proxy: %s", - GetDesktopEnvironmentIdentifier().get(), error, - WaylandProxy::GetState()); -+#endif - } - - void WlCompositorCrashHandler() { -+#ifndef XP_HAIKU - gfxCriticalNote << "Wayland protocol error: Compositor (" - << GetDesktopEnvironmentIdentifier().get() - << ") crashed, proxy: " << WaylandProxy::GetState(); - MOZ_CRASH_UNSAFE_PRINTF("Compositor crashed (%s) proxy: %s", - GetDesktopEnvironmentIdentifier().get(), - WaylandProxy::GetState()); -+#endif - } - - nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay) -diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp -index 033e951..39463db 100644 ---- a/xpcom/base/nsSystemInfo.cpp -+++ b/xpcom/base/nsSystemInfo.cpp -@@ -81,6 +81,10 @@ - # include "mozilla/SandboxInfo.h" - #endif - -+#ifdef XP_HAIKU -+# include -+#endif -+ - // Slot for NS_InitXPCOM to pass information to nsSystemInfo::Init. - // Only set to nonzero (potentially) if XP_UNIX. On such systems, the - // system call to discover the appropriate value is not thread-safe, -@@ -1366,7 +1370,15 @@ nsresult nsSystemInfo::Init() { - SetInt32Property(u"pagesize"_ns, PR_GetPageSize()); - SetInt32Property(u"pageshift"_ns, PR_GetPageShift()); - SetInt32Property(u"memmapalign"_ns, PR_GetMemMapAlignment()); -+#ifdef XP_HAIKU -+ { // workaround -+ system_info info; -+ get_system_info(&info); -+ SetUint64Property(u"memsize"_ns, info.max_pages * B_PAGE_SIZE); -+ } -+#else - SetUint64Property(u"memsize"_ns, PR_GetPhysicalMemorySize()); -+#endif - SetUint32Property(u"umask"_ns, nsSystemInfo::gUserUmask); - - #ifdef HAVE_64BIT_BUILD -diff --git a/xpcom/build/BinaryPath.h b/xpcom/build/BinaryPath.h -index 1718caa..64de0b2 100644 ---- a/xpcom/build/BinaryPath.h -+++ b/xpcom/build/BinaryPath.h -@@ -24,6 +24,10 @@ - #if defined(__OpenBSD__) - # include - #endif -+#if defined(XP_HAIKU) -+# include -+# include -+#endif - #include "mozilla/UniquePtr.h" - #include "mozilla/UniquePtrExtensions.h" - -@@ -273,6 +277,21 @@ class BinaryPath { - return NS_ERROR_FAILURE; - } - -+#elif defined(XP_HAIKU) -+ static nsresult Get(char aResult[MAXPATHLEN]) { -+ image_info info; -+ int32 cookie = 0; -+ -+ while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) >= B_OK) { -+ if (info.type == B_APP_IMAGE) { -+ strlcpy(aResult, info.name, MAXPATHLEN - 1); -+ return NS_OK; -+ } -+ } -+ -+ return NS_ERROR_FAILURE; -+ } -+ - #else - # error Oops, you need platform-specific code here - #endif -diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build -index 6b566f9..2895ad9 100644 ---- a/xpcom/reflect/xptcall/md/unix/moz.build -+++ b/xpcom/reflect/xptcall/md/unix/moz.build -@@ -33,6 +33,7 @@ if CONFIG["OS_ARCH"] in ( - "Bitrig", - "DragonFly", - "FreeBSD", -+ "Haiku", - "NetBSD", - "OpenBSD", - "SunOS", -diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp -index dbd9993..1431340 100644 ---- a/xpcom/threads/nsProcessCommon.cpp -+++ b/xpcom/threads/nsProcessCommon.cpp -@@ -43,7 +43,11 @@ - # include "base/process_util.h" - # endif - # include --# include -+# ifdef XP_HAIKU -+# include -+# else -+# include -+# endif - # endif - # include - # include --- -2.48.1 - - -From c50ab036bba159ac86a3b8322bb097f327544523 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sat, 5 Apr 2025 15:58:03 +1000 -Subject: Implement native remote server - - diff --git a/toolkit/components/remote/RemoteUtils.h b/toolkit/components/remote/RemoteUtils.h index c4c1bcd..2beb4ea 100644 --- a/toolkit/components/remote/RemoteUtils.h @@ -5840,6 +4794,1064 @@ index 46860f6..b010d4d 100644 mRemoteServer = MakeUnique(); # else mRemoteServer = MakeUnique(); +diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build +index 66fe86e..ee7fb31 100644 +--- a/toolkit/library/moz.build ++++ b/toolkit/library/moz.build +@@ -345,6 +345,10 @@ if CONFIG["OS_ARCH"] == "Darwin": + "-weak_framework MediaPlayer", + ] + ++if CONFIG["OS_ARCH"] == "Haiku": ++ OS_LIBS += [ ++ "be", ++ ] + + if CONFIG["OS_ARCH"] == "WINNT": + OS_LIBS += [ +diff --git a/toolkit/library/rust/moz.build b/toolkit/library/rust/moz.build +index 34c94a1..56edb0a 100644 +--- a/toolkit/library/rust/moz.build ++++ b/toolkit/library/rust/moz.build +@@ -8,6 +8,12 @@ include("gkrust-features.mozbuild") + + RustLibrary("gkrust", gkrust_features, is_gkrust=True) + ++if CONFIG["OS_ARCH"] == "Haiku": ++ # Rust 1.83+ requires arc4random_buf() ++ OS_LIBS += [ ++ "bsd" ++ ] ++ + for feature in gkrust_features: + # We don't want to enable refcount logging during rusttests, since the + # relevant FFI symbols wouldn't be found. +diff --git a/toolkit/modules/ShortcutUtils.sys.mjs b/toolkit/modules/ShortcutUtils.sys.mjs +index 360a7db..69b089f 100644 +--- a/toolkit/modules/ShortcutUtils.sys.mjs ++++ b/toolkit/modules/ShortcutUtils.sys.mjs +@@ -64,7 +64,7 @@ export var ShortcutUtils = { + let elemString = ""; + let haveCloverLeaf = false; + if (elemMod.match("accel")) { +- if (Services.appinfo.OS == "Darwin") { ++ if (Services.appinfo.OS == "Darwin" || Services.appinfo.OS == "Haiku") { + haveCloverLeaf = true; + } else { + elemString += +@@ -73,7 +73,7 @@ export var ShortcutUtils = { + } + } + if (elemMod.match("access")) { +- if (Services.appinfo.OS == "Darwin") { ++ if (Services.appinfo.OS == "Darwin" || Services.appinfo.OS == "Haiku") { + elemString += + lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + + lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); +@@ -94,14 +94,26 @@ export var ShortcutUtils = { + lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); + } + if (elemMod.match("alt")) { +- elemString += +- lazy.PlatformKeys.GetStringFromName("VK_ALT") + +- lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ if (Services.appinfo.OS == "Haiku") { ++ elemString += ++ lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + ++ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ } else { ++ elemString += ++ lazy.PlatformKeys.GetStringFromName("VK_ALT") + ++ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ } + } + if (elemMod.match("ctrl") || elemMod.match("control")) { +- elemString += +- lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + +- lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ if (Services.appinfo.OS == "Haiku") { ++ elemString += ++ lazy.PlatformKeys.GetStringFromName("VK_ALT") + ++ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ } else { ++ elemString += ++ lazy.PlatformKeys.GetStringFromName("VK_CONTROL") + ++ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ } + } + if (elemMod.match("meta") && this.metaKeyIsCommandKey()) { + elemString += +@@ -110,9 +122,15 @@ export var ShortcutUtils = { + } + + if (haveCloverLeaf) { +- elemString += +- lazy.PlatformKeys.GetStringFromName("VK_COMMAND_OR_WIN") + +- lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ if (Services.appinfo.OS == "Haiku") { ++ elemString += ++ lazy.PlatformKeys.GetStringFromName("VK_ALT") + ++ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ } else { ++ elemString += ++ lazy.PlatformKeys.GetStringFromName("VK_COMMAND_OR_WIN") + ++ lazy.PlatformKeys.GetStringFromName("MODIFIER_SEPARATOR"); ++ } + } + + return elemString; +diff --git a/toolkit/moz.configure b/toolkit/moz.configure +index 09b3065..d317d21 100644 +--- a/toolkit/moz.configure ++++ b/toolkit/moz.configure +@@ -299,6 +299,8 @@ def audio_backends_default(target): + return ("sndio",) + elif target.kernel == "Darwin": + return ("audiounit",) ++ elif target.os == "Haiku": ++ return ("haiku",) + elif target.os == "NetBSD": + return ("sunaudio",) + elif target.os == "SunOS": +@@ -316,6 +318,7 @@ option( + "aaudio", + "alsa", + "audiounit", ++ "haiku", + "jack", + "opensl", + "oss", +@@ -354,6 +357,11 @@ def imply_audiounit(values, target): + return any("audiounit" in value for value in values) or None + + ++@depends("--enable-audio-backends") ++def imply_haiku(values): ++ return any("haiku" in value for value in values) or None ++ ++ + @depends("--enable-audio-backends") + def imply_jack(values): + return any("jack" in value for value in values) or None +@@ -417,6 +425,8 @@ imply_option( + + set_config("MOZ_AUDIOUNIT_RUST", imply_audiounit, when="--enable-audio-backends") + ++set_config("MOZ_HAIKU", imply_haiku, when="--enable-audio-backends") ++ + imply_option( + "--enable-jack", imply_jack, reason="--enable-audio-backends", when=use_pkg_config + ) +@@ -3061,6 +3071,7 @@ def forkserver_default(target, build_project): + (target.os == "GNU" and target.kernel == "Linux") + or target.os == "FreeBSD" + or target.os == "OpenBSD" ++ or target.os == "Haiku" + ) + + +@@ -3720,7 +3731,7 @@ with only_when(compile_environment): + + @depends(target) + def default_user_appdir(target): +- if target.kernel in ("WINNT", "Darwin"): ++ if target.kernel in ("WINNT", "Darwin", "Haiku"): + return "Mozilla" + return ".mozilla" + +diff --git a/toolkit/system/gnome/moz.build b/toolkit/system/gnome/moz.build +index aa2df2b..a42f897 100644 +--- a/toolkit/system/gnome/moz.build ++++ b/toolkit/system/gnome/moz.build +@@ -7,8 +7,12 @@ + with Files("**"): + BUG_COMPONENT = ("Firefox", "Shell Integration") + ++if CONFIG["OS_ARCH"] != "Haiku": ++ SOURCES += [ ++ "nsAlertsIconListener.cpp", ++ ] ++ + SOURCES += [ +- "nsAlertsIconListener.cpp", + "nsSystemAlertsService.cpp", + ] + +diff --git a/toolkit/system/gnome/nsGIOService.cpp b/toolkit/system/gnome/nsGIOService.cpp +index fd173f9..839d9f4 100644 +--- a/toolkit/system/gnome/nsGIOService.cpp ++++ b/toolkit/system/gnome/nsGIOService.cpp +@@ -399,6 +399,32 @@ gboolean g_app_info_launch_default_for_uri_openbsd(const char* uri, + } + #endif + ++#ifdef __HAIKU__ ++ ++gboolean g_app_info_launch_uris_haiku(GAppInfo* mApp, const char* uri, ++ GAppLaunchContext* context, ++ GError** error) { ++ gchar* command = g_strdup_printf("open '%s'", uri); ++ auto releaseCommand = MakeScopeExit([&] { g_free(command); }); ++ ++ int result = system(command); ++ ++ if (result != 0) { ++ g_set_error(error, G_IO_ERROR, G_IO_ERROR_FAILED, ++ "Failed to open URI '%s' using 'open' utility", uri); ++ return FALSE; ++ } ++ return TRUE; ++} ++ ++gboolean g_app_info_launch_default_for_uri_haiku(const char* uri, ++ GAppLaunchContext* context, ++ GError** error) { ++ return g_app_info_launch_uris_haiku(NULL, uri, context, error); ++} ++ ++#endif // __HAIKU__ ++ + static NS_IMETHODIMP LaunchWithURIImpl(RefPtr aInfo, nsIURI* aUri, + const char* aXDGToken = nullptr) { + GList uris = {0}; +@@ -412,6 +438,10 @@ static NS_IMETHODIMP LaunchWithURIImpl(RefPtr aInfo, nsIURI* aUri, + gboolean result = g_app_info_launch_uris_openbsd( + aInfo, spec.get(), GetLaunchContext(aXDGToken).get(), + getter_Transfers(error)); ++#elif defined(__HAIKU__) ++ gboolean result = g_app_info_launch_uris_haiku( ++ aInfo, spec.get(), GetLaunchContext(aXDGToken).get(), ++ getter_Transfers(error)); + #else + gboolean result = g_app_info_launch_uris( + aInfo, &uris, GetLaunchContext(aXDGToken).get(), getter_Transfers(error)); +@@ -802,6 +832,9 @@ static nsresult ShowURIImpl(nsIURI* aURI, const char* aXDGToken = nullptr) { + #ifdef __OpenBSD__ + if (!g_app_info_launch_default_for_uri_openbsd( + spec.get(), GetLaunchContext(aXDGToken).get(), ++#elif defined(__HAIKU__) ++ if (!g_app_info_launch_default_for_uri_haiku( ++ spec.get(), GetLaunchContext(aXDGToken).get(), + #else + if (!g_app_info_launch_default_for_uri(spec.get(), + GetLaunchContext(aXDGToken).get(), +@@ -837,6 +870,9 @@ static nsresult LaunchPathImpl(const nsACString& aPath, + #ifdef __OpenBSD__ + g_app_info_launch_default_for_uri_openbsd(spec.get(), + GetLaunchContext(aXDGToken).get(), ++#elif defined(__HAIKU__) ++ g_app_info_launch_default_for_uri_haiku(spec.get(), ++ GetLaunchContext(aXDGToken).get(), + #else + g_app_info_launch_default_for_uri(spec.get(), + GetLaunchContext(aXDGToken).get(), +diff --git a/toolkit/system/haiku/moz.build b/toolkit/system/haiku/moz.build +new file mode 100644 +index 0000000..8c3bf79 +--- /dev/null ++++ b/toolkit/system/haiku/moz.build +@@ -0,0 +1,26 @@ ++# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- ++# vim: set filetype=python: ++# This Source Code Form is subject to the terms of the Mozilla Public ++# License, v. 2.0. If a copy of the MPL was not distributed with this ++# file, You can obtain one at http://mozilla.org/MPL/2.0/. ++ ++with Files("**"): ++ BUG_COMPONENT = ("Firefox", "Shell Integration") ++ ++if CONFIG["OS_ARCH"] == "Haiku": ++ SOURCES += [ ++ "nsAlertsIconListener.cpp", ++ ] ++ OS_LIBS += [ ++ 'be', ++ ] ++ ++ ++FINAL_LIBRARY = "xul" ++ ++LOCAL_INCLUDES += [ ++ "/toolkit/components/build/", ++] ++ ++CXXFLAGS += CONFIG["GLIB_CFLAGS"] ++CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"] +diff --git a/toolkit/system/haiku/nsAlertsIconListener.cpp b/toolkit/system/haiku/nsAlertsIconListener.cpp +new file mode 100644 +index 0000000..4c4d1a6 +--- /dev/null ++++ b/toolkit/system/haiku/nsAlertsIconListener.cpp +@@ -0,0 +1,306 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode:nil; c-basic-offset: 2 -*- */ ++/* This Source Code Form is subject to the terms of the Mozilla Public ++ * License, v. 2.0. If a copy of the MPL was not distributed with this ++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ++ ++#include "../gnome/nsSystemAlertsService.h" ++ ++#include "nsAlertsIconListener.h" ++#include "imgIContainer.h" ++#include "imgIRequest.h" ++#include "nsServiceManagerUtils.h" ++#include "nsIAlertsService.h" ++#include "nsICancelable.h" ++#include "nsImageToPixbuf.h" ++#include "nsIStringBundle.h" ++#include "nsIObserverService.h" ++#include "nsCRT.h" ++#include "mozilla/XREAppData.h" ++#include "mozilla/GRefPtr.h" ++#include "mozilla/GUniquePtr.h" ++#include "mozilla/UniquePtrExtensions.h" ++ ++#include ++#include ++#include ++ ++#include "mozilla/UniquePtr.h" ++ ++using namespace mozilla; ++extern const StaticXREAppData* gAppData; ++ ++NS_IMPL_ISUPPORTS(nsAlertsIconListener, nsIAlertNotificationImageListener, ++ nsIObserver, nsISupportsWeakReference) ++ ++GdkPixbuf* nsAlertsIconListener::GetPixbufFromImgRequest(imgIRequest* aRequest) { ++ nsCOMPtr image; ++ nsresult rv = aRequest->GetImage(getter_AddRefs(image)); ++ if (NS_FAILED(rv) || !image) { ++ return nullptr; ++ } ++ ++ RefPtr pixbuf = nsImageToPixbuf::ImageToPixbuf(image); ++ if (!pixbuf) { ++ return nullptr; ++ } ++ ++ return pixbuf.forget().take(); ++} ++ ++ ++BBitmap* nsAlertsIconListener::PixbufToBitmap(GdkPixbuf* aPixbuf) { ++ if (!aPixbuf) { ++ return nullptr; ++ } ++ ++ GdkPixbuf* pixbufToUse = aPixbuf; ++ RefPtr scaledPixbuf; ++ ++ int width = gdk_pixbuf_get_width(aPixbuf); ++ int height = gdk_pixbuf_get_height(aPixbuf); ++ ++ const int maxWidth = 64; ++ const int maxHeight = 64; ++ ++ if (width > maxWidth || height > maxHeight) { ++ double ratio = std::min(static_cast(maxWidth) / width, ++ static_cast(maxHeight) / height); ++ int newWidth = std::max(1, static_cast(std::round(width * ratio))); ++ int newHeight = std::max(1, static_cast(std::round(height * ratio))); ++ ++ scaledPixbuf = gdk_pixbuf_scale_simple( ++ aPixbuf, newWidth, newHeight, GDK_INTERP_BILINEAR); ++ ++ if (!scaledPixbuf) { ++ fprintf(stderr, "PixbufToBitmap: Failed to scale pixbuf\n"); ++ return nullptr; ++ } ++ pixbufToUse = scaledPixbuf.get(); ++ width = newWidth; ++ height = newHeight; ++ } ++ ++ int n_channels = gdk_pixbuf_get_n_channels(pixbufToUse); ++ bool has_alpha = gdk_pixbuf_get_has_alpha(pixbufToUse); ++ ++ if (width <= 0 || height <= 0) { ++ return nullptr; ++ } ++ ++ if (n_channels != 4 || !has_alpha) { ++ fprintf(stderr, "PixbufToBitmap: Expected 4 channels (RGBA) after potential scaling, got %d\n", n_channels); ++ return nullptr; ++ } ++ ++ BRect bounds(0, 0, width - 1, height - 1); ++ BBitmap* bitmap = new BBitmap(bounds, B_RGBA32); ++ ++ if (!bitmap || bitmap->InitCheck() != B_OK) { ++ delete bitmap; ++ return nullptr; ++ } ++ ++ guchar* pixbufPixels = gdk_pixbuf_get_pixels(pixbufToUse); ++ int pixbufRowstride = gdk_pixbuf_get_rowstride(pixbufToUse); ++ uint8* bitmapPixels = (uint8*)bitmap->Bits(); ++ uint32 bitmapRowstride = bitmap->BytesPerRow(); ++ ++ for (int y = 0; y < height; ++y) { ++ guchar* p = pixbufPixels + y * pixbufRowstride; ++ uint8* b = bitmapPixels + y * bitmapRowstride; ++ for (int x = 0; x < width; ++x) { ++ uint8 r = p[0]; ++ uint8 g = p[1]; ++ uint8 b_ = p[2]; ++ uint8 a = p[3]; ++ ++ b[0] = b_; ++ b[1] = g; ++ b[2] = r; ++ b[3] = a; ++ ++ p += 4; ++ b += 4; ++ } ++ } ++ ++ return bitmap; ++} ++ ++ ++nsAlertsIconListener::nsAlertsIconListener( ++ nsSystemAlertsService* aBackend, nsIAlertNotification* aAlertNotification, ++ const nsAString& aAlertName) ++ : mAlertName(aAlertName), ++ mBackend(aBackend), ++ mAlertNotification(aAlertNotification) { ++} ++ ++nsAlertsIconListener::~nsAlertsIconListener() { ++ mBackend->RemoveListener(mAlertName, this); ++} ++ ++NS_IMETHODIMP ++nsAlertsIconListener::OnImageMissing(nsISupports*) { ++ return ShowAlert(nullptr); ++} ++ ++NS_IMETHODIMP ++nsAlertsIconListener::OnImageReady(nsISupports*, imgIRequest* aRequest) { ++ GdkPixbuf* pixbuf = GetPixbufFromImgRequest(aRequest); ++ if (!pixbuf) { ++ fprintf(stderr, "Failed to get GdkPixbuf from image request\n"); ++ return ShowAlert(nullptr); ++ } ++ ++ BBitmap* iconBitmap = PixbufToBitmap(pixbuf); ++ ++ g_object_unref(pixbuf); ++ ++ if (!iconBitmap) { ++ fprintf(stderr, "Failed to convert GdkPixbuf to BBitmap (possibly after scaling)\n"); ++ } ++ ++ nsresult rv = ShowAlert(iconBitmap); ++ return rv; ++} ++ ++nsresult nsAlertsIconListener::ShowAlert(BBitmap* aIconBitmap) { ++ mozilla::UniquePtr iconBitmap(aIconBitmap); ++ ++ if (!mBackend->IsActiveListener(mAlertName, this)) return NS_OK; ++ ++ notification_type type = B_INFORMATION_NOTIFICATION; ++ ++ BNotification notification(type); ++ if (notification.InitCheck() != B_OK) { ++ fprintf(stderr, "Failed to initialize BNotification\n"); ++ return NS_ERROR_FAILURE; ++ } ++ ++ nsCOMPtr bundleService = ++ do_GetService(NS_STRINGBUNDLE_CONTRACTID); ++ ++ nsAutoCString appShortName; ++ if (bundleService) { ++ nsCOMPtr bundle; ++ bundleService->CreateBundle("chrome://branding/locale/brand.properties", ++ getter_AddRefs(bundle)); ++ nsAutoString appName; ++ ++ if (bundle) { ++ bundle->GetStringFromName("brandShortName", appName); ++ CopyUTF16toUTF8(appName, appShortName); ++ } else { ++ NS_WARNING( ++ "brand.properties not present, using default application name"); ++ appShortName.AssignLiteral("Mozilla"); ++ } ++ } else { ++ appShortName.AssignLiteral("Mozilla"); ++ } ++ ++ notification.SetGroup(appShortName.get()); ++ ++ if (!mAlertTitle.IsEmpty()) { ++ notification.SetTitle(mAlertTitle.get()); ++ } else { ++ notification.SetTitle("Notification"); ++ } ++ ++ if (!mAlertText.IsEmpty()) { ++ notification.SetContent(mAlertText.get()); ++ } ++ ++ if (!mAlertCookie.IsEmpty()) { ++ nsCString cookieStr = NS_ConvertUTF16toUTF8(mAlertCookie); ++ if (!cookieStr.IsEmpty()) { ++ notification.SetMessageID(cookieStr.get()); ++ } ++ } ++ ++ if (iconBitmap) { ++ notification.SetIcon(iconBitmap.get()); ++ } ++ ++ bigtime_t timeout = mAlertRequiresInteraction ? 15000000 : -1; ++ ++ status_t sendStatus = notification.Send(timeout); ++ if (sendStatus != B_OK) { ++ fprintf(stderr, "Failed to send BNotification: %s\n", strerror(sendStatus)); ++ } ++ ++ nsCOMPtr obsServ = ++ do_GetService("@mozilla.org/observer-service;1"); ++ if (obsServ) obsServ->AddObserver(this, "quit-application", true); ++ ++ if (mAlertListener) ++ mAlertListener->Observe(nullptr, "alertshow", mAlertCookie.get()); ++ ++ return NS_OK; ++} ++ ++void nsAlertsIconListener::SendCallback() { ++ if (mAlertListener) ++ mAlertListener->Observe(nullptr, "alertclickcallback", mAlertCookie.get()); ++} ++ ++void nsAlertsIconListener::SendClosed() { ++ NotifyFinished(); ++} ++ ++NS_IMETHODIMP ++nsAlertsIconListener::Observe(nsISupports* aSubject, const char* aTopic, ++ const char16_t* aData) { ++ if (!nsCRT::strcmp(aTopic, "quit-application")) { ++ Release(); ++ } ++ return NS_OK; ++} ++ ++void nsAlertsIconListener::Disconnect() { ++ Release(); ++} ++ ++nsresult nsAlertsIconListener::Close() { ++ if (mIconRequest) { ++ mIconRequest->Cancel(NS_BINDING_ABORTED); ++ mIconRequest = nullptr; ++ } ++ NotifyFinished(); ++ return NS_OK; ++} ++ ++nsresult nsAlertsIconListener::InitAlertAsync(nsIAlertNotification* aAlert, ++ nsIObserver* aAlertListener) { ++ nsresult rv = aAlert->GetTextClickable(&mAlertHasAction); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = aAlert->GetSilent(&mAlertIsSilent); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = aAlert->GetRequireInteraction(&mAlertRequiresInteraction); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsAutoString title; ++ rv = aAlert->GetTitle(title); ++ NS_ENSURE_SUCCESS(rv, rv); ++ CopyUTF16toUTF8(title, mAlertTitle); ++ ++ nsAutoString text; ++ rv = aAlert->GetText(text); ++ NS_ENSURE_SUCCESS(rv, rv); ++ CopyUTF16toUTF8(text, mAlertText); ++ ++ mAlertListener = aAlertListener; ++ ++ rv = aAlert->GetCookie(mAlertCookie); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ return aAlert->LoadImage(0, this, nullptr, getter_AddRefs(mIconRequest)); ++} ++ ++void nsAlertsIconListener::NotifyFinished() { ++ if (mAlertListener) ++ mAlertListener->Observe(nullptr, "alertfinished", mAlertCookie.get()); ++} +diff --git a/toolkit/system/haiku/nsAlertsIconListener.h b/toolkit/system/haiku/nsAlertsIconListener.h +new file mode 100644 +index 0000000..d9ac4f3 +--- /dev/null ++++ b/toolkit/system/haiku/nsAlertsIconListener.h +@@ -0,0 +1,75 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* This Source Code Form is subject to the terms of the Mozilla Public ++ * License, v. 2.0. If a copy of the MPL was not distributed with this ++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ++ ++#ifndef nsAlertsIconListener_h__ ++#define nsAlertsIconListener_h__ ++ ++#include "nsCOMPtr.h" ++#include "nsIAlertsService.h" ++#include "nsString.h" ++#include "nsIObserver.h" ++#include "nsWeakReference.h" ++ ++#include ++ ++#pragma GCC visibility push(default) ++#include ++#include ++#include ++#include ++#pragma GCC visibility pop ++ ++class nsIAlertNotification; ++class nsICancelable; ++class nsSystemAlertsService; ++class imgIRequest; ++ ++class nsAlertsIconListener : public nsIAlertNotificationImageListener, ++ public nsIObserver, ++ public nsSupportsWeakReference { ++ public: ++ NS_DECL_ISUPPORTS ++ NS_DECL_NSIALERTNOTIFICATIONIMAGELISTENER ++ NS_DECL_NSIOBSERVER ++ ++ nsAlertsIconListener(nsSystemAlertsService* aBackend, ++ nsIAlertNotification* aAlertNotification, ++ const nsAString& aAlertName); ++ ++ nsresult InitAlertAsync(nsIAlertNotification* aAlert, ++ nsIObserver* aAlertListener); ++ nsresult Close(); ++ ++ void SendCallback(); ++ void SendClosed(); ++ void Disconnect(); ++ ++ protected: ++ virtual ~nsAlertsIconListener(); ++ ++ static BBitmap* PixbufToBitmap(GdkPixbuf* aPixbuf); ++ static GdkPixbuf* GetPixbufFromImgRequest(imgIRequest* aRequest); ++ ++ nsCOMPtr mIconRequest; ++ nsCString mAlertTitle; ++ nsCString mAlertText; ++ ++ nsCOMPtr mAlertListener; ++ nsString mAlertCookie; ++ nsString mAlertName; ++ ++ RefPtr mBackend; ++ nsCOMPtr mAlertNotification; ++ ++ bool mAlertHasAction; ++ bool mAlertIsSilent; ++ bool mAlertRequiresInteraction; ++ ++ nsresult ShowAlert(BBitmap* aIconBitmap = nullptr); ++ ++ void NotifyFinished(); ++}; ++ ++#endif +diff --git a/toolkit/themes/shared/popup.css b/toolkit/themes/shared/popup.css +index 5701d30..c1172a1 100644 +--- a/toolkit/themes/shared/popup.css ++++ b/toolkit/themes/shared/popup.css +@@ -43,6 +43,12 @@ panel { + } + } + ++ /* Disable border-radius and shadow for Haiku popups */ ++ @media (-moz-platform: linux) { ++ --panel-border-radius: 0px; ++ --panel-shadow-margin: 0px; ++ } ++ + @media (-moz-platform: macos) { + appearance: auto; + -moz-default-appearance: menupopup; +diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild +index 304c39a..c69f810 100644 +--- a/toolkit/toolkit.mozbuild ++++ b/toolkit/toolkit.mozbuild +@@ -144,6 +144,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": + DIRS += [ + "/media/mozva", + "/toolkit/system/gnome", ++ "/toolkit/system/haiku", + ] + + if CONFIG["ENABLE_WEBDRIVER"]: +diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp +index 3581105..aceace6 100644 +--- a/toolkit/xre/nsAppRunner.cpp ++++ b/toolkit/xre/nsAppRunner.cpp +@@ -345,14 +345,16 @@ MOZ_CONSTINIT nsString gProcessStartupShortcut; + # ifdef MOZ_WAYLAND + # include + # include "mozilla/widget/nsWaylandDisplay.h" +-# include "wayland-proxy.h" ++# ifndef XP_HAIKU ++# include "wayland-proxy.h" ++# endif /* !XP_HAIKU */ + # endif + # ifdef MOZ_X11 + # include + # endif /* MOZ_X11 */ + #endif + +-#if defined(MOZ_WAYLAND) ++#if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) + MOZ_RUNINIT std::unique_ptr gWaylandProxy; + #endif + +@@ -432,6 +434,9 @@ static void UnexpectedExit() { + + #if defined(MOZ_WAYLAND) + bool IsWaylandEnabled() { ++#ifdef XP_HAIKU ++ return true; ++#else + static bool isWaylandEnabled = []() { + const char* waylandDisplay = PR_GetEnv("WAYLAND_DISPLAY"); + if (!waylandDisplay) { +@@ -462,6 +467,7 @@ bool IsWaylandEnabled() { + return !gtk_check_version(3, 24, 30); + }(); + return isWaylandEnabled; ++#endif // !XP_HAIKU + } + #else + bool IsWaylandEnabled() { return false; } +@@ -3812,7 +3818,7 @@ class XREMain { + #endif + }; + +-#if defined(XP_UNIX) && !defined(ANDROID) ++#if defined(XP_UNIX) && !defined(ANDROID) && !defined(XP_HAIKU) + static SmprintfPointer FormatUid(uid_t aId) { + if (const auto pw = getpwuid(aId)) { + return mozilla::Smprintf("%s", pw->pw_name); +@@ -3861,7 +3867,7 @@ static bool CheckForUserMismatch() { + } + return false; + } +-#else // !XP_UNIX || ANDROID ++#else // !XP_UNIX || ANDROID || XP_HAIKU + static bool CheckForUserMismatch() { return false; } + #endif + +@@ -4858,7 +4864,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) { + // display_name is owned by gdk. + display_name = gdk_get_display_arg_name(); + bool waylandEnabled = IsWaylandEnabled(); +-# ifdef MOZ_WAYLAND ++# if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) + if (!display_name) { + auto* proxyEnv = getenv("MOZ_DISABLE_WAYLAND_PROXY"); + bool disableWaylandProxy = proxyEnv && *proxyEnv; +@@ -4913,7 +4919,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) { + } else { + gdk_display_manager_open_display(gdk_display_manager_get(), nullptr); + } +-# if defined(MOZ_WAYLAND) ++# if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) + // We want to use proxy for main connection only so + // restore original Wayland display for next potential Wayland connections + // from gfx probe code and so on. +@@ -6199,7 +6205,9 @@ int XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) { + if (!gfxPlatform::IsHeadless()) { + # ifdef MOZ_WAYLAND + WaylandDisplayRelease(); ++# ifndef XP_HAIKU + gWaylandProxy = nullptr; ++# endif // !XP_HAIKU + # endif + } + #endif +diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp +index 146a586..10b7fb6 100644 +--- a/toolkit/xre/nsSigHandlers.cpp ++++ b/toolkit/xre/nsSigHandlers.cpp +@@ -43,7 +43,9 @@ + # endif + + # ifdef MOZ_WAYLAND +-# include "wayland-proxy.h" ++# ifndef XP_HAIKU ++# include "wayland-proxy.h" ++# endif /* !XP_HAIKU */ + # endif + + // Note: some tests manipulate this value. +@@ -180,7 +182,7 @@ static bool IsCrashyGtkMessage(const nsACString& aMessage) { + static void HandleGLibMessage(GLogLevelFlags aLogLevel, + const nsDependentCString& aMessage) { + if (MOZ_UNLIKELY(IsCrashyGtkMessage(aMessage))) { +-# ifdef MOZ_WAYLAND ++# if defined(MOZ_WAYLAND) && !defined(XP_HAIKU) + MOZ_CRASH_UNSAFE_PRINTF( + "(%s) %s Proxy: %s", + mozilla::widget::GetDesktopEnvironmentIdentifier().get(), +diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp +index 3b4612e..118fa5e 100644 +--- a/toolkit/xre/nsXREDirProvider.cpp ++++ b/toolkit/xre/nsXREDirProvider.cpp +@@ -80,6 +80,10 @@ + #ifdef XP_IOS + # include "UIKitDirProvider.h" + #endif ++#ifdef XP_HAIKU ++# include ++# include ++#endif + + #if defined(XP_MACOSX) + # define APP_REGISTRY_NAME "Application Registry" +@@ -365,7 +369,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, + } else if (!strcmp(aProperty, XRE_USER_NATIVE_MANIFESTS)) { + rv = GetUserDataDirectoryHome(getter_AddRefs(file), false); + NS_ENSURE_SUCCESS(rv, rv); +-# if defined(XP_MACOSX) ++# if defined(XP_MACOSX) || defined(XP_HAIKU) + rv = file->AppendNative("Mozilla"_ns); + # else // defined(XP_MACOSX) + rv = file->AppendNative(".mozilla"_ns); +@@ -1081,6 +1085,12 @@ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, + NS_ENSURE_SUCCESS(rv, rv); + + MOZ_TRY(NS_NewLocalFile(path, getter_AddRefs(localDir))); ++#elif defined(XP_HAIKU) ++ nsresult rv; ++ BPath settingsDir; ++ status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &settingsDir); ++ if (status != B_OK) return NS_ERROR_FAILURE; ++ rv = NS_NewNativeLocalFile(nsDependentCString(settingsDir.Path()), getter_AddRefs(localDir)); + #elif defined(XP_UNIX) + const char* homeDir = getenv("HOME"); + if (!homeDir || !*homeDir) return NS_ERROR_FAILURE; +@@ -1190,7 +1200,7 @@ nsresult nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile) { + + nsresult rv; + +-#if defined(XP_MACOSX) || defined(XP_WIN) ++#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_HAIKU) + + static const char* const sXR = "Mozilla"; + rv = aFile->AppendNative(nsDependentCString(sXR)); +@@ -1249,7 +1259,7 @@ nsresult nsXREDirProvider::AppendProfilePath(nsIFile* aFile, bool aLocal) { + } + NS_ENSURE_SUCCESS(rv, rv); + +-#elif defined(XP_WIN) ++#elif defined(XP_WIN) || defined(XP_HAIKU) + if (!profile.IsEmpty()) { + rv = AppendProfileString(aFile, profile.get()); + } else { +diff --git a/tools/profiler/core/ProfilerUtils.cpp b/tools/profiler/core/ProfilerUtils.cpp +index 4c53061..76d3561 100644 +--- a/tools/profiler/core/ProfilerUtils.cpp ++++ b/tools/profiler/core/ProfilerUtils.cpp +@@ -88,6 +88,15 @@ ProfilerThreadId profiler_current_thread_id() { + return ProfilerThreadId::FromNativeId(id); + } + ++// ------------------------------------------------------- Haiku ++# elif defined(XP_HAIKU) ++ ++# include ++ ++ProfilerThreadId profiler_current_thread_id() { ++ return ProfilerThreadId::FromNativeId(find_thread(NULL)); ++} ++ + // ------------------------------------------------------- Others + # else + +diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build +index c61079e..63017a7 100644 +--- a/widget/gtk/moz.build ++++ b/widget/gtk/moz.build +@@ -28,7 +28,9 @@ if CONFIG["COMPILE_ENVIRONMENT"]: + DIRS += ["mozgtk"] + + if CONFIG["MOZ_WAYLAND"]: +- DIRS += ["wayland", "mozwayland", "../../third_party/wayland-proxy"] ++ DIRS += ["wayland", "mozwayland"] ++ if CONFIG["OS_ARCH"] != "Haiku": ++ DIRS += ["../../third_party/wayland-proxy"] + + if CONFIG["MOZ_ENABLE_VAAPI"]: + DIRS += ["vaapitest"] +diff --git a/widget/gtk/nsWaylandDisplay.cpp b/widget/gtk/nsWaylandDisplay.cpp +index 052971c..664d95d 100644 +--- a/widget/gtk/nsWaylandDisplay.cpp ++++ b/widget/gtk/nsWaylandDisplay.cpp +@@ -20,7 +20,9 @@ + #include "WidgetUtilsGtk.h" + #include "nsGtkKeyUtils.h" + #include "nsWindow.h" +-#include "wayland-proxy.h" ++#ifndef XP_HAIKU ++# include "wayland-proxy.h" ++#endif /* !XP_HAIKU */ + + namespace mozilla::widget { + +@@ -247,6 +249,7 @@ static const struct moz_wl_pointer_listener pointer_listener = { + }; + + void nsWaylandDisplay::SetPointer(wl_pointer* aPointer) { ++#ifndef XP_HAIKU + // Don't even try on such old interface + if (wl_proxy_get_version((struct wl_proxy*)aPointer) < + WL_POINTER_RELEASE_SINCE_VERSION) { +@@ -271,6 +274,7 @@ void nsWaylandDisplay::SetPointer(wl_pointer* aPointer) { + zwp_pointer_gesture_hold_v1_add_listener(mPointerGestureHold, + &gesture_hold_listener, this); + } ++#endif + } + + void nsWaylandDisplay::RemovePointer() { +@@ -630,19 +634,22 @@ static void WlLogHandler(const char* format, va_list args) { + if (strstr(error, "still attached")) { + return; + } +- ++#ifndef XP_HAIKU + MOZ_CRASH_UNSAFE_PRINTF("(%s) %s Proxy: %s", + GetDesktopEnvironmentIdentifier().get(), error, + WaylandProxy::GetState()); ++#endif + } + + void WlCompositorCrashHandler() { ++#ifndef XP_HAIKU + gfxCriticalNote << "Wayland protocol error: Compositor (" + << GetDesktopEnvironmentIdentifier().get() + << ") crashed, proxy: " << WaylandProxy::GetState(); + MOZ_CRASH_UNSAFE_PRINTF("Compositor crashed (%s) proxy: %s", + GetDesktopEnvironmentIdentifier().get(), + WaylandProxy::GetState()); ++#endif + } + + nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay) +diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp +index 2aa1dd1..bf224f0 100644 +--- a/xpcom/base/nsSystemInfo.cpp ++++ b/xpcom/base/nsSystemInfo.cpp +@@ -82,6 +82,10 @@ + # include "mozilla/SandboxInfo.h" + #endif + ++#ifdef XP_HAIKU ++# include ++#endif ++ + // Slot for NS_InitXPCOM to pass information to nsSystemInfo::Init. + // Only set to nonzero (potentially) if XP_UNIX. On such systems, the + // system call to discover the appropriate value is not thread-safe, +@@ -1410,7 +1414,15 @@ nsresult nsSystemInfo::Init() { + SetInt32Property(u"pagesize"_ns, PR_GetPageSize()); + SetInt32Property(u"pageshift"_ns, PR_GetPageShift()); + SetInt32Property(u"memmapalign"_ns, PR_GetMemMapAlignment()); ++#ifdef XP_HAIKU ++ { // workaround ++ system_info info; ++ get_system_info(&info); ++ SetUint64Property(u"memsize"_ns, info.max_pages * B_PAGE_SIZE); ++ } ++#else + SetUint64Property(u"memsize"_ns, PR_GetPhysicalMemorySize()); ++#endif + SetUint32Property(u"umask"_ns, nsSystemInfo::gUserUmask); + + #ifdef HAVE_64BIT_BUILD +diff --git a/xpcom/build/BinaryPath.h b/xpcom/build/BinaryPath.h +index 1718caa..64de0b2 100644 +--- a/xpcom/build/BinaryPath.h ++++ b/xpcom/build/BinaryPath.h +@@ -24,6 +24,10 @@ + #if defined(__OpenBSD__) + # include + #endif ++#if defined(XP_HAIKU) ++# include ++# include ++#endif + #include "mozilla/UniquePtr.h" + #include "mozilla/UniquePtrExtensions.h" + +@@ -273,6 +277,21 @@ class BinaryPath { + return NS_ERROR_FAILURE; + } + ++#elif defined(XP_HAIKU) ++ static nsresult Get(char aResult[MAXPATHLEN]) { ++ image_info info; ++ int32 cookie = 0; ++ ++ while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) >= B_OK) { ++ if (info.type == B_APP_IMAGE) { ++ strlcpy(aResult, info.name, MAXPATHLEN - 1); ++ return NS_OK; ++ } ++ } ++ ++ return NS_ERROR_FAILURE; ++ } ++ + #else + # error Oops, you need platform-specific code here + #endif +diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build +index 6b566f9..2895ad9 100644 +--- a/xpcom/reflect/xptcall/md/unix/moz.build ++++ b/xpcom/reflect/xptcall/md/unix/moz.build +@@ -33,6 +33,7 @@ if CONFIG["OS_ARCH"] in ( + "Bitrig", + "DragonFly", + "FreeBSD", ++ "Haiku", + "NetBSD", + "OpenBSD", + "SunOS", +diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp +index dbd9993..1431340 100644 +--- a/xpcom/threads/nsProcessCommon.cpp ++++ b/xpcom/threads/nsProcessCommon.cpp +@@ -43,7 +43,11 @@ + # include "base/process_util.h" + # endif + # include +-# include ++# ifdef XP_HAIKU ++# include ++# else ++# include ++# endif + # endif + # include + # include -- 2.48.1 diff --git a/www-client/iceweasel/patches/iceweasel_launcher-137.0.1.patchset b/www-client/iceweasel/patches/iceweasel_launcher-138.0.1.patchset similarity index 100% rename from www-client/iceweasel/patches/iceweasel_launcher-137.0.1.patchset rename to www-client/iceweasel/patches/iceweasel_launcher-138.0.1.patchset