diff --git a/bug1375074-save-restore-x28.patch b/bug1375074-save-restore-x28.patch new file mode 100644 index 0000000000000000000000000000000000000000..57a83a2a20dd3c97a77de42030859427ba996f8e --- /dev/null +++ b/bug1375074-save-restore-x28.patch @@ -0,0 +1,74 @@ +# HG changeset patch +# User Lars T Hansen +# Date 1519822672 -3600 +# Wed Feb 28 13:57:52 2018 +0100 +# Node ID 672f0415217b202ae59a930769dffd9d6ba6b87c +# Parent 825fd04dacc6297d3a980ec4184079405950b35d +Bug 1375074 - Save and restore non-volatile x28 on ARM64 for generated unboxed object constructor. + +diff --git a/js/src/jit-test/tests/bug1375074.js b/js/src/jit-test/tests/bug1375074.js +new file mode 100644 +--- /dev/null ++++ b/js/src/jit-test/tests/bug1375074.js +@@ -0,0 +1,18 @@ ++// This forces the VM to start creating unboxed objects and thus stresses a ++// particular path into generated code for a specialized unboxed object ++// constructor. ++ ++var K = 2000; // 2000 should be plenty ++var s = "["; ++var i; ++for ( i=0; i < K-1; i++ ) ++ s = s + `{"i":${i}},`; ++s += `{"i":${i}}]`; ++var v = JSON.parse(s); ++ ++assertEq(v.length == K, true); ++ ++for ( i=0; i < K; i++) { ++ assertEq(v[i] instanceof Object, true); ++ assertEq(v[i].i, i); ++} +diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp +--- a/js/src/vm/UnboxedObject.cpp ++++ b/js/src/vm/UnboxedObject.cpp +@@ -95,7 +95,15 @@ UnboxedLayout::makeConstructorCode(JSCon + #endif + + #ifdef JS_CODEGEN_ARM64 +- // ARM64 communicates stack address via sp, but uses a pseudo-sp for addressing. ++ // ARM64 communicates stack address via sp, but uses a pseudo-sp (PSP) for ++ // addressing. The register we use for PSP may however also be used by ++ // calling code, and it is nonvolatile, so save it. Do this as a special ++ // case first because the generic save/restore code needs the PSP to be ++ // initialized already. ++ MOZ_ASSERT(PseudoStackPointer64.Is(masm.GetStackPointer64())); ++ masm.Str(PseudoStackPointer64, vixl::MemOperand(sp, -16, vixl::PreIndex)); ++ ++ // Initialize the PSP from the SP. + masm.initStackPtr(); + #endif + +@@ -233,7 +241,22 @@ UnboxedLayout::makeConstructorCode(JSCon + masm.pop(ScratchDoubleReg); + masm.PopRegsInMask(savedNonVolatileRegisters); + ++#ifdef JS_CODEGEN_ARM64 ++ // Now restore the value that was in the PSP register on entry, and return. ++ ++ // Obtain the correct SP from the PSP. ++ masm.Mov(sp, PseudoStackPointer64); ++ ++ // Restore the saved value of the PSP register, this value is whatever the ++ // caller had saved in it, not any actual SP value, and it must not be ++ // overwritten subsequently. ++ masm.Ldr(PseudoStackPointer64, vixl::MemOperand(sp, 16, vixl::PostIndex)); ++ ++ // Perform a plain Ret(), as abiret() will move SP <- PSP and that is wrong. ++ masm.Ret(vixl::lr); ++#else + masm.abiret(); ++#endif + + masm.bind(&failureStoreOther); + diff --git a/build-aarch64-skia.patch b/build-aarch64-skia.patch new file mode 100644 index 0000000000000000000000000000000000000000..a63e3e812bd1fd722ab7b35883c7b2f0ad6afb07 --- /dev/null +++ b/build-aarch64-skia.patch @@ -0,0 +1,45 @@ +diff -up firefox-72.0/gfx/skia/skia/include/private/SkHalf.h.aarch64-skia firefox-72.0/gfx/skia/skia/include/private/SkHalf.h +--- firefox-72.0/gfx/skia/skia/include/private/SkHalf.h.aarch64-skia 2020-01-02 22:33:02.000000000 +0100 ++++ firefox-72.0/gfx/skia/skia/include/private/SkHalf.h 2020-01-03 09:00:37.537296105 +0100 +@@ -40,7 +40,7 @@ static inline Sk4h SkFloatToHalf_finite_ + + static inline Sk4f SkHalfToFloat_finite_ftz(uint64_t rgba) { + Sk4h hs = Sk4h::Load(&rgba); +-#if !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) ++#if 0 // !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) + float32x4_t fs; + asm ("fcvtl %[fs].4s, %[hs].4h \n" // vcvt_f32_f16(...) + : [fs] "=w" (fs) // =w: write-only NEON register +@@ -62,7 +62,7 @@ static inline Sk4f SkHalfToFloat_finite_ + } + + static inline Sk4h SkFloatToHalf_finite_ftz(const Sk4f& fs) { +-#if !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) ++#if 0 // !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) + float32x4_t vec = fs.fVec; + asm ("fcvtn %[vec].4h, %[vec].4s \n" // vcvt_f16_f32(vec) + : [vec] "+w" (vec)); // +w: read-write NEON register +diff -up firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h +--- firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia 2020-01-03 09:00:37.538296107 +0100 ++++ firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h 2020-01-03 10:11:41.259219508 +0100 +@@ -1087,7 +1087,7 @@ SI F from_half(U16 h) { + } + + SI U16 to_half(F f) { +-#if defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) \ ++#if 0 //defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) \ + && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds. + return vcvt_f16_f32(f); + +diff -up firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h.aarch64-skia firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h +--- firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h.aarch64-skia 2020-01-03 09:00:37.538296107 +0100 ++++ firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h 2020-01-03 10:11:53.513250979 +0100 +@@ -183,8 +183,6 @@ SI F F_from_Half(U16 half) { + SI U16 Half_from_F(F f) { + #if defined(USING_NEON_FP16) + return bit_pun(f); +-#elif defined(USING_NEON_F16C) +- return (U16)vcvt_f16_f32(f); + #elif defined(USING_AVX512F) + return (U16)_mm512_cvtps_ph((__m512 )f, _MM_FROUND_CUR_DIRECTION ); + #elif defined(USING_AVX_F16C) diff --git a/build-arm-libaom.patch b/build-arm-libaom.patch new file mode 100644 index 0000000000000000000000000000000000000000..985f01d1507eeecab5ce654ec538e2b7b24e4630 --- /dev/null +++ b/build-arm-libaom.patch @@ -0,0 +1,12 @@ +diff -up firefox-73.0/media/libaom/moz.build.old firefox-73.0/media/libaom/moz.build +--- firefox-73.0/media/libaom/moz.build.old 2020-02-07 23:13:28.000000000 +0200 ++++ firefox-73.0/media/libaom/moz.build 2020-02-17 10:30:08.509805092 +0200 +@@ -55,7 +55,7 @@ elif CONFIG['CPU_ARCH'] == 'arm': + + for f in SOURCES: + if f.endswith('neon.c'): +- SOURCES[f].flags += CONFIG['VPX_ASFLAGS'] ++ SOURCES[f].flags += CONFIG['NEON_FLAGS'] + + if CONFIG['OS_TARGET'] == 'Android': + # For cpu-features.h diff --git a/build-arm-libopus.patch b/build-arm-libopus.patch new file mode 100644 index 0000000000000000000000000000000000000000..1b3f31b58d8a40aab231709d2325fcfd224633b9 --- /dev/null +++ b/build-arm-libopus.patch @@ -0,0 +1,12 @@ +diff -up firefox-66.0/media/libopus/silk/arm/arm_silk_map.c.old firefox-66.0/media/libopus/silk/arm/arm_silk_map.c +--- firefox-66.0/media/libopus/silk/arm/arm_silk_map.c.old 2019-03-12 21:07:35.356677522 +0100 ++++ firefox-66.0/media/libopus/silk/arm/arm_silk_map.c 2019-03-12 21:07:42.937693394 +0100 +@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE. + # include "config.h" + #endif + +-#include "main_FIX.h" ++#include "fixed/main_FIX.h" + #include "NSQ.h" + #include "SigProc_FIX.h" + diff --git a/build-arm-wasm.patch b/build-arm-wasm.patch new file mode 100644 index 0000000000000000000000000000000000000000..bd841ab25eeb8d48d61de3fc540dee7cef775642 --- /dev/null +++ b/build-arm-wasm.patch @@ -0,0 +1,21 @@ +diff -up firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp.old firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp +--- firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp.old 2020-01-17 23:34:41.000000000 +0200 ++++ firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp 2020-02-02 08:07:54.670341986 +0200 +@@ -249,7 +249,16 @@ using mozilla::DebugOnly; + #endif + + #ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS +-# include ++struct user_vfp { ++ unsigned long long fpregs[32]; ++ unsigned long fpscr; ++}; ++ ++struct user_vfp_exc { ++ unsigned long fpexc; ++ unsigned long fpinst; ++ unsigned long fpinst2; ++}; + #endif + + #if defined(ANDROID) diff --git a/build-cacheFlush-missing.patch b/build-cacheFlush-missing.patch new file mode 100644 index 0000000000000000000000000000000000000000..51c368c670ada7d939977b0880993a4f5786e308 --- /dev/null +++ b/build-cacheFlush-missing.patch @@ -0,0 +1,13 @@ +diff -up firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm firefox-55.0.3/js/src/jit/ExecutableAllocator.h +--- firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm 2017-09-05 11:32:12.235909468 +0200 ++++ firefox-55.0.3/js/src/jit/ExecutableAllocator.h 2017-09-05 11:32:46.157916575 +0200 +@@ -219,7 +219,7 @@ class ExecutableAllocator + + static void poisonCode(JSRuntime* rt, JitPoisonRangeVector& ranges); + +-#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64) ++#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64) || defined(JS_CODEGEN_NONE) + static void cacheFlush(void*, size_t) + { + } +diff -up firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d.wasm firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d diff --git a/build-disable-elfhack.patch b/build-disable-elfhack.patch new file mode 100644 index 0000000000000000000000000000000000000000..a80c5518dbfb762d6aa277490d8165c821e8c028 --- /dev/null +++ b/build-disable-elfhack.patch @@ -0,0 +1,12 @@ +diff -up firefox-65.0/toolkit/moz.configure.disable-elfhack firefox-65.0/toolkit/moz.configure +--- firefox-65.0/toolkit/moz.configure.disable-elfhack 2019-01-28 14:16:48.530345132 +0100 ++++ firefox-65.0/toolkit/moz.configure 2019-01-28 14:18:03.231029682 +0100 +@@ -1036,7 +1036,7 @@ with only_when('--enable-compile-environ + help='{Enable|Disable} elf hacks') + + set_config('USE_ELF_HACK', +- depends_if('--enable-elf-hack')(lambda _: True)) ++ depends_if('--enable-elf-hack')(lambda _: False)) + + + @depends(check_build_environment) diff --git a/build-icu-big-endian.patch b/build-icu-big-endian.patch new file mode 100644 index 0000000000000000000000000000000000000000..0be2d3c929339250d87f6663376ef86224059134 --- /dev/null +++ b/build-icu-big-endian.patch @@ -0,0 +1,12 @@ +diff -up firefox-61.0/build/autoconf/icu.m4.icu firefox-61.0/build/autoconf/icu.m4 +--- firefox-61.0/build/autoconf/icu.m4.icu 2018-06-20 09:03:17.957565445 +0200 ++++ firefox-61.0/build/autoconf/icu.m4 2018-06-20 09:08:28.159403451 +0200 +@@ -77,7 +77,7 @@ if test -n "$USE_ICU"; then + # TODO: the l is actually endian-dependent + # We could make this set as 'l' or 'b' for little or big, respectively, + # but we'd need to check in a big-endian version of the file. +- ICU_DATA_FILE="icudt${version}l.dat" ++ ICU_DATA_FILE="icudt${version}b.dat" + fi + + AC_SUBST(MOZ_ICU_VERSION) diff --git a/build-jit-atomic-always-lucky.patch b/build-jit-atomic-always-lucky.patch index 31bc5ec2aaec49b22083641d0d2df7b4b7600d36..ab99524ef1645154a29ea7437b69ef10f8b11f7c 100644 --- a/build-jit-atomic-always-lucky.patch +++ b/build-jit-atomic-always-lucky.patch @@ -1,30 +1,12 @@ -diff -up firefox-57.0b5/js/src/jit/AtomicOperations.h.jit-atomic-lucky firefox-57.0b5/js/src/jit/AtomicOperations.h ---- firefox-57.0b5/js/src/jit/AtomicOperations.h.jit-atomic-lucky 2017-10-06 12:34:02.338973607 +0200 -+++ firefox-57.0b5/js/src/jit/AtomicOperations.h 2017-10-06 12:38:24.632622215 +0200 -@@ -415,7 +415,7 @@ AtomicOperations::isLockfreeJS(int32_t s +diff -up firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky firefox-60.5.0/js/src/jit/AtomicOperations.h +--- firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky 2019-01-22 10:20:27.993697161 +0100 ++++ firefox-60.5.0/js/src/jit/AtomicOperations.h 2019-01-22 10:23:15.337873762 +0100 +@@ -394,7 +394,7 @@ inline bool AtomicOperations::isLockfree #elif defined(__s390__) || defined(__s390x__) - # include "jit/none/AtomicOperations-feeling-lucky.h" + #include "jit/none/AtomicOperations-feeling-lucky.h" #else --# error "No AtomicOperations support provided for this platform" -+# include "jit/none/AtomicOperations-feeling-lucky.h" +-#error "No AtomicOperations support provided for this platform" ++#include "jit/none/AtomicOperations-feeling-lucky.h" #endif - #endif // jit_AtomicOperations_h -diff -up firefox-57.0b5/js/src/jit/none/AtomicOperations-feeling-lucky.h.jit-atomic-lucky firefox-57.0b5/js/src/jit/none/AtomicOperations-feeling-lucky.h ---- firefox-57.0b5/js/src/jit/none/AtomicOperations-feeling-lucky.h.jit-atomic-lucky 2017-09-19 06:18:28.000000000 +0200 -+++ firefox-57.0b5/js/src/jit/none/AtomicOperations-feeling-lucky.h 2017-10-06 12:34:02.338973607 +0200 -@@ -79,6 +79,14 @@ - # define GNUC_COMPATIBLE - #endif - -+#ifdef __s390__ -+# define GNUC_COMPATIBLE -+#endif -+ -+#ifdef __s390x__ -+# define GNUC_COMPATIBLE -+#endif -+ - // The default implementation tactic for gcc/clang is to use the newer - // __atomic intrinsics added for use in C++11 . Where that - // isn't available, we use GCC's older __sync functions instead. + #endif // jit_AtomicOperations_h diff --git a/build-ppc-jit.patch b/build-ppc-jit.patch new file mode 100644 index 0000000000000000000000000000000000000000..a9dc6d1ab3225275cf01c740841e7fbe4a30e371 --- /dev/null +++ b/build-ppc-jit.patch @@ -0,0 +1,51 @@ +diff -up firefox-55.0/js/src/jit/MIR.h.old firefox-55.0/js/src/jit/MIR.h +--- firefox-55.0/js/src/jit/MIR.h.old 2017-08-08 14:04:44.528460099 +0200 ++++ firefox-55.0/js/src/jit/MIR.h 2017-08-08 14:05:11.045364831 +0200 +@@ -12434,7 +12434,7 @@ class MNearbyInt + TRIVIAL_NEW_WRAPPERS + + static bool HasAssemblerSupport(RoundingMode mode) { +- return Assembler::HasRoundInstruction(mode); ++ return false; + } + + RoundingMode roundingMode() const { return roundingMode_; } +diff -up firefox-55.0/js/src/jit/ExecutableAllocator.h.old firefox-55.0/js/src/jit/ExecutableAllocator.h +--- firefox-55.0/js/src/jit/ExecutableAllocator.h.old 2017-08-09 09:24:18.784983505 +0200 ++++ firefox-55.0/js/src/jit/ExecutableAllocator.h 2017-08-09 09:28:01.471100075 +0200 +@@ -307,6 +307,10 @@ class ExecutableAllocator + { + sync_instruction_memory((caddr_t)code, size); + } ++#else ++ static void cacheFlush(void*, size_t) ++ { ++ } + #endif + + private: +diff -up firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old firefox-55.0/js/src/wasm/WasmBuiltins.cpp +--- firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old 2017-08-09 12:50:46.877450765 +0200 ++++ firefox-55.0/js/src/wasm/WasmBuiltins.cpp 2017-08-09 12:50:59.725406974 +0200 +@@ -881,7 +881,6 @@ wasm::EnsureBuiltinThunksInitialized() + MOZ_ASSERT(!masm.numSymbolicAccesses()); + #endif + +- ExecutableAllocator::cacheFlush(thunks->codeBase, thunks->codeSize); + if (!ExecutableAllocator::makeExecutable(thunks->codeBase, thunks->codeSize)) + return false; + +diff -up firefox-55.0/js/src/wasm/WasmCode.cpp.old firefox-55.0/js/src/wasm/WasmCode.cpp +--- firefox-55.0/js/src/wasm/WasmCode.cpp.old 2017-08-09 12:50:37.205483731 +0200 ++++ firefox-55.0/js/src/wasm/WasmCode.cpp 2017-08-09 12:51:10.365370708 +0200 +@@ -287,8 +287,6 @@ CodeSegment::initialize(Tier tier, + if (!StaticallyLink(*this, linkData)) + return false; + +- ExecutableAllocator::cacheFlush(bytes_.get(), RoundupCodeLength(codeLength)); +- + // Reprotect the whole region to avoid having separate RW and RX mappings. + if (!ExecutableAllocator::makeExecutable(bytes_.get(), RoundupCodeLength(codeLength))) + return false; +diff -up firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium +diff -up firefox-55.0/media/webrtc/trunk/Makefile.old firefox-55.0/media/webrtc/trunk/Makefile diff --git a/build-rust-ppc64le.patch b/build-rust-ppc64le.patch new file mode 100644 index 0000000000000000000000000000000000000000..2474c357aef546553502e9735808cfbe3f23fee1 --- /dev/null +++ b/build-rust-ppc64le.patch @@ -0,0 +1,25 @@ +diff -up firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le firefox-55.0/build/moz.configure/rust.configure +--- firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/build/moz.configure/rust.configure 2017-08-02 10:19:03.254220003 +0200 +@@ -151,6 +151,9 @@ def rust_triple_alias(host_or_target): + ('sparc64', 'Linux'): 'sparc64-unknown-linux-gnu', + ('x86', 'Linux'): 'i686-unknown-linux-gnu', + ('x86_64', 'Linux'): 'x86_64-unknown-linux-gnu', ++ ('ppc64le', 'Linux'): 'powerpc64le-unknown-linux-gnu', ++ ('ppc64', 'Linux'): 'powerpc64-unknown-linux-gnu', ++ ('s390x', 'Linux'): 's390x-unknown-linux-gnu', + # OS X + ('x86', 'OSX'): 'i686-apple-darwin', + ('x86_64', 'OSX'): 'x86_64-apple-darwin', +@@ -174,8 +177,10 @@ def rust_triple_alias(host_or_target): + ('sparc64', 'SunOS'): 'sparcv9-sun-solaris', + }.get((host_or_target.cpu, os_or_kernel), None) + ++ if (rustc_target == 'powerpc64-unknown-linux-gnu' and host_or_target.endianness == 'little'): ++ rustc_target = 'powerpc64le-unknown-linux-gnu' + if rustc_target is None: +- die("Don't know how to translate {} for rustc".format(host_or_target.alias)) ++ die("Don't know how to translate {} for rustc, cpu: {}, os: {}".format(target.alias, target.cpu, os_or_kernel)) + + # Check to see whether our rustc has a reasonably functional stdlib + # for our chosen target. diff --git a/cbindgen-vendor.tar.xz b/cbindgen-vendor.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..ac7be67e1df535ef60d4eb2648215ae4c037a793 Binary files /dev/null and b/cbindgen-vendor.tar.xz differ diff --git a/distribution.ini b/distribution.ini index f784bf8b3e810a4e2c1124581b27122dba8ad87c..ea464734484e21e176a522a4b665f129d0bf7ee4 100644 --- a/distribution.ini +++ b/distribution.ini @@ -6,5 +6,5 @@ about=Mozilla Firefox for Openeuler [Preferences] app.distributor=openeuler app.distributor.channel=openeuler -app.partner.fedora=openeuler +app.partner.openeuler=openeuler diff --git a/firefox-62.0.3.source.tar.xz b/firefox-79.0.source.tar.xz similarity index 81% rename from firefox-62.0.3.source.tar.xz rename to firefox-79.0.source.tar.xz index 3a28f9c372596159c41310e04005b5acc3b8e324..7160049047f439e7d3deb58af1ce472b2b2aee17 100644 Binary files a/firefox-62.0.3.source.tar.xz and b/firefox-79.0.source.tar.xz differ diff --git a/firefox-disable-ffvpx-with-vapi.patch b/firefox-disable-ffvpx-with-vapi.patch new file mode 100644 index 0000000000000000000000000000000000000000..df179b0aa0361454f9ff1760bc2f423253f84a0b --- /dev/null +++ b/firefox-disable-ffvpx-with-vapi.patch @@ -0,0 +1,41 @@ +diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp +--- a/dom/media/platforms/PDMFactory.cpp ++++ b/dom/media/platforms/PDMFactory.cpp +@@ -21,16 +21,17 @@ + #include "mozilla/GpuDecoderModule.h" + #include "mozilla/RemoteDecoderModule.h" + #include "mozilla/SharedThreadPool.h" + #include "mozilla/StaticPrefs_media.h" + #include "mozilla/StaticPtr.h" + #include "mozilla/SyncRunnable.h" + #include "mozilla/TaskQueue.h" + #include "mozilla/gfx/gfxVars.h" ++#include "gfxPlatformGtk.h" + + #ifdef XP_WIN + # include "WMFDecoderModule.h" + # include "mozilla/WindowsVersion.h" + #endif + #ifdef MOZ_FFVPX + # include "FFVPXRuntimeLinker.h" + #endif +@@ -362,17 +363,18 @@ void PDMFactory::CreatePDMs() { + #endif + #ifdef MOZ_OMX + if (StaticPrefs::media_omx_enabled()) { + m = OmxDecoderModule::Create(); + StartupPDM(m); + } + #endif + #ifdef MOZ_FFVPX +- if (StaticPrefs::media_ffvpx_enabled()) { ++ if (StaticPrefs::media_ffvpx_enabled() && ++ !gfxPlatformGtk::GetPlatform()->UseWaylandHardwareVideoDecoding()) { + m = FFVPXRuntimeLinker::CreateDecoderModule(); + StartupPDM(m); + } + #endif + #ifdef MOZ_FFMPEG + if (StaticPrefs::media_ffmpeg_enabled()) { + m = FFmpegRuntimeLinker::CreateDecoderModule(); + mFFmpegFailedToLoad = !StartupPDM(m); diff --git a/firefox-enable-addons.patch b/firefox-enable-addons.patch new file mode 100644 index 0000000000000000000000000000000000000000..15d0707cf01087cdee72c53a637c950f11c1d45b --- /dev/null +++ b/firefox-enable-addons.patch @@ -0,0 +1,13 @@ +diff -up firefox-55.0/browser/app/profile/firefox.js.addons firefox-55.0/browser/app/profile/firefox.js +--- firefox-55.0/browser/app/profile/firefox.js.addons 2017-08-02 10:58:30.566363833 +0200 ++++ firefox-55.0/browser/app/profile/firefox.js 2017-08-02 10:59:15.377216959 +0200 +@@ -65,7 +65,8 @@ pref("extensions.systemAddon.update.url" + + // Disable add-ons that are not installed by the user in all scopes by default. + // See the SCOPE constants in AddonManager.jsm for values to use here. +-pref("extensions.autoDisableScopes", 15); ++pref("extensions.autoDisableScopes", 0); ++pref("extensions.showMismatchUI", false); + // Scopes to scan for changes at startup. + pref("extensions.startupScanScopes", 0); + diff --git a/firefox-langpacks-62.0.3-20181002.tar.xz b/firefox-langpacks-79.0-20200727.tar.xz similarity index 73% rename from firefox-langpacks-62.0.3-20181002.tar.xz rename to firefox-langpacks-79.0-20200727.tar.xz index e3effad3e852df5d59bab914abc1e1b0fd3742f2..afc5ffb9fabe08f26ad80680cbd6999a56a7b3cb 100644 Binary files a/firefox-langpacks-62.0.3-20181002.tar.xz and b/firefox-langpacks-79.0-20200727.tar.xz differ diff --git a/firefox-locale-debug.patch b/firefox-locale-debug.patch new file mode 100644 index 0000000000000000000000000000000000000000..35de02f934500ae0bc6b76c225cf2f554530efd9 --- /dev/null +++ b/firefox-locale-debug.patch @@ -0,0 +1,12 @@ +diff -up firefox-75.0/intl/locale/LocaleService.cpp.locale-debug firefox-75.0/intl/locale/LocaleService.cpp +--- firefox-75.0/intl/locale/LocaleService.cpp.locale-debug 2020-04-06 22:42:20.196799809 +0200 ++++ firefox-75.0/intl/locale/LocaleService.cpp 2020-04-06 22:43:02.522530317 +0200 +@@ -372,8 +372,6 @@ LocaleService::GetDefaultLocale(nsACStri + // just use our hard-coded default below. + GetGREFileContents("update.locale", &locale); + locale.Trim(" \t\n\r"); +- // This should never be empty. +- MOZ_ASSERT(!locale.IsEmpty()); + if (CanonicalizeLanguageId(locale)) { + mDefaultLocale.Assign(locale); + } diff --git a/firefox-mozconfig b/firefox-mozconfig index d64b691f558f56d7abf15da62723a38e1f508928..ef68221ed5faad1bca08d7cb460e77958b44908a 100644 --- a/firefox-mozconfig +++ b/firefox-mozconfig @@ -1,24 +1,19 @@ . $topsrcdir/browser/config/mozconfig -ac_add_options --prefix="$PREFIX" -ac_add_options --libdir="$LIBDIR" ac_add_options --with-system-zlib -ac_add_options --with-system-bz2 ac_add_options --disable-strip -ac_add_options --disable-tests #ac_add_options --enable-libnotify ac_add_options --enable-necko-wifi -ac_add_options --enable-startup-notification ac_add_options --disable-updater ac_add_options --enable-chrome-format=omni ac_add_options --enable-pulseaudio -ac_add_options --with-system-icu -ac_add_options --with-mozilla-api-keyfile=../mozilla-api-key -ac_add_options --with-google-api-keyfile=../google-api-key +ac_add_options --enable-av1 +ac_add_options --without-system-icu ac_add_options --enable-release -ac_add_options --enable-pie +ac_add_options --update-channel=release # Workaround for mozbz#1341234 ac_add_options BINDGEN_CFLAGS="$(pkg-config nspr pixman-1 --cflags)" +ac_add_options --allow-addon-sideload export BUILD_OFFICIAL=1 export MOZILLA_OFFICIAL=1 diff --git a/firefox-nss-version.patch b/firefox-nss-version.patch new file mode 100644 index 0000000000000000000000000000000000000000..fee93bbf8efb905f9e0773e1069a98c483df9d0d --- /dev/null +++ b/firefox-nss-version.patch @@ -0,0 +1,12 @@ +diff -up firefox-78.0/toolkit/moz.configure.nss-version firefox-78.0/toolkit/moz.configure +--- firefox-78.0/toolkit/moz.configure.nss-version 2020-06-30 08:47:09.657501414 +0200 ++++ firefox-78.0/toolkit/moz.configure 2020-06-30 08:47:12.652510169 +0200 +@@ -2089,7 +2089,7 @@ option('--with-system-nss', help='Use sy + + imply_option('--with-system-nspr', True, when='--with-system-nss') + +-nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.1', when='--with-system-nss', config=False) ++nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.0', when='--with-system-nss', config=False) + + set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss') + diff --git a/firefox-pipewire-0-2.patch b/firefox-pipewire-0-2.patch new file mode 100644 index 0000000000000000000000000000000000000000..b1c695019d631e3dca64503125aaf73f7da852c2 --- /dev/null +++ b/firefox-pipewire-0-2.patch @@ -0,0 +1,526 @@ +diff -up firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-2 firefox-79.0/config/system-headers.mozbuild +--- firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-2 2020-07-21 00:49:36.000000000 +0200 ++++ firefox-79.0/config/system-headers.mozbuild 2020-07-29 11:03:51.455284187 +0200 +@@ -314,6 +314,7 @@ system_headers = [ + 'Gestalt.h', + 'getopt.h', + 'gio/gio.h', ++ 'gio/gunixfdlist.h', + 'glibconfig.h', + 'glib.h', + 'glib-object.h', +@@ -607,6 +608,7 @@ system_headers = [ + 'Pgenerr.h', + 'PGenErr.h', + 'Ph.h', ++ 'pipewire/pipewire.h', + 'pixman.h', + 'pk11func.h', + 'pk11pqg.h', +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-2 2020-07-29 11:03:51.455284187 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2020-07-29 11:04:40.898017241 +0200 +@@ -231,6 +231,27 @@ if CONFIG["OS_TARGET"] == "OpenBSD": + "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc" + ] + ++# PipeWire specific files ++if CONFIG["OS_TARGET"] == "Linux": ++ ++ DEFINES["WEBRTC_USE_PIPEWIRE"] = "1" ++ ++ OS_LIBS += [ ++ "rt", ++ "pipewire-0.2", ++ "glib-2.0", ++ "gio-2.0", ++ "gobject-2.0" ++ ] ++ ++ CXXFLAGS += CONFIG['TK_CFLAGS'] ++ ++ UNIFIED_SOURCES += [ ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc" ++ ] ++ + if CONFIG["OS_TARGET"] == "WINNT": + + DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-2 2020-07-20 22:54:16.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2020-07-29 11:03:51.456284181 +0200 +@@ -141,7 +141,7 @@ class DesktopCaptureOptions { + bool disable_effects_ = true; + bool detect_updated_region_ = false; + #if defined(WEBRTC_USE_PIPEWIRE) +- bool allow_pipewire_ = false; ++ bool allow_pipewire_ = true; + #endif + }; + +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-2 2020-07-20 22:54:27.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc 2020-07-29 11:03:51.618283306 +0200 +@@ -18,6 +18,11 @@ + #include + #include + ++#include ++#include ++#include ++#include ++ + #include + #include + +@@ -36,6 +41,27 @@ const char kSessionInterfaceName[] = "or + const char kRequestInterfaceName[] = "org.freedesktop.portal.Request"; + const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast"; + ++ ++// static ++void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { ++ struct dma_buf_sync sync = { 0 }; ++ ++ sync.flags = start_or_end | DMA_BUF_SYNC_READ; ++ ++ while(true) { ++ int ret; ++ ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync); ++ if (ret == -1 && errno == EINTR) { ++ continue; ++ } else if (ret == -1) { ++ RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno); ++ break; ++ } else { ++ break; ++ } ++ } ++} ++ + // static + void BaseCapturerPipeWire::OnStateChanged(void* data, + pw_remote_state old_state, +@@ -108,11 +134,13 @@ void BaseCapturerPipeWire::OnStreamForma + auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4); + auto size = height * stride; + ++ that->desktop_size_ = DesktopSize(width, height); ++ + uint8_t buffer[1024] = {}; + auto builder = spa_pod_builder{buffer, sizeof(buffer)}; + + // Setup buffers and meta header for new format. +- const struct spa_pod* params[2]; ++ const struct spa_pod* params[3]; + params[0] = reinterpret_cast(spa_pod_builder_object( + &builder, + // id to enumerate buffer requirements +@@ -141,8 +169,14 @@ void BaseCapturerPipeWire::OnStreamForma + // Size: size of the metadata, specified as integer (i) + ":", that->pw_core_type_->param_meta.size, "i", + sizeof(struct spa_meta_header))); +- +- pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2); ++ params[2] = reinterpret_cast( ++ spa_pod_builder_object(&builder, that->pw_core_type_->param.idMeta, ++ that->pw_core_type_->param_meta.Meta, ":", ++ that->pw_core_type_->param_meta.type, "I", ++ that->pw_core_type_->meta.VideoCrop, ":", ++ that->pw_core_type_->param_meta.size, "i", ++ sizeof(struct spa_meta_video_crop))); ++ pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/3); + } + + // static +@@ -150,15 +184,25 @@ void BaseCapturerPipeWire::OnStreamProce + BaseCapturerPipeWire* that = static_cast(data); + RTC_DCHECK(that); + +- pw_buffer* buf = nullptr; ++ struct pw_buffer *next_buffer; ++ struct pw_buffer *buffer = nullptr; + +- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ while (next_buffer) { ++ buffer = next_buffer; ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ ++ if (next_buffer) ++ pw_stream_queue_buffer (that->pw_stream_, buffer); ++ } ++ ++ if (!buffer) { + return; + } + +- that->HandleBuffer(buf); ++ that->HandleBuffer(buffer); + +- pw_stream_queue_buffer(that->pw_stream_, buf); ++ pw_stream_queue_buffer(that->pw_stream_, buffer); + } + + BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) +@@ -197,10 +241,6 @@ BaseCapturerPipeWire::~BaseCapturerPipeW + pw_loop_destroy(pw_loop_); + } + +- if (current_frame_) { +- free(current_frame_); +- } +- + if (start_request_signal_id_) { + g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); + } +@@ -290,12 +330,7 @@ void BaseCapturerPipeWire::InitPipeWireT + + void BaseCapturerPipeWire::CreateReceivingStream() { + spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; +- spa_rectangle pwScreenBounds = +- spa_rectangle{static_cast(desktop_size_.width()), +- static_cast(desktop_size_.height())}; +- +- spa_fraction pwFrameRateMin = spa_fraction{0, 1}; +- spa_fraction pwFrameRateMax = spa_fraction{60, 1}; ++ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX}; + + pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1", + /*end of varargs*/ nullptr); +@@ -313,27 +348,19 @@ void BaseCapturerPipeWire::CreateReceivi + // then allowed formats are enumerated (e) and the format is undecided (u) + // to allow negotiation + ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx, +- SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx, +- pw_type_->video_format.BGRx), ++ SPA_POD_PROP_ENUM( ++ 4, pw_type_->video_format.RGBx, pw_type_->video_format.BGRx, ++ pw_type_->video_format.RGBA, pw_type_->video_format.BGRA), + // Video size: specified as rectangle (R), preferred size is specified as + // first parameter, then allowed size is defined as range (r) from min and + // max values and the format is undecided (u) to allow negotiation +- ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2, +- &pwMinScreenBounds, &pwScreenBounds, +- // Frame rate: specified as fraction (F) and set to minimum frame rate +- // value +- ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin, +- // Max frame rate: specified as fraction (F), preferred frame rate is set +- // to maximum value, then allowed frame rate is defined as range (r) from +- // min and max values and it is undecided (u) to allow negotiation +- ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2, +- &pwFrameRateMin, &pwFrameRateMax)); ++ ":", pw_type_->format_video.size, "Rru", &pwMinScreenBounds, ++ SPA_POD_PROP_MIN_MAX(&pwMinScreenBounds, &pwMaxScreenBounds))); + + pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, + this); + pw_stream_flags flags = static_cast( +- PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | +- PW_STREAM_FLAG_MAP_BUFFERS); ++ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE); + if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr, + flags, params, + /*n_params=*/1) != 0) { +@@ -344,15 +371,81 @@ void BaseCapturerPipeWire::CreateReceivi + } + + void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { ++ struct spa_meta_video_crop* video_crop; + spa_buffer* spaBuffer = buffer->buffer; +- void* src = nullptr; ++ uint8_t *map = nullptr; ++ uint8_t* src = nullptr; ++ uint8_t* dst = nullptr; ++ ++ if (spaBuffer->datas[0].chunk->size == 0) { ++ map = nullptr; ++ src = nullptr; ++ } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemFd) { ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)); ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) { ++ int fd; ++ fd = spaBuffer->datas[0].fd; ++ ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, fd, 0)); ++ SyncDmaBuf(fd, DMA_BUF_SYNC_START); ++ ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemPtr) { ++ map = nullptr; ++ src = static_cast(spaBuffer->datas[0].data); ++ } else { ++ return; ++ } + +- if (!(src = spaBuffer->datas[0].data)) { ++ if (!src) { + return; + } + +- uint32_t maxSize = spaBuffer->datas[0].maxsize; +- int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ DesktopSize prev_crop_size = DesktopSize(0, 0); ++ if (video_crop_size_initialized_) { ++ prev_crop_size = video_crop_size_; ++ } ++ ++ if ((video_crop = static_cast( ++ spa_buffer_find_meta(spaBuffer, pw_core_type_->meta.VideoCrop)))) { ++ RTC_DCHECK(video_crop->width <= desktop_size_.width() && ++ video_crop->height <= desktop_size_.height()); ++ if ((video_crop->width != desktop_size_.width() || ++ video_crop->height != desktop_size_.height()) && video_crop->width && video_crop->height) { ++ video_crop_size_ = DesktopSize(video_crop->width, video_crop->height); ++ video_crop_size_initialized_ = true; ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ ++ size_t frame_size; ++ if (video_crop_size_initialized_) { ++ frame_size = ++ video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel; ++ } else { ++ frame_size = ++ desktop_size_.width() * desktop_size_.height() * kBytesPerPixel; ++ } ++ ++ if (!current_frame_ || ++ (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) { ++ current_frame_ = std::make_unique(frame_size); ++ } ++ RTC_DCHECK(current_frame_ != nullptr); ++ ++ const int32_t dstStride = video_crop_size_initialized_ ++ ? video_crop_size_.width() * kBytesPerPixel ++ : desktop_size_.width() * kBytesPerPixel; ++ const int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ + if (srcStride != (desktop_size_.width() * kBytesPerPixel)) { + RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " + << srcStride +@@ -361,21 +454,39 @@ void BaseCapturerPipeWire::HandleBuffer( + return; + } + +- if (!current_frame_) { +- current_frame_ = static_cast(malloc(maxSize)); ++ dst = current_frame_.get(); ++ ++ // Adjust source content based on crop video position ++ if (video_crop_size_initialized_ && ++ (video_crop->y + video_crop_size_.height() <= desktop_size_.height())) { ++ for (int i = 0; i < video_crop->y; ++i) { ++ src += srcStride; ++ } ++ } ++ const int xOffset = ++ video_crop_size_initialized_ && (video_crop->x + video_crop_size_.width() <= ++ desktop_size_.width()) ++ ? video_crop->x * kBytesPerPixel ++ : 0; ++ const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height(); ++ for (int i = 0; i < height; ++i) { ++ // Adjust source content based on crop video position if needed ++ src += xOffset; ++ std::memcpy(dst, src, dstStride); ++ // If both sides decided to go with the RGBx format we need to convert it to ++ // BGRx to match color format expected by WebRTC. ++ if (spa_video_format_->format == pw_type_->video_format.RGBx) { ++ ConvertRGBxToBGRx(dst, dstStride); ++ } ++ src += srcStride - xOffset; ++ dst += dstStride; + } +- RTC_DCHECK(current_frame_ != nullptr); + +- // If both sides decided to go with the RGBx format we need to convert it to +- // BGRx to match color format expected by WebRTC. +- if (spa_video_format_->format == pw_type_->video_format.RGBx) { +- uint8_t* tempFrame = static_cast(malloc(maxSize)); +- std::memcpy(tempFrame, src, maxSize); +- ConvertRGBxToBGRx(tempFrame, maxSize); +- std::memcpy(current_frame_, tempFrame, maxSize); +- free(tempFrame); +- } else { +- std::memcpy(current_frame_, src, maxSize); ++ if (map) { ++ if (spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) { ++ SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END); ++ } ++ munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset); + } + } + +@@ -725,10 +836,6 @@ void BaseCapturerPipeWire::OnStartReques + g_variant_get(variant, "(u@a{sv})", &stream_id, &options); + RTC_DCHECK(options != nullptr); + +- g_variant_lookup(options, "size", "(ii)", &width, &height); +- +- that->desktop_size_.set(width, height); +- + g_variant_unref(options); + g_variant_unref(variant); + } +@@ -813,10 +920,15 @@ void BaseCapturerPipeWire::CaptureFrame( + return; + } + +- std::unique_ptr result(new BasicDesktopFrame(desktop_size_)); ++ DesktopSize frame_size = desktop_size_; ++ if (video_crop_size_initialized_) { ++ frame_size = video_crop_size_; ++ } ++ ++ std::unique_ptr result(new BasicDesktopFrame(frame_size)); + result->CopyPixelsFrom( +- current_frame_, (desktop_size_.width() * kBytesPerPixel), +- DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height())); ++ current_frame_.get(), (frame_size.width() * kBytesPerPixel), ++ DesktopRect::MakeWH(frame_size.width(), frame_size.height())); + if (!result) { + callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); + return; +@@ -837,4 +949,22 @@ bool BaseCapturerPipeWire::SelectSource( + return true; + } + ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options) { ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer);} ++ ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options) { ++ ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer); ++} ++ + } // namespace webrtc +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-2 2020-07-20 22:54:40.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h 2020-07-29 11:03:51.619283301 +0200 +@@ -32,7 +32,11 @@ class PipeWireType { + + class BaseCapturerPipeWire : public DesktopCapturer { + public: +- enum CaptureSourceType { Screen = 1, Window }; ++ enum CaptureSourceType : uint32_t { ++ kScreen = 0b01, ++ kWindow = 0b10, ++ kAny = 0b11 ++ }; + + explicit BaseCapturerPipeWire(CaptureSourceType source_type); + ~BaseCapturerPipeWire() override; +@@ -43,6 +47,12 @@ class BaseCapturerPipeWire : public Desk + bool GetSourceList(SourceList* sources) override; + bool SelectSource(SourceId id) override; + ++ static std::unique_ptr CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options); ++ ++ static std::unique_ptr CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options); ++ + private: + // PipeWire types --> + pw_core* pw_core_ = nullptr; +@@ -64,7 +74,7 @@ class BaseCapturerPipeWire : public Desk + gint32 pw_fd_ = -1; + + CaptureSourceType capture_source_type_ = +- BaseCapturerPipeWire::CaptureSourceType::Screen; ++ BaseCapturerPipeWire::CaptureSourceType::kAny; + + // <-- end of PipeWire types + +@@ -78,10 +88,12 @@ class BaseCapturerPipeWire : public Desk + guint sources_request_signal_id_ = 0; + guint start_request_signal_id_ = 0; + ++ bool video_crop_size_initialized_ = false; ++ DesktopSize video_crop_size_;; + DesktopSize desktop_size_ = {}; + DesktopCaptureOptions options_ = {}; + +- uint8_t* current_frame_ = nullptr; ++ std::unique_ptr current_frame_; + Callback* callback_ = nullptr; + + bool portal_init_failed_ = false; +@@ -95,6 +107,7 @@ class BaseCapturerPipeWire : public Desk + + void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size); + ++ static void SyncDmaBuf(int fd, uint64_t start_or_end); + static void OnStateChanged(void* data, + pw_remote_state old_state, + pw_remote_state state, +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-2 2020-07-20 22:53:57.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc 2020-07-29 11:03:51.619283301 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + ScreenCapturerPipeWire::ScreenCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {} + ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {} + + // static +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-2 2020-07-20 22:54:18.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc 2020-07-29 11:03:51.619283301 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + WindowCapturerPipeWire::WindowCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {} + WindowCapturerPipeWire::~WindowCapturerPipeWire() {} + + // static +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-2 2020-07-20 22:54:40.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2020-07-29 11:03:51.620283296 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return ScreenCapturerPipeWire::CreateRawScreenCapturer(options); ++ return BaseCapturerPipeWire::CreateRawScreenCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-2 2020-07-20 22:53:32.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2020-07-29 11:03:51.620283296 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return WindowCapturerPipeWire::CreateRawWindowCapturer(options); ++ return BaseCapturerPipeWire::CreateRawWindowCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + diff --git a/firefox-pipewire-0-3.patch b/firefox-pipewire-0-3.patch new file mode 100644 index 0000000000000000000000000000000000000000..73e1b36aa35ff733a40f53d6e031025af4c79b55 --- /dev/null +++ b/firefox-pipewire-0-3.patch @@ -0,0 +1,834 @@ +diff -up firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-3 firefox-79.0/config/system-headers.mozbuild +--- firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-3 2020-07-21 00:49:36.000000000 +0200 ++++ firefox-79.0/config/system-headers.mozbuild 2020-07-28 10:06:59.485481599 +0200 +@@ -314,6 +314,7 @@ system_headers = [ + 'Gestalt.h', + 'getopt.h', + 'gio/gio.h', ++ 'gio/gunixfdlist.h', + 'glibconfig.h', + 'glib.h', + 'glib-object.h', +@@ -607,6 +608,7 @@ system_headers = [ + 'Pgenerr.h', + 'PGenErr.h', + 'Ph.h', ++ 'pipewire/pipewire.h', + 'pixman.h', + 'pk11func.h', + 'pk11pqg.h', +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 2020-07-20 22:53:33.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn 2020-07-28 10:06:59.485481599 +0200 +@@ -158,7 +158,7 @@ if (rtc_include_tests) { + if (is_linux) { + if (rtc_use_pipewire) { + pkg_config("pipewire") { +- packages = [ "libpipewire-0.2" ] ++ packages = [ "libpipewire-0.3" ] + + defines = [ "WEBRTC_USE_PIPEWIRE" ] + } +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 2020-07-28 10:06:59.486481593 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2020-07-28 10:11:51.231907101 +0200 +@@ -174,6 +174,28 @@ if CONFIG["OS_TARGET"] == "Linux": + "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc" + ] + ++# PipeWire specific files ++if CONFIG["OS_TARGET"] == "Linux": ++ DEFINES["WEBRTC_USE_PIPEWIRE"] = "1" ++ ++ OS_LIBS += [ ++ "rt", ++ "pipewire-0.3", ++ "glib-2.0", ++ "gio-2.0", ++ "gobject-2.0" ++ ] ++ ++ CXXFLAGS += CONFIG['TK_CFLAGS'] ++ CXXFLAGS += [ "-I/usr/include/pipewire-0.3" ] ++ CXXFLAGS += [ "-I/usr/include/spa-0.2" ] ++ ++ UNIFIED_SOURCES += [ ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc" ++ ] ++ + if CONFIG["OS_TARGET"] == "Darwin": + + DEFINES["CR_XCODE_VERSION"] = "0920" +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 2020-07-20 22:54:16.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2020-07-28 10:06:59.486481593 +0200 +@@ -141,7 +141,7 @@ class DesktopCaptureOptions { + bool disable_effects_ = true; + bool detect_updated_region_ = false; + #if defined(WEBRTC_USE_PIPEWIRE) +- bool allow_pipewire_ = false; ++ bool allow_pipewire_ = true; + #endif + }; + +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:54:27.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc 2020-07-28 10:06:59.500481514 +0200 +@@ -15,8 +15,11 @@ + + #include + #include +-#include +-#include ++ ++#include ++#include ++#include ++#include + + #include + #include +@@ -36,32 +39,37 @@ const char kSessionInterfaceName[] = "or + const char kRequestInterfaceName[] = "org.freedesktop.portal.Request"; + const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast"; + ++ + // static +-void BaseCapturerPipeWire::OnStateChanged(void* data, +- pw_remote_state old_state, +- pw_remote_state state, +- const char* error_message) { +- BaseCapturerPipeWire* that = static_cast(data); +- RTC_DCHECK(that); ++void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { ++ struct dma_buf_sync sync = { 0 }; + +- switch (state) { +- case PW_REMOTE_STATE_ERROR: +- RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message; +- break; +- case PW_REMOTE_STATE_CONNECTED: +- RTC_LOG(LS_INFO) << "PipeWire remote state: connected."; +- that->CreateReceivingStream(); +- break; +- case PW_REMOTE_STATE_CONNECTING: +- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting."; ++ sync.flags = start_or_end | DMA_BUF_SYNC_READ; ++ ++ while(true) { ++ int ret; ++ ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync); ++ if (ret == -1 && errno == EINTR) { ++ continue; ++ } else if (ret == -1) { ++ RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno); + break; +- case PW_REMOTE_STATE_UNCONNECTED: +- RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected."; ++ } else { + break; ++ } + } + } + + // static ++void BaseCapturerPipeWire::OnCoreError(void *data, ++ uint32_t id, ++ int seq, ++ int res, ++ const char *message) { ++ RTC_LOG(LS_ERROR) << "core error: " << message; ++} ++ ++// static + void BaseCapturerPipeWire::OnStreamStateChanged(void* data, + pw_stream_state old_state, + pw_stream_state state, +@@ -73,76 +81,54 @@ void BaseCapturerPipeWire::OnStreamState + case PW_STREAM_STATE_ERROR: + RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message; + break; +- case PW_STREAM_STATE_CONFIGURE: +- pw_stream_set_active(that->pw_stream_, true); +- break; +- case PW_STREAM_STATE_UNCONNECTED: +- case PW_STREAM_STATE_CONNECTING: +- case PW_STREAM_STATE_READY: + case PW_STREAM_STATE_PAUSED: + case PW_STREAM_STATE_STREAMING: ++ case PW_STREAM_STATE_UNCONNECTED: ++ case PW_STREAM_STATE_CONNECTING: + break; + } + } + + // static +-void BaseCapturerPipeWire::OnStreamFormatChanged(void* data, +- const struct spa_pod* format) { ++void BaseCapturerPipeWire::OnStreamParamChanged(void *data, uint32_t id, ++ const struct spa_pod *format) { + BaseCapturerPipeWire* that = static_cast(data); + RTC_DCHECK(that); + +- RTC_LOG(LS_INFO) << "PipeWire stream format changed."; ++ RTC_LOG(LS_INFO) << "PipeWire stream param changed."; + +- if (!format) { +- pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr, +- /*n_params=*/0); ++ if (!format || id != SPA_PARAM_Format) { + return; + } + +- that->spa_video_format_ = new spa_video_info_raw(); +- spa_format_video_raw_parse(format, that->spa_video_format_, +- &that->pw_type_->format_video); ++ spa_format_video_raw_parse(format, &that->spa_video_format_); + +- auto width = that->spa_video_format_->size.width; +- auto height = that->spa_video_format_->size.height; ++ auto width = that->spa_video_format_.size.width; ++ auto height = that->spa_video_format_.size.height; + auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4); + auto size = height * stride; + ++ that->desktop_size_ = DesktopSize(width, height); ++ + uint8_t buffer[1024] = {}; + auto builder = spa_pod_builder{buffer, sizeof(buffer)}; + + // Setup buffers and meta header for new format. +- const struct spa_pod* params[2]; +- params[0] = reinterpret_cast(spa_pod_builder_object( +- &builder, +- // id to enumerate buffer requirements +- that->pw_core_type_->param.idBuffers, +- that->pw_core_type_->param_buffers.Buffers, +- // Size: specified as integer (i) and set to specified size +- ":", that->pw_core_type_->param_buffers.size, "i", size, +- // Stride: specified as integer (i) and set to specified stride +- ":", that->pw_core_type_->param_buffers.stride, "i", stride, +- // Buffers: specifies how many buffers we want to deal with, set as +- // integer (i) where preferred number is 8, then allowed number is defined +- // as range (r) from min and max values and it is undecided (u) to allow +- // negotiation +- ":", that->pw_core_type_->param_buffers.buffers, "iru", 8, +- SPA_POD_PROP_MIN_MAX(1, 32), +- // Align: memory alignment of the buffer, set as integer (i) to specified +- // value +- ":", that->pw_core_type_->param_buffers.align, "i", 16)); +- params[1] = reinterpret_cast(spa_pod_builder_object( +- &builder, +- // id to enumerate supported metadata +- that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta, +- // Type: specified as id or enum (I) +- ":", that->pw_core_type_->param_meta.type, "I", +- that->pw_core_type_->meta.Header, +- // Size: size of the metadata, specified as integer (i) +- ":", that->pw_core_type_->param_meta.size, "i", +- sizeof(struct spa_meta_header))); +- +- pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2); ++ const struct spa_pod* params[3]; ++ params[0] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, ++ SPA_PARAM_BUFFERS_size, SPA_POD_Int(size), ++ SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride), ++ SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32))); ++ params[1] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, ++ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header), ++ SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)))); ++ params[2] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, ++ SPA_PARAM_META_type, SPA_POD_Id (SPA_META_VideoCrop), ++ SPA_PARAM_META_size, SPA_POD_Int (sizeof(struct spa_meta_region)))); ++ pw_stream_update_params(that->pw_stream_, params, 3); + } + + // static +@@ -150,15 +136,25 @@ void BaseCapturerPipeWire::OnStreamProce + BaseCapturerPipeWire* that = static_cast(data); + RTC_DCHECK(that); + +- pw_buffer* buf = nullptr; ++ struct pw_buffer *next_buffer; ++ struct pw_buffer *buffer = nullptr; ++ ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ while (next_buffer) { ++ buffer = next_buffer; ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ ++ if (next_buffer) ++ pw_stream_queue_buffer (that->pw_stream_, buffer); ++ } + +- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { ++ if (!buffer) { + return; + } + +- that->HandleBuffer(buf); ++ that->HandleBuffer(buffer); + +- pw_stream_queue_buffer(that->pw_stream_, buf); ++ pw_stream_queue_buffer(that->pw_stream_, buffer); + } + + BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) +@@ -169,38 +165,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeW + pw_thread_loop_stop(pw_main_loop_); + } + +- if (pw_type_) { +- delete pw_type_; +- } +- +- if (spa_video_format_) { +- delete spa_video_format_; +- } +- + if (pw_stream_) { + pw_stream_destroy(pw_stream_); + } + +- if (pw_remote_) { +- pw_remote_destroy(pw_remote_); ++ if (pw_core_) { ++ pw_core_disconnect(pw_core_); + } + +- if (pw_core_) { +- pw_core_destroy(pw_core_); ++ if (pw_context_) { ++ pw_context_destroy(pw_context_); + } + + if (pw_main_loop_) { + pw_thread_loop_destroy(pw_main_loop_); + } + +- if (pw_loop_) { +- pw_loop_destroy(pw_loop_); +- } +- +- if (current_frame_) { +- free(current_frame_); +- } +- + if (start_request_signal_id_) { + g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); + } +@@ -250,27 +230,35 @@ void BaseCapturerPipeWire::InitPortal() + void BaseCapturerPipeWire::InitPipeWire() { + pw_init(/*argc=*/nullptr, /*argc=*/nullptr); + +- pw_loop_ = pw_loop_new(/*properties=*/nullptr); +- pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop"); +- +- pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr); +- pw_core_type_ = pw_core_get_type(pw_core_); +- pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0); ++ pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr); ++ pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0); ++ if (!pw_context_) { ++ RTC_LOG(LS_ERROR) << "Failed to create PipeWire context"; ++ return; ++ } + +- InitPipeWireTypes(); ++ pw_core_ = pw_context_connect(pw_context_, nullptr, 0); ++ if (!pw_core_) { ++ RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context"; ++ return; ++ } + + // Initialize event handlers, remote end and stream-related. +- pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS; +- pw_remote_events_.state_changed = &OnStateChanged; ++ pw_core_events_.version = PW_VERSION_CORE_EVENTS; ++ pw_core_events_.error = &OnCoreError; + + pw_stream_events_.version = PW_VERSION_STREAM_EVENTS; + pw_stream_events_.state_changed = &OnStreamStateChanged; +- pw_stream_events_.format_changed = &OnStreamFormatChanged; ++ pw_stream_events_.param_changed = &OnStreamParamChanged; + pw_stream_events_.process = &OnStreamProcess; + +- pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_, +- this); +- pw_remote_connect_fd(pw_remote_, pw_fd_); ++ pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this); ++ ++ pw_stream_ = CreateReceivingStream(); ++ if (!pw_stream_) { ++ RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream"; ++ return; ++ } + + if (pw_thread_loop_start(pw_main_loop_) < 0) { + RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop"; +@@ -278,81 +266,132 @@ void BaseCapturerPipeWire::InitPipeWire( + } + } + +-void BaseCapturerPipeWire::InitPipeWireTypes() { +- spa_type_map* map = pw_core_type_->map; +- pw_type_ = new PipeWireType(); ++pw_stream* BaseCapturerPipeWire::CreateReceivingStream() { ++ spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; ++ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX}; + +- spa_type_media_type_map(map, &pw_type_->media_type); +- spa_type_media_subtype_map(map, &pw_type_->media_subtype); +- spa_type_format_video_map(map, &pw_type_->format_video); +- spa_type_video_format_map(map, &pw_type_->video_format); +-} ++ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr); + +-void BaseCapturerPipeWire::CreateReceivingStream() { +- spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; +- spa_rectangle pwScreenBounds = +- spa_rectangle{static_cast(desktop_size_.width()), +- static_cast(desktop_size_.height())}; +- +- spa_fraction pwFrameRateMin = spa_fraction{0, 1}; +- spa_fraction pwFrameRateMax = spa_fraction{60, 1}; +- +- pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1", +- /*end of varargs*/ nullptr); +- pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps); ++ if (!stream) { ++ RTC_LOG(LS_ERROR) << "Could not create receiving stream."; ++ return nullptr; ++ } + + uint8_t buffer[1024] = {}; +- const spa_pod* params[1]; +- spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; +- params[0] = reinterpret_cast(spa_pod_builder_object( +- &builder, +- // id to enumerate formats +- pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I", +- pw_type_->media_type.video, "I", pw_type_->media_subtype.raw, +- // Video format: specified as id or enum (I), preferred format is BGRx, +- // then allowed formats are enumerated (e) and the format is undecided (u) +- // to allow negotiation +- ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx, +- SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx, +- pw_type_->video_format.BGRx), +- // Video size: specified as rectangle (R), preferred size is specified as +- // first parameter, then allowed size is defined as range (r) from min and +- // max values and the format is undecided (u) to allow negotiation +- ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2, +- &pwMinScreenBounds, &pwScreenBounds, +- // Frame rate: specified as fraction (F) and set to minimum frame rate +- // value +- ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin, +- // Max frame rate: specified as fraction (F), preferred frame rate is set +- // to maximum value, then allowed frame rate is defined as range (r) from +- // min and max values and it is undecided (u) to allow negotiation +- ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2, +- &pwFrameRateMin, &pwFrameRateMax)); ++ const spa_pod* params[2]; ++ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer)); ++ ++ params[0] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, ++ SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), ++ SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), ++ SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA, ++ SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA), ++ SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds, ++ &pwMinScreenBounds, ++ &pwMaxScreenBounds), ++ 0)); ++ pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_, this); + +- pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, +- this); + pw_stream_flags flags = static_cast( +- PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | +- PW_STREAM_FLAG_MAP_BUFFERS); +- if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr, +- flags, params, +- /*n_params=*/1) != 0) { ++ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE); ++ ++ if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) { + RTC_LOG(LS_ERROR) << "Could not connect receiving stream."; + portal_init_failed_ = true; +- return; + } ++ ++ return stream; + } + + void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { ++ struct spa_meta_region* video_crop; + spa_buffer* spaBuffer = buffer->buffer; +- void* src = nullptr; ++ uint8_t *map = nullptr; ++ uint8_t* src = nullptr; ++ uint8_t* dst = nullptr; ++ ++ if (spaBuffer->datas[0].chunk->size == 0) { ++ map = nullptr; ++ src = nullptr; ++ } else if (spaBuffer->datas[0].type == SPA_DATA_MemFd) { ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)); ++ ++ if (map == MAP_FAILED) { ++ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno); ++ return; ++ } ++ ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { ++ int fd; ++ fd = spaBuffer->datas[0].fd; ++ ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, fd, 0)); ++ ++ if (map == MAP_FAILED) { ++ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno); ++ return; ++ } + +- if (!(src = spaBuffer->datas[0].data)) { ++ SyncDmaBuf(fd, DMA_BUF_SYNC_START); ++ ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) { ++ map = nullptr; ++ src = static_cast(spaBuffer->datas[0].data); ++ } else { + return; + } + +- uint32_t maxSize = spaBuffer->datas[0].maxsize; +- int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ if (!src) { ++ return; ++ } ++ ++ DesktopSize prev_crop_size = DesktopSize(0, 0); ++ if (video_crop_size_initialized_) { ++ prev_crop_size = video_crop_size_; ++ } ++ ++ if ((video_crop = static_cast( ++ spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(*video_crop))))) { ++ RTC_DCHECK(video_crop->region.size.width <= desktop_size_.width() && ++ video_crop->region.size.height <= desktop_size_.height()); ++ if ((video_crop->region.size.width != desktop_size_.width() || ++ video_crop->region.size.height != desktop_size_.height()) && video_crop->region.size.width && video_crop->region.size.height) { ++ video_crop_size_ = DesktopSize(video_crop->region.size.width, video_crop->region.size.height); ++ video_crop_size_initialized_ = true; ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ ++ size_t frame_size; ++ if (video_crop_size_initialized_) { ++ frame_size = ++ video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel; ++ } else { ++ frame_size = ++ desktop_size_.width() * desktop_size_.height() * kBytesPerPixel; ++ } ++ ++ if (!current_frame_ || ++ (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) { ++ current_frame_ = std::make_unique(frame_size); ++ } ++ RTC_DCHECK(current_frame_ != nullptr); ++ ++ const int32_t dstStride = video_crop_size_initialized_ ++ ? video_crop_size_.width() * kBytesPerPixel ++ : desktop_size_.width() * kBytesPerPixel; ++ const int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ + if (srcStride != (desktop_size_.width() * kBytesPerPixel)) { + RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " + << srcStride +@@ -361,21 +400,40 @@ void BaseCapturerPipeWire::HandleBuffer( + return; + } + +- if (!current_frame_) { +- current_frame_ = static_cast(malloc(maxSize)); ++ dst = current_frame_.get(); ++ ++ // Adjust source content based on crop video position ++ if (video_crop_size_initialized_ && ++ (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) { ++ for (int i = 0; i < video_crop->region.position.y; ++i) { ++ src += srcStride; ++ } ++ } ++ const int xOffset = ++ video_crop_size_initialized_ && (video_crop->region.position.x + video_crop_size_.width() <= ++ desktop_size_.width()) ++ ? video_crop->region.position.x * kBytesPerPixel ++ : 0; ++ const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height(); ++ for (int i = 0; i < height; ++i) { ++ // Adjust source content based on crop video position if needed ++ src += xOffset; ++ std::memcpy(dst, src, dstStride); ++ // If both sides decided to go with the RGBx format we need to convert it to ++ // BGRx to match color format expected by WebRTC. ++ if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx || ++ spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) { ++ ConvertRGBxToBGRx(dst, dstStride); ++ } ++ src += srcStride - xOffset; ++ dst += dstStride; + } +- RTC_DCHECK(current_frame_ != nullptr); + +- // If both sides decided to go with the RGBx format we need to convert it to +- // BGRx to match color format expected by WebRTC. +- if (spa_video_format_->format == pw_type_->video_format.RGBx) { +- uint8_t* tempFrame = static_cast(malloc(maxSize)); +- std::memcpy(tempFrame, src, maxSize); +- ConvertRGBxToBGRx(tempFrame, maxSize); +- std::memcpy(current_frame_, tempFrame, maxSize); +- free(tempFrame); +- } else { +- std::memcpy(current_frame_, src, maxSize); ++ if (map) { ++ if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { ++ SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END); ++ } ++ munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset); + } + } + +@@ -725,10 +783,7 @@ void BaseCapturerPipeWire::OnStartReques + g_variant_get(variant, "(u@a{sv})", &stream_id, &options); + RTC_DCHECK(options != nullptr); + +- g_variant_lookup(options, "size", "(ii)", &width, &height); +- +- that->desktop_size_.set(width, height); +- ++ that->pw_stream_node_id_ = stream_id; + g_variant_unref(options); + g_variant_unref(variant); + } +@@ -813,10 +868,15 @@ void BaseCapturerPipeWire::CaptureFrame( + return; + } + +- std::unique_ptr result(new BasicDesktopFrame(desktop_size_)); ++ DesktopSize frame_size = desktop_size_; ++ if (video_crop_size_initialized_) { ++ frame_size = video_crop_size_; ++ } ++ ++ std::unique_ptr result(new BasicDesktopFrame(frame_size)); + result->CopyPixelsFrom( +- current_frame_, (desktop_size_.width() * kBytesPerPixel), +- DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height())); ++ current_frame_.get(), (frame_size.width() * kBytesPerPixel), ++ DesktopRect::MakeWH(frame_size.width(), frame_size.height())); + if (!result) { + callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); + return; +@@ -837,4 +897,22 @@ bool BaseCapturerPipeWire::SelectSource( + return true; + } + ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options) { ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer);} ++ ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options) { ++ ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer); ++} ++ + } // namespace webrtc +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 2020-07-20 22:54:40.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h 2020-07-28 10:06:59.501481508 +0200 +@@ -22,17 +22,13 @@ + + namespace webrtc { + +-class PipeWireType { +- public: +- spa_type_media_type media_type; +- spa_type_media_subtype media_subtype; +- spa_type_format_video format_video; +- spa_type_video_format video_format; +-}; +- + class BaseCapturerPipeWire : public DesktopCapturer { + public: +- enum CaptureSourceType { Screen = 1, Window }; ++ enum CaptureSourceType : uint32_t { ++ kScreen = 0b01, ++ kWindow = 0b10, ++ kAny = 0b11 ++ }; + + explicit BaseCapturerPipeWire(CaptureSourceType source_type); + ~BaseCapturerPipeWire() override; +@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public Desk + bool GetSourceList(SourceList* sources) override; + bool SelectSource(SourceId id) override; + ++ static std::unique_ptr CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options); ++ ++ static std::unique_ptr CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options); ++ + private: + // PipeWire types --> ++ pw_context* pw_context_ = nullptr; + pw_core* pw_core_ = nullptr; +- pw_type* pw_core_type_ = nullptr; + pw_stream* pw_stream_ = nullptr; +- pw_remote* pw_remote_ = nullptr; +- pw_loop* pw_loop_ = nullptr; + pw_thread_loop* pw_main_loop_ = nullptr; +- PipeWireType* pw_type_ = nullptr; + ++ spa_hook spa_core_listener_ = {}; + spa_hook spa_stream_listener_ = {}; +- spa_hook spa_remote_listener_ = {}; + ++ pw_core_events pw_core_events_ = {}; + pw_stream_events pw_stream_events_ = {}; +- pw_remote_events pw_remote_events_ = {}; + +- spa_video_info_raw* spa_video_format_ = nullptr; ++ struct spa_video_info_raw spa_video_format_; + ++ guint32 pw_stream_node_id_ = 0; + gint32 pw_fd_ = -1; + + CaptureSourceType capture_source_type_ = +- BaseCapturerPipeWire::CaptureSourceType::Screen; ++ BaseCapturerPipeWire::CaptureSourceType::kAny; + + // <-- end of PipeWire types + +@@ -78,33 +78,37 @@ class BaseCapturerPipeWire : public Desk + guint sources_request_signal_id_ = 0; + guint start_request_signal_id_ = 0; + ++ bool video_crop_size_initialized_ = false; ++ DesktopSize video_crop_size_;; + DesktopSize desktop_size_ = {}; + DesktopCaptureOptions options_ = {}; + +- uint8_t* current_frame_ = nullptr; ++ std::unique_ptr current_frame_; + Callback* callback_ = nullptr; + + bool portal_init_failed_ = false; + + void InitPortal(); + void InitPipeWire(); +- void InitPipeWireTypes(); + +- void CreateReceivingStream(); ++ pw_stream* CreateReceivingStream(); + void HandleBuffer(pw_buffer* buffer); + + void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size); + +- static void OnStateChanged(void* data, +- pw_remote_state old_state, +- pw_remote_state state, +- const char* error); ++ static void SyncDmaBuf(int fd, uint64_t start_or_end); ++ static void OnCoreError(void *data, ++ uint32_t id, ++ int seq, ++ int res, ++ const char *message); ++ static void OnStreamParamChanged(void *data, ++ uint32_t id, ++ const struct spa_pod *format); + static void OnStreamStateChanged(void* data, + pw_stream_state old_state, + pw_stream_state state, + const char* error_message); +- +- static void OnStreamFormatChanged(void* data, const struct spa_pod* format); + static void OnStreamProcess(void* data); + static void OnNewBuffer(void* data, uint32_t id); + +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:53:57.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc 2020-07-28 10:06:59.501481508 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + ScreenCapturerPipeWire::ScreenCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {} + ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {} + + // static +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:54:18.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc 2020-07-28 10:06:59.501481508 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + WindowCapturerPipeWire::WindowCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {} + WindowCapturerPipeWire::~WindowCapturerPipeWire() {} + + // static +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 2020-07-20 22:54:40.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2020-07-28 10:06:59.501481508 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return ScreenCapturerPipeWire::CreateRawScreenCapturer(options); ++ return BaseCapturerPipeWire::CreateRawScreenCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 2020-07-20 22:53:32.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2020-07-28 10:06:59.501481508 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return WindowCapturerPipeWire::CreateRawWindowCapturer(options); ++ return BaseCapturerPipeWire::CreateRawWindowCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + diff --git a/firefox-search-provider.ini b/firefox-search-provider.ini new file mode 100644 index 0000000000000000000000000000000000000000..3868e3d528d3cf72c26a69a912d789c2b865a7db --- /dev/null +++ b/firefox-search-provider.ini @@ -0,0 +1,5 @@ +[Shell Search Provider] +DesktopId=firefox.desktop +BusName=org.mozilla.Firefox.SearchProvider +ObjectPath=/org/mozilla/Firefox/SearchProvider +Version=2 diff --git a/firefox-symbolic.svg b/firefox-symbolic.svg new file mode 100644 index 0000000000000000000000000000000000000000..2078eea40b69f9284c0861316e367478ac1d8737 --- /dev/null +++ b/firefox-symbolic.svg @@ -0,0 +1,64 @@ + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + + Gnome Symbolic Icon Theme + + diff --git a/firefox-vaapi-extra-frames.patch b/firefox-vaapi-extra-frames.patch new file mode 100644 index 0000000000000000000000000000000000000000..c2ed7a208dbe66b7de308b4325cfbdb3ecee215c --- /dev/null +++ b/firefox-vaapi-extra-frames.patch @@ -0,0 +1,14 @@ +diff -up firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.old firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +--- firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.old 2020-05-13 14:28:26.556800474 +0200 ++++ firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp 2020-05-13 14:28:31.562768959 +0200 +@@ -43,7 +43,7 @@ typedef int VAStatus; + #endif + + // Use some extra HW frames for potential rendering lags. +-#define EXTRA_HW_FRAMES 6 ++#define EXTRA_HW_FRAMES 20 + + typedef mozilla::layers::Image Image; + typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage; +diff -up firefox-76.0.1/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-76.0.1/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium +diff -up firefox-76.0.1/media/webrtc/trunk/Makefile.old firefox-76.0.1/media/webrtc/trunk/Makefile diff --git a/firefox-wayland.desktop b/firefox-wayland.desktop index 12669c5916ab60369c1e41e2dda31211fc468cb5..cd2dd61c24685759fa9e87f7dd24a598c8ace8ab 100644 --- a/firefox-wayland.desktop +++ b/firefox-wayland.desktop @@ -11,7 +11,7 @@ MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xm StartupNotify=true Categories=Network;WebBrowser; Keywords=web;browser;internet; -Actions=new-window;new-private-window; +Actions=new-window;new-private-window;profile-manager-window; [Desktop Action new-window] Name=Open a New Window @@ -24,8 +24,8 @@ Name[ast]=Ventana nueva Name[az]=Yeni Pəncərə Name[be]=Новае акно Name[bg]=Нов прозорец -Name[bn-BD]=নতুন উইন্ডো (N) -Name[bn-IN]=নতুন উইন্ডো +Name[bn_BD]=নতুন উইন্ডো (N) +Name[bn_IN]=নতুন উইন্ডো Name[br]=Prenestr nevez Name[brx]=गोदान उइन्ड'(N) Name[bs]=Novi prozor @@ -37,37 +37,37 @@ Name[da]=Nyt vindue Name[de]=Neues Fenster Name[dsb]=Nowe wokno Name[el]=Νέο παράθυρο -Name[en-GB]=New Window -Name[en-US]=New Window -Name[en-ZA]=New Window +Name[en_GB]=New Window +Name[en_US]=New Window +Name[en_ZA]=New Window Name[eo]=Nova fenestro -Name[es-AR]=Nueva ventana -Name[es-CL]=Nueva ventana -Name[es-ES]=Nueva ventana -Name[es-MX]=Nueva ventana +Name[es_AR]=Nueva ventana +Name[es_CL]=Nueva ventana +Name[es_ES]=Nueva ventana +Name[es_MX]=Nueva ventana Name[et]=Uus aken Name[eu]=Leiho berria Name[fa]=پنجره جدید‌ Name[ff]=Henorde Hesere Name[fi]=Uusi ikkuna Name[fr]=Nouvelle fenêtre -Name[fy-NL]=Nij finster -Name[ga-IE]=Fuinneog Nua +Name[fy_NL]=Nij finster +Name[ga_IE]=Fuinneog Nua Name[gd]=Uinneag ùr Name[gl]=Nova xanela Name[gn]=Ovetã pyahu -Name[gu-IN]=નવી વિન્ડો +Name[gu_IN]=નવી વિન્ડો Name[he]=חלון חדש -Name[hi-IN]=नया विंडो +Name[hi_IN]=नया विंडो Name[hr]=Novi prozor Name[hsb]=Nowe wokno Name[hu]=Új ablak -Name[hy-AM]=Նոր Պատուհան +Name[hy_AM]=Նոր Պատուհան Name[id]=Jendela Baru Name[is]=Nýr gluggi Name[it]=Nuova finestra Name[ja]=新しいウィンドウ -Name[ja-JP-mac]=新規ウインドウ +Name[ja_JP-mac]=新規ウインドウ Name[ka]=ახალი ფანჯარა Name[kk]=Жаңа терезе Name[km]=បង្អួច​​​ថ្មី @@ -86,15 +86,15 @@ Name[ml]=പുതിയ ജാലകം Name[mr]=नवीन पटल Name[ms]=Tetingkap Baru Name[my]=ဝင်းဒိုးအသစ် -Name[nb-NO]=Nytt vindu -Name[ne-NP]=नयाँ सञ्झ्याल +Name[nb_NO]=Nytt vindu +Name[ne_NP]=नयाँ सञ्झ्याल Name[nl]=Nieuw venster -Name[nn-NO]=Nytt vindauge +Name[nn_NO]=Nytt vindauge Name[or]=ନୂତନ ୱିଣ୍ଡୋ -Name[pa-IN]=ਨਵੀਂ ਵਿੰਡੋ +Name[pa_IN]=ਨਵੀਂ ਵਿੰਡੋ Name[pl]=Nowe okno -Name[pt-BR]=Nova janela -Name[pt-PT]=Nova janela +Name[pt_BR]=Nova janela +Name[pt_PT]=Nova janela Name[rm]=Nova fanestra Name[ro]=Fereastră nouă Name[ru]=Новое окно @@ -105,7 +105,7 @@ Name[sl]=Novo okno Name[son]=Zanfun taaga Name[sq]=Dritare e Re Name[sr]=Нови прозор -Name[sv-SE]=Nytt fönster +Name[sv_SE]=Nytt fönster Name[ta]=புதிய சாளரம் Name[te]=కొత్త విండో Name[th]=หน้าต่างใหม่ @@ -117,8 +117,8 @@ Name[uz]=Yangi oyna Name[vi]=Cửa sổ mới Name[wo]=Palanteer bu bees Name[xh]=Ifestile entsha -Name[zh-CN]=新建窗口 -Name[zh-TW]=開新視窗 +Name[zh_CN]=新建窗口 +Name[zh_TW]=開新視窗 Exec=firefox-wayland --name firefox-wayland --new-window %u [Desktop Action new-private-window] @@ -132,8 +132,8 @@ Name[ast]=Ventana privada nueva Name[az]=Yeni Məxfi Pəncərə Name[be]=Новае акно адасаблення Name[bg]=Нов прозорец за поверително сърфиране -Name[bn-BD]=নতুন ব্যক্তিগত উইন্ডো -Name[bn-IN]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_BD]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_IN]=নতুন ব্যক্তিগত উইন্ডো Name[br]=Prenestr merdeiñ prevez nevez Name[brx]=गोदान प्राइभेट उइन्ड' Name[bs]=Novi privatni prozor @@ -145,37 +145,37 @@ Name[da]=Nyt privat vindue Name[de]=Neues privates Fenster Name[dsb]=Nowe priwatne wokno Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης -Name[en-GB]=New Private Window -Name[en-US]=New Private Window -Name[en-ZA]=New Private Window +Name[en_GB]=New Private Window +Name[en_US]=New Private Window +Name[en_ZA]=New Private Window Name[eo]=Nova privata fenestro -Name[es-AR]=Nueva ventana privada -Name[es-CL]=Nueva ventana privada -Name[es-ES]=Nueva ventana privada -Name[es-MX]=Nueva ventana privada +Name[es_AR]=Nueva ventana privada +Name[es_CL]=Nueva ventana privada +Name[es_ES]=Nueva ventana privada +Name[es_MX]=Nueva ventana privada Name[et]=Uus privaatne aken Name[eu]=Leiho pribatu berria Name[fa]=پنجره ناشناس جدید Name[ff]=Henorde Suturo Hesere Name[fi]=Uusi yksityinen ikkuna Name[fr]=Nouvelle fenêtre de navigation privée -Name[fy-NL]=Nij priveefinster -Name[ga-IE]=Fuinneog Nua Phríobháideach +Name[fy_NL]=Nij priveefinster +Name[ga_IE]=Fuinneog Nua Phríobháideach Name[gd]=Uinneag phrìobhaideach ùr Name[gl]=Nova xanela privada Name[gn]=Ovetã ñemi pyahu -Name[gu-IN]=નવી ખાનગી વિન્ડો +Name[gu_IN]=નવી ખાનગી વિન્ડો Name[he]=חלון פרטי חדש -Name[hi-IN]=नयी निजी विंडो +Name[hi_IN]=नयी निजी विंडो Name[hr]=Novi privatni prozor Name[hsb]=Nowe priwatne wokno Name[hu]=Új privát ablak -Name[hy-AM]=Սկսել Գաղտնի դիտարկում +Name[hy_AM]=Սկսել Գաղտնի դիտարկում Name[id]=Jendela Mode Pribadi Baru Name[is]=Nýr huliðsgluggi Name[it]=Nuova finestra anonima Name[ja]=新しいプライベートウィンドウ -Name[ja-JP-mac]=新規プライベートウインドウ +Name[ja_JP-mac]=新規プライベートウインドウ Name[ka]=ახალი პირადი ფანჯარა Name[kk]=Жаңа жекелік терезе Name[km]=បង្អួច​ឯកជន​ថ្មី @@ -194,15 +194,15 @@ Name[ml]=പുതിയ സ്വകാര്യ ജാലകം Name[mr]=नवीन वैयक्तिक पटल Name[ms]=Tetingkap Persendirian Baharu Name[my]=New Private Window -Name[nb-NO]=Nytt privat vindu -Name[ne-NP]=नयाँ निजी सञ्झ्याल +Name[nb_NO]=Nytt privat vindu +Name[ne_NP]=नयाँ निजी सञ्झ्याल Name[nl]=Nieuw privévenster -Name[nn-NO]=Nytt privat vindauge +Name[nn_NO]=Nytt privat vindauge Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ -Name[pa-IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ +Name[pa_IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ Name[pl]=Nowe okno prywatne -Name[pt-BR]=Nova janela privativa -Name[pt-PT]=Nova janela privada +Name[pt_BR]=Nova janela privativa +Name[pt_PT]=Nova janela privada Name[rm]=Nova fanestra privata Name[ro]=Fereastră privată nouă Name[ru]=Новое приватное окно @@ -213,7 +213,7 @@ Name[sl]=Novo zasebno okno Name[son]=Sutura zanfun taaga Name[sq]=Dritare e Re Private Name[sr]=Нови приватан прозор -Name[sv-SE]=Nytt privat fönster +Name[sv_SE]=Nytt privat fönster Name[ta]=புதிய தனிப்பட்ட சாளரம் Name[te]=కొత్త ఆంతరంగిక విండో Name[th]=หน้าต่างส่วนตัวใหม่ @@ -225,7 +225,11 @@ Name[uz]=Yangi maxfiy oyna Name[vi]=Cửa sổ riêng tư mới Name[wo]=Panlanteeru biir bu bees Name[xh]=Ifestile yangasese entsha -Name[zh-CN]=新建隐私浏览窗口 -Name[zh-TW]=新增隱私視窗 +Name[zh_CN]=新建隐私浏览窗口 +Name[zh_TW]=新增隱私視窗 Exec=firefox-wayland --private-window --name firefox-wayland %u +[Desktop Action profile-manager-window] +Name=Open the Profile Manager +Name[cs]=Správa profilů +Exec=firefox-wayland --name firefox-wayland --ProfileManager diff --git a/firefox-wayland.sh.in b/firefox-wayland.sh.in index 64a1c868e86089f41a33dbbb3fdccbc3f9cc5f89..bd6806824f22e5d5675583567e0cab2bb433ca3e 100644 --- a/firefox-wayland.sh.in +++ b/firefox-wayland.sh.in @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/bash # # Run Firefox under Wayland # -export GDK_BACKEND=wayland -exec /usr/bin/firefox "$@" +export MOZ_ENABLE_WAYLAND=1 +exec /__PREFIX__/bin/firefox "$@" diff --git a/firefox-x11.desktop b/firefox-x11.desktop new file mode 100644 index 0000000000000000000000000000000000000000..4124891dbae320a4cb9fd103dbc43f60602de580 --- /dev/null +++ b/firefox-x11.desktop @@ -0,0 +1,235 @@ +[Desktop Entry] +Version=1.0 +Name=Firefox on X11 +GenericName=Web Browser +Comment=Browse the Web +Exec=firefox-x11 --name firefox-x11 %u +Icon=firefox +Terminal=false +Type=Application +MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; +StartupNotify=true +Categories=Network;WebBrowser; +Keywords=web;browser;internet; +Actions=new-window;new-private-window;profile-manager-window; + +[Desktop Action new-window] +Name=Open a New Window +Name[ach]=Dirica manyen +Name[af]=Nuwe venster +Name[an]=Nueva finestra +Name[ar]=نافذة جديدة +Name[as]=নতুন উইন্ডো +Name[ast]=Ventana nueva +Name[az]=Yeni Pəncərə +Name[be]=Новае акно +Name[bg]=Нов прозорец +Name[bn_BD]=নতুন উইন্ডো (N) +Name[bn_IN]=নতুন উইন্ডো +Name[br]=Prenestr nevez +Name[brx]=गोदान उइन्ड'(N) +Name[bs]=Novi prozor +Name[ca]=Finestra nova +Name[cak]=K'ak'a' tzuwäch +Name[cs]=Nové okno +Name[cy]=Ffenestr Newydd +Name[da]=Nyt vindue +Name[de]=Neues Fenster +Name[dsb]=Nowe wokno +Name[el]=Νέο παράθυρο +Name[en_GB]=New Window +Name[en_US]=New Window +Name[en_ZA]=New Window +Name[eo]=Nova fenestro +Name[es_AR]=Nueva ventana +Name[es_CL]=Nueva ventana +Name[es_ES]=Nueva ventana +Name[es_MX]=Nueva ventana +Name[et]=Uus aken +Name[eu]=Leiho berria +Name[fa]=پنجره جدید‌ +Name[ff]=Henorde Hesere +Name[fi]=Uusi ikkuna +Name[fr]=Nouvelle fenêtre +Name[fy_NL]=Nij finster +Name[ga_IE]=Fuinneog Nua +Name[gd]=Uinneag ùr +Name[gl]=Nova xanela +Name[gn]=Ovetã pyahu +Name[gu_IN]=નવી વિન્ડો +Name[he]=חלון חדש +Name[hi_IN]=नया विंडो +Name[hr]=Novi prozor +Name[hsb]=Nowe wokno +Name[hu]=Új ablak +Name[hy_AM]=Նոր Պատուհան +Name[id]=Jendela Baru +Name[is]=Nýr gluggi +Name[it]=Nuova finestra +Name[ja]=新しいウィンドウ +Name[ja_JP-mac]=新規ウインドウ +Name[ka]=ახალი ფანჯარა +Name[kk]=Жаңа терезе +Name[km]=បង្អួច​​​ថ្មី +Name[kn]=ಹೊಸ ಕಿಟಕಿ +Name[ko]=새 창 +Name[kok]=नवें जनेल +Name[ks]=نئئ وِنڈو +Name[lij]=Neuvo barcon +Name[lo]=ຫນ້າຕ່າງໃຫມ່ +Name[lt]=Naujas langas +Name[ltg]=Jauns lūgs +Name[lv]=Jauns logs +Name[mai]=नव विंडो +Name[mk]=Нов прозорец +Name[ml]=പുതിയ ജാലകം +Name[mr]=नवीन पटल +Name[ms]=Tetingkap Baru +Name[my]=ဝင်းဒိုးအသစ် +Name[nb_NO]=Nytt vindu +Name[ne_NP]=नयाँ सञ्झ्याल +Name[nl]=Nieuw venster +Name[nn_NO]=Nytt vindauge +Name[or]=ନୂତନ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਵਿੰਡੋ +Name[pl]=Nowe okno +Name[pt_BR]=Nova janela +Name[pt_PT]=Nova janela +Name[rm]=Nova fanestra +Name[ro]=Fereastră nouă +Name[ru]=Новое окно +Name[sat]=नावा विंडो (N) +Name[si]=නව කවුළුවක් +Name[sk]=Nové okno +Name[sl]=Novo okno +Name[son]=Zanfun taaga +Name[sq]=Dritare e Re +Name[sr]=Нови прозор +Name[sv_SE]=Nytt fönster +Name[ta]=புதிய சாளரம் +Name[te]=కొత్త విండో +Name[th]=หน้าต่างใหม่ +Name[tr]=Yeni pencere +Name[tsz]=Eraatarakua jimpani +Name[uk]=Нове вікно +Name[ur]=نیا دریچہ +Name[uz]=Yangi oyna +Name[vi]=Cửa sổ mới +Name[wo]=Palanteer bu bees +Name[xh]=Ifestile entsha +Name[zh_CN]=新建窗口 +Name[zh_TW]=開新視窗 +Exec=firefox-x11 --name firefox-x11 --new-window %u + +[Desktop Action new-private-window] +Name=Open a New Private Window +Name[ach]=Dirica manyen me mung +Name[af]=Nuwe privaatvenster +Name[an]=Nueva finestra privada +Name[ar]=نافذة خاصة جديدة +Name[as]=নতুন ব্যক্তিগত উইন্ডো +Name[ast]=Ventana privada nueva +Name[az]=Yeni Məxfi Pəncərə +Name[be]=Новае акно адасаблення +Name[bg]=Нов прозорец за поверително сърфиране +Name[bn_BD]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_IN]=নতুন ব্যক্তিগত উইন্ডো +Name[br]=Prenestr merdeiñ prevez nevez +Name[brx]=गोदान प्राइभेट उइन्ड' +Name[bs]=Novi privatni prozor +Name[ca]=Finestra privada nova +Name[cak]=K'ak'a' ichinan tzuwäch +Name[cs]=Nové anonymní okno +Name[cy]=Ffenestr Breifat Newydd +Name[da]=Nyt privat vindue +Name[de]=Neues privates Fenster +Name[dsb]=Nowe priwatne wokno +Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης +Name[en_GB]=New Private Window +Name[en_US]=New Private Window +Name[en_ZA]=New Private Window +Name[eo]=Nova privata fenestro +Name[es_AR]=Nueva ventana privada +Name[es_CL]=Nueva ventana privada +Name[es_ES]=Nueva ventana privada +Name[es_MX]=Nueva ventana privada +Name[et]=Uus privaatne aken +Name[eu]=Leiho pribatu berria +Name[fa]=پنجره ناشناس جدید +Name[ff]=Henorde Suturo Hesere +Name[fi]=Uusi yksityinen ikkuna +Name[fr]=Nouvelle fenêtre de navigation privée +Name[fy_NL]=Nij priveefinster +Name[ga_IE]=Fuinneog Nua Phríobháideach +Name[gd]=Uinneag phrìobhaideach ùr +Name[gl]=Nova xanela privada +Name[gn]=Ovetã ñemi pyahu +Name[gu_IN]=નવી ખાનગી વિન્ડો +Name[he]=חלון פרטי חדש +Name[hi_IN]=नयी निजी विंडो +Name[hr]=Novi privatni prozor +Name[hsb]=Nowe priwatne wokno +Name[hu]=Új privát ablak +Name[hy_AM]=Սկսել Գաղտնի դիտարկում +Name[id]=Jendela Mode Pribadi Baru +Name[is]=Nýr huliðsgluggi +Name[it]=Nuova finestra anonima +Name[ja]=新しいプライベートウィンドウ +Name[ja_JP-mac]=新規プライベートウインドウ +Name[ka]=ახალი პირადი ფანჯარა +Name[kk]=Жаңа жекелік терезе +Name[km]=បង្អួច​ឯកជន​ថ្មី +Name[kn]=ಹೊಸ ಖಾಸಗಿ ಕಿಟಕಿ +Name[ko]=새 사생활 보호 모드 +Name[kok]=नवो खाजगी विंडो +Name[ks]=نْو پرایوٹ وینڈو& +Name[lij]=Neuvo barcon privou +Name[lo]=ເປີດຫນ້າຕ່າງສວນຕົວຂື້ນມາໃຫມ່ +Name[lt]=Naujas privataus naršymo langas +Name[ltg]=Jauns privatais lūgs +Name[lv]=Jauns privātais logs +Name[mai]=नया निज विंडो (W) +Name[mk]=Нов приватен прозорец +Name[ml]=പുതിയ സ്വകാര്യ ജാലകം +Name[mr]=नवीन वैयक्तिक पटल +Name[ms]=Tetingkap Persendirian Baharu +Name[my]=New Private Window +Name[nb_NO]=Nytt privat vindu +Name[ne_NP]=नयाँ निजी सञ्झ्याल +Name[nl]=Nieuw privévenster +Name[nn_NO]=Nytt privat vindauge +Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ +Name[pl]=Nowe okno prywatne +Name[pt_BR]=Nova janela privativa +Name[pt_PT]=Nova janela privada +Name[rm]=Nova fanestra privata +Name[ro]=Fereastră privată nouă +Name[ru]=Новое приватное окно +Name[sat]=नावा निजेराक् विंडो (W ) +Name[si]=නව පුද්ගලික කවුළුව (W) +Name[sk]=Nové okno v režime Súkromné prehliadanie +Name[sl]=Novo zasebno okno +Name[son]=Sutura zanfun taaga +Name[sq]=Dritare e Re Private +Name[sr]=Нови приватан прозор +Name[sv_SE]=Nytt privat fönster +Name[ta]=புதிய தனிப்பட்ட சாளரம் +Name[te]=కొత్త ఆంతరంగిక విండో +Name[th]=หน้าต่างส่วนตัวใหม่ +Name[tr]=Yeni gizli pencere +Name[tsz]=Juchiiti eraatarakua jimpani +Name[uk]=Приватне вікно +Name[ur]=نیا نجی دریچہ +Name[uz]=Yangi maxfiy oyna +Name[vi]=Cửa sổ riêng tư mới +Name[wo]=Panlanteeru biir bu bees +Name[xh]=Ifestile yangasese entsha +Name[zh_CN]=新建隐私浏览窗口 +Name[zh_TW]=新增隱私視窗 +Exec=firefox-x11 --private-window --name firefox-x11 %u + +[Desktop Action profile-manager-window] +Name=Open the Profile Manager +Name[cs]=Správa profilů +Exec=firefox-x11 --name firefox-x11 --ProfileManager diff --git a/firefox-x11.sh.in b/firefox-x11.sh.in new file mode 100644 index 0000000000000000000000000000000000000000..94045c9c6e19d9d6931a6a59ac434ad950a1e5c9 --- /dev/null +++ b/firefox-x11.sh.in @@ -0,0 +1,7 @@ +#!/usr/bin/bash +# +# Run Firefox on X11 backend +# + +export MOZ_DISABLE_WAYLAND=1 +exec /__PREFIX__/bin/firefox "$@" diff --git a/firefox.1 b/firefox.1 index 4311322ec375d80a552bedb3fa84038620612db9..556cf07eef0947eddbd3326d7d363c540520cc64 100644 --- a/firefox.1 +++ b/firefox.1 @@ -60,7 +60,7 @@ Open new instance, not a new window in running instance. \fB\-\-UILocale\fR \fIlocale\fR Start with \fIlocale\fR resources as UI Locale. .TP -\fB\-\-save\-mode\fR +\fB\-\-safe\-mode\fR Disables extensions and themes for this session. .TP \fB\-\-headless\fR diff --git a/firefox.appdata.xml.in b/firefox.appdata.xml.in new file mode 100644 index 0000000000000000000000000000000000000000..75b00f4477a85b4f166b3fb68da2e76d19f613f5 --- /dev/null +++ b/firefox.appdata.xml.in @@ -0,0 +1,53 @@ + + + + firefox.desktop + CC0-1.0 + Firefox + Web Browser + Navegador web + Webový prohlížeč + Navegador web + مرورگر اینترنتی + WWW-selain + Navigateur Web + Webböngésző + Browser Web + ウェブ・ブラウザ + 웹 브라우저 + Nettleser + Webbrowser + Nettlesar + Nettleser + Przeglądarka WWW + Navegador Web + Navegador Web + Internetový prehliadač + Webbläsare + +

+ Bringing together all kinds of awesomeness to make browsing better for you. + Get to your favorite sites quickly – even if you don’t remember the URLs. + Type your term into the location bar (aka the Awesome Bar) and the autocomplete + function will include possible matches from your browsing history, bookmarked + sites and open tabs. +

+
+ https://www.mozilla.org + + ModernToolkit + SearchProvider + + Mozilla + GPL-3.0+ + Mozilla Corporation + https://bugzilla.mozilla.org/ + https://support.mozilla.org/ + firefox + + firefox.desktop + + + + +
diff --git a/firefox.desktop b/firefox.desktop index 89fa082fac912948df8a6133e7e612b067152b8f..35c2c4841003a7821d891713933b44fc9cb91500 100644 --- a/firefox.desktop +++ b/firefox.desktop @@ -37,7 +37,7 @@ Comment[nb]=Surf på nettet Comment[nl]=Verken het internet Comment[nn]=Surf på nettet Comment[no]=Surf på nettet -Comment[pl]=Przeglądanie stron WWW +Comment[pl]=Przeglądanie stron WWW Comment[pt]=Navegue na Internet Comment[pt_BR]=Navegue na Internet Comment[sk]=Prehliadanie internetu @@ -50,7 +50,7 @@ MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xm StartupNotify=true Categories=Network;WebBrowser; Keywords=web;browser;internet; -Actions=new-window;new-private-window; +Actions=new-window;new-private-window;profile-manager-window; [Desktop Action new-window] Name=Open a New Window @@ -63,8 +63,8 @@ Name[ast]=Ventana nueva Name[az]=Yeni Pəncərə Name[be]=Новае акно Name[bg]=Нов прозорец -Name[bn-BD]=নতুন উইন্ডো (N) -Name[bn-IN]=নতুন উইন্ডো +Name[bn_BD]=নতুন উইন্ডো (N) +Name[bn_IN]=নতুন উইন্ডো Name[br]=Prenestr nevez Name[brx]=गोदान उइन्ड'(N) Name[bs]=Novi prozor @@ -76,37 +76,37 @@ Name[da]=Nyt vindue Name[de]=Neues Fenster Name[dsb]=Nowe wokno Name[el]=Νέο παράθυρο -Name[en-GB]=New Window -Name[en-US]=New Window -Name[en-ZA]=New Window +Name[en_GB]=New Window +Name[en_US]=New Window +Name[en_ZA]=New Window Name[eo]=Nova fenestro -Name[es-AR]=Nueva ventana -Name[es-CL]=Nueva ventana -Name[es-ES]=Nueva ventana -Name[es-MX]=Nueva ventana +Name[es_AR]=Nueva ventana +Name[es_CL]=Nueva ventana +Name[es_ES]=Nueva ventana +Name[es_MX]=Nueva ventana Name[et]=Uus aken Name[eu]=Leiho berria Name[fa]=پنجره جدید‌ Name[ff]=Henorde Hesere Name[fi]=Uusi ikkuna Name[fr]=Nouvelle fenêtre -Name[fy-NL]=Nij finster -Name[ga-IE]=Fuinneog Nua +Name[fy_NL]=Nij finster +Name[ga_IE]=Fuinneog Nua Name[gd]=Uinneag ùr Name[gl]=Nova xanela Name[gn]=Ovetã pyahu -Name[gu-IN]=નવી વિન્ડો +Name[gu_IN]=નવી વિન્ડો Name[he]=חלון חדש -Name[hi-IN]=नया विंडो +Name[hi_IN]=नया विंडो Name[hr]=Novi prozor Name[hsb]=Nowe wokno Name[hu]=Új ablak -Name[hy-AM]=Նոր Պատուհան +Name[hy_AM]=Նոր Պատուհան Name[id]=Jendela Baru Name[is]=Nýr gluggi Name[it]=Nuova finestra Name[ja]=新しいウィンドウ -Name[ja-JP-mac]=新規ウインドウ +Name[ja_JP-mac]=新規ウインドウ Name[ka]=ახალი ფანჯარა Name[kk]=Жаңа терезе Name[km]=បង្អួច​​​ថ្មី @@ -125,15 +125,15 @@ Name[ml]=പുതിയ ജാലകം Name[mr]=नवीन पटल Name[ms]=Tetingkap Baru Name[my]=ဝင်းဒိုးအသစ် -Name[nb-NO]=Nytt vindu -Name[ne-NP]=नयाँ सञ्झ्याल +Name[nb_NO]=Nytt vindu +Name[ne_NP]=नयाँ सञ्झ्याल Name[nl]=Nieuw venster -Name[nn-NO]=Nytt vindauge +Name[nn_NO]=Nytt vindauge Name[or]=ନୂତନ ୱିଣ୍ଡୋ -Name[pa-IN]=ਨਵੀਂ ਵਿੰਡੋ +Name[pa_IN]=ਨਵੀਂ ਵਿੰਡੋ Name[pl]=Nowe okno -Name[pt-BR]=Nova janela -Name[pt-PT]=Nova janela +Name[pt_BR]=Nova janela +Name[pt_PT]=Nova janela Name[rm]=Nova fanestra Name[ro]=Fereastră nouă Name[ru]=Новое окно @@ -144,7 +144,7 @@ Name[sl]=Novo okno Name[son]=Zanfun taaga Name[sq]=Dritare e Re Name[sr]=Нови прозор -Name[sv-SE]=Nytt fönster +Name[sv_SE]=Nytt fönster Name[ta]=புதிய சாளரம் Name[te]=కొత్త విండో Name[th]=หน้าต่างใหม่ @@ -156,10 +156,8 @@ Name[uz]=Yangi oyna Name[vi]=Cửa sổ mới Name[wo]=Palanteer bu bees Name[xh]=Ifestile entsha -Name[zh-CN]=新建窗口 -Name[zh-TW]=開新視窗 - - +Name[zh_CN]=新建窗口 +Name[zh_TW]=開新視窗 Exec=firefox --new-window %u [Desktop Action new-private-window] @@ -173,8 +171,8 @@ Name[ast]=Ventana privada nueva Name[az]=Yeni Məxfi Pəncərə Name[be]=Новае акно адасаблення Name[bg]=Нов прозорец за поверително сърфиране -Name[bn-BD]=নতুন ব্যক্তিগত উইন্ডো -Name[bn-IN]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_BD]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_IN]=নতুন ব্যক্তিগত উইন্ডো Name[br]=Prenestr merdeiñ prevez nevez Name[brx]=गोदान प्राइभेट उइन्ड' Name[bs]=Novi privatni prozor @@ -186,37 +184,37 @@ Name[da]=Nyt privat vindue Name[de]=Neues privates Fenster Name[dsb]=Nowe priwatne wokno Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης -Name[en-GB]=New Private Window -Name[en-US]=New Private Window -Name[en-ZA]=New Private Window +Name[en_GB]=New Private Window +Name[en_US]=New Private Window +Name[en_ZA]=New Private Window Name[eo]=Nova privata fenestro -Name[es-AR]=Nueva ventana privada -Name[es-CL]=Nueva ventana privada -Name[es-ES]=Nueva ventana privada -Name[es-MX]=Nueva ventana privada +Name[es_AR]=Nueva ventana privada +Name[es_CL]=Nueva ventana privada +Name[es_ES]=Nueva ventana privada +Name[es_MX]=Nueva ventana privada Name[et]=Uus privaatne aken Name[eu]=Leiho pribatu berria Name[fa]=پنجره ناشناس جدید Name[ff]=Henorde Suturo Hesere Name[fi]=Uusi yksityinen ikkuna Name[fr]=Nouvelle fenêtre de navigation privée -Name[fy-NL]=Nij priveefinster -Name[ga-IE]=Fuinneog Nua Phríobháideach +Name[fy_NL]=Nij priveefinster +Name[ga_IE]=Fuinneog Nua Phríobháideach Name[gd]=Uinneag phrìobhaideach ùr Name[gl]=Nova xanela privada Name[gn]=Ovetã ñemi pyahu -Name[gu-IN]=નવી ખાનગી વિન્ડો +Name[gu_IN]=નવી ખાનગી વિન્ડો Name[he]=חלון פרטי חדש -Name[hi-IN]=नयी निजी विंडो +Name[hi_IN]=नयी निजी विंडो Name[hr]=Novi privatni prozor Name[hsb]=Nowe priwatne wokno Name[hu]=Új privát ablak -Name[hy-AM]=Սկսել Գաղտնի դիտարկում +Name[hy_AM]=Սկսել Գաղտնի դիտարկում Name[id]=Jendela Mode Pribadi Baru Name[is]=Nýr huliðsgluggi Name[it]=Nuova finestra anonima Name[ja]=新しいプライベートウィンドウ -Name[ja-JP-mac]=新規プライベートウインドウ +Name[ja_JP-mac]=新規プライベートウインドウ Name[ka]=ახალი პირადი ფანჯარა Name[kk]=Жаңа жекелік терезе Name[km]=បង្អួច​ឯកជន​ថ្មី @@ -235,15 +233,15 @@ Name[ml]=പുതിയ സ്വകാര്യ ജാലകം Name[mr]=नवीन वैयक्तिक पटल Name[ms]=Tetingkap Persendirian Baharu Name[my]=New Private Window -Name[nb-NO]=Nytt privat vindu -Name[ne-NP]=नयाँ निजी सञ्झ्याल +Name[nb_NO]=Nytt privat vindu +Name[ne_NP]=नयाँ निजी सञ्झ्याल Name[nl]=Nieuw privévenster -Name[nn-NO]=Nytt privat vindauge +Name[nn_NO]=Nytt privat vindauge Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ -Name[pa-IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ +Name[pa_IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ Name[pl]=Nowe okno prywatne -Name[pt-BR]=Nova janela privativa -Name[pt-PT]=Nova janela privada +Name[pt_BR]=Nova janela privativa +Name[pt_PT]=Nova janela privada Name[rm]=Nova fanestra privata Name[ro]=Fereastră privată nouă Name[ru]=Новое приватное окно @@ -254,7 +252,7 @@ Name[sl]=Novo zasebno okno Name[son]=Sutura zanfun taaga Name[sq]=Dritare e Re Private Name[sr]=Нови приватан прозор -Name[sv-SE]=Nytt privat fönster +Name[sv_SE]=Nytt privat fönster Name[ta]=புதிய தனிப்பட்ட சாளரம் Name[te]=కొత్త ఆంతరంగిక విండో Name[th]=หน้าต่างส่วนตัวใหม่ @@ -266,7 +264,11 @@ Name[uz]=Yangi maxfiy oyna Name[vi]=Cửa sổ riêng tư mới Name[wo]=Panlanteeru biir bu bees Name[xh]=Ifestile yangasese entsha -Name[zh-CN]=新建隐私浏览窗口 -Name[zh-TW]=新增隱私視窗 +Name[zh_CN]=新建隐私浏览窗口 +Name[zh_TW]=新增隱私視窗 Exec=firefox --private-window %u +[Desktop Action profile-manager-window] +Name=Open the Profile Manager +Name[cs]=Správa profilů +Exec=firefox --ProfileManager diff --git a/firefox.js b/firefox.js index 441b1308dea12e6868e9c54d50c19a297553b5f4..6bed75edf3eb530550974bc818add3500a7336b0 100644 --- a/firefox.js +++ b/firefox.js @@ -1,2 +1,35 @@ +pref("app.update.auto", false); +pref("app.update.enabled", false); +pref("app.update.autoInstallEnabled", false); +pref("general.smoothScroll", true); +pref("intl.locale.matchOS", true); +pref("intl.locale.requested", ""); +pref("toolkit.storage.synchronous", 0); +pref("toolkit.networkmanager.disable", false); +pref("offline.autoDetect", true); +pref("browser.backspace_action", 2); +pref("browser.display.use_system_colors", true); +pref("browser.download.folderList", 1); +pref("browser.link.open_external", 3); +pref("browser.shell.checkDefaultBrowser", false); +pref("network.manage-offline-status", true); +pref("extensions.shownSelectionUI", true); +pref("ui.SpellCheckerUnderlineStyle", 1); +pref("startup.homepage_override_url", ""); pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=https://openeuler.org/zh/"); pref("browser.newtabpage.pinned", '[{"url":"https://openeuler.org/zh/","title":"Openeuler Project - Start Page"}]'); +pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%"); +pref("media.gmp-gmpopenh264.provider.enabled",false); +pref("media.gmp-gmpopenh264.autoupdate",false); +pref("media.gmp-gmpopenh264.enabled",false); +pref("media.gmp-gmpopenh264.enabled",false); +pref("plugins.notifyMissingFlash", false); +pref("layers.use-image-offscreen-surfaces", false); +/* Allow sending credetials to all https:// sites */ +pref("network.negotiate-auth.trusted-uris", "https://"); +pref("spellchecker.dictionary_path","/usr/share/myspell"); +/* Disable DoH by default */ +pref("network.trr.mode", 5); +/* Enable per-user policy dir */ +pref("browser.policies.perUserDir", true); +pref("browser.gnome-search-provider.enabled",true); diff --git a/firefox.sh.in b/firefox.sh.in index f14956487f7a6244a908e81a6e31c849ba3a635a..bc00fe3cf368b81c333257abc636412539487119 100644 --- a/firefox.sh.in +++ b/firefox.sh.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/bash # # The contents of this file are subject to the Netscape Public # License Version 1.1 (the "License"); you may not use this file @@ -17,10 +17,10 @@ # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # -# Contributor(s): +# Contributor(s): # -## +## ## Usage: ## ## $ firefox @@ -39,12 +39,12 @@ cmdname=`basename $0` MOZ_ARCH=$(uname -m) case $MOZ_ARCH in x86_64 | s390x | sparc64) - MOZ_LIB_DIR="/usr/lib64" - SECONDARY_LIB_DIR="/usr/lib" + MOZ_LIB_DIR="/__PREFIX__/lib64" + SECONDARY_LIB_DIR="/__PREFIX__/lib" ;; * ) - MOZ_LIB_DIR="/usr/lib" - SECONDARY_LIB_DIR="/usr/lib64" + MOZ_LIB_DIR="/__PREFIX__/lib" + SECONDARY_LIB_DIR="/__PREFIX__/lib64" ;; esac @@ -66,11 +66,27 @@ MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-1 MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE" MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh" +## +## Enable Wayland backend? +## +if __DEFAULT_WAYLAND__ && ! [ $MOZ_DISABLE_WAYLAND ]; then + if [ "$XDG_CURRENT_DESKTOP" == "GNOME" ]; then + export MOZ_ENABLE_WAYLAND=1 + fi +fi + +## +## Use D-Bus remote exclusively when there's Wayland display. +## +if [ "$WAYLAND_DISPLAY" ]; then + export MOZ_DBUS_REMOTE=1 +fi + ## ## Set MOZ_GRE_CONF ## MOZ_GRE_CONF=/etc/gre.d/gre.conf -if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then +if [ "$MOZ_LIB_DIR" == "/__PREFIX__/lib64" ]; then MOZ_GRE_CONF=/etc/gre.d/gre64.conf fi export MOZ_GRE_CONF @@ -98,7 +114,7 @@ export MOZ_PLUGIN_PATH ## ## Set MOZ_APP_LAUNCHER for gnome-session ## -export MOZ_APP_LAUNCHER="/usr/bin/firefox" +export MOZ_APP_LAUNCHER="/__PREFIX__/bin/firefox" ## ## Set FONTCONFIG_PATH for Xft/fontconfig @@ -107,9 +123,9 @@ FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft" export FONTCONFIG_PATH ## -## In order to better support certain scripts (such as Indic and some CJK -## scripts), Fedora builds its Firefox, with permission from the Mozilla -## Corporation, with the Pango system as its text renderer. This change +## In order to better support certain scripts (such as Indic and some CJK +## scripts), openeuler builds its Firefox, with permission from the Mozilla +## Corporation, with the Pango system as its text renderer. This change ## may negatively impact performance on some pages. To disable the use of ## Pango, set MOZ_DISABLE_PANGO=1 in your environment before launching ## Firefox. @@ -148,30 +164,30 @@ export MOZ_USE_XINPUT2=1 # ## -## Automatically installed langpacks are tracked by .fedora-langpack-install +## Automatically installed langpacks are tracked by .openeuler-langpack-install ## config file. ## -FEDORA_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.fedora-langpack-install" +OPENEULER_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.openeuler-langpack-install" # MOZ_DISABLE_LANGPACKS disables language packs completely MOZILLA_DOWN=0 if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then if [ -x $MOZ_DIST_BIN/$MOZ_FIREFOX_FILE ]; then # Is firefox running? - /usr/bin/pidof firefox > /dev/null 2>&1 + /__PREFIX__/bin/pidof firefox > /dev/null 2>&1 MOZILLA_DOWN=$? fi fi -# Modify language pack configuration only when firefox is not running +# Modify language pack configuration only when firefox is not running # and language packs are not disabled if [ $MOZILLA_DOWN -ne 0 ]; then # Clear already installed langpacks mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR - if [ -f $FEDORA_LANGPACK_CONFIG ]; then - rm `cat $FEDORA_LANGPACK_CONFIG` > /dev/null 2>&1 - rm $FEDORA_LANGPACK_CONFIG > /dev/null 2>&1 + if [ -f $OPENEULER_LANGPACK_CONFIG ]; then + rm `cat $OPENEULER_LANGPACK_CONFIG` > /dev/null 2>&1 + rm $OPENEULER_LANGPACK_CONFIG > /dev/null 2>&1 # remove all empty langpacks dirs while they block installation of langpacks rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1 fi @@ -182,22 +198,22 @@ if [ $MOZILLA_DOWN -ne 0 ]; then CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG} # Try with a local variant first, then without a local variant - SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g"` - MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g"` + SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g" | sed "s|\..*||g"` + MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g" | sed "s|\..*||g"` function create_langpack_link() { local language=$* local langpack=langpack-${language}@firefox.mozilla.org.xpi if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack - # If the target file is a symlink (the fallback langpack), + # If the target file is a symlink (the fallback langpack), # install the original file instead of the fallback one if [ -h $MOZ_LANGPACKS_DIR/$langpack ]; then langpack=`readlink $MOZ_LANGPACKS_DIR/$langpack` fi ln -s $MOZ_LANGPACKS_DIR/$langpack \ $MOZ_EXTENSIONS_PROFILE_DIR/$langpack - echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $FEDORA_LANGPACK_CONFIG + echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $OPENEULER_LANGPACK_CONFIG return 0 fi return 1 @@ -239,9 +255,11 @@ do esac done -if ! [ "$GDK_BACKEND" ]; then - export GDK_BACKEND=x11 -fi +# Flatpak specific environment variables +%FLATPAK_ENV_VARS% + +# Don't throw "old profile" dialog box. +export MOZ_ALLOW_DOWNGRADE=1 # Run the browser debugging=0 @@ -250,5 +268,4 @@ then echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@" fi - exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@" diff --git a/firefox.spec b/firefox.spec index aad6d936056168886d2ff9e710cedeadcf3b1565..bcf9378dbf00322343b8dd495893731efa99adc8 100644 --- a/firefox.spec +++ b/firefox.spec @@ -1,201 +1,599 @@ -Name: firefox -Summary: Mozilla Firefox Web browser -Version: 62.0.3 -Release: 4 -URL: https://www.mozilla.org/firefox/ -License: MPLv1.1 or GPLv2+ or LGPLv2+ -Source0: http://download-origin.cdn.mozilla.net/pub/firefox/releases/62.0.3/source/firefox-62.0.3.source.tar.xz -Source1: firefox-langpacks-%{version}-20181002.tar.xz -Source2: firefox-mozconfig -Source3: firefox.js -Source4: firefox.desktop -Source5: firefox.sh.in -Source7: mozilla-api-key -Source6: firefox.1 -Source9: distribution.ini -Source10: google-api-key -Source11: firefox-wayland.sh.in -Source12: firefox-wayland.desktop - -Patch0001: build-jit-atomic-always-lucky.patch -Patch0004: mozilla-build-arm.patch -Patch0006: rhbz-1173156.patch -Patch0008: mozilla-1170092.patch -Patch0009: rhbz-1354671.patch -Patch0010: mozilla-1196777.patch -Patch0011: mozilla-256180.patch -Patch0012: mozilla-1353817.patch -Patch0016: mozilla-1467125.patch -Patch0017: mozilla-1467128.patch -Patch0018: mozilla-1415078.patch - -BuildRequires: pkgconfig(nspr) >= 4.19 pkgconfig(nss) >= 3.37.3 pkgconfig(libpng) pkgconfig(libffi) -BuildRequires: pkgconfig(zlib) pkgconfig(libIDL-2.0) pkgconfig(gtk+-3.0) pkgconfig(gtk+-2.0) pkgconfig(krb5) -BuildRequires: pkgconfig(pango) pkgconfig(freetype2) >= 2.1.9 pkgconfig(xt) pkgconfig(xrender) pkgconfig(dri) -BuildRequires: pkgconfig(libstartup-notification-1.0) pkgconfig(libnotify) >= 0.7.0 pkgconfig(libcurl) -BuildRequires: pkgconfig(libpulse) pkgconfig(icu-i18n) pkgconfig(gconf-2.0) yasm clang clang-libs autoconf213 -BuildRequires: libjpeg-devel bzip2-devel dbus-glib-devel llvm-devel libvpx-devel >= 1.4.0 python2-devel llvm zip -BuildRequires: desktop-file-utils rust cargo clang-devel nss-static >= 3.37.3 nss-devel >= 3.37.3 - -Requires: mozilla-filesystem p11-kit-trust nspr >= 4.19 nss >= 3.37.3 u2f-hidraw-policy - -Provides: webclient firefox-wayland = %{version}-%{release} -Obsoletes: mozilla <= 37:1.7.13 firefox-wayland <= %{version}-%{release} - +%global release_build 1 +%global debug_build 0 +%global build_with_clang 0 +%global build_with_asan 0 +%global enable_mozilla_crashreporter 0 +%ifarch x86_64 %{ix86} +%global enable_mozilla_crashreporter 1 +%endif +%if %{build_with_asan} +%global enable_mozilla_crashreporter 0 +%endif +%if 0%{?flatpak} +%global enable_mozilla_crashreporter 0 +%endif +%global system_nss 1 +%global system_ffi 1 +%ifarch armv7hl +%global system_libvpx 1 +%else +%global system_libvpx 0 +%endif +%global hardened_build 1 +%global system_jpeg 1 +%global run_tests 0 +%global disable_elfhack 1 +%global use_bundled_cbindgen 1 +%ifarch x86_64 aarch64 +%if %{release_build} +%global build_with_pgo 0 +%else +%global build_with_pgo 0 +%endif +%global pgo_wayland 0 +%endif +%global wayland_backend_default 1 +%if 0%{?flatpak} +%global wayland_backend_default 1 +%global build_with_pgo 0 +%endif +%ifarch ppc64 s390x +%global big_endian 1 +%endif +%ifarch armv7hl +%define _unpackaged_files_terminate_build 0 +%global debug_package %{nil} +%endif +%if 0%{?build_with_pgo} +%global use_xvfb 1 +%global build_tests 1 +%endif +%if 0%{?run_tests} +%global use_xvfb 1 +%global build_tests 1 +%endif +%global firefox_app_id \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} +%global cairo_version 1.13.1 +%global freetype_version 2.1.9 +%global libnotify_version 0.7.0 +%if %{?system_libvpx} +%global libvpx_version 1.8.2 +%endif +%if %{?system_nss} +%global nspr_version 4.21 +%global nspr_build_version %{nspr_version} +%global nss_version 3.54 +%global nss_build_version %{nss_version} +%endif +%global mozappdir %{_libdir}/%{name} +%global mozappdirdev %{_libdir}/%{name}-devel-%{version} +%global langpackdir %{mozappdir}/langpacks +%global tarballdir firefox-%{version} +%global official_branding 1 +%bcond_without langpacks +%if !%{release_build} +%global pre_tag .npgo +%endif +%if %{build_with_clang} +%global pre_tag .clang +%global build_with_pgo 0 +%endif +%if %{build_with_asan} +%global pre_tag .asan +%global build_with_pgo 0 +%endif +%if !%{system_nss} +%global nss_tag .nss +%endif +Summary: Mozilla Firefox Web browser +Name: firefox +Version: 79.0 +Release: 2 +URL: https://www.mozilla.org/firefox/ +License: MPLv1.1 or GPLv2+ or LGPLv2+ +Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}/source/firefox-%{version}.source.tar.xz +%if %{with langpacks} +Source1: firefox-langpacks-%{version}-20200727.tar.xz +%endif +Source2: cbindgen-vendor.tar.xz +Source3: testing.tar.xz +Source10: firefox-mozconfig +Source12: firefox.js +Source20: firefox.desktop +Source21: firefox.sh.in +Source23: firefox.1 +Source24: mozilla-api-key +Source25: firefox-symbolic.svg +Source26: distribution.ini +Source27: google-api-key +Source28: firefox-wayland.sh.in +Source29: firefox-wayland.desktop +Source30: firefox-x11.sh.in +Source31: firefox-x11.desktop +Source32: node-stdout-nonblocking-wrapper +Source33: firefox.appdata.xml.in +Source34: firefox-search-provider.ini +Patch3: mozilla-build-arm.patch +Patch25: rhbz-1219542-s390-build.patch +Patch26: build-icu-big-endian.patch +Patch32: build-rust-ppc64le.patch +Patch35: build-ppc-jit.patch +Patch37: build-jit-atomic-always-lucky.patch +Patch38: build-cacheFlush-missing.patch +Patch40: build-aarch64-skia.patch +Patch41: build-disable-elfhack.patch +Patch44: build-arm-libopus.patch +Patch46: firefox-nss-version.patch +Patch48: build-arm-wasm.patch +Patch49: build-arm-libaom.patch +Patch51: mozilla-1640982.patch +Patch215: firefox-enable-addons.patch +Patch219: rhbz-1173156.patch +Patch224: mozilla-1170092.patch +Patch226: rhbz-1354671.patch +Patch227: firefox-locale-debug.patch +Patch402: mozilla-1196777.patch +Patch412: mozilla-1337988.patch +Patch417: bug1375074-save-restore-x28.patch +Patch422: mozilla-1580174-webrtc-popup.patch +Patch574: firefox-pipewire-0-2.patch +Patch575: firefox-pipewire-0-3.patch +Patch584: firefox-disable-ffvpx-with-vapi.patch +Patch585: firefox-vaapi-extra-frames.patch +Patch586: mozilla-1645671.patch +Patch589: mozilla-1656436.patch +Patch600: pgo.patch +Patch601: mozilla-1516081.patch +Patch602: mozilla-1516803.patch +%if %{?system_nss} +BuildRequires: pkgconfig(nspr) >= %{nspr_version} pkgconfig(nss) >= %{nss_version} +BuildRequires: nss-static >= %{nss_version} +%endif +BuildRequires: pkgconfig(libpng) +%if %{?system_jpeg} +BuildRequires: libjpeg-devel +%endif +BuildRequires: zip bzip2-devel pkgconfig(zlib) pkgconfig(gtk+-3.0) pkgconfig(gtk+-2.0) +BuildRequires: pkgconfig(krb5) pkgconfig(pango) pkgconfig(freetype2) >= %{freetype_version} +BuildRequires: pkgconfig(xt) pkgconfig(xrender) pkgconfig(libstartup-notification-1.0) +BuildRequires: pkgconfig(libnotify) >= %{libnotify_version} pkgconfig(dri) pkgconfig(libcurl) +BuildRequires: dbus-glib-devel +%if %{?system_libvpx} +BuildRequires: libvpx-devel >= %{libvpx_version} +%endif +BuildRequires: autoconf213 pkgconfig(libpulse) yasm llvm llvm-devel clang clang-libs +%if 0%{?build_with_clang} +BuildRequires: lld +%endif +BuildRequires: pipewire-devel +%if !0%{?use_bundled_cbindgen} +BuildRequires: cbindgen +%endif +BuildRequires: nodejs nasm >= 1.13 libappstream-glib +%if 0%{?big_endian} +BuildRequires: icu +%endif +Requires: mozilla-filesystem p11-kit-trust +%if %{?system_nss} +Requires: nspr >= %{nspr_build_version} nss >= %{nss_build_version} +%endif +BuildRequires: python3-devel +%if !0%{?flatpak} +Requires: u2f-hidraw-policy +%endif +BuildRequires: nss-devel >= 3.29.1-2.1 +Requires: nss >= 3.48.0 +BuildRequires: desktop-file-utils +%if !0%{?flatpak} +%endif +%if %{?system_ffi} +BuildRequires: pkgconfig(libffi) +%endif +%if 0%{?use_xvfb} +BuildRequires: xorg-x11-server-Xvfb +%endif +%if 0%{?pgo_wayland} +BuildRequires: mutter +%endif +BuildRequires: rust cargo clang-devel +%if %{build_with_asan} +BuildRequires: libasan libasan-static +%endif +BuildRequires: perl-interpreter +Obsoletes: mozilla <= 37:1.7.13 +Provides: webclient %description Mozilla Firefox is an open-source web browser, designed for standards compliance, performance and portability. +%if %{enable_mozilla_crashreporter} +%global moz_debug_prefix %{_prefix}/lib/debug +%global moz_debug_dir %{moz_debug_prefix}%{mozappdir} +%global uname_m %(uname -m) +%global symbols_file_name %{name}-%{version}.en-US.%{_os}-%{uname_m}.crashreporter-symbols.zip +%global symbols_file_path %{moz_debug_dir}/%{symbols_file_name} +%global _find_debuginfo_opts -p %{symbols_file_path} -o debugcrashreporter.list +%global crashreporter_pkg_name mozilla-crashreporter-%{name}-debuginfo + +%package -n %{crashreporter_pkg_name} +Summary: Debugging symbols used by Mozilla's crash reporter servers +%description -n %{crashreporter_pkg_name} +This package provides debug information for Firefox, for use by +Mozilla's crash reporter servers. If you are trying to locally +debug %{name}, you want to install %{name}-debuginfo instead. + +%files -n %{crashreporter_pkg_name} -f debugcrashreporter.list +%endif +%if 0%{?wayland_backend_default} + +%package x11 +Summary: Firefox X11 launcher. +Requires: %{name} +%description x11 +The firefox-x11 package contains launcher and desktop file +to run Firefox explicitly on X11. + +%files x11 +%{_bindir}/firefox-x11 +%{_datadir}/applications/firefox-x11.desktop +%endif + +%package wayland +Summary: Firefox Wayland launcher. +Requires: %{name} +%description wayland +The firefox-wayland package contains launcher and desktop file +to run Firefox explicitly on Wayland. + +%files wayland +%{_bindir}/firefox-wayland +%{_datadir}/applications/firefox-wayland.desktop +%if %{run_tests} +%global testsuite_pkg_name mozilla-%{name}-testresults -%prep -%autosetup -n firefox-%{version} -p1 +%package -n %{testsuite_pkg_name} +Summary: Results of testsuite +%description -n %{testsuite_pkg_name} +This package contains results of tests executed during build. -rm -f .mozconfig -cp %{SOURCE2} .mozconfig -cp %{SOURCE7} mozilla-api-key -cp %{SOURCE10} google-api-key +%files -n %{testsuite_pkg_name} +/test_results +%endif +%prep +%setup -q -n %{tarballdir} +tar -xf %{SOURCE3} +%ifarch s390 +%patch25 -p1 -b .rhbz-1219542-s390 +%endif +%patch40 -p1 -b .aarch64-skia +%if 0%{?disable_elfhack} +%patch41 -p1 -b .disable-elfhack +%endif +%patch3 -p1 -b .arm +%patch44 -p1 -b .build-arm-libopus +%if 0%{?big_endian} +%patch26 -p1 -b .icu +%endif +%patch48 -p1 -b .build-arm-wasm +%patch49 -p1 -b .build-arm-libaom +%patch51 -p1 -b .mozilla-1640982 +%patch215 -p1 -b .addons +%patch219 -p1 -b .rhbz-1173156 +%patch224 -p1 -b .1170092 +%ifarch aarch64 +%patch226 -p1 -b .1354671 +%endif +%patch227 -p1 -b .locale-debug +%patch402 -p1 -b .1196777 +%patch574 -p1 -b .firefox-pipewire-0-2 +%patch584 -p1 -b .firefox-disable-ffvpx-with-vapi +%patch585 -p1 -b .firefox-vaapi-extra-frames +%patch586 -p1 -b .mozilla-1645671 +%patch589 -p1 -b .mozilla-1656436 +%patch600 -p1 -b .pgo +%patch602 -p1 -b .1516803 +%{__rm} -f .mozconfig +%{__cp} %{SOURCE10} .mozconfig echo "ac_add_options --enable-default-toolkit=cairo-gtk3-wayland" >> .mozconfig -echo "ac_add_options --enable-official-branding" >> .mozconfig -echo "ac_add_options --with-system-nspr" >> .mozconfig -echo "ac_add_options --with-system-nss" >> .mozconfig -echo "ac_add_options --disable-system-sqlite" >> .mozconfig -echo "ac_add_options --disable-system-cairo" >> .mozconfig -echo "ac_add_options --enable-system-ffi" >> .mozconfig -echo "ac_add_options --disable-debug" >> .mozconfig -echo "ac_add_options --disable-crashreporter" >> .mozconfig -echo "ac_add_options --without-system-jpeg" >> .mozconfig -echo "ac_add_options --with-system-libvpx" >> .mozconfig -echo "ac_add_options --without-system-icu" >> .mozconfig - -echo "ac_add_options --enable-optimize='-g -O2'" >> .mozconfig -echo "ac_add_options --disable-jemalloc" >> .mozconfig -echo "ac_add_options --disable-webrtc" >> .mozconfig - +%if %{official_branding} +echo "ac_add_options --enable-official-branding" >> .mozconfig +%endif +%{__cp} %{SOURCE24} mozilla-api-key +%{__cp} %{SOURCE27} google-api-key +echo "ac_add_options --prefix=\"%{_prefix}\"" >> .mozconfig +echo "ac_add_options --libdir=\"%{_libdir}\"" >> .mozconfig +%if %{?system_nss} +echo "ac_add_options --with-system-nspr" >> .mozconfig +echo "ac_add_options --with-system-nss" >> .mozconfig +%else +echo "ac_add_options --without-system-nspr" >> .mozconfig +echo "ac_add_options --without-system-nss" >> .mozconfig +%endif +%if %{?system_ffi} +echo "ac_add_options --enable-system-ffi" >> .mozconfig +%endif +%ifarch %{arm} +echo "ac_add_options --disable-elf-hack" >> .mozconfig +%endif +%if %{?debug_build} +echo "ac_add_options --enable-debug" >> .mozconfig +echo "ac_add_options --disable-optimize" >> .mozconfig +%else +%global optimize_flags "none" +%ifarch ppc64le aarch64 +%global optimize_flags "-g -O2" +%endif +%if %{optimize_flags} != "none" +echo 'ac_add_options --enable-optimize=%{?optimize_flags}' >> .mozconfig +%else +echo 'ac_add_options --enable-optimize' >> .mozconfig +%endif +echo "ac_add_options --disable-debug" >> .mozconfig +%endif +%ifnarch %{ix86} x86_64 +echo "ac_add_options --disable-jemalloc" >> .mozconfig +%endif +%if !%{enable_mozilla_crashreporter} +echo "ac_add_options --disable-crashreporter" >> .mozconfig +%endif +%if 0%{?build_tests} +echo "ac_add_options --enable-tests" >> .mozconfig +%else +echo "ac_add_options --disable-tests" >> .mozconfig +%endif +%if !%{?system_jpeg} +echo "ac_add_options --without-system-jpeg" >> .mozconfig +%else +echo "ac_add_options --with-system-jpeg" >> .mozconfig +%endif +%if %{?system_libvpx} +echo "ac_add_options --with-system-libvpx" >> .mozconfig +%else +echo "ac_add_options --without-system-libvpx" >> .mozconfig +%endif +%ifarch s390 s390x +echo "ac_add_options --disable-ion" >> .mozconfig +%endif +%if %{build_with_asan} +echo "ac_add_options --enable-address-sanitizer" >> .mozconfig +echo "ac_add_options --disable-jemalloc" >> .mozconfig +%endif +echo "ac_add_options --with-mozilla-api-keyfile=`pwd`/mozilla-api-key" >> .mozconfig +echo "ac_add_options --with-google-safebrowsing-api-keyfile=`pwd`/google-api-key" >> .mozconfig +echo 'export NODEJS="%{_buildrootdir}/bin/node-stdout-nonblocking-wrapper"' >> .mozconfig chmod -x third_party/rust/itertools/src/lib.rs +chmod a-x third_party/rust/gfx-backend-vulkan/src/*.rs +chmod a-x third_party/rust/gfx-hal/src/*.rs +chmod a-x third_party/rust/ash/src/extensions/ext/*.rs +chmod a-x third_party/rust/ash/src/extensions/khr/*.rs %build -echo "Generate big endian version of config/external/icu/data/icud58l.dat" - -find ./ -name config.guess -exec cp /usr/lib/rpm/config.guess {} ';' - +%if 0%{?use_bundled_cbindgen} +mkdir -p my_rust_vendor +cd my_rust_vendor +%{__tar} xf %{SOURCE2} +mkdir -p .cargo +cat > .cargo/config <> .mozconfig +%endif +%endif +%if 0%{?flatpak} +MOZ_LINK_FLAGS="$MOZ_LINK_FLAGS -L%{_libdir}" +%endif +%ifarch %{arm} %{ix86} +export RUSTFLAGS="-Cdebuginfo=0" +%endif +%if %{build_with_asan} +MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -fsanitize=address -Dxmalloc=myxmalloc" +MOZ_LINK_FLAGS="$MOZ_LINK_FLAGS -fsanitize=address -ldl" +%endif +MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -DNSS_PKCS11_3_0_STRICT" +%if !%{build_with_clang} +%ifarch x86_64 +MOZ_OPT_FLAGS='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/openEuler/openEuler-hardened-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fpermissive -fPIC -Wl,-z,relro -Wl,-z,now -DNSS_PKCS11_3_0_STRICT' +%endif +%ifarch aarch64 +MOZ_OPT_FLAGS='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/openEuler/openEuler-hardened-cc1 -mabi=lp64 -mtune=generic -fasynchronous-unwind-tables -fpermissive -fPIC -Wl,-z,relro -Wl,-z,now -DNSS_PKCS11_3_0_STRICT' +%endif +echo "export CFLAGS=\"$MOZ_OPT_FLAGS\"" >> .mozconfig +echo "export CXXFLAGS=\"$MOZ_OPT_FLAGS\"" >> .mozconfig +echo "export LDFLAGS=\"$MOZ_LINK_FLAGS\"" >> .mozconfig +%endif +%if 0%{?build_with_clang} +echo "export LLVM_PROFDATA=\"llvm-profdata\"" >> .mozconfig +echo "export AR=\"llvm-ar\"" >> .mozconfig +echo "export NM=\"llvm-nm\"" >> .mozconfig +echo "export RANLIB=\"llvm-ranlib\"" >> .mozconfig +echo "ac_add_options --enable-linker=lld" >> .mozconfig +%else +echo "export CC=gcc" >> .mozconfig +echo "export CXX=g++" >> .mozconfig +echo "export AR=\"gcc-ar\"" >> .mozconfig +echo "export NM=\"gcc-nm\"" >> .mozconfig +echo "export RANLIB=\"gcc-ranlib\"" >> .mozconfig +%endif +%if 0%{?build_with_pgo} +echo "ac_add_options MOZ_PGO=1" >> .mozconfig +echo "ac_add_options --enable-lto" >> .mozconfig +%endif MOZ_SMP_FLAGS=-j1 -[ -z "$RPM_BUILD_NCPUS" ] && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" +%ifarch %{ix86} +[ -z "$RPM_BUILD_NCPUS" ] && \ + RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +%endif +%ifarch x86_64 ppc ppc64 ppc64le aarch64 +[ -z "$RPM_BUILD_NCPUS" ] && \ + RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" [ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 [ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 [ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 - -./mach build +%endif +echo "export MOZ_MAKE_FLAGS=\"$MOZ_SMP_FLAGS\"" >> .mozconfig +echo "export MOZ_SERVICES_SYNC=1" >> .mozconfig +echo "export STRIP=/bin/true" >> .mozconfig +%if 0%{?build_with_pgo} +%if 0%{?pgo_wayland} +xvfb-run mutter --wayland --nested & +if [ -z "$WAYLAND_DISPLAY" ]; then + export WAYLAND_DISPLAY=wayland-0 +else + export WAYLAND_DISPLAY=wayland-1 +fi +MOZ_ENABLE_WAYLAND=1 ./mach build 2>&1 | cat - +%else +GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - +%endif +%else +./mach build -v 2>&1 | cat - +%endif +%if %{enable_mozilla_crashreporter} +make -C objdir buildsymbols +%endif +%if %{?run_tests} +%if %{?system_nss} +ln -s %{_prefix}/bin/certutil objdir/dist/bin/certutil +ln -s %{_prefix}/bin/pk12util objdir/dist/bin/pk12util +%endif +mkdir test_results +./mach --log-no-times check-spidermonkey &> test_results/check-spidermonkey || true +./mach --log-no-times check-spidermonkey &> test_results/check-spidermonkey-2nd-run || true +./mach --log-no-times cppunittest &> test_results/cppunittest || true +xvfb-run ./mach --log-no-times crashtest &> test_results/crashtest || true +./mach --log-no-times gtest &> test_results/gtest || true +xvfb-run ./mach --log-no-times jetpack-test &> test_results/jetpack-test || true +xvfb-run ./mach --log-no-times mochitest-a11y &> test_results/mochitest-a11y || true +xvfb-run ./mach --log-no-times mochitest-browser &> test_results/mochitest-browser || true +xvfb-run ./mach --log-no-times mochitest-chrome &> test_results/mochitest-chrome || true +xvfb-run ./mach --log-no-times mochitest-devtools &> test_results/mochitest-devtools || true +xvfb-run ./mach --log-no-times mochitest-plain &> test_results/mochitest-plain || true +xvfb-run ./mach --log-no-times reftest &> test_results/reftest || true +xvfb-run ./mach --log-no-times webapprt-test-chrome &> test_results/webapprt-test-chrome || true +xvfb-run ./mach --log-no-times webapprt-test-content &> test_results/webapprt-test-content || true +./mach --log-no-times webidl-parser-test &> test_results/webidl-parser-test || true +xvfb-run ./mach --log-no-times xpcshell-test &> test_results/xpcshell-test || true +%if %{?system_nss} +rm -f objdir/dist/bin/certutil +rm -f objdir/dist/bin/pk12util +%endif +%endif %install - -cat > objdir/dist/bin/browser/defaults/preferences/firefox-l10n.js << EOF +%if !0%{?flatpak} +%endif +%{__cat} > objdir/dist/bin/browser/defaults/preferences/firefox-l10n.js << EOF pref("general.useragent.locale", "chrome://global/locale/intl.properties"); EOF - -DESTDIR=$RPM_BUILD_ROOT make -C objdir install - -mkdir -p $RPM_BUILD_ROOT{%{_libdir},%{_bindir},%{_datadir}/applications} - -desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE4} -desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE12} - -rm -rf $RPM_BUILD_ROOT%{_bindir}/firefox -cat %{SOURCE5} > $RPM_BUILD_ROOT%{_bindir}/firefox -cat %{SOURCE11} > $RPM_BUILD_ROOT%{_bindir}/firefox-wayland -chmod 755 $RPM_BUILD_ROOT%{_bindir}/firefox -chmod 755 $RPM_BUILD_ROOT%{_bindir}/firefox-wayland - -install -p -D -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_mandir}/man1/firefox.1 - -rm -f $RPM_BUILD_ROOT/%{_libdir}/%{name}/firefox-config -rm -f $RPM_BUILD_ROOT/%{_libdir}/%{name}/update-settings.ini - +DESTDIR=%{buildroot} make -C objdir install +%{__mkdir_p} %{buildroot}{%{_libdir},%{_bindir},%{_datadir}/applications} +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE20} +%if 0%{?wayland_backend_default} +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE31} +%endif +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE29} +%if 0%{?wayland_backend_default} +%global wayland_default true +%else +%global wayland_default false +%endif +%{__rm} -rf %{buildroot}%{_bindir}/firefox +%{__sed} -e 's/__DEFAULT_WAYLAND__/%{wayland_default}/' \ + -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE21} > %{buildroot}%{_bindir}/firefox +%{__chmod} 755 %{buildroot}%{_bindir}/firefox +%if 0%{?flatpak} +sed -i -e 's|%FLATPAK_ENV_VARS%|export TMPDIR="$XDG_CACHE_HOME/tmp"|' %{buildroot}%{_bindir}/firefox +%else +sed -i -e 's|%FLATPAK_ENV_VARS%||' %{buildroot}%{_bindir}/firefox +%endif +%if 0%{?wayland_backend_default} +%{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE30} > %{buildroot}%{_bindir}/firefox-x11 +%{__chmod} 755 %{buildroot}%{_bindir}/firefox-x11 +%endif +%{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE28} > %{buildroot}%{_bindir}/firefox-wayland +%{__chmod} 755 %{buildroot}%{_bindir}/firefox-wayland +%{__install} -p -D -m 644 %{SOURCE23} %{buildroot}%{_mandir}/man1/firefox.1 +%{__rm} -f %{buildroot}/%{mozappdir}/firefox-config +%{__rm} -f %{buildroot}/%{mozappdir}/update-settings.ini for s in 16 22 24 32 48 256; do - mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps - cp -p browser/branding/official/default${s}.png \ - $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${s}x${s}/apps/firefox.png + %{__mkdir_p} %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps + %{__cp} -p browser/branding/official/default${s}.png \ + %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/firefox.png done - -mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/symbolic/apps -mkdir -p $RPM_BUILD_ROOT%{_datadir}/appdata - -cat > $RPM_BUILD_ROOT%{_datadir}/appdata/%{name}.appdata.xml < - - - - firefox.desktop - CC0-1.0 - -

- Bringing together all kinds of awesomeness to make browsing better for you. - Get to your favorite sites quickly – even if you don’t remember the URLs. - Type your term into the location bar (aka the Awesome Bar) and the autocomplete - function will include possible matches from your browsing history, bookmarked - sites and open tabs. -

- -
- http://www.mozilla.org/ - - https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/firefox/a.png - https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/firefox/b.png - https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/firefox/c.png - - -
-EOF - +%{__mkdir_p} %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps +%{__cp} -p %{SOURCE25} \ + %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps echo > %{name}.lang -mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}/langpacks -tar xf %{SOURCE1} - +%if %{with langpacks} +%{__mkdir_p} %{buildroot}%{langpackdir} +%{__tar} xf %{SOURCE1} for langpack in `ls firefox-langpacks/*.xpi`; do language=`basename $langpack .xpi` extensionID=langpack-$language@firefox.mozilla.org - mkdir -p $extensionID + %{__mkdir_p} $extensionID unzip -qq $langpack -d $extensionID find $extensionID -type f | xargs chmod 644 - cd $extensionID zip -qq -r9mX ../${extensionID}.xpi * cd - - - install -m 644 ${extensionID}.xpi $RPM_BUILD_ROOT%{_libdir}/%{name}/langpacks + %{__install} -m 644 ${extensionID}.xpi %{buildroot}%{langpackdir} language=`echo $language | sed -e 's/-/_/g'` - echo "%%lang($language) %{_libdir}/%{name}/langpacks/${extensionID}.xpi" >> %{name}.lang +%if 0%{?flatpak} + echo "%{langpackdir}/${extensionID}.xpi" >> %{name}.lang +%else + echo "%%lang($language) %{langpackdir}/${extensionID}.xpi" >> %{name}.lang +%endif done -rm -rf firefox-langpacks - +%{__rm} -rf firefox-langpacks function create_default_langpack() { language_long=$1 language_short=$2 -cd $RPM_BUILD_ROOT%{_libdir}/%{name}/langpacks +cd %{buildroot}%{langpackdir} ln -s langpack-$language_long@firefox.mozilla.org.xpi langpack-$language_short@firefox.mozilla.org.xpi cd - -echo "%%lang($language_short) %{_libdir}/%{name}/langpacks/langpack-$language_short@firefox.mozilla.org.xpi" >> %{name}.lang +echo "%%lang($language_short) %{langpackdir}/langpack-$language_short@firefox.mozilla.org.xpi" >> %{name}.lang } - -create_default_langpack "bn-IN" "bn" create_default_langpack "es-AR" "es" create_default_langpack "fy-NL" "fy" create_default_langpack "ga-IE" "ga" @@ -208,32 +606,62 @@ create_default_langpack "pa-IN" "pa" create_default_langpack "pt-PT" "pt" create_default_langpack "sv-SE" "sv" create_default_langpack "zh-TW" "zh" +%endif +%{__mkdir_p} %{buildroot}/%{mozappdir}/browser/defaults/preferences +%{__mkdir_p} %{buildroot}/%{_sysconfdir}/%{name}/pref +%{__mkdir_p} %{buildroot}%{_datadir}/mozilla/extensions/%{firefox_app_id} +%{__mkdir_p} %{buildroot}%{_libdir}/mozilla/extensions/%{firefox_app_id} +%{__install} -p -c -m 644 LICENSE %{buildroot}/%{mozappdir} +%{__rm} -rf %{buildroot}%{mozappdir}/dictionaries +ln -s %{_datadir}/myspell %{buildroot}%{mozappdir}/dictionaries +%if %{enable_mozilla_crashreporter} +sed -i -e "s/\[Crash Reporter\]/[Crash Reporter]\nEnabled=1/" %{buildroot}/%{mozappdir}/application.ini +%{__mkdir_p} %{buildroot}/%{moz_debug_dir} +%{__cp} objdir/dist/%{symbols_file_name} %{buildroot}/%{moz_debug_dir} +%endif +%if %{run_tests} +%{__mkdir_p} %{buildroot}/test_results +%{__cp} test_results/* %{buildroot}/test_results +%endif +%{__cp} %{SOURCE12} %{buildroot}%{mozappdir}/browser/defaults/preferences +%{__cp} build/unix/run-mozilla.sh %{buildroot}%{mozappdir} +%{__mkdir_p} %{buildroot}%{mozappdir}/distribution +%{__cp} %{SOURCE26} %{buildroot}%{mozappdir}/distribution +mkdir -p %{buildroot}%{_datadir}/metainfo +%{__sed} -e 's/__VERSION__/%{version}/' %{SOURCE33} > %{buildroot}%{_datadir}/metainfo/firefox.appdata.xml +mkdir -p %{buildroot}%{_datadir}/gnome-shell/search-providers +%{__cp} %{SOURCE34} %{buildroot}%{_datadir}/gnome-shell/search-providers +rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libmozjs.so +rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libmozalloc.so +rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libxul.so -mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/defaults/preferences -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/pref -mkdir -p $RPM_BUILD_ROOT%{_datadir}/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384} -mkdir -p $RPM_BUILD_ROOT%{_libdir}/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384} - -install -p -c -m 644 LICENSE $RPM_BUILD_ROOT/%{_libdir}/%{name} - -rm -rf $RPM_BUILD_ROOT%{_libdir}/%{name}/dictionaries -ln -s %{_datadir}/myspell $RPM_BUILD_ROOT%{_libdir}/%{name}/dictionaries - -cp %{SOURCE3} $RPM_BUILD_ROOT%{_libdir}/%{name}/browser/defaults/preferences -cp build/unix/run-mozilla.sh $RPM_BUILD_ROOT%{_libdir}/%{name} -mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{name}/distribution -cp %{SOURCE9} $RPM_BUILD_ROOT%{_libdir}/%{name}/distribution +%pretrans -p +require 'posix' +require 'os' +if (posix.stat("%{mozappdir}/browser/defaults/preferences", "type") == "link") then + posix.unlink("%{mozappdir}/browser/defaults/preferences") + posix.mkdir("%{mozappdir}/browser/defaults/preferences") + if (posix.stat("%{mozappdir}/defaults/preferences", "type") == "directory") then + for i,filename in pairs(posix.dir("%{mozappdir}/defaults/preferences")) do + os.rename("%{mozappdir}/defaults/preferences/"..filename, "%{mozappdir}/browser/defaults/preferences/"..filename) + end + f = io.open("%{mozappdir}/defaults/preferences/README","w") + if f then + f:write("Content of this directory has been moved to %{mozappdir}/browser/defaults/preferences.") + f:close() + end + end +end -rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}-devel-%{version}/sdk/lib/libmozjs.so -rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}-devel-%{version}/sdk/lib/libmozalloc.so -rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}-devel-%{version}/sdk/lib/libxul.so +%check +appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.appdata.xml %preun if [ $1 -eq 0 ]; then - rm -rf %{_libdir}/%{name}/components - rm -rf %{_libdir}/%{name}/extensions - rm -rf %{_libdir}/%{name}/plugins - rm -rf %{_libdir}/%{name}/langpacks + %{__rm} -rf %{mozappdir}/components + %{__rm} -rf %{mozappdir}/extensions + %{__rm} -rf %{mozappdir}/plugins + #%{__rm} -rf %{langpackdir} fi %post @@ -247,73 +675,85 @@ if [ $1 -eq 0 ] ; then gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : fi -%pretrans -p -require 'posix' -require 'os' -if (posix.stat("%{_libdir}/%{name}/browser/defaults/preferences", "type") == "link") then - posix.unlink("%{_libdir}/%{name}/browser/defaults/preferences") - posix.mkdir("%{_libdir}/%{name}/browser/defaults/preferences") - if (posix.stat("%{_libdir}/%{name}/defaults/preferences", "type") == "directory") then - for i,filename in pairs(posix.dir("%{_libdir}/%{name}/defaults/preferences")) do - os.rename("%{_libdir}/%{name}/defaults/preferences/"..filename, "%{_libdir}/%{name}/browser/defaults/preferences/"..filename) - end - f = io.open("%{_libdir}/%{name}/defaults/preferences/README","w") - if f then - f:write("Content of this directory has been moved to %{_libdir}/%{name}/browser/defaults/preferences.") - f:close() - end - end -end - %posttrans gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %files -f %{name}.lang -%license %{_libdir}/%{name}/LICENSE -%doc %{_mandir}/man1/* %{_bindir}/firefox -%{_bindir}/firefox-wayland +%{mozappdir}/firefox +%{mozappdir}/firefox-bin +%doc %{_mandir}/man1/* %dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}/* %dir %{_datadir}/mozilla/extensions/* %dir %{_libdir}/mozilla/extensions/* -%dir %{_libdir}/%{name} -%dir %{_libdir}/%{name}/langpacks -%attr(644, root, root) %{_libdir}/%{name}/browser/blocklist.xml -%{_libdir}/%{name}/*.so -%{_libdir}/%{name}/gtk2/*.so -%{_libdir}/%{name}/firefox -%{_libdir}/%{name}/firefox-bin -%{_libdir}/%{name}/browser/chrome -%{_libdir}/%{name}/browser/chrome.manifest -%{_libdir}/%{name}/browser/omni.ja -%{_libdir}/%{name}/browser/defaults/preferences/firefox.js -%{_libdir}/%{name}/browser/features/*.xpi -%{_libdir}/%{name}/distribution/distribution.ini -%{_libdir}/%{name}/defaults/pref/channel-prefs.js -%{_libdir}/%{name}/dependentlibs.list -%{_libdir}/%{name}/dictionaries -%{_libdir}/%{name}/omni.ja -%{_libdir}/%{name}/platform.ini -%{_libdir}/%{name}/plugin-container -%{_libdir}/%{name}/gmp-clearkey -%{_libdir}/%{name}/fonts/TwemojiMozilla.ttf -%{_libdir}/%{name}/chrome.manifest -%{_libdir}/%{name}/run-mozilla.sh -%{_libdir}/%{name}/application.ini -%{_libdir}/%{name}/pingsender -%ghost %{_libdir}/%{name}/browser/features/aushelper@mozilla.org.xpi -%exclude %{_libdir}/%{name}/removed-files -%{_datadir}/appdata/*.appdata.xml %{_datadir}/applications/%{name}.desktop +%{_datadir}/metainfo/*.appdata.xml +%{_datadir}/gnome-shell/search-providers/*.ini +%dir %{mozappdir} +%license %{mozappdir}/LICENSE +%{mozappdir}/browser/chrome +%{mozappdir}/browser/defaults/preferences/firefox.js +%{mozappdir}/browser/features/*.xpi +%{mozappdir}/distribution/distribution.ini +%ghost %{mozappdir}/browser/features/aushelper@mozilla.org.xpi +%if %{with langpacks} +%dir %{langpackdir} +%endif +%{mozappdir}/browser/omni.ja +%{mozappdir}/run-mozilla.sh +%{mozappdir}/application.ini +%{mozappdir}/pingsender +%exclude %{mozappdir}/removed-files %{_datadir}/icons/hicolor/16x16/apps/firefox.png %{_datadir}/icons/hicolor/22x22/apps/firefox.png %{_datadir}/icons/hicolor/24x24/apps/firefox.png %{_datadir}/icons/hicolor/256x256/apps/firefox.png %{_datadir}/icons/hicolor/32x32/apps/firefox.png %{_datadir}/icons/hicolor/48x48/apps/firefox.png -%{_datadir}/applications/firefox-wayland.desktop +%{_datadir}/icons/hicolor/symbolic/apps/firefox-symbolic.svg +%if %{enable_mozilla_crashreporter} +%{mozappdir}/crashreporter +%{mozappdir}/crashreporter.ini +%{mozappdir}/minidump-analyzer +%{mozappdir}/Throbber-small.gif +%{mozappdir}/browser/crashreporter-override.ini +%endif +%{mozappdir}/*.so +%{mozappdir}/gtk2/*.so +%{mozappdir}/defaults/pref/channel-prefs.js +%{mozappdir}/dependentlibs.list +%{mozappdir}/dictionaries +%{mozappdir}/omni.ja +%{mozappdir}/platform.ini +%{mozappdir}/plugin-container +%{mozappdir}/gmp-clearkey +%{mozappdir}/fonts/TwemojiMozilla.ttf +%if !%{?system_nss} +%exclude %{mozappdir}/libnssckbi.so +%endif +%if %{build_with_asan} +%{mozappdir}/llvm-symbolizer +%endif %changelog +* Thu Oct 29 2020 caodongxia - 79.0-2 +- Fix firefox remove warning + +* Wed Oct 14 2020 Jeffery.Gao - 79.0-1 +- Update to 79.0-1 and switch off -fstack_clash_protection compiler option + +* Wed Jul 22 2020 lingsheng - 62.0.3-7 +- Fix firefox build with rust 1.38 + +* Mon May 25 2020 huanghaitao - 62.0.3-6 +- Type:cves +- ID: CVE-2020-6811 CVE-2020-6814 +- SUG:restart +- DESC: fix CVE-2020-6811 CVE-2020-6814 + +* Mon May 25 2020 Captain Wei - 62.0.3-5 +- fix unstable_name_collisions problem when compile + * Wen Feb 26 2020 xuxijian - 62.0.3-4 - Package init diff --git a/mozilla-1170092.patch b/mozilla-1170092.patch index 9e8906f34c5489bd79d5259140ed625f3bd02790..bb7741479be6604a29e28b6a0f2bd167003d9300 100644 --- a/mozilla-1170092.patch +++ b/mozilla-1170092.patch @@ -1,56 +1,57 @@ -diff -up firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp ---- firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2018-01-11 21:17:03.000000000 +0100 -+++ firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2018-01-23 13:59:45.446495820 +0100 -@@ -239,9 +239,20 @@ nsresult nsReadConfig::openAndEvaluateJS - return rv; +diff -up firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp +--- firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2020-04-03 21:34:41.000000000 +0200 ++++ firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2020-04-06 22:40:02.760674871 +0200 +@@ -244,8 +244,20 @@ nsresult nsReadConfig::openAndEvaluateJS + if (NS_FAILED(rv)) return rv; - rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile); -- if (NS_FAILED(rv)) -- return rv; -+ if (NS_FAILED(rv)) { -+ // Look for cfg file in /etc//pref -+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR, -+ getter_AddRefs(jsFile)); -+ NS_ENSURE_SUCCESS(rv, rv); + rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile); +- if (NS_FAILED(rv)) return rv; ++ if (NS_FAILED(rv)) { ++ // Look for cfg file in /etc//pref ++ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR, ++ getter_AddRefs(jsFile)); ++ NS_ENSURE_SUCCESS(rv, rv); + -+ rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref")); -+ NS_ENSURE_SUCCESS(rv, rv); -+ rv = jsFile->AppendNative(nsDependentCString(aFileName)); -+ NS_ENSURE_SUCCESS(rv, rv); ++ rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref")); ++ NS_ENSURE_SUCCESS(rv, rv); ++ rv = jsFile->AppendNative(nsDependentCString(aFileName)); ++ NS_ENSURE_SUCCESS(rv, rv); -+ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile); -+ NS_ENSURE_SUCCESS(rv, rv); -+ } - } else { - nsAutoCString location("resource://gre/defaults/autoconfig/"); - location += aFileName; -diff -up firefox-58.0/modules/libpref/Preferences.cpp.1170092 firefox-58.0/modules/libpref/Preferences.cpp ---- firefox-58.0/modules/libpref/Preferences.cpp.1170092 2018-01-23 13:59:45.447495817 +0100 -+++ firefox-58.0/modules/libpref/Preferences.cpp 2018-01-23 14:02:51.456987774 +0100 -@@ -4402,6 +4402,8 @@ pref_InitInitialObjects() ++ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } + } else { + nsAutoCString location("resource://gre/defaults/autoconfig/"); + location += aFileName; +diff -up firefox-75.0/modules/libpref/Preferences.cpp.1170092 firefox-75.0/modules/libpref/Preferences.cpp +--- firefox-75.0/modules/libpref/Preferences.cpp.1170092 2020-04-06 22:40:02.761674865 +0200 ++++ firefox-75.0/modules/libpref/Preferences.cpp 2020-04-06 22:40:57.675325227 +0200 +@@ -4468,6 +4468,9 @@ nsresult Preferences::InitInitialObjects // // Thus, in the omni.jar case, we always load app-specific default // preferences from omni.jar, whether or not `$app == $gre`. ++ // + // At very end load configuration from system config location: + // - /etc/firefox/pref/*.js - nsresult rv; - nsZipFind* findPtr; -diff -up firefox-58.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-58.0/toolkit/xre/nsXREDirProvider.cpp ---- firefox-58.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2018-01-11 21:17:06.000000000 +0100 -+++ firefox-58.0/toolkit/xre/nsXREDirProvider.cpp 2018-01-23 13:59:45.447495817 +0100 -@@ -59,6 +59,7 @@ + nsresult rv = NS_ERROR_FAILURE; + UniquePtr find; +diff -up firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-75.0/toolkit/xre/nsXREDirProvider.cpp +--- firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2020-04-03 21:35:39.000000000 +0200 ++++ firefox-75.0/toolkit/xre/nsXREDirProvider.cpp 2020-04-06 22:40:02.761674865 +0200 +@@ -60,6 +60,7 @@ #endif #ifdef XP_UNIX - #include -+#include "nsIXULAppInfo.h" + # include ++# include "nsIXULAppInfo.h" #endif #ifdef XP_IOS - #include "UIKitDirProvider.h" -@@ -554,6 +555,20 @@ nsXREDirProvider::GetFile(const char* aP + # include "UIKitDirProvider.h" +@@ -533,6 +534,21 @@ nsXREDirProvider::GetFile(const char* aP } } } ++ +#if defined(XP_UNIX) + if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) { + nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/"); @@ -65,32 +66,34 @@ diff -up firefox-58.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-58.0/tool + } +#endif + - if (NS_FAILED(rv) || !file) - return NS_ERROR_FAILURE; + if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE; + + if (ensureFilePermissions) { +@@ -845,6 +861,16 @@ nsresult nsXREDirProvider::GetFilesInter -@@ -887,6 +902,14 @@ nsXREDirProvider::GetFilesInternal(const LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories); - LoadDirsIntoArray(mAppBundleDirectories, - kAppendPrefDir, directories); + + // Add /etc//pref/ directory if it exists + nsCOMPtr systemPrefDir; -+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR, getter_AddRefs(systemPrefDir)); ++ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR, ++ getter_AddRefs(systemPrefDir)); + if (NS_SUCCEEDED(rv)) { + rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref")); + if (NS_SUCCEEDED(rv)) + directories.AppendObject(systemPrefDir); + } - - rv = NS_NewArrayEnumerator(aResult, directories); - } -diff -up firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h ---- firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2018-01-23 13:59:45.447495817 +0100 -+++ firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h 2018-01-23 14:02:02.871120476 +0100 -@@ -59,6 +59,7 @@ - #define NS_APP_PREFS_50_FILE "PrefF" - #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL" - #define NS_APP_PREFS_OVERRIDE_DIR "PrefDOverride" // Directory for per-profile defaults ++ + rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile)); + } else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) { + // NS_APP_CHROME_DIR_LIST is only used to get default (native) icons +diff -up firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h +--- firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2020-04-03 21:35:39.000000000 +0200 ++++ firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h 2020-04-06 22:40:02.761674865 +0200 +@@ -60,6 +60,7 @@ + #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL" + #define NS_APP_PREFS_OVERRIDE_DIR \ + "PrefDOverride" // Directory for per-profile defaults +#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration - #define NS_APP_USER_PROFILE_50_DIR "ProfD" - #define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD" + #define NS_APP_USER_PROFILE_50_DIR "ProfD" + #define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD" diff --git a/mozilla-1196777.patch b/mozilla-1196777.patch index ba5e4b7f7af7674499f03c06b2abc420646e2a13..ed3ab16dd102efed0953ee706d3aaaa8915b38d5 100644 --- a/mozilla-1196777.patch +++ b/mozilla-1196777.patch @@ -1,28 +1,13 @@ -# HG changeset patch -# User Martin Stransky -# Parent 4e3ad95d689a5beabf3c1f41d958794fe00e3767 -Bug 1196777 - Ask GDK to receive focus events, r=?karlt - -diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp ---- a/widget/gtk/nsWindow.cpp -+++ b/widget/gtk/nsWindow.cpp -@@ -142,17 +142,18 @@ const gint kEvents = GDK_EXPOSURE_MASK | - GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | - #if GTK_CHECK_VERSION(3,4,0) - GDK_SMOOTH_SCROLL_MASK | - GDK_TOUCH_MASK | +diff -up firefox-68.0/widget/gtk/nsWindow.cpp.1196777 firefox-68.0/widget/gtk/nsWindow.cpp +--- firefox-68.0/widget/gtk/nsWindow.cpp.1196777 2019-07-02 11:47:06.864726826 +0200 ++++ firefox-68.0/widget/gtk/nsWindow.cpp 2019-07-02 11:48:09.896544339 +0200 +@@ -156,7 +156,8 @@ const gint kEvents = + #if GTK_CHECK_VERSION(3, 4, 0) + GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK | #endif - GDK_SCROLL_MASK | - GDK_POINTER_MOTION_MASK | -- GDK_PROPERTY_CHANGE_MASK; -+ GDK_PROPERTY_CHANGE_MASK | -+ GDK_FOCUS_CHANGE_MASK; +- GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK; ++ GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK | ++ GDK_FOCUS_CHANGE_MASK; - /* utility functions */ - static bool is_mouse_in_window(GdkWindow* aWindow, - gdouble aMouseX, gdouble aMouseY); - static nsWindow *get_window_for_gtk_widget(GtkWidget *widget); - static nsWindow *get_window_for_gdk_window(GdkWindow *window); - static GtkWidget *get_gtk_widget_for_gdk_window(GdkWindow *window); - static GdkCursor *get_gtk_cursor(nsCursor aCursor); + #if !GTK_CHECK_VERSION(3, 22, 0) + typedef enum { diff --git a/mozilla-1337988.patch b/mozilla-1337988.patch new file mode 100644 index 0000000000000000000000000000000000000000..8c404458dba39ade02e20d8c3391b0aa270976ad --- /dev/null +++ b/mozilla-1337988.patch @@ -0,0 +1,496 @@ +diff -up firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp +--- firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 2017-09-14 22:15:56.000000000 +0200 ++++ firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp 2017-09-25 10:34:11.205611698 +0200 +@@ -1719,7 +1719,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj, + auto entry = + static_cast(sNPObjWrappers->Search(npobj)); + MOZ_ASSERT(entry && entry->mJSObj); +- MOZ_ASSERT(entry->mJSObj == old); ++ MOZ_ASSERT(entry->mJSObj.unbarrieredGetPtr() == old); + entry->mJSObj = obj; + } + +diff -up firefox-56.0/js/ipc/JavaScriptShared.cpp.1337988 firefox-56.0/js/ipc/JavaScriptShared.cpp +--- firefox-56.0/js/ipc/JavaScriptShared.cpp.1337988 2017-07-31 18:20:47.000000000 +0200 ++++ firefox-56.0/js/ipc/JavaScriptShared.cpp 2017-09-25 10:34:11.205611698 +0200 +@@ -101,7 +101,7 @@ IdToObjectMap::has(const ObjectId& id, c + auto p = table_.lookup(id); + if (!p) + return false; +- return p->value() == obj; ++ return p->value().unbarrieredGet() == obj; + } + #endif + +diff -up firefox-56.0/js/public/RootingAPI.h.1337988 firefox-56.0/js/public/RootingAPI.h +--- firefox-56.0/js/public/RootingAPI.h.1337988 2017-07-31 18:20:47.000000000 +0200 ++++ firefox-56.0/js/public/RootingAPI.h 2017-09-25 10:34:11.206611695 +0200 +@@ -148,6 +148,10 @@ template + struct PersistentRootedMarker; + } /* namespace gc */ + ++#define DECLARE_POINTER_COMPARISON_OPS(T) \ ++ bool operator==(const T& other) const { return get() == other; } \ ++ bool operator!=(const T& other) const { return get() != other; } ++ + // Important: Return a reference so passing a Rooted, etc. to + // something that takes a |const T&| is not a GC hazard. + #define DECLARE_POINTER_CONSTREF_OPS(T) \ +@@ -237,8 +241,6 @@ class Heap : public js::HeapBase::value, + "Type T must be a public GC pointer type"); + public: +- using ElementType = T; +- + Heap() { + static_assert(sizeof(T) == sizeof(Heap), + "Heap must be binary compatible with T."); +@@ -385,8 +387,6 @@ template + class TenuredHeap : public js::HeapBase> + { + public: +- using ElementType = T; +- + TenuredHeap() : bits(0) { + static_assert(sizeof(T) == sizeof(TenuredHeap), + "TenuredHeap must be binary compatible with T."); +@@ -394,6 +394,9 @@ class TenuredHeap : public js::HeapBase< + explicit TenuredHeap(T p) : bits(0) { setPtr(p); } + explicit TenuredHeap(const TenuredHeap& p) : bits(0) { setPtr(p.getPtr()); } + ++ bool operator==(const TenuredHeap& other) { return bits == other.bits; } ++ bool operator!=(const TenuredHeap& other) { return bits != other.bits; } ++ + void setPtr(T newPtr) { + MOZ_ASSERT((reinterpret_cast(newPtr) & flagsMask) == 0); + if (newPtr) +@@ -470,8 +473,6 @@ class MOZ_NONHEAP_CLASS Handle : public + friend class JS::MutableHandle; + + public: +- using ElementType = T; +- + /* Creates a handle from a handle of a type convertible to T. */ + template + MOZ_IMPLICIT Handle(Handle handle, +@@ -533,6 +534,7 @@ class MOZ_NONHEAP_CLASS Handle : public + MOZ_IMPLICIT Handle(MutableHandle& root, + typename mozilla::EnableIf::value, int>::Type dummy = 0); + ++ DECLARE_POINTER_COMPARISON_OPS(T); + DECLARE_POINTER_CONSTREF_OPS(T); + DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr); + +@@ -559,8 +561,6 @@ template + class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase> + { + public: +- using ElementType = T; +- + inline MOZ_IMPLICIT MutableHandle(Rooted* root); + inline MOZ_IMPLICIT MutableHandle(PersistentRooted* root); + +@@ -589,6 +589,7 @@ class MOZ_STACK_CLASS MutableHandle : pu + return h; + } + ++ DECLARE_POINTER_COMPARISON_OPS(T); + DECLARE_POINTER_CONSTREF_OPS(T); + DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr); + DECLARE_NONPOINTER_MUTABLE_ACCESSOR_METHODS(*ptr); +@@ -805,8 +806,6 @@ class MOZ_RAII Rooted : public js::Roote + } + + public: +- using ElementType = T; +- + template + explicit Rooted(const RootingContext& cx) + : ptr(GCPolicy::initial()) +@@ -839,6 +838,7 @@ class MOZ_RAII Rooted : public js::Roote + ptr = mozilla::Move(value); + } + ++ DECLARE_POINTER_COMPARISON_OPS(T); + DECLARE_POINTER_CONSTREF_OPS(T); + DECLARE_POINTER_ASSIGN_OPS(Rooted, T); + DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr); +@@ -903,14 +903,13 @@ template + class MOZ_RAII FakeRooted : public RootedBase> + { + public: +- using ElementType = T; +- + template + explicit FakeRooted(CX* cx) : ptr(JS::GCPolicy::initial()) {} + + template + FakeRooted(CX* cx, T initial) : ptr(initial) {} + ++ DECLARE_POINTER_COMPARISON_OPS(T); + DECLARE_POINTER_CONSTREF_OPS(T); + DECLARE_POINTER_ASSIGN_OPS(FakeRooted, T); + DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr); +@@ -931,8 +930,6 @@ template + class FakeMutableHandle : public js::MutableHandleBase> + { + public: +- using ElementType = T; +- + MOZ_IMPLICIT FakeMutableHandle(T* t) { + ptr = t; + } +@@ -1124,8 +1121,6 @@ class PersistentRooted : public js::Root + } + + public: +- using ElementType = T; +- + PersistentRooted() : ptr(GCPolicy::initial()) {} + + explicit PersistentRooted(RootingContext* cx) +@@ -1203,6 +1198,7 @@ class PersistentRooted : public js::Root + } + } + ++ DECLARE_POINTER_COMPARISON_OPS(T); + DECLARE_POINTER_CONSTREF_OPS(T); + DECLARE_POINTER_ASSIGN_OPS(PersistentRooted, T); + DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr); +@@ -1234,8 +1230,6 @@ class JS_PUBLIC_API(ObjectPtr) + Heap value; + + public: +- using ElementType = JSObject*; +- + ObjectPtr() : value(nullptr) {} + + explicit ObjectPtr(JSObject* obj) : value(obj) {} +@@ -1342,177 +1336,6 @@ Swap(JS::TenuredHeap& aX, JS::Tenured + + } /* namespace mozilla */ + +-namespace js { +-namespace detail { +- +-// DefineComparisonOps is a trait which selects which wrapper classes to define +-// operator== and operator!= for. It supplies a getter function to extract the +-// value to compare. This is used to avoid triggering the automatic read +-// barriers where appropriate. +-// +-// If DefineComparisonOps is not specialized for a particular wrapper you may +-// get errors such as 'invalid operands to binary expression' or 'no match for +-// operator==' when trying to compare against instances of the wrapper. +- +-template +-struct DefineComparisonOps : mozilla::FalseType {}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const JS::Heap& v) { return v.unbarrieredGet(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T get(const JS::TenuredHeap& v) { return v.unbarrieredGetPtr(); } +-}; +- +-template <> +-struct DefineComparisonOps : mozilla::TrueType { +- static const JSObject* get(const JS::ObjectPtr& v) { return v.unbarrieredGet(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const JS::Rooted& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const JS::Handle& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const JS::MutableHandle& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const JS::PersistentRooted& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const js::FakeRooted& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const js::FakeMutableHandle& v) { return v.get(); } +-}; +- +-} /* namespace detail */ +-} /* namespace js */ +- +-// Overload operator== and operator!= for all types with the DefineComparisonOps +-// trait using the supplied getter. +-// +-// There are four cases: +- +-// Case 1: comparison between two wrapper objects. +- +-template +-typename mozilla::EnableIf::value && +- js::detail::DefineComparisonOps::value, bool>::Type +-operator==(const T& a, const U& b) { +- return js::detail::DefineComparisonOps::get(a) == js::detail::DefineComparisonOps::get(b); +-} +- +-template +-typename mozilla::EnableIf::value && +- js::detail::DefineComparisonOps::value, bool>::Type +-operator!=(const T& a, const U& b) { +- return !(a == b); +-} +- +-// Case 2: comparison between a wrapper object and its unwrapped element type. +- +-template +-typename mozilla::EnableIf::value, bool>::Type +-operator==(const T& a, const typename T::ElementType& b) { +- return js::detail::DefineComparisonOps::get(a) == b; +-} +- +-template +-typename mozilla::EnableIf::value, bool>::Type +-operator!=(const T& a, const typename T::ElementType& b) { +- return !(a == b); +-} +- +-template +-typename mozilla::EnableIf::value, bool>::Type +-operator==(const typename T::ElementType& a, const T& b) { +- return a == js::detail::DefineComparisonOps::get(b); +-} +- +-template +-typename mozilla::EnableIf::value, bool>::Type +-operator!=(const typename T::ElementType& a, const T& b) { +- return !(a == b); +-} +- +-// Case 3: For pointer wrappers, comparison between the wrapper and a const +-// element pointer. +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator==(const typename mozilla::RemovePointer::Type* a, const T& b) { +- return a == js::detail::DefineComparisonOps::get(b); +-} +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator!=(const typename mozilla::RemovePointer::Type* a, const T& b) { +- return !(a == b); +-} +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator==(const T& a, const typename mozilla::RemovePointer::Type* b) { +- return js::detail::DefineComparisonOps::get(a) == b; +-} +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator!=(const T& a, const typename mozilla::RemovePointer::Type* b) { +- return !(a == b); +-} +- +-// Case 4: For pointer wrappers, comparison between the wrapper and nullptr. +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator==(std::nullptr_t a, const T& b) { +- return a == js::detail::DefineComparisonOps::get(b); +-} +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator!=(std::nullptr_t a, const T& b) { +- return !(a == b); +-} +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator==(const T& a, std::nullptr_t b) { +- return js::detail::DefineComparisonOps::get(a) == b; +-} +- +-template +-typename mozilla::EnableIf::value && +- mozilla::IsPointer::value, bool>::Type +-operator!=(const T& a, std::nullptr_t b) { +- return !(a == b); +-} +- + #undef DELETE_ASSIGNMENT_OPS + + #endif /* js_RootingAPI_h */ +diff -up firefox-56.0/js/src/gc/Barrier.h.1337988 firefox-56.0/js/src/gc/Barrier.h +--- firefox-56.0/js/src/gc/Barrier.h.1337988 2017-09-14 22:16:01.000000000 +0200 ++++ firefox-56.0/js/src/gc/Barrier.h 2017-09-25 10:34:11.206611695 +0200 +@@ -353,8 +353,8 @@ class WriteBarrieredBase : public Barrie + explicit WriteBarrieredBase(const T& v) : BarrieredBase(v) {} + + public: +- using ElementType = T; + ++ DECLARE_POINTER_COMPARISON_OPS(T); + DECLARE_POINTER_CONSTREF_OPS(T); + + // Use this if the automatic coercion to T isn't working. +@@ -612,13 +612,14 @@ class ReadBarriered : public ReadBarrier + return *this; + } + +- const T& get() const { +- if (InternalBarrierMethods::isMarkable(this->value)) +- this->read(); ++ const T get() const { ++ if (!InternalBarrierMethods::isMarkable(this->value)) ++ return JS::GCPolicy::initial(); ++ this->read(); + return this->value; + } + +- const T& unbarrieredGet() const { ++ const T unbarrieredGet() const { + return this->value; + } + +@@ -626,9 +627,9 @@ class ReadBarriered : public ReadBarrier + return bool(this->value); + } + +- operator const T&() const { return get(); } ++ operator const T() const { return get(); } + +- const T& operator->() const { return get(); } ++ const T operator->() const { return get(); } + + T* unsafeGet() { return &this->value; } + T const* unsafeGet() const { return &this->value; } +@@ -955,35 +956,6 @@ typedef ReadBarriered + + typedef ReadBarriered ReadBarrieredValue; + +-namespace detail { +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const PreBarriered& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const GCPtr& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const HeapPtr& v) { return v.get(); } +-}; +- +-template +-struct DefineComparisonOps> : mozilla::TrueType { +- static const T& get(const ReadBarriered& v) { return v.unbarrieredGet(); } +-}; +- +-template <> +-struct DefineComparisonOps : mozilla::TrueType { +- static const Value& get(const HeapSlot& v) { return v.get(); } +-}; +- +-} /* namespace detail */ +- + } /* namespace js */ + + #endif /* gc_Barrier_h */ +diff -up firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp +--- firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 2017-09-14 22:16:02.000000000 +0200 ++++ firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp 2017-09-25 10:34:11.206611695 +0200 +@@ -5,7 +5,6 @@ + * 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 "mozilla/TypeTraits.h" + #include "mozilla/UniquePtr.h" + + #include "js/RootingAPI.h" +diff -up firefox-56.0/js/src/vm/SharedMem.h.1337988 firefox-56.0/js/src/vm/SharedMem.h +--- firefox-56.0/js/src/vm/SharedMem.h.1337988 2017-06-15 22:52:29.000000000 +0200 ++++ firefox-56.0/js/src/vm/SharedMem.h 2017-09-25 10:34:11.206611695 +0200 +@@ -12,8 +12,8 @@ + template + class SharedMem + { +- // static_assert(mozilla::IsPointer::value, +- // "SharedMem encapsulates pointer types"); ++ static_assert(mozilla::IsPointer::value, ++ "SharedMem encapsulates pointer types"); + + enum Sharedness { + IsUnshared, +diff -up firefox-56.0/js/xpconnect/src/XPCInlines.h.1337988 firefox-56.0/js/xpconnect/src/XPCInlines.h +--- firefox-56.0/js/xpconnect/src/XPCInlines.h.1337988 2017-09-14 22:16:03.000000000 +0200 ++++ firefox-56.0/js/xpconnect/src/XPCInlines.h 2017-09-25 10:34:11.206611695 +0200 +@@ -465,7 +465,7 @@ inline + void XPCWrappedNativeTearOff::JSObjectMoved(JSObject* obj, const JSObject* old) + { + MOZ_ASSERT(!IsMarked()); +- MOZ_ASSERT(mJSObject == old); ++ MOZ_ASSERT(mJSObject.unbarrieredGetPtr() == old); + mJSObject = obj; + } + +diff -up firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp +--- firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 2017-09-14 22:16:03.000000000 +0200 ++++ firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp 2017-09-25 10:34:11.207611692 +0200 +@@ -874,7 +874,7 @@ void + XPCWrappedNative::FlatJSObjectMoved(JSObject* obj, const JSObject* old) + { + JS::AutoAssertGCCallback inCallback; +- MOZ_ASSERT(mFlatJSObject == old); ++ MOZ_ASSERT(mFlatJSObject.unbarrieredGetPtr() == old); + + nsWrapperCache* cache = nullptr; + CallQueryInterface(mIdentity, &cache); +diff -up firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp +--- firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 2017-07-31 18:20:47.000000000 +0200 ++++ firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp 2017-09-25 10:34:11.207611692 +0200 +@@ -101,7 +101,7 @@ XPCWrappedNativeProto::CallPostCreatePro + void + XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj) + { +- MOZ_ASSERT(obj == mJSProtoObject, "huh?"); ++ MOZ_ASSERT(obj == mJSProtoObject.unbarrieredGet(), "huh?"); + + #ifdef DEBUG + // Check that this object has already been swept from the map. +@@ -117,7 +117,7 @@ XPCWrappedNativeProto::JSProtoObjectFina + void + XPCWrappedNativeProto::JSProtoObjectMoved(JSObject* obj, const JSObject* old) + { +- MOZ_ASSERT(mJSProtoObject == old); ++ MOZ_ASSERT(mJSProtoObject.unbarrieredGet() == old); + mJSProtoObject.init(obj); // Update without triggering barriers. + } + diff --git a/mozilla-1353817.patch b/mozilla-1353817.patch deleted file mode 100644 index dc8d8f8e99b88b063c0bd844fcd8661c2c77ef87..0000000000000000000000000000000000000000 --- a/mozilla-1353817.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 1cc652f5525f458b0b4ceb12af24bf5a4367db32 Mon Sep 17 00:00:00 2001 -From: Nicolas Dufresne -Date: Tue, 23 May 2017 13:09:48 -0400 -Subject: [PATCH] Bug 1353817: Include SkNx_neon.h for ARM64 too - -This fixes build errors as arm_neon.h was missing along with some -missing converters. ---- - gfx/skia/skia/src/core/SkNx.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gfx/skia/skia/src/core/SkNx.h b/gfx/skia/skia/src/core/SkNx.h -index 6bca856..b0427aa 100644 ---- a/gfx/skia/skia/src/core/SkNx.h -+++ b/gfx/skia/skia/src/core/SkNx.h -@@ -299,7 +299,7 @@ typedef SkNx<4, uint32_t> Sk4u; - // Include platform specific specializations if available. - #if !defined(SKNX_NO_SIMD) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 - #include "../opts/SkNx_sse.h" --#elif !defined(SKNX_NO_SIMD) && defined(SK_ARM_HAS_NEON) -+#elif !defined(SKNX_NO_SIMD) && (defined(SK_ARM_HAS_NEON) || defined(SK_CPU_ARM64)) - #include "../opts/SkNx_neon.h" - #else - --- -2.9.4 - diff --git a/mozilla-1415078.patch b/mozilla-1415078.patch deleted file mode 100644 index c5c433eab59cda25e84119e88ce27de9b9bfd3cb..0000000000000000000000000000000000000000 --- a/mozilla-1415078.patch +++ /dev/null @@ -1,57 +0,0 @@ -diff --git a/toolkit/components/remote/nsRemoteService.cpp b/toolkit/components/remote/nsRemoteService.cpp ---- a/toolkit/components/remote/nsRemoteService.cpp -+++ b/toolkit/components/remote/nsRemoteService.cpp -@@ -34,20 +34,18 @@ - NS_IMETHODIMP - nsRemoteService::Startup(const char* aAppName, const char* aProfileName) - { --#if defined(MOZ_ENABLE_DBUS) -+#if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND) - nsresult rv; - mDBusRemoteService = new nsDBusRemoteService(); - rv = mDBusRemoteService->Startup(aAppName, aProfileName); - if (NS_FAILED(rv)) { - mDBusRemoteService = nullptr; - } -+#elif !defined(MOZ_WAYLAND) -+ mGtkRemoteService = new nsGTKRemoteService(); -+ mGtkRemoteService->Startup(aAppName, aProfileName); - #endif - -- if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) { -- mGtkRemoteService = new nsGTKRemoteService(); -- mGtkRemoteService->Startup(aAppName, aProfileName); -- } -- - if (!mDBusRemoteService && !mGtkRemoteService) - return NS_ERROR_FAILURE; - -@@ -73,7 +71,7 @@ - NS_IMETHODIMP - nsRemoteService::Shutdown() - { --#if defined(MOZ_ENABLE_DBUS) -+#if defined(MOZ_ENABLE_DBUS) && defined(MOZ_WAYLAND) - if (mDBusRemoteService) { - mDBusRemoteService->Shutdown(); - mDBusRemoteService = nullptr; -diff --git a/widget/xremoteclient/moz.build b/widget/xremoteclient/moz.build ---- a/widget/xremoteclient/moz.build -+++ b/widget/xremoteclient/moz.build -@@ -11,7 +11,6 @@ - - SOURCES += [ - 'RemoteUtils.cpp', -- 'XRemoteClient.cpp', - ] - - if CONFIG['MOZ_ENABLE_DBUS'] and CONFIG['MOZ_WAYLAND']: -@@ -20,3 +19,7 @@ - ] - CXXFLAGS += CONFIG['TK_CFLAGS'] - CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS'] -+else: -+ SOURCES += [ -+ 'XRemoteClient.cpp', -+ ] - diff --git a/mozilla-1467125.patch b/mozilla-1467125.patch deleted file mode 100644 index 375ac4901fe3f7cdf7c27dbe6d244f9195bc6a68..0000000000000000000000000000000000000000 --- a/mozilla-1467125.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -146,18 +146,19 @@ static StaticMutex gWaylandDisplaysMutex - // - // nsWaylandDisplay is our interface to wayland compositor. It provides wayland - // global objects as we need (wl_display, wl_shm) and operates wl_event_queue on - // compositor (not the main) thread. - static nsWaylandDisplay* WaylandDisplayGet(wl_display *aDisplay); - static void WaylandDisplayRelease(wl_display *aDisplay); - static void WaylandDisplayLoop(wl_display *aDisplay); - --// TODO: is the 60pfs loop correct? --#define EVENT_LOOP_DELAY (1000/60) -+// TODO: Bug 1467125 - We need to integrate wl_display_dispatch_queue_pending() with -+// compositor event loop. -+#define EVENT_LOOP_DELAY (1000/240) - - // Get WaylandDisplay for given wl_display and actual calling thread. - static nsWaylandDisplay* - WaylandDisplayGetLocked(wl_display *aDisplay, const StaticMutexAutoLock&) - { - nsWaylandDisplay* waylandDisplay = nullptr; - - int len = gWaylandDisplays.Count(); - diff --git a/mozilla-1467128.patch b/mozilla-1467128.patch deleted file mode 100644 index 75cf92c16e1f9836b6780a5a79608d12acf0496b..0000000000000000000000000000000000000000 --- a/mozilla-1467128.patch +++ /dev/null @@ -1,359 +0,0 @@ -diff --git a/gfx/thebes/gfxPlatformGtk.h b/gfx/thebes/gfxPlatformGtk.h ---- a/gfx/thebes/gfxPlatformGtk.h -+++ b/gfx/thebes/gfxPlatformGtk.h -@@ -102,23 +102,42 @@ public: - #endif - - #ifdef MOZ_X11 - Display* GetCompositorDisplay() { - return mCompositorDisplay; - } - #endif // MOZ_X11 - -+#ifdef MOZ_WAYLAND -+ void SetWaylandLastVsync(uint32_t aVsyncTimestamp) { -+ mWaylandLastVsyncTimestamp = aVsyncTimestamp; -+ } -+ int64_t GetWaylandLastVsync() { -+ return mWaylandLastVsyncTimestamp; -+ } -+ void SetWaylandFrameDelay(int64_t aFrameDelay) { -+ mWaylandFrameDelay = aFrameDelay; -+ } -+ int64_t GetWaylandFrameDelay() { -+ return mWaylandFrameDelay; -+ } -+#endif -+ - protected: - bool CheckVariationFontSupport() override; - - int8_t mMaxGenericSubstitutions; - - private: - virtual void GetPlatformCMSOutputProfile(void *&mem, - size_t &size) override; - - #ifdef MOZ_X11 - Display* mCompositorDisplay; - #endif -+#ifdef MOZ_WAYLAND -+ int64_t mWaylandLastVsyncTimestamp; -+ int64_t mWaylandFrameDelay; -+#endif - }; - - #endif /* GFX_PLATFORM_GTK_H */ -diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp ---- a/gfx/thebes/gfxPlatformGtk.cpp -+++ b/gfx/thebes/gfxPlatformGtk.cpp -@@ -46,16 +46,20 @@ - #include "GLContextGLX.h" - #include "GLXLibrary.h" - - /* Undefine the Status from Xlib since it will conflict with system headers on OSX */ - #if defined(__APPLE__) && defined(Status) - #undef Status - #endif - -+#ifdef MOZ_WAYLAND -+#include -+#endif -+ - #endif /* MOZ_X11 */ - - #include - - #include "nsMathUtils.h" - - #define GDK_PIXMAP_SIZE_MAX 32767 - -@@ -89,16 +93,22 @@ gfxPlatformGtk::gfxPlatformGtk() - #ifdef MOZ_X11 - if (gfxPlatform::IsHeadless() && GDK_IS_X11_DISPLAY(gdk_display_get_default())) { - mCompositorDisplay = XOpenDisplay(nullptr); - MOZ_ASSERT(mCompositorDisplay, "Failed to create compositor display!"); - } else { - mCompositorDisplay = nullptr; - } - #endif // MOZ_X11 -+#ifdef MOZ_WAYLAND -+ // Wayland compositors use g_get_monotonic_time() to get timestamps. -+ mWaylandLastVsyncTimestamp = (g_get_monotonic_time() / 1000); -+ // Set default display fps to 60 -+ mWaylandFrameDelay = 1000/60; -+#endif - } - - gfxPlatformGtk::~gfxPlatformGtk() - { - #ifdef MOZ_X11 - if (mCompositorDisplay) { - XCloseDisplay(mCompositorDisplay); - } -@@ -505,26 +515,26 @@ gfxPlatformGtk::CheckVariationFontSuppor - // until at least 2.7.1. - FT_Int major, minor, patch; - FT_Library_Version(GetFTLibrary(), &major, &minor, &patch); - return major * 1000000 + minor * 1000 + patch >= 2007001; - } - - #ifdef MOZ_X11 - --class GLXVsyncSource final : public VsyncSource -+class GtkVsyncSource final : public VsyncSource - { - public: -- GLXVsyncSource() -+ GtkVsyncSource() - { - MOZ_ASSERT(NS_IsMainThread()); - mGlobalDisplay = new GLXDisplay(); - } - -- virtual ~GLXVsyncSource() -+ virtual ~GtkVsyncSource() - { - MOZ_ASSERT(NS_IsMainThread()); - } - - virtual Display& GetGlobalDisplay() override - { - return *mGlobalDisplay; - } -@@ -536,39 +546,52 @@ public: - public: - GLXDisplay() : mGLContext(nullptr) - , mXDisplay(nullptr) - , mSetupLock("GLXVsyncSetupLock") - , mVsyncThread("GLXVsyncThread") - , mVsyncTask(nullptr) - , mVsyncEnabledLock("GLXVsyncEnabledLock") - , mVsyncEnabled(false) -+#ifdef MOZ_WAYLAND -+ , mIsWaylandDisplay(false) -+#endif - { - } - - // Sets up the display's GL context on a worker thread. - // Required as GLContexts may only be used by the creating thread. - // Returns true if setup was a success. - bool Setup() - { - MonitorAutoLock lock(mSetupLock); - MOZ_ASSERT(NS_IsMainThread()); - if (!mVsyncThread.Start()) - return false; - - RefPtr vsyncSetup = -- NewRunnableMethod("GLXVsyncSource::GLXDisplay::SetupGLContext", -+ NewRunnableMethod("GtkVsyncSource::GLXDisplay::SetupGLContext", - this, - &GLXDisplay::SetupGLContext); - mVsyncThread.message_loop()->PostTask(vsyncSetup.forget()); - // Wait until the setup has completed. - lock.Wait(); - return mGLContext != nullptr; - } - -+#ifdef MOZ_WAYLAND -+ bool SetupWayland() -+ { -+ MonitorAutoLock lock(mSetupLock); -+ MOZ_ASSERT(NS_IsMainThread()); -+ mIsWaylandDisplay = true; -+ return mVsyncThread.Start(); -+ } -+#endif -+ - // Called on the Vsync thread to setup the GL context. - void SetupGLContext() - { - MonitorAutoLock lock(mSetupLock); - MOZ_ASSERT(!NS_IsMainThread()); - MOZ_ASSERT(!mGLContext, "GLContext already setup!"); - - // Create video sync timer on a separate Display to prevent locking the -@@ -613,29 +636,35 @@ public: - } - - lock.NotifyAll(); - } - - virtual void EnableVsync() override - { - MOZ_ASSERT(NS_IsMainThread()); -+#if !defined(MOZ_WAYLAND) - MOZ_ASSERT(mGLContext, "GLContext not setup!"); -+#endif - - MonitorAutoLock lock(mVsyncEnabledLock); - if (mVsyncEnabled) { - return; - } - mVsyncEnabled = true; - - // If the task has not nulled itself out, it hasn't yet realized - // that vsync was disabled earlier, so continue its execution. - if (!mVsyncTask) { - mVsyncTask = NewRunnableMethod( -- "GLXVsyncSource::GLXDisplay::RunVsync", this, &GLXDisplay::RunVsync); -+ "GtkVsyncSource::GLXDisplay::RunVsync", this, -+#if defined(MOZ_WAYLAND) -+ mIsWaylandDisplay ? &GLXDisplay::RunVsyncWayland : -+#endif -+ &GLXDisplay::RunVsync); - RefPtr addrefedTask = mVsyncTask; - mVsyncThread.message_loop()->PostTask(addrefedTask.forget()); - } - } - - virtual void DisableVsync() override - { - MonitorAutoLock lock(mVsyncEnabledLock); -@@ -650,17 +679,17 @@ public: - - virtual void Shutdown() override - { - MOZ_ASSERT(NS_IsMainThread()); - DisableVsync(); - - // Cleanup thread-specific resources before shutting down. - RefPtr shutdownTask = NewRunnableMethod( -- "GLXVsyncSource::GLXDisplay::Cleanup", this, &GLXDisplay::Cleanup); -+ "GtkVsyncSource::GLXDisplay::Cleanup", this, &GLXDisplay::Cleanup); - mVsyncThread.message_loop()->PostTask(shutdownTask.forget()); - - // Stop, waiting for the cleanup task to finish execution. - mVsyncThread.Stop(); - } - - private: - virtual ~GLXDisplay() -@@ -709,50 +738,96 @@ public: - } - } - - lastVsync = TimeStamp::Now(); - NotifyVsync(lastVsync); - } - } - -+#ifdef MOZ_WAYLAND -+ /* VSync on Wayland is tricky as we can get only "last VSync" event signal. -+ * That means we should draw next frame at "last Vsync + frame delay" time. -+ */ -+ void RunVsyncWayland() -+ { -+ MOZ_ASSERT(!NS_IsMainThread()); -+ -+ for (;;) { -+ { -+ MonitorAutoLock lock(mVsyncEnabledLock); -+ if (!mVsyncEnabled) { -+ mVsyncTask = nullptr; -+ return; -+ } -+ } -+ -+ gint64 lastVsync = gfxPlatformGtk::GetPlatform()->GetWaylandLastVsync(); -+ gint64 currTime = (g_get_monotonic_time() / 1000); -+ -+ gint64 remaining = gfxPlatformGtk::GetPlatform()->GetWaylandFrameDelay() - -+ (currTime - lastVsync); -+ if (remaining > 0) { -+ PlatformThread::Sleep(remaining); -+ } else { -+ // Time from last HW Vsync is longer than our frame delay, -+ // use our approximation then. -+ gfxPlatformGtk::GetPlatform()->SetWaylandLastVsync(currTime); -+ } -+ -+ NotifyVsync(TimeStamp::Now()); -+ } -+ } -+#endif -+ - void Cleanup() { - MOZ_ASSERT(!NS_IsMainThread()); - - mGLContext = nullptr; -- XCloseDisplay(mXDisplay); -+ if (mXDisplay) -+ XCloseDisplay(mXDisplay); - } - - // Owned by the vsync thread. - RefPtr mGLContext; - _XDisplay* mXDisplay; - Monitor mSetupLock; - base::Thread mVsyncThread; - RefPtr mVsyncTask; - Monitor mVsyncEnabledLock; - bool mVsyncEnabled; -+#ifdef MOZ_WAYLAND -+ bool mIsWaylandDisplay; -+#endif - }; - private: - // We need a refcounted VsyncSource::Display to use chromium IPC runnables. - RefPtr mGlobalDisplay; - }; - - already_AddRefed - gfxPlatformGtk::CreateHardwareVsyncSource() - { -+#ifdef MOZ_WAYLAND -+ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { -+ RefPtr vsyncSource = new GtkVsyncSource(); -+ VsyncSource::Display& display = vsyncSource->GetGlobalDisplay(); -+ static_cast(display).SetupWayland(); -+ return vsyncSource.forget(); -+ } -+#endif -+ - // Only use GLX vsync when the OpenGL compositor is being used. - // The extra cost of initializing a GLX context while blocking the main - // thread is not worth it when using basic composition. -- // Also don't use it on non-X11 displays. - if (gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) { -- if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) && -- gl::sGLXLibrary.SupportsVideoSync()) { -- RefPtr vsyncSource = new GLXVsyncSource(); -+ if (gl::sGLXLibrary.SupportsVideoSync()) { -+ RefPtr vsyncSource = new GtkVsyncSource(); - VsyncSource::Display& display = vsyncSource->GetGlobalDisplay(); -- if (!static_cast(display).Setup()) { -+ if (!static_cast(display).Setup()) { - NS_WARNING("Failed to setup GLContext, falling back to software vsync."); - return gfxPlatform::CreateHardwareVsyncSource(); - } - return vsyncSource.forget(); - } - NS_WARNING("SGI_video_sync unsupported. Falling back to software vsync."); - } - return gfxPlatform::CreateHardwareVsyncSource(); -diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp ---- a/widget/gtk/WindowSurfaceWayland.cpp -+++ b/widget/gtk/WindowSurfaceWayland.cpp -@@ -546,16 +546,18 @@ WindowBackBuffer::Lock() - mWaylandDisplay->GetSurfaceFormat()); - } - - static void - frame_callback_handler(void *data, struct wl_callback *callback, uint32_t time) - { - auto surface = reinterpret_cast(data); - surface->FrameCallbackHandler(); -+ -+ gfxPlatformGtk::GetPlatform()->SetWaylandLastVsync(time); - } - - static const struct wl_callback_listener frame_listener = { - frame_callback_handler - }; - - WindowSurfaceWayland::WindowSurfaceWayland(nsWindow *aWindow) - : mWindow(aWindow) - diff --git a/mozilla-1516081.patch b/mozilla-1516081.patch new file mode 100644 index 0000000000000000000000000000000000000000..a15facdfd7fd5d3d310aee5c99be8907ba345486 --- /dev/null +++ b/mozilla-1516081.patch @@ -0,0 +1,21 @@ +diff -up firefox-71.0/build/moz.configure/lto-pgo.configure.1516081 firefox-71.0/build/moz.configure/lto-pgo.configure +--- firefox-71.0/build/moz.configure/lto-pgo.configure.1516081 2019-11-26 01:02:19.000000000 +0100 ++++ firefox-71.0/build/moz.configure/lto-pgo.configure 2019-11-26 11:04:10.993077232 +0100 +@@ -71,7 +71,7 @@ set_config('PGO_PROFILE_PATH', pgo_profi + def pgo_flags(compiler, target, profdata): + if compiler.type == 'gcc': + return namespace( +- gen_cflags=['-fprofile-generate'], ++ gen_cflags=['-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'], + gen_ldflags=['-fprofile-generate'], + use_cflags=['-fprofile-use', '-fprofile-correction', + '-Wcoverage-mismatch'], +@@ -92,7 +92,7 @@ def pgo_flags(compiler, target, profdata + gen_ldflags = ['-fprofile-generate'] + + return namespace( +- gen_cflags=[prefix + '-fprofile-generate'], ++ gen_cflags=[prefix + '-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'], + gen_ldflags=gen_ldflags, + use_cflags=[prefix + '-fprofile-use=%s' % profdata, + # Some error messages about mismatched profile data diff --git a/mozilla-1516803.patch b/mozilla-1516803.patch new file mode 100644 index 0000000000000000000000000000000000000000..f1f37f4991aefb2dc65c593cb0e4c0a864da8530 --- /dev/null +++ b/mozilla-1516803.patch @@ -0,0 +1,16 @@ +diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build +--- a/security/sandbox/linux/moz.build ++++ b/security/sandbox/linux/moz.build +@@ -99,9 +99,8 @@ + # gcc lto likes to put the top level asm in syscall.cc in a different partition + # from the function using it which breaks the build. Work around that by + # forcing there to be only one partition. +-for f in CONFIG['OS_CXXFLAGS']: +- if f.startswith('-flto') and CONFIG['CC_TYPE'] != 'clang': +- LDFLAGS += ['--param lto-partitions=1'] ++if CONFIG['CC_TYPE'] != 'clang': ++ LDFLAGS += ['--param', 'lto-partitions=1'] + + DEFINES['NS_NO_XPCOM'] = True + DisableStlWrapping() + diff --git a/mozilla-1580174-webrtc-popup.patch b/mozilla-1580174-webrtc-popup.patch new file mode 100644 index 0000000000000000000000000000000000000000..2d154eb1c241a7ec64f1c9771eee34aea7f30265 --- /dev/null +++ b/mozilla-1580174-webrtc-popup.patch @@ -0,0 +1,51 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -1155,6 +1155,28 @@ + } + } + ++bool IsPopupWithoutToplevelParent(nsMenuPopupFrame* aMenuPopupFrame) { ++ // Check if the popup is autocomplete (like tags autocomplete ++ // in the bookmark edit popup). ++ nsAtom* popupId = aMenuPopupFrame->GetContent()->GetID(); ++ if (popupId && popupId->Equals(NS_LITERAL_STRING("PopupAutoComplete"))) { ++ return true; ++ } ++ ++ // Check if the popup is in popupnotificationcontent (like choosing capture ++ // device when starting webrtc session). ++ nsIFrame* parentFrame = aMenuPopupFrame->GetParent(); ++ if (!parentFrame) { ++ return false; ++ } ++ parentFrame = parentFrame->GetParent(); ++ if (parentFrame && parentFrame->GetContent()->NodeName().EqualsLiteral( ++ "popupnotificationcontent")) { ++ return true; ++ } ++ return false; ++} ++ + // Wayland keeps strong popup window hierarchy. We need to track active + // (visible) popup windows and make sure we hide popup on the same level + // before we open another one on that level. It means that every open +@@ -1211,10 +1233,14 @@ + LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow)); + + // If the popup is a regular menu but GetParentMenuWidget() returns +- // nullptr which means it's connected non-menu parent +- // (bookmark toolbar for instance). ++ // nullptr which means is not a submenu of any other menu. + // In this case use a parent given at nsWindow::Create(). +- if (!parentWindow && !menuPopupFrame->IsContextMenu()) { ++ // But we have to avoid using mToplevelParentWindow in case the popup ++ // is in 'popupnotificationcontent' element or autocomplete popup, ++ // otherwise the popupnotification would disappear when for ++ // example opening a popup with microphone selection. ++ if (!parentWindow && !menuPopupFrame->IsContextMenu() && ++ !IsPopupWithoutToplevelParent(menuPopupFrame)) { + parentWindow = + get_window_for_gtk_widget(GTK_WIDGET(mToplevelParentWindow)); + } + diff --git a/mozilla-1640982.patch b/mozilla-1640982.patch new file mode 100644 index 0000000000000000000000000000000000000000..b63ba3bfbbc6a9331de6f6674932e281e7c8d7c0 --- /dev/null +++ b/mozilla-1640982.patch @@ -0,0 +1,16 @@ +diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk +--- a/config/makefiles/rust.mk ++++ b/config/makefiles/rust.mk +@@ -61,7 +61,11 @@ + # Enable link-time optimization for release builds, but not when linking + # gkrust_gtest. + ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE))) ++# Pass -Clto for older versions of rust, and CARGO_PROFILE_RELEASE_LTO=true ++# for newer ones that support it. Combining the latter with -Clto works, so ++# set both everywhere. + cargo_rustc_flags += -Clto ++export CARGO_PROFILE_RELEASE_LTO=true + endif + endif + endif + diff --git a/mozilla-1645671.patch b/mozilla-1645671.patch new file mode 100644 index 0000000000000000000000000000000000000000..0943469b2d09815e3dd339fc43c4a47d41667595 --- /dev/null +++ b/mozilla-1645671.patch @@ -0,0 +1,67 @@ +changeset: 544864:a8603f131703 +tag: tip +parent: 544861:161920b70ae4 +user: Martin Stransky +date: Fri Jul 31 13:39:48 2020 +0200 +files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +description: +Bug 1645671 [Linux/VA-API] Create DMABufSurfaceWrapper directly at nsTAttay and disable DMABufSurfaceWrapper class copy and assignment constructors, r?jya + +When DMABufSurfaceWrapper is added to nsTArray, a temporary local DMABufSurfaceWrapper object is created. When the temporary +object is deleted after the adding, associated dmabuf data is released which leads to rendering artifact during VA-API video playback. + +As a fix in this patch we create DMABufSurfaceWrapper 'in-place' at nsTAttay. +We also disable DMABufSurfaceWrapper class copy and assignment constructors to avoid similar potential issues. + +Differential Revision: https://phabricator.services.mozilla.com/D85152 + + +diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp ++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +@@ -777,17 +777,17 @@ MediaResult FFmpegVideoDecoderSetUID(++uid); + FFMPEG_LOG("Created new DMABufSurface UID = %d", uid); + # endif +- mDMABufSurfaces.AppendElement(DMABufSurfaceWrapper(surface, mLib)); ++ mDMABufSurfaces.EmplaceBack(surface, mLib); + surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]); + } else { + surface = surfaceWrapper->GetDMABufSurface(); + bool ret; + + if (mVAAPIDeviceContext) { + ret = surface->UpdateYUVData(vaDesc); + } else { +diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h ++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +@@ -70,16 +70,22 @@ class DMABufSurfaceWrapper final { + // Check if DMABufSurface is used by any gecko rendering process + // (WebRender or GL compositor) or by DMABUFSurfaceImage/VideoData. + bool IsUsed() const { return mSurface->IsGlobalRefSet(); } + + RefPtr GetDMABufSurface() const { + return mSurface->GetAsDMABufSurfaceYUV(); + } + ++ // Don't allow DMABufSurfaceWrapper plain copy as it leads to ++ // enexpected DMABufSurface/HW buffer releases and we don't want to ++ // deep copy them. ++ DMABufSurfaceWrapper(const DMABufSurfaceWrapper&) = delete; ++ const DMABufSurfaceWrapper& operator=(DMABufSurfaceWrapper const&) = delete; ++ + private: + const RefPtr mSurface; + const FFmpegLibWrapper* mLib; + AVBufferRef* mAVHWFramesContext; + AVBufferRef* mHWAVBuffer; + }; + #endif + + diff --git a/mozilla-1656436.patch b/mozilla-1656436.patch new file mode 100644 index 0000000000000000000000000000000000000000..6350a433000132f4ac0ea587ebc88838ee6d1e91 --- /dev/null +++ b/mozilla-1656436.patch @@ -0,0 +1,28 @@ +diff -up firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.mozilla-1656436 firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +--- firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.mozilla-1656436 2020-08-04 13:31:49.476663242 +0200 ++++ firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp 2020-08-04 13:32:28.201448682 +0200 +@@ -766,6 +766,11 @@ MediaResult FFmpegVideoDecoderReleaseVAAPIData(); ++ } ++ + surface = surfaceWrapper->GetDMABufSurface(); + bool ret; + +diff -up firefox-79.0/widget/gtk/DMABufSurface.cpp.mozilla-1656436 firefox-79.0/widget/gtk/DMABufSurface.cpp +--- firefox-79.0/widget/gtk/DMABufSurface.cpp.mozilla-1656436 2020-08-04 13:31:49.477663237 +0200 ++++ firefox-79.0/widget/gtk/DMABufSurface.cpp 2020-08-04 13:33:07.666230023 +0200 +@@ -744,7 +744,8 @@ bool DMABufSurfaceYUV::UpdateYUVData(con + return false; + } + if (mDmabufFds[0] >= 0) { +- ReleaseSurface(); ++ NS_WARNING("DMABufSurfaceYUV is already created!"); ++ return false; + } + + mSurfaceFormat = gfx::SurfaceFormat::NV12; diff --git a/mozilla-256180.patch b/mozilla-256180.patch deleted file mode 100644 index 13a1c9777cc99cbdb7fcd437ff6cd57c254034fe..0000000000000000000000000000000000000000 --- a/mozilla-256180.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/layout/generic/nsIFrame.h.old 2016-07-11 13:41:39.688276559 +0200 -+++ b/layout/generic/nsIFrame.h 2016-07-11 13:42:12.791406976 +0200 -@@ -13,7 +13,7 @@ - #error This header/class should only be used within Mozilla code. It should not be used by extensions. - #endif - --#define MAX_REFLOW_DEPTH 200 -+#define MAX_REFLOW_DEPTH 1000 - - /* nsIFrame is in the process of being deCOMtaminated, i.e., this file is eventually - going to be eliminated, and all callers will use nsFrame instead. At the moment diff --git a/node-stdout-nonblocking-wrapper b/node-stdout-nonblocking-wrapper new file mode 100755 index 0000000000000000000000000000000000000000..b2814b8d40392ffe76c24d7676c91a353a23b76a --- /dev/null +++ b/node-stdout-nonblocking-wrapper @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/node "$@" 2>&1 | cat - diff --git a/pgo.patch b/pgo.patch new file mode 100644 index 0000000000000000000000000000000000000000..c58a1b517a8b5fedcbe672154b9763c7f12dfc3e --- /dev/null +++ b/pgo.patch @@ -0,0 +1,113 @@ +diff -up firefox-77.0.1/build/moz.configure/lto-pgo.configure.pgo firefox-77.0.1/build/moz.configure/lto-pgo.configure +--- firefox-77.0.1/build/moz.configure/lto-pgo.configure.pgo 2020-06-03 01:35:41.000000000 +0200 ++++ firefox-77.0.1/build/moz.configure/lto-pgo.configure 2020-06-23 14:39:38.716560329 +0200 +@@ -69,12 +69,14 @@ set_config('PGO_PROFILE_PATH', pgo_profi + @imports(_from='__builtin__', _import='min') + def pgo_flags(compiler, profdata, target_is_windows): + if compiler.type == 'gcc': ++ #profile_use = '-fprofile-use=$(topobjdir)' ++ profile_use = '-fprofile-use' + return namespace( + gen_cflags=['-fprofile-generate'], + gen_ldflags=['-fprofile-generate'], +- use_cflags=['-fprofile-use', '-fprofile-correction', ++ use_cflags=[profile_use, '-fprofile-correction', + '-Wcoverage-mismatch'], +- use_ldflags=['-fprofile-use'], ++ use_ldflags=[profile_use], + ) + + if compiler.type in ('clang-cl', 'clang'): +diff -up firefox-77.0.1/build/pgo/profileserver.py.pgo firefox-77.0.1/build/pgo/profileserver.py +--- firefox-77.0.1/build/pgo/profileserver.py.pgo 2020-06-03 03:04:50.000000000 +0200 ++++ firefox-77.0.1/build/pgo/profileserver.py 2020-06-23 14:53:56.877736235 +0200 +@@ -11,7 +11,7 @@ import glob + import subprocess + + import mozcrash +-from mozbuild.base import MozbuildObject, BinaryNotFoundException ++from mozbuild.base import MozbuildObject, BinaryNotFoundException, BuildEnvironmentNotFoundException + from mozfile import TemporaryDirectory + from mozhttpd import MozHttpd + from mozprofile import FirefoxProfile, Preferences +@@ -84,9 +84,22 @@ if __name__ == '__main__': + port=PORT, + options='primary,privileged') + +- old_profraw_files = glob.glob('*.profraw') +- for f in old_profraw_files: +- os.remove(f) ++ using_gcc = False ++ try: ++ if build.config_environment.substs.get('CC_TYPE') == 'gcc': ++ using_gcc = True ++ except BuildEnvironmentNotFoundException: ++ pass ++ ++ if using_gcc: ++ for dirpath, _, filenames in os.walk('.'): ++ for f in filenames: ++ if f.endswith('.gcda'): ++ os.remove(os.path.join(dirpath, f)) ++ else: ++ old_profraw_files = glob.glob('*.profraw') ++ for f in old_profraw_files: ++ os.remove(f) + + with TemporaryDirectory() as profilePath: + # TODO: refactor this into mozprofile +@@ -191,6 +204,11 @@ if __name__ == '__main__': + print("Firefox exited successfully, but produced a crashreport") + sys.exit(1) + ++ ++ print('Copying profile data....') ++ os.system('pwd'); ++ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;'); ++ + llvm_profdata = env.get('LLVM_PROFDATA') + if llvm_profdata: + profraw_files = glob.glob('*.profraw') +diff -up firefox-77.0.1/build/unix/mozconfig.unix.pgo firefox-77.0.1/build/unix/mozconfig.unix +--- firefox-77.0.1/build/unix/mozconfig.unix.pgo 2020-06-03 01:35:41.000000000 +0200 ++++ firefox-77.0.1/build/unix/mozconfig.unix 2020-06-23 14:39:38.716560329 +0200 +@@ -6,6 +6,15 @@ if [ -n "$FORCE_GCC" ]; then + CC="$MOZ_FETCHES_DIR/gcc/bin/gcc" + CXX="$MOZ_FETCHES_DIR/gcc/bin/g++" + ++ if [ -n "$MOZ_PGO" ]; then ++ if [ -z "$USE_ARTIFACT" ]; then ++ ac_add_options --enable-lto ++ fi ++ export AR="$topsrcdir/gcc/bin/gcc-ar" ++ export NM="$topsrcdir/gcc/bin/gcc-nm" ++ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib" ++ fi ++ + # We want to make sure we use binutils and other binaries in the tooltool + # package. + mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH" +diff -up firefox-77.0.1/config/config.mk.pgo firefox-77.0.1/config/config.mk +diff -up firefox-77.0.1/extensions/spellcheck/src/moz.build.pgo firefox-77.0.1/extensions/spellcheck/src/moz.build +--- firefox-77.0.1/extensions/spellcheck/src/moz.build.pgo 2020-06-03 01:35:48.000000000 +0200 ++++ firefox-77.0.1/extensions/spellcheck/src/moz.build 2020-06-23 14:39:38.717560324 +0200 +@@ -31,3 +31,5 @@ EXPORTS.mozilla += [ + + if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] ++ ++CXXFLAGS += ['-fno-devirtualize'] +\ No newline at end of file +diff -up firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py.pgo firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py +--- firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py.pgo 2020-06-03 01:36:46.000000000 +0200 ++++ firefox-77.0.1/python/mozbuild/mozbuild/build_commands.py 2020-06-23 14:39:38.717560324 +0200 +@@ -114,7 +114,8 @@ class Build(MachCommandBase): + return status + + pgo_env = os.environ.copy() +- pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA') ++ if instr.config_environment.substs.get('CC_TYPE') != 'gcc': ++ pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA') + pgo_env['JARLOG_FILE'] = mozpath.join(orig_topobjdir, 'jarlog/en-US.log') + pgo_cmd = [ + instr.virtualenv_manager.python_path, diff --git a/rhbz-1173156.patch b/rhbz-1173156.patch index 5cb47322d23cd1857350cf4546e2d0e48952f6b6..c35d901df935096813b0cba47993ae5f75b52b7a 100644 --- a/rhbz-1173156.patch +++ b/rhbz-1173156.patch @@ -1,12 +1,12 @@ -diff -up mozilla-esr31/extensions/auth/nsAuthSambaNTLM.cpp.old mozilla-esr31/extensions/auth/nsAuthSambaNTLM.cpp ---- mozilla-esr31/extensions/auth/nsAuthSambaNTLM.cpp.old 2014-11-25 12:23:22.000000000 +0100 -+++ mozilla-esr31/extensions/auth/nsAuthSambaNTLM.cpp 2014-12-23 15:26:36.606674625 +0100 -@@ -174,7 +174,7 @@ nsAuthSambaNTLM::SpawnNTLMAuthHelper() - return NS_ERROR_FAILURE; +diff -up firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp.rhbz-1173156 firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp +--- firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp.rhbz-1173156 2019-01-22 10:36:09.284069020 +0100 ++++ firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp 2019-01-22 10:37:12.669757744 +0100 +@@ -161,7 +161,7 @@ nsresult nsAuthSambaNTLM::SpawnNTLMAuthH + const char* username = PR_GetEnv("USER"); + if (!username) return NS_ERROR_FAILURE; - const char* const args[] = { -- "ntlm_auth", -+ "/usr/bin/ntlm_auth", - "--helper-protocol", "ntlmssp-client-1", - "--use-cached-creds", - "--username", username, +- const char* const args[] = {"ntlm_auth", ++ const char* const args[] = {"/usr/bin/ntlm_auth", + "--helper-protocol", + "ntlmssp-client-1", + "--use-cached-creds", diff --git a/rhbz-1219542-s390-build.patch b/rhbz-1219542-s390-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..f94e43a623c4d80a9a387bb15bc735809420b655 --- /dev/null +++ b/rhbz-1219542-s390-build.patch @@ -0,0 +1,23 @@ +diff -up firefox-55.0/js/src/old-configure.in.rhbz-1219542-s390 firefox-55.0/js/src/old-configure.in +--- firefox-55.0/js/src/old-configure.in.rhbz-1219542-s390 2017-07-31 18:20:48.000000000 +0200 ++++ firefox-55.0/js/src/old-configure.in 2017-08-02 14:31:32.190243669 +0200 +@@ -541,7 +541,7 @@ case "$host" in + + *-linux*|*-kfreebsd*-gnu|*-gnu*) + HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" +- HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" ++ HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O1}" + ;; + + *) +@@ -617,8 +617,8 @@ case "$target" in + + *-*linux*) + if test "$GNU_CC" -o "$GNU_CXX"; then +- MOZ_PGO_OPTIMIZE_FLAGS="-O3" +- MOZ_OPTIMIZE_FLAGS="-O3" ++ MOZ_PGO_OPTIMIZE_FLAGS="-O1" ++ MOZ_OPTIMIZE_FLAGS="-O1" + if test -z "$CLANG_CC"; then + MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS" + fi diff --git a/rhbz-1354671.patch b/rhbz-1354671.patch index 6ee89b775c3ebbae45ebbda75c7491311fa01ec1..b6e8bbd06e06582f1e9c0ce0f5344e90b2ad92f2 100644 --- a/rhbz-1354671.patch +++ b/rhbz-1354671.patch @@ -1,12 +1,12 @@ -diff -up firefox-53.0/layout/base/nsIPresShell.h.1354671 firefox-53.0/layout/base/nsIPresShell.h ---- firefox-53.0/layout/base/nsIPresShell.h.1354671 2017-04-27 13:07:43.808653320 +0200 -+++ firefox-53.0/layout/base/nsIPresShell.h 2017-04-27 13:09:40.404427641 +0200 -@@ -212,7 +212,7 @@ public: +diff -up firefox-70.0/layout/base/PresShell.h.1354671 firefox-70.0/layout/base/PresShell.h +--- firefox-70.0/layout/base/PresShell.h.1354671 2019-10-22 12:33:12.987775587 +0200 ++++ firefox-70.0/layout/base/PresShell.h 2019-10-22 12:36:39.999366086 +0200 +@@ -257,7 +257,7 @@ class PresShell final : public nsStubDoc * to the same aSize value. AllocateFrame is infallible and will abort * on out-of-memory. */ -- void* AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) -+ void* __attribute__((optimize("no-lifetime-dse"))) AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) - { - void* result = mFrameArena.AllocateByFrameID(aID, aSize); - RecordAlloc(result); +- void* AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) { ++ void* __attribute__((optimize("no-lifetime-dse"))) AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) { + #define FRAME_ID(classname, ...) \ + static_assert(size_t(nsQueryFrame::FrameIID::classname##_id) == \ + size_t(eArenaObjectID_##classname), \ diff --git a/testing.tar.xz b/testing.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..879e6232aa6f45bd79c32d7dd003b393f6a39912 Binary files /dev/null and b/testing.tar.xz differ