The package rpms/icecat.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/icecat.git/commit/?id=c355d1f7e5d....
Change:
+%ifarch %{arm}
Thanks.
Full change:
============
commit c355d1f7e5db964759c8055f6cd0db2264f13275
Author: sagitter <sagitter(a)fedoraproject.org>
Date: Thu Sep 20 19:24:09 2018 +0200
Pre release 60.2.0
diff --git a/.gitignore b/.gitignore
index 0aa23e0..4e91319 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,3 +56,4 @@
/icecat-52.8.0-gnu2.tar.bz2
/icecat-52.8.1-gnu1.tar.bz2
/icecat-52.9.0-gnu1.tar.bz2
+/icecat-60.2.0-gnu1.tar.bz2
diff --git a/Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
b/Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
new file mode 100644
index 0000000..70e45ff
--- /dev/null
+++ b/Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
@@ -0,0 +1,19 @@
+diff -up firefox-60.0/mfbt/LinuxSignal.h.mozilla-1238661 firefox-60.0/mfbt/LinuxSignal.h
+--- firefox-60.0/mfbt/LinuxSignal.h.mozilla-1238661 2018-04-27 08:55:38.848241768 +0200
++++ firefox-60.0/mfbt/LinuxSignal.h 2018-04-27 09:06:47.946769859 +0200
+@@ -25,10 +25,13 @@ SignalTrampoline(int aSignal, siginfo_t*
+ "nop; nop; nop; nop"
+ : : : "memory");
+
++ // Because the assembler may generate additional insturctions below, we
++ // need to ensure NOPs are inserted first by separating them out above.
++
+ asm volatile (
+- "b %0"
++ "bx %0"
+ :
+- : "X"(H)
++ : "r"(H), "l"(aSignal), "l"(aInfo),
"l"(aContext)
+ : "memory");
+ }
+
diff --git a/bug1375074-save-restore-x28.patch b/bug1375074-save-restore-x28.patch
new file mode 100644
index 0000000..57a83a2
--- /dev/null
+++ b/bug1375074-save-restore-x28.patch
@@ -0,0 +1,74 @@
+# HG changeset patch
+# User Lars T Hansen <lhansen(a)mozilla.com>
+# 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 0000000..33d2d35
--- /dev/null
+++ b/build-aarch64-skia.patch
@@ -0,0 +1,21 @@
+diff -up firefox-60.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp.aarch64-skia
firefox-60.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp
+--- firefox-60.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp.aarch64-skia 2018-04-20
12:07:26.242037226 +0200
++++ firefox-60.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp 2018-04-20
12:12:58.916428432 +0200
+@@ -666,7 +666,7 @@ SI F approx_powf(F x, F y) {
+ }
+
+ SI F from_half(U16 h) {
+-#if defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary
workaround for some Google3 builds.
++#if 0 && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) //
Temporary workaround for some Google3 builds.
+ return vcvt_f32_f16(h);
+
+ #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
+@@ -686,7 +686,7 @@ SI F from_half(U16 h) {
+ }
+
+ SI U16 to_half(F f) {
+-#if defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary
workaround for some Google3 builds.
++#if 0 && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3) //
Temporary workaround for some Google3 builds.
+ return vcvt_f16_f32(f);
+
+ #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
diff --git a/build-big-endian.patch b/build-big-endian.patch
new file mode 100644
index 0000000..e8ec439
--- /dev/null
+++ b/build-big-endian.patch
@@ -0,0 +1,84 @@
+diff -up firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h.big-endian
firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h
+--- firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h.big-endian 2018-04-09
22:50:48.000000000 +0200
++++ firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h 2018-04-18 11:51:38.748680174
+0200
+@@ -54,18 +54,19 @@ static inline U8CPU SkUnitScalarClampToB
+ *
+ * Here we enforce this constraint.
+ */
+-
++/*
+ #ifdef SK_CPU_BENDIAN
+ #define SK_RGBA_R32_SHIFT 24
+ #define SK_RGBA_G32_SHIFT 16
+ #define SK_RGBA_B32_SHIFT 8
+ #define SK_RGBA_A32_SHIFT 0
+ #else
++*/
+ #define SK_RGBA_R32_SHIFT 0
+ #define SK_RGBA_G32_SHIFT 8
+ #define SK_RGBA_B32_SHIFT 16
+ #define SK_RGBA_A32_SHIFT 24
+-#endif
++/*#endif*/
+
+ #define SkGetPackedA32(packed) ((uint32_t)((packed) << (24 - SK_A32_SHIFT))
>> 24)
+ #define SkGetPackedR32(packed) ((uint32_t)((packed) << (24 - SK_R32_SHIFT))
>> 24)
+diff -up firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h.big-endian
firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h
+--- firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h.big-endian 2018-04-09
22:50:48.000000000 +0200
++++ firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h 2018-04-18 11:51:38.748680174
+0200
+@@ -84,7 +84,8 @@ enum SkColorType {
+ #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
+ kN32_SkColorType = kRGBA_8888_SkColorType,
+ #else
+- #error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order"
++ //#error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order"
++ kN32_SkColorType = kBGRA_8888_SkColorType
+ #endif
+ };
+
+diff -up firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h.big-endian
firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h
+--- firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h.big-endian 2018-04-09
22:50:48.000000000 +0200
++++ firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h 2018-04-18 11:51:38.748680174 +0200
+@@ -344,15 +344,13 @@ enum GrPixelConfig {
+ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
+
+ // Aliases for pixel configs that match skia's byte order.
+-#ifndef SK_CPU_LENDIAN
+- #error "Skia gpu currently assumes little endian"
+-#endif
+ #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
+ static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
+ #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
+ static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig;
+ #else
+- #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA
format."
++ static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
++ static const GrPixelConfig kSkiaGamma8888_GrPixelConfig =
kSBGRA_8888_GrPixelConfig;
+ #endif
+
+ /**
+diff -up firefox-60.0/gfx/skia/skia/src/core/SkColorData.h.big-endian
firefox-60.0/gfx/skia/skia/src/core/SkColorData.h
+--- firefox-60.0/gfx/skia/skia/src/core/SkColorData.h.big-endian 2018-04-18
13:42:06.980476156 +0200
++++ firefox-60.0/gfx/skia/skia/src/core/SkColorData.h 2018-04-18 13:42:50.493520552
+0200
+@@ -31,18 +31,19 @@
+ *
+ * Here we enforce this constraint.
+ */
+-
++/*
+ #ifdef SK_CPU_BENDIAN
+ #define SK_BGRA_B32_SHIFT 24
+ #define SK_BGRA_G32_SHIFT 16
+ #define SK_BGRA_R32_SHIFT 8
+ #define SK_BGRA_A32_SHIFT 0
+ #else
++*/
+ #define SK_BGRA_B32_SHIFT 0
+ #define SK_BGRA_G32_SHIFT 8
+ #define SK_BGRA_R32_SHIFT 16
+ #define SK_BGRA_A32_SHIFT 24
+-#endif
++//#endif
+
+ #if defined(SK_PMCOLOR_IS_RGBA) && defined(SK_PMCOLOR_IS_BGRA)
+ #error "can't define PMCOLOR to be RGBA and BGRA"
diff --git a/build-cacheFlush-missing.patch b/build-cacheFlush-missing.patch
new file mode 100644
index 0000000..51c368c
--- /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-icu-big-endian.patch b/build-icu-big-endian.patch
index 68fbea1..aaa0e3b 100644
--- a/build-icu-big-endian.patch
+++ b/build-icu-big-endian.patch
@@ -1,12 +1,12 @@
-diff -up mozilla-aurora/build/autoconf/icu.m4.icu-endian
mozilla-aurora/build/autoconf/icu.m4
---- mozilla-aurora/build/autoconf/icu.m4.icu-endian 2016-12-09 09:11:01.227317790 +0100
-+++ mozilla-aurora/build/autoconf/icu.m4 2016-12-09 09:18:40.608712247 +0100
-@@ -78,7 +78,7 @@ if test -n "$USE_ICU"; then
+diff -up a/build/autoconf/icu.orig.m4 b/build/autoconf/icu.m4
+--- a/build/autoconf/icu.orig.m4 2016-12-09 09:11:01.227317790 +0100
++++ b/build/autoconf/icu.m4 2016-12-09 09:18:40.608712247 +0100
+@@ -78,7 +78,7 @@
# 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"
- dnl We won't build ICU data as a separate file when building
- dnl JS standalone so that embedders don't have to deal with it.
+ MOZ_ICU_DATA_ARCHIVE=
+ fi
diff --git a/build-jit-atomic-always-lucky.patch b/build-jit-atomic-always-lucky.patch
new file mode 100644
index 0000000..31bc5ec
--- /dev/null
+++ b/build-jit-atomic-always-lucky.patch
@@ -0,0 +1,30 @@
+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
+ #elif defined(__s390__) || defined(__s390x__)
+ # include "jit/none/AtomicOperations-feeling-lucky.h"
+ #else
+-# 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 <atomic>. Where that
+ // isn't available, we use GCC's older __sync functions instead.
diff --git a/build-ppc-jit.patch b/build-ppc-jit.patch
new file mode 100644
index 0000000..a9dc6d1
--- /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 0000000..2474c35
--- /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/complete-csd-window-offset-mozilla-1457691.patch
b/complete-csd-window-offset-mozilla-1457691.patch
new file mode 100644
index 0000000..a43a518
--- /dev/null
+++ b/complete-csd-window-offset-mozilla-1457691.patch
@@ -0,0 +1,614 @@
+This is a composition of these patches for Firefox 60:
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1441873
+https://bugzilla.mozilla.org/show_bug.cgi?id=1441665
+https://bugzilla.mozilla.org/show_bug.cgi?id=1456898
+https://bugzilla.mozilla.org/show_bug.cgi?id=1457309
+https://bugzilla.mozilla.org/show_bug.cgi?id=1457691
+
+which fix popup window placement at CSD window mode.
+
+
+diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
+--- a/widget/gtk/nsLookAndFeel.cpp
++++ b/widget/gtk/nsLookAndFeel.cpp
+@@ -1076,19 +1076,18 @@ nsLookAndFeel::EnsureInit()
+ nullptr);
+
+ GetSystemFontInfo(gtk_widget_get_style_context(entry),
+ &mFieldFontName, &mFieldFontStyle);
+
+ gtk_widget_destroy(window);
+ g_object_unref(labelWidget);
+
+- // Require GTK 3.10 for GtkHeaderBar support and compatible window manager.
+- mCSDAvailable = (gtk_check_version(3, 10, 0) == nullptr &&
+- nsWindow::GetCSDSupportLevel() != nsWindow::CSD_SUPPORT_NONE);
++ mCSDAvailable =
++ nsWindow::GetSystemCSDSupportLevel() != nsWindow::CSD_SUPPORT_NONE;
+
+ mCSDCloseButton = false;
+ mCSDMinimizeButton = false;
+ mCSDMaximizeButton = false;
+
+ // We need to initialize whole CSD config explicitly because it's queried
+ // as -moz-gtk* media features.
+ WidgetNodeType buttonLayout[TOOLBAR_BUTTONS];
+diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
+--- a/widget/gtk/nsWindow.h
++++ b/widget/gtk/nsWindow.h
+@@ -395,28 +395,26 @@ public:
+ // From GDK
+ int GdkCoordToDevicePixels(gint coord);
+ LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point);
+ LayoutDeviceIntPoint GdkEventCoordsToDevicePixels(gdouble x, gdouble y);
+ LayoutDeviceIntRect GdkRectToDevicePixels(GdkRectangle rect);
+
+ virtual bool WidgetTypeSupportsAcceleration() override;
+
+- bool DoDrawTitlebar() const;
+-
+ typedef enum { CSD_SUPPORT_SYSTEM, // CSD including shadows
+ CSD_SUPPORT_CLIENT, // CSD without shadows
+ CSD_SUPPORT_NONE, // WM does not support CSD at all
+ CSD_SUPPORT_UNKNOWN
+ } CSDSupportLevel;
+ /**
+ * Get the support of Client Side Decoration by checking
+ * the XDG_CURRENT_DESKTOP environment variable.
+ */
+- static CSDSupportLevel GetCSDSupportLevel();
++ static CSDSupportLevel GetSystemCSDSupportLevel();
+
+ protected:
+ virtual ~nsWindow();
+
+ // event handling code
+ void DispatchActivateEvent(void);
+ void DispatchDeactivateEvent(void);
+ void DispatchResized();
+@@ -512,19 +510,21 @@ private:
+ int mXDepth;
+ mozilla::widget::WindowSurfaceProvider mSurfaceProvider;
+ #endif
+
+ // Upper bound on pending ConfigureNotify events to be dispatched to the
+ // window. See bug 1225044.
+ unsigned int mPendingConfigures;
+
+- bool mIsCSDAvailable;
++ // Window titlebar rendering mode, CSD_SUPPORT_NONE if it's disabled
++ // for this window.
++ CSDSupportLevel mCSDSupportLevel;
+ // If true, draw our own window titlebar.
+- bool mIsCSDEnabled;
++ bool mDrawInTitlebar;
+ // Draggable titlebar region maintained by UpdateWindowDraggingRegion
+ LayoutDeviceIntRegion mDraggableRegion;
+
+ #ifdef ACCESSIBILITY
+ RefPtr<mozilla::a11y::Accessible> mRootAccessible;
+
+ /**
+ * Request to create the accessible for this window if it is top level.
+
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -474,18 +474,18 @@ nsWindow::nsWindow()
+
+ mTransparencyBitmapWidth = 0;
+ mTransparencyBitmapHeight = 0;
+
+ #if GTK_CHECK_VERSION(3,4,0)
+ mLastScrollEventTime = GDK_CURRENT_TIME;
+ #endif
+ mPendingConfigures = 0;
+- mIsCSDAvailable = false;
+- mIsCSDEnabled = false;
++ mCSDSupportLevel = CSD_SUPPORT_NONE;
++ mDrawInTitlebar = false;
+ }
+
+ nsWindow::~nsWindow()
+ {
+ LOG(("nsWindow::~nsWindow() [%p]\n", (void *)this));
+
+ delete[] mTransparencyBitmap;
+ mTransparencyBitmap = nullptr;
+@@ -2814,17 +2814,17 @@ nsWindow::OnButtonReleaseEvent(GdkEventB
+ LayoutDeviceIntPoint pos = event.mRefPoint;
+
+ nsEventStatus eventStatus = DispatchInputEvent(&event);
+
+ bool defaultPrevented = (eventStatus == nsEventStatus_eConsumeNoDefault);
+ // Check if mouse position in titlebar and doubleclick happened to
+ // trigger restore/maximize.
+ if (!defaultPrevented
+- && mIsCSDEnabled
++ && mDrawInTitlebar
+ && event.button == WidgetMouseEvent::eLeftButton
+ && event.mClickCount == 2
+ && mDraggableRegion.Contains(pos.x, pos.y)) {
+
+ if (mSizeState == nsSizeMode_Maximized) {
+ SetSizeMode(nsSizeMode_Normal);
+ } else {
+ SetSizeMode(nsSizeMode_Maximized);
+@@ -3758,22 +3758,18 @@ nsWindow::Create(nsIWidget* aParent,
+ gtk_window_set_wmclass(GTK_WINDOW(mShell), "Toplevel",
+ gdk_get_program_class());
+
+ // each toplevel window gets its own window group
+ GtkWindowGroup *group = gtk_window_group_new();
+ gtk_window_group_add_window(group, GTK_WINDOW(mShell));
+ g_object_unref(group);
+
+- int32_t isCSDAvailable = false;
+- nsresult rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDAvailable,
+- &isCSDAvailable);
+- if (NS_SUCCEEDED(rv)) {
+- mIsCSDAvailable = isCSDAvailable;
+- }
++ // We enable titlebar rendering for toplevel windows only.
++ mCSDSupportLevel = GetSystemCSDSupportLevel();
+ }
+
+ // Create a container to hold child windows and child GtkWidgets.
+ GtkWidget *container = moz_container_new();
+ mContainer = MOZ_CONTAINER(container);
+
+ // "csd" style is set when widget is realized so we need to call
+ // it explicitly now.
+@@ -3788,17 +3784,17 @@ nsWindow::Create(nsIWidget* aParent,
+ * are drawn by Gtk+ to mShell. Content is rendered to mContainer
+ * and we listen to the Gtk+ events on mContainer.
+ * 3) We're running on Wayland. All gecko content is rendered
+ * to mContainer and we listen to the Gtk+ events on mContainer.
+ */
+ GtkStyleContext* style = gtk_widget_get_style_context(mShell);
+ drawToContainer =
+ !mIsX11Display ||
+- (mIsCSDAvailable && GetCSDSupportLevel() == CSD_SUPPORT_CLIENT) ||
++ (mCSDSupportLevel == CSD_SUPPORT_CLIENT) ||
+ gtk_style_context_has_class(style, "csd");
+ eventWidget = (drawToContainer) ? container : mShell;
+
+ gtk_widget_add_events(eventWidget, kEvents);
+ if (drawToContainer)
+ gtk_widget_add_events(mShell, GDK_PROPERTY_CHANGE_MASK);
+
+ // Prevent GtkWindow from painting a background to avoid flickering.
+@@ -6581,90 +6577,91 @@ nsWindow::ClearCachedResources()
+ window->ClearCachedResources();
+ }
+ }
+ }
+
+ nsresult
+ nsWindow::SetNonClientMargins(LayoutDeviceIntMargin &aMargins)
+ {
+- SetDrawsInTitlebar(aMargins.top == 0);
+- return NS_OK;
++ SetDrawsInTitlebar(aMargins.top == 0);
++ return NS_OK;
+ }
+
+ void
+ nsWindow::SetDrawsInTitlebar(bool aState)
+ {
+- if (!mIsCSDAvailable || aState == mIsCSDEnabled)
+- return;
+-
+- if (mShell) {
+- if (GetCSDSupportLevel() == CSD_SUPPORT_SYSTEM) {
+- SetWindowDecoration(aState ? eBorderStyle_border : mBorderStyle);
+- }
+- else {
+- /* Window manager does not support GDK_DECOR_BORDER,
+- * emulate it by CSD.
+- *
+- * gtk_window_set_titlebar() works on unrealized widgets only,
+- * we need to handle mShell carefully here.
+- * When CSD is enabled mGdkWindow is owned by mContainer which is good
+- * as we can't delete our mGdkWindow. To make mShell unrealized while
+- * mContainer is preserved we temporary reparent mContainer to an
+- * invisible GtkWindow.
+- */
+- NativeShow(false);
+-
+- // Using GTK_WINDOW_POPUP rather than
+- // GTK_WINDOW_TOPLEVEL in the hope that POPUP results in less
+- // initialization and window manager interaction.
+- GtkWidget* tmpWindow = gtk_window_new(GTK_WINDOW_POPUP);
+- gtk_widget_realize(tmpWindow);
+-
+- gtk_widget_reparent(GTK_WIDGET(mContainer), tmpWindow);
+- gtk_widget_unrealize(GTK_WIDGET(mShell));
+-
+- // Available as of GTK 3.10+
+- static auto sGtkWindowSetTitlebar = (void (*)(GtkWindow*, GtkWidget*))
+- dlsym(RTLD_DEFAULT, "gtk_window_set_titlebar");
+- MOZ_ASSERT(sGtkWindowSetTitlebar,
+- "Missing gtk_window_set_titlebar(), old Gtk+ library?");
+-
+- if (aState) {
+- // Add a hidden titlebar widget to trigger CSD, but disable the default
+- // titlebar. GtkFixed is a somewhat random choice for a simple unused
+- // widget. gtk_window_set_titlebar() takes ownership of the titlebar
+- // widget.
+- sGtkWindowSetTitlebar(GTK_WINDOW(mShell), gtk_fixed_new());
+- } else {
+- sGtkWindowSetTitlebar(GTK_WINDOW(mShell), nullptr);
+- }
+-
+- /* A workaround for
https://bugzilla.gnome.org/show_bug.cgi?id=791081
+- * gtk_widget_realize() throws:
+- * "In pixman_region32_init_rect: Invalid rectangle passed"
+- * when mShell has default 1x1 size.
+- */
+- GtkAllocation allocation = {0, 0, 0, 0};
+- gtk_widget_get_preferred_width(GTK_WIDGET(mShell), nullptr,
+- &allocation.width);
+- gtk_widget_get_preferred_height(GTK_WIDGET(mShell), nullptr,
+- &allocation.height);
+- gtk_widget_size_allocate(GTK_WIDGET(mShell), &allocation);
+-
+- gtk_widget_realize(GTK_WIDGET(mShell));
+- gtk_widget_reparent(GTK_WIDGET(mContainer), GTK_WIDGET(mShell));
+- mNeedsShow = true;
+- NativeResize();
+-
+- gtk_widget_destroy(tmpWindow);
+- }
+- }
+-
+- mIsCSDEnabled = aState;
++ if (!mShell ||
++ mCSDSupportLevel == CSD_SUPPORT_NONE ||
++ aState == mDrawInTitlebar) {
++ return;
++ }
++
++ if (mCSDSupportLevel == CSD_SUPPORT_SYSTEM) {
++ SetWindowDecoration(aState ? eBorderStyle_border : mBorderStyle);
++ }
++ else if (mCSDSupportLevel == CSD_SUPPORT_CLIENT) {
++ /* Window manager does not support GDK_DECOR_BORDER,
++ * emulate it by CSD.
++ *
++ * gtk_window_set_titlebar() works on unrealized widgets only,
++ * we need to handle mShell carefully here.
++ * When CSD is enabled mGdkWindow is owned by mContainer which is good
++ * as we can't delete our mGdkWindow. To make mShell unrealized while
++ * mContainer is preserved we temporary reparent mContainer to an
++ * invisible GtkWindow.
++ */
++ NativeShow(false);
++
++ // Using GTK_WINDOW_POPUP rather than
++ // GTK_WINDOW_TOPLEVEL in the hope that POPUP results in less
++ // initialization and window manager interaction.
++ GtkWidget* tmpWindow = gtk_window_new(GTK_WINDOW_POPUP);
++ gtk_widget_realize(tmpWindow);
++
++ gtk_widget_reparent(GTK_WIDGET(mContainer), tmpWindow);
++ gtk_widget_unrealize(GTK_WIDGET(mShell));
++
++ // Available as of GTK 3.10+
++ static auto sGtkWindowSetTitlebar = (void (*)(GtkWindow*, GtkWidget*))
++ dlsym(RTLD_DEFAULT, "gtk_window_set_titlebar");
++ MOZ_ASSERT(sGtkWindowSetTitlebar,
++ "Missing gtk_window_set_titlebar(), old Gtk+ library?");
++
++ if (aState) {
++ // Add a hidden titlebar widget to trigger CSD, but disable the default
++ // titlebar. GtkFixed is a somewhat random choice for a simple unused
++ // widget. gtk_window_set_titlebar() takes ownership of the titlebar
++ // widget.
++ sGtkWindowSetTitlebar(GTK_WINDOW(mShell), gtk_fixed_new());
++ } else {
++ sGtkWindowSetTitlebar(GTK_WINDOW(mShell), nullptr);
++ }
++
++ /* A workaround for
https://bugzilla.gnome.org/show_bug.cgi?id=791081
++ * gtk_widget_realize() throws:
++ * "In pixman_region32_init_rect: Invalid rectangle passed"
++ * when mShell has default 1x1 size.
++ */
++ GtkAllocation allocation = {0, 0, 0, 0};
++ gtk_widget_get_preferred_width(GTK_WIDGET(mShell), nullptr,
++ &allocation.width);
++ gtk_widget_get_preferred_height(GTK_WIDGET(mShell), nullptr,
++ &allocation.height);
++ gtk_widget_size_allocate(GTK_WIDGET(mShell), &allocation);
++
++ gtk_widget_realize(GTK_WIDGET(mShell));
++ gtk_widget_reparent(GTK_WIDGET(mContainer), GTK_WIDGET(mShell));
++ mNeedsShow = true;
++ NativeResize();
++
++ gtk_widget_destroy(tmpWindow);
++ }
++
++ mDrawInTitlebar = aState;
+ }
+
+ gint
+ nsWindow::GdkScaleFactor()
+ {
+ #if (MOZ_WIDGET_GTK >= 3)
+ // Available as of GTK 3.10+
+ static auto sGdkWindowGetScaleFactorPtr = (gint (*)(GdkWindow*))
+@@ -6923,28 +6920,28 @@ nsWindow::SynthesizeNativeTouchPoint(uin
+ event.touch.y = DevicePixelsToGdkCoordRoundDown(pointInWindow.y);
+
+ gdk_event_put(&event);
+
+ return NS_OK;
+ }
+ #endif
+
+-bool
+-nsWindow::DoDrawTitlebar() const
+-{
+- return mIsCSDEnabled && mSizeState == nsSizeMode_Normal;
+-}
+-
+ nsWindow::CSDSupportLevel
+-nsWindow::GetCSDSupportLevel() {
++nsWindow::GetSystemCSDSupportLevel() {
+ if (sCSDSupportLevel != CSD_SUPPORT_UNKNOWN) {
+ return sCSDSupportLevel;
+ }
+
++ // Require GTK 3.10 for GtkHeaderBar support and compatible window manager.
++ if (gtk_check_version(3, 10, 0) != nullptr) {
++ sCSDSupportLevel = CSD_SUPPORT_NONE;
++ return sCSDSupportLevel;
++ }
++
+ const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
+ if (currentDesktop) {
+ // GNOME Flashback (fallback)
+ if (strstr(currentDesktop, "GNOME-Flashback:GNOME") != nullptr) {
+ sCSDSupportLevel = CSD_SUPPORT_CLIENT;
+ // gnome-shell
+ } else if (strstr(currentDesktop, "GNOME") != nullptr) {
+ sCSDSupportLevel = CSD_SUPPORT_SYSTEM;
+diff -up firefox-60.0/widget/gtk/gtk3drawing.cpp.orig
firefox-60.0/widget/gtk/gtk3drawing.cpp
+--- firefox-60.0/widget/gtk/gtk3drawing.cpp.orig 2018-04-26 22:07:36.000000000 +0200
++++ firefox-60.0/widget/gtk/gtk3drawing.cpp 2018-04-30 13:38:19.083949868 +0200
+@@ -38,6 +38,16 @@ static ToolbarGTKMetrics sToolbarMetrics
+ #define GTK_STATE_FLAG_CHECKED (1 << 11)
+ #endif
+
++static GtkBorder
++operator+=(GtkBorder& first, const GtkBorder& second)
++{
++ first.left += second.left;
++ first.right += second.right;
++ first.top += second.top;
++ first.bottom += second.bottom;
++ return first;
++}
++
+ static gint
+ moz_gtk_get_tab_thickness(GtkStyleContext *style);
+
+@@ -3056,6 +3066,76 @@ GetScrollbarMetrics(GtkOrientation aOrie
+ return metrics;
+ }
+
++/*
++ * get_shadow_width() from gtkwindow.c is not public so we need
++ * to implement it.
++ */
++bool
++GetCSDDecorationSize(GtkWindow *aGtkWindow, GtkBorder* aDecorationSize)
++{
++ GtkStyleContext* context = gtk_widget_get_style_context(GTK_WIDGET(aGtkWindow));
++ bool solidDecorations = gtk_style_context_has_class(context,
"solid-csd");
++ context = GetStyleContext(solidDecorations ?
++ MOZ_GTK_WINDOW_DECORATION_SOLID :
++ MOZ_GTK_WINDOW_DECORATION);
++
++ /* Always sum border + padding */
++ GtkBorder padding;
++ GtkStateFlags state = gtk_style_context_get_state(context);
++ gtk_style_context_get_border(context, state, aDecorationSize);
++ gtk_style_context_get_padding(context, state, &padding);
++ *aDecorationSize += padding;
++
++ // Available on GTK 3.20+.
++ static auto sGtkRenderBackgroundGetClip =
++ (void (*)(GtkStyleContext*, gdouble, gdouble, gdouble, gdouble, GdkRectangle*))
++ dlsym(RTLD_DEFAULT, "gtk_render_background_get_clip");
++
++ GtkBorder margin;
++ gtk_style_context_get_margin(context, state, &margin);
++
++ GtkBorder extents = {0, 0, 0, 0};
++ if (sGtkRenderBackgroundGetClip) {
++ /* Get shadow extents but combine with style margin; use the bigger value.
++ */
++ GdkRectangle clip;
++ sGtkRenderBackgroundGetClip(context, 0, 0, 0, 0, &clip);
++
++ extents.top = -clip.y;
++ extents.right = clip.width + clip.x;
++ extents.bottom = clip.height + clip.y;
++ extents.left = -clip.x;
++
++ // Margin is used for resize grip size - it's not present on
++ // popup windows.
++ if (gtk_window_get_window_type(aGtkWindow) != GTK_WINDOW_POPUP) {
++ extents.top = MAX(extents.top, margin.top);
++ extents.right = MAX(extents.right, margin.right);
++ extents.bottom = MAX(extents.bottom, margin.bottom);
++ extents.left = MAX(extents.left, margin.left);
++ }
++ } else {
++ /* If we can't get shadow extents use decoration-resize-handle instead
++ * as a workaround. This is inspired by update_border_windows()
++ * from gtkwindow.c although this is not 100% accurate as we emulate
++ * the extents here.
++ */
++ gint handle;
++ gtk_widget_style_get(GetWidget(MOZ_GTK_WINDOW),
++ "decoration-resize-handle", &handle,
++ NULL);
++
++ extents.top = handle + margin.top;
++ extents.right = handle + margin.right;
++ extents.bottom = handle + margin.bottom;
++ extents.left = handle + margin.left;
++ }
++
++ *aDecorationSize += extents;
++
++ return (sGtkRenderBackgroundGetClip != nullptr);
++}
++
+ /* cairo_t *cr argument has to be a system-cairo. */
+ gint
+ moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
+diff -up firefox-60.0/widget/gtk/gtkdrawing.h.orig firefox-60.0/widget/gtk/gtkdrawing.h
+--- firefox-60.0/widget/gtk/gtkdrawing.h.orig 2018-04-26 22:07:35.000000000 +0200
++++ firefox-60.0/widget/gtk/gtkdrawing.h 2018-04-30 13:38:19.083949868 +0200
+@@ -334,6 +334,10 @@ typedef enum {
+ */
+ MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE_RESTORE,
+
++ /* Client-side window decoration node. Available on GTK 3.20+. */
++ MOZ_GTK_WINDOW_DECORATION,
++ MOZ_GTK_WINDOW_DECORATION_SOLID,
++
+ MOZ_GTK_WIDGET_NODE_COUNT
+ } WidgetNodeType;
+
+@@ -606,4 +610,17 @@ GetToolbarButtonMetrics(WidgetNodeType a
+ int
+ GetGtkHeaderBarButtonLayout(WidgetNodeType* aButtonLayout, int aMaxButtonNums);
+
++/**
++ * Get size of CSD window extents of given GtkWindow.
++ *
++ * aGtkWindow [IN] Decorated window.
++ * aDecorationSize [OUT] Returns calculated (or estimated) decoration
++ * size of given aGtkWindow.
++ *
++ * returns: True if we have extract decoration size (for GTK 3.20+)
++ * False if we have only an estimation (for GTK+ before 3.20+)
++ */
++bool
++GetCSDDecorationSize(GtkWindow *aGtkWindow, GtkBorder* aDecorationSize);
++
+ #endif
+diff -up firefox-60.0/widget/gtk/nsWindow.cpp.orig firefox-60.0/widget/gtk/nsWindow.cpp
+--- firefox-60.0/widget/gtk/nsWindow.cpp.orig 2018-04-30 13:37:32.145122854 +0200
++++ firefox-60.0/widget/gtk/nsWindow.cpp 2018-04-30 13:39:12.593752681 +0200
+@@ -127,6 +127,7 @@ using namespace mozilla::widget;
+ #endif
+
+ #include "nsShmImage.h"
++#include "gtkdrawing.h"
+
+ #include "nsIDOMWheelEvent.h"
+
+@@ -3360,6 +3361,10 @@ nsWindow::OnWindowStateEvent(GtkWidget *
+ aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN);
+ }
+ }
++
++ if (mDrawInTitlebar && mCSDSupportLevel == CSD_SUPPORT_CLIENT) {
++ UpdateClientOffsetForCSDWindow();
++ }
+ }
+
+ void
+@@ -6552,6 +6557,32 @@ nsWindow::ClearCachedResources()
+ }
+ }
+
++/* nsWindow::UpdateClientOffsetForCSDWindow() is designed to be called from
++ * paint code to update mClientOffset any time. It also propagates
++ * the mClientOffset to child tabs.
++ *
++ * It works only for CSD decorated GtkWindow.
++ */
++void
++nsWindow::UpdateClientOffsetForCSDWindow()
++{
++ // _NET_FRAME_EXTENTS is not set on client decorated windows,
++ // so we need to read offset between mContainer and toplevel mShell
++ // window.
++ if (mSizeState == nsSizeMode_Normal) {
++ GtkBorder decorationSize;
++ GetCSDDecorationSize(GTK_WINDOW(mShell), &decorationSize);
++ mClientOffset = nsIntPoint(decorationSize.left, decorationSize.top);
++ } else {
++ mClientOffset = nsIntPoint(0, 0);
++ }
++
++ // Send a WindowMoved notification. This ensures that TabParent
++ // picks up the new client offset and sends it to the child process
++ // if appropriate.
++ NotifyWindowMoved(mBounds.x, mBounds.y);
++}
++
+ nsresult
+ nsWindow::SetNonClientMargins(LayoutDeviceIntMargin &aMargins)
+ {
+@@ -6626,6 +6657,13 @@ nsWindow::SetDrawsInTitlebar(bool aState
+ mNeedsShow = true;
+ NativeResize();
+
++ // When we use system titlebar setup managed by Gtk+ we also get
++ // _NET_FRAME_EXTENTS property for our toplevel window so we can't
++ // update the client offset it here.
++ if (aState) {
++ UpdateClientOffsetForCSDWindow();
++ }
++
+ gtk_widget_destroy(tmpWindow);
+ }
+
+diff -up firefox-60.0/widget/gtk/nsWindow.h.orig firefox-60.0/widget/gtk/nsWindow.h
+--- firefox-60.0/widget/gtk/nsWindow.h.orig 2018-04-30 13:37:32.143122861 +0200
++++ firefox-60.0/widget/gtk/nsWindow.h 2018-04-30 13:38:19.085949861 +0200
+@@ -454,6 +454,8 @@ private:
+ nsIWidgetListener* GetListener();
+ bool IsComposited() const;
+
++ void UpdateClientOffsetForCSDWindow();
++
+ GtkWidget *mShell;
+ MozContainer *mContainer;
+ GdkWindow *mGdkWindow;
+diff -up firefox-60.0/widget/gtk/WidgetStyleCache.cpp.orig
firefox-60.0/widget/gtk/WidgetStyleCache.cpp
+--- firefox-60.0/widget/gtk/WidgetStyleCache.cpp.orig 2018-04-26 22:07:35.000000000
+0200
++++ firefox-60.0/widget/gtk/WidgetStyleCache.cpp 2018-04-30 13:38:19.085949861 +0200
+@@ -1285,6 +1285,22 @@ GetCssNodeStyleInternal(WidgetNodeType a
+ "MOZ_GTK_HEADER_BAR_BUTTON_RESTORE is used as an icon only!");
+ return nullptr;
+ }
++ case MOZ_GTK_WINDOW_DECORATION:
++ {
++ GtkStyleContext* parentStyle =
++ CreateSubStyleWithClass(MOZ_GTK_WINDOW, "csd");
++ style = CreateCSSNode("decoration", parentStyle);
++ g_object_unref(parentStyle);
++ break;
++ }
++ case MOZ_GTK_WINDOW_DECORATION_SOLID:
++ {
++ GtkStyleContext* parentStyle =
++ CreateSubStyleWithClass(MOZ_GTK_WINDOW, "solid-csd");
++ style = CreateCSSNode("decoration", parentStyle);
++ g_object_unref(parentStyle);
++ break;
++ }
+ default:
+ return GetWidgetRootStyle(aNodeType);
+ }
diff --git a/firefox-build-prbool.patch b/firefox-build-prbool.patch
deleted file mode 100644
index f271631..0000000
--- a/firefox-build-prbool.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff -up firefox-52.0/dom/u2f/U2F.cpp.prbool firefox-52.0/dom/u2f/U2F.cpp
---- firefox-52.0/dom/u2f/U2F.cpp.prbool 2017-03-03 13:42:22.613691228 +0100
-+++ firefox-52.0/dom/u2f/U2F.cpp 2017-03-03 13:48:20.864647727 +0100
-@@ -4,6 +4,7 @@
- * 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 "prtypes.h"
- #include "hasht.h"
- #include "mozilla/dom/CallbackFunction.h"
- #include "mozilla/dom/ContentChild.h"
-diff -up firefox-52.0/security/certverifier/CTLogVerifier.cpp.prbool
firefox-52.0/security/certverifier/CTLogVerifier.cpp
---- firefox-52.0/security/certverifier/CTLogVerifier.cpp.prbool 2017-01-16
17:16:51.000000000 +0100
-+++ firefox-52.0/security/certverifier/CTLogVerifier.cpp 2017-03-03 13:42:22.613691228
+0100
-@@ -7,6 +7,7 @@
- #include "CTLogVerifier.h"
-
- #include "CTSerialization.h"
-+#include "prtypes.h"
- #include "hasht.h"
- #include "mozilla/ArrayUtils.h"
- #include "mozilla/Assertions.h"
-diff -up firefox-52.0/security/certverifier/CTObjectsExtractor.cpp.prbool
firefox-52.0/security/certverifier/CTObjectsExtractor.cpp
---- firefox-52.0/security/certverifier/CTObjectsExtractor.cpp.prbool 2017-01-16
17:16:51.000000000 +0100
-+++ firefox-52.0/security/certverifier/CTObjectsExtractor.cpp 2017-03-03
13:42:22.613691228 +0100
-@@ -6,6 +6,7 @@
-
- #include "CTObjectsExtractor.h"
-
-+#include "prtypes.h"
- #include "hasht.h"
- #include "mozilla/Assertions.h"
- #include "mozilla/Casting.h"
-diff -up firefox-52.0/security/certverifier/OCSPCache.h.prbool
firefox-52.0/security/certverifier/OCSPCache.h
---- firefox-52.0/security/certverifier/OCSPCache.h.prbool 2017-02-27 17:11:06.000000000
+0100
-+++ firefox-52.0/security/certverifier/OCSPCache.h 2017-03-03 13:42:22.613691228 +0100
-@@ -25,6 +25,7 @@
- #ifndef mozilla_psm_OCSPCache_h
- #define mozilla_psm_OCSPCache_h
-
-+#include "prtypes.h"
- #include "hasht.h"
- #include "mozilla/Mutex.h"
- #include "mozilla/Vector.h"
diff --git a/firefox-install-dir.patch b/firefox-install-dir.patch
deleted file mode 100644
index 646e0c9..0000000
--- a/firefox-install-dir.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-45.0/firefox-45.0/config/baseconfig.mk.orig
firefox-45.0/firefox-45.0/config/baseconfig.mk
---- firefox-45.0/config/baseconfig.mk.orig 2016-03-02 13:26:31.981927073 +0100
-+++ firefox-45.0/config/baseconfig.mk 2016-03-02 13:30:09.044756473 +0100
-@@ -4,7 +4,7 @@
- # whether a normal build is happening or whether the check is running.
- includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
- idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
--installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-+installdir = $(libdir)/$(MOZ_APP_NAME)
- sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
- ifeq (.,$(DEPTH))
- DIST = dist
diff --git a/icecat-fix_installer.patch b/icecat-fix_installer.patch
index 80a5060..3ea7fbd 100644
--- a/icecat-fix_installer.patch
+++ b/icecat-fix_installer.patch
@@ -13,51 +13,31 @@
#endif
#endif
#ifdef XP_MACOSX
-@@ -622,9 +622,9 @@
+@@ -612,9 +612,9 @@
@RESPATH(a)/chrome/recording.manifest
@RESPATH@/chrome/recording/*
#ifdef MOZ_GTK
-@RESPATH(a)/browser/chrome/icons/default/default16.png
-@RESPATH(a)/browser/chrome/icons/default/default32.png
-@RESPATH(a)/browser/chrome/icons/default/default48.png
-+#@RESPATH(a)/browser/branding/official/default16.png
-+#@RESPATH(a)/browser/branding/official/default32.png
-+#@RESPATH(a)/browser/branding/official/default48.png
++#@RESPATH(a)/browser/chrome/icons/default/default16.png
++#@RESPATH(a)/browser/chrome/icons/default/default32.png
++#@RESPATH(a)/browser/chrome/icons/default/default48.png
+ @RESPATH(a)/browser/chrome/icons/default/default64.png
+ @RESPATH(a)/browser/chrome/icons/default/default128.png
#endif
- @RESPATH@/browser/features/*
-
-@@ -642,7 +642,7 @@
- #ifdef XP_UNIX
- #ifndef XP_MACOSX
- ; shell icons
--@RESPATH(a)/browser/icons/*.png
-+#@RESPATH(a)/browser/icons/*.png
- #ifdef MOZ_UPDATER
- ; updater icon
- @RESPATH(a)/icons/updater.png
--- browser/installer/allowed-dupes.orig.mn 2017-03-19 19:59:09.000000000 +0100
+++ browser/installer/allowed-dupes.mn 2017-03-24 23:15:37.026964374 +0100
-@@ -110,6 +110,37 @@
- browser/features/flyweb(a)mozilla.org/chrome/skin/windows/icon-64-anchored.png
- browser/features/flyweb(a)mozilla.org/chrome/skin/windows/icon-64.png
- browser/icons/mozicon128.png
+@@ -752,3 +752,19 @@
+ browser/extensions/goteo(a)0xbeef.coffee/License
+ browser/extensions/goteo(a)0xbeef.coffee/goteo.js
+ browser/extensions/goteo(a)0xbeef.coffee/manifest.json
+#
+browser/extensions/abouticecat(a)gnu.org/defaults/preferences/preferences.js
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/lib/settings/settings.js
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/node_modules/pathfinder/docs/addon-warning.md
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/node_modules/pathfinder/docs/content-policy.md
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/node_modules/pathfinder/test/test-userstyles.css
+browser/extensions/html5-video-everywhere(a)lejenome.me/bootstrap.js
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/bootstrap.js
-+browser/extensions/jid1-KtlZuoiikVfFew@jetpack/data/assets/images/README
-+browser/extensions/jid1-KtlZuoiikVfFew@jetpack/data/widget/images/README
+browser/chrome/browser/content/browser/aboutaccounts/images/fox.png
+browser/extensions/spyblock(a)gnu.org/chrome/content/ui/ext/common.js
+browser/extensions/spyblock(a)gnu.org/lib/ext_common.js
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/data/widget/images/librejs-64.png
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/icon.png
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/data/images/gnu-icon.png
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/node_modules/notification-box/data/gnu-icon.png
+browser/extensions/html5-video-everywhere(a)lejenome.me/LICENSE
+browser/extensions/html5-video-everywhere(a)lejenome.me/node_modules/h5vew-site-break/LICENSE
+browser/extensions/html5-video-everywhere(a)lejenome.me/node_modules/h5vew-site-dailymotion/LICENSE
@@ -65,13 +45,6 @@
+browser/extensions/html5-video-everywhere(a)lejenome.me/node_modules/h5vew-site-metacafe/LICENSE
+browser/extensions/html5-video-everywhere(a)lejenome.me/node_modules/h5vew-site-vimeo/LICENSE
+browser/extensions/html5-video-everywhere(a)lejenome.me/node_modules/h5vew-site-youtube/LICENSE
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/data/licenses/mpl-2.0.txt
-+browser/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/notification-box/LICENSE
+browser/extensions/spyblock(a)gnu.org/chrome/content/ui/skin/abp-128.png
+browser/extensions/spyblock(a)gnu.org/chrome/skin/abp-icon-big.png
-+browser/extensions/jid1-KtlZuoiikVfFew@jetpack/COPYING
-+browser/extensions/jid1-KtlZuoiikVfFew(a)jetpack/data/licenses/gpl-3.0.txt
+#
- chrome.manifest
- chrome/en-US/locale/en-US/browser/overrides/AccessFu.properties
- chrome/en-US/locale/en-US/browser/overrides/about.dtd
diff --git a/icecat-fix_jar.patch b/icecat-fix_jar.patch
index f62bc0f..418b5b9 100644
--- a/icecat-fix_jar.patch
+++ b/icecat-fix_jar.patch
@@ -1,11 +1,11 @@
--- browser/locales/jar.orig.mn 2017-03-19 19:59:09.000000000 +0100
+++ browser/locales/jar.mn 2017-03-22 19:49:57.602190867 +0100
-@@ -6,7 +6,7 @@
+@@ -12,7 +12,7 @@
@AB_CD@.jar:
% locale browser @AB_CD@ %locale/browser/
-* locale/browser/bookmarks.html (generic/profile/bookmarks.html.in)
+ locale/browser/bookmarks.html (generic/profile/bookmarks.html.in)
- locale/browser/aboutAccounts.dtd (%chrome/browser/aboutAccounts.dtd)
locale/browser/aboutDialog.dtd (%chrome/browser/aboutDialog.dtd)
locale/browser/aboutPrivateBrowsing.dtd
(%chrome/browser/aboutPrivateBrowsing.dtd)
+ locale/browser/aboutPrivateBrowsing.properties
(%chrome/browser/aboutPrivateBrowsing.properties)
diff --git a/icecat-locale.patch b/icecat-locale.patch
index 802b49c..7bdcbac 100644
--- a/icecat-locale.patch
+++ b/icecat-locale.patch
@@ -1,12 +1,11 @@
--- intl/icu/source/i18n/digitlst.orig.cpp 2017-07-25 16:08:42.000000000 +0000
+++ intl/icu/source/i18n/digitlst.cpp 2017-08-03 19:20:54.808813010 +0000
-@@ -64,7 +64,7 @@
- # if U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_CYGWIN
- # include <locale.h>
- # else
+@@ -63,7 +63,7 @@
+
+ #if U_USE_STRTOD_L
+ # if U_HAVE_XLOCALE_H
-# include <xlocale.h>
+# include <c++/v1/support/xlocale/xlocale.h>
+ # else
+ # include <locale.h>
# endif
- #endif
-
-
diff --git a/icecat-mozconfig-common b/icecat-mozconfig-common
index f5578fa..c5a3241 100644
--- a/icecat-mozconfig-common
+++ b/icecat-mozconfig-common
@@ -7,19 +7,15 @@ mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZILLA_OFFICIAL=1
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir
-ac_add_options --enable-default-toolkit=cairo-gtk3
-
ac_add_options --prefix="$PREFIX"
ac_add_options --libdir="$LIBDIR"
ac_add_options --with-pthreads
-#ac_add_options --enable-libnotify
ac_add_options --enable-necko-wifi
ac_add_options --enable-startup-notification
-#ac_add_options --disable-cpp-exceptions
ac_add_options --disable-updater
-ac_add_options --enable-url-classifier
-ac_add_options --enable-gio
-#ac_add_options --disable-gnomevfs
ac_add_options --enable-chrome-format=omni
ac_add_options --enable-release
ac_add_options --enable-pie
+ac_add_options --disable-stylo
+# Workaround for mozbz#1341234
+ac_add_options BINDGEN_CFLAGS="$(pkg-config nspr pixman-1 --cflags)"
diff --git a/icecat-mozilla-1474265.patch b/icecat-mozilla-1474265.patch
new file mode 100644
index 0000000..4592517
--- /dev/null
+++ b/icecat-mozilla-1474265.patch
@@ -0,0 +1,22 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky(a)redhat.com>
+# Date 1531135139 -7200
+# Node ID f27de60fff477d7b61b5509fc2c9c9c098f5b953
+# Parent 9b330d91059107e972908036c1580ce98a477eb5
+Bug 1474265 - Add missing semicolon at DBusRemoteClient.cpp. r=jhorak, a=lizzard
+
+MozReview-Commit-ID: HIz4gZOzfOE
+
+diff --git a/widget/xremoteclient/DBusRemoteClient.cpp
b/widget/xremoteclient/DBusRemoteClient.cpp
+--- a/widget/xremoteclient/DBusRemoteClient.cpp
++++ b/widget/xremoteclient/DBusRemoteClient.cpp
+@@ -142,7 +142,7 @@
+ (bool (*)(const char *, DBusError *))
+ dlsym(RTLD_DEFAULT, "dbus_validate_bus_name");
+ if (!sDBusValidateBusName) {
+- return false
++ return false;
+ }
+
+ if (!sDBusValidateBusName(aDestinationName.get(), nullptr)) {
diff --git a/icecat-mozilla-1479540.patch b/icecat-mozilla-1479540.patch
new file mode 100644
index 0000000..16531dc
--- /dev/null
+++ b/icecat-mozilla-1479540.patch
@@ -0,0 +1,41 @@
+
+# HG changeset patch
+# User Chris Manchester <cmanchester(a)mozilla.com>
+# Date 1533063488 25200
+# Node ID bc651d3d910cbc0730d870c5436b29ddc01fef10
+# Parent e9dd9434ad9ac15284429d904a45e4daf567c03b
+Bug 1479540 - Accept "triplet" strings with only two parts in moz.configure.
r=froydnj, a=jcristau
+
+MozReview-Commit-ID: 7pFhoJgBMhQ
+
+diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
+--- a/build/moz.configure/init.configure
++++ b/build/moz.configure/init.configure
+@@ -586,17 +586,26 @@ option('--target', nargs=1,
+ @imports(_from='__builtin__', _import='KeyError')
+ @imports(_from='__builtin__', _import='ValueError')
+ def split_triplet(triplet, allow_unknown=False):
+ # The standard triplet is defined as
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+ # There is also a quartet form:
+ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+ # But we can consider the "KERNEL-OPERATING_SYSTEM" as one.
+- cpu, manufacturer, os = triplet.split('-', 2)
++ # Additionally, some may omit "unknown" when the manufacturer
++ # is not specified and emit
++ # CPU_TYPE-OPERATING_SYSTEM
++ parts = triplet.split('-', 2)
++ if len(parts) == 3:
++ cpu, _, os = parts
++ elif len(parts) == 2:
++ cpu, os = parts
++ else:
++ die("Unexpected triplet string: %s" % triplet)
+
+ # Autoconf uses config.sub to validate and canonicalize those triplets,
+ # but the granularity of its results has never been satisfying to our
+ # use, so we've had our own, different, canonicalization. We've also
+ # historically not been very consistent with how we use the canonicalized
+ # values. Hopefully, this will help us make things better.
+ # The tests are inherited from our decades-old autoconf-based configure,
+ # which can probably be improved/cleaned up because they are based on a
diff --git a/icecat-remove_unrecognized_flags.patch
b/icecat-remove_unrecognized_flags.patch
deleted file mode 100644
index 0283a3b..0000000
--- a/icecat-remove_unrecognized_flags.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- gfx/angle/moz.orig.build 2016-08-29 02:17:57.000000000 +0200
-+++ gfx/angle/moz.build 2016-09-01 13:09:17.936098501 +0200
-@@ -124,8 +124,7 @@
- ]
- else:
- CXXFLAGS += [
-- '-Wno-shadow-compatible-local',
-- '-Wno-shadow-local',
-+ '-Wno-shadow',
- ]
-
- if CONFIG['MOZ_DIRECTX_SDK_PATH'] and not
CONFIG['MOZ_HAS_WINSDK_WITH_D3D']:
diff --git a/icecat-virtualenv.patch b/icecat-virtualenv.patch
index fe646c8..7e8d280 100644
--- a/icecat-virtualenv.patch
+++ b/icecat-virtualenv.patch
@@ -1,13 +1,12 @@
--- python/mozbuild/mozbuild/virtualenv.orig.py 2014-10-07 21:44:49.000000000 +0200
+++ python/mozbuild/mozbuild/virtualenv.py 2014-10-11 12:34:19.292241319 +0200
-@@ -56,8 +56,7 @@
+@@ -66,8 +66,7 @@
@property
def virtualenv_script_path(self):
"""Path to virtualenv's own populator
script."""
-- return os.path.join(self.topsrcdir, 'python', 'virtualenv',
-- 'virtualenv.py')
+- return os.path.join(self.topsrcdir, 'third_party', 'python',
+- 'virtualenv', 'virtualenv.py')
+ return '/usr/bin/virtualenv'
@property
def bin_path(self):
-
diff --git a/icecat-wayland.desktop b/icecat-wayland.desktop
new file mode 100644
index 0000000..662ad21
--- /dev/null
+++ b/icecat-wayland.desktop
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Version=1.0
+Name=IceCat on Wayland
+Comment=Browse the World Wide Web
+GenericName=Web Browser
+Keywords=Internet;WWW;Browser;Web;Explorer;
+Exec=icecat-wayland --name icecat-wayland %u
+Icon=icecat
+Terminal=false
+Type=Application
+MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
+Categories=Network;WebBrowser;
+StartupNotify=true
+StartupWMClass=icecat
+Name[en_US]=icecat-wayland
+Actions=new-window;new-private-window;
+
+[Desktop Action new-window]
+Name=Open a New Window
+Exec=icecat-wayland --name icecat-wayland --new-window %u
+
+[Desktop Action new-private-window]
+Name=Open a New Private Window
+Exec=icecat-wayland --private-window --name icecat-wayland %u
diff --git a/icecat-wayland.sh.in b/icecat-wayland.sh.in
new file mode 100644
index 0000000..37c133b
--- /dev/null
+++ b/icecat-wayland.sh.in
@@ -0,0 +1,7 @@
+#!/bin/bash
+#
+# Run IceCat under Wayland
+#
+
+export GDK_BACKEND=wayland
+exec /usr/bin/icecat "$@"
diff --git a/icecat.appdata.xml b/icecat.appdata.xml
new file mode 100644
index 0000000..5d2cbf8
--- /dev/null
+++ b/icecat.appdata.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop">
+ <id type="desktop">icecat.desktop</id>
+ <metadata_license>CC0-1.0</metadata_license>
+ <summary>GNU version of Firefox browser</summary>
+ <name>icecat</name>
+ <project_license>(MPL-1.1 or GPL-2.0+ or LGPL-2.0+) and GPL-3.0+ and MIT and BSD
and ISC and ASL-2.0 and MPL-2.0</project_license>
+ <categories>
+ <category>Internet</category>
+ <category>Web Browser</category>
+ </categories>
+ <description>
+ <p>
+ GNUzilla is the GNU version of the Mozilla suite, and GNU IceCat is the GNU version
of the Firefox ESR browser.
+ </p>
+ <p>
+ Its main advantage is an ethical one: it is entirely free software:
+ while the Firefox source code from the Mozilla project is free software,
+ they distribute and recommend non-free software as plug-ins and addons.
+ Also their trademark license restricts distribution in several ways incompatible
with freedom 0.
+ </p>
+ <p>
+ Extensions included to this version of IceCat:
+ - LibreJS
+ GNU LibreJS aims to address the JavaScript problem described in Richard
+ Stallman's article The JavaScript Trap.
+ - SpyBlock
+ Blocks privacy trackers while in normal browsing mode, and all third party
+ requests when in private browsing mode. Based on Adblock Plus.
+ - AboutIceCat
+ Adds a custom "about:icecat" homepage with links to information about
the
+ free software and privacy features in IceCat, and check-boxes to enable
+ and disable the ones more prone to break websites.
+ - HTML5-video-everywhere
+ Uses the native video player to play embedded videos from different sources
+ - Fingerprinting countermeasures: Fingerprinting is a series of techniques
+ allowing to uniquely identify a browser based on specific characteristics of
+ that particular instance (like what fonts are available in that machine).
+ Unlike cookies the user cannot opt-out of being tracked this way,
+ so the browser has to avoid giving away that kind of hints.
+ </p>
+ </description>
+ <url
type="homepage">http://www.gnu.org/software/gnuzilla/</ur...
+ <screenshots>
+ <screenshot type="default">
+
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
+ </screenshot>
+ <screenshot>
+
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
+ </screenshot>
+ <screenshot>
+
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
+ </screenshot>
+ <screenshot>
+
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
+ </screenshot>
+ </screenshots>
+ <updatecontact>sagitter_at_fedoraproject.org</updatecontact>
+</component>
diff --git a/icecat.metainfo.xml b/icecat.metainfo.xml
new file mode 100644
index 0000000..691082e
--- /dev/null
+++ b/icecat.metainfo.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="addon">
+ <id>mozilla-requestpolicy</id>
+ <extends>icecat.desktop</extends>
+ <name>mozilla-requestpolicy</name>
+ <summary>Extension that gives you control over cross-site
requests</summary>
+ <url
type="homepage">https://requestpolicycontinued.github.io/</url>
+ <url
type="bugtracker">https://github.com/requestpolicycontinued/...
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>GPL-3.0+ and LGPL-3.0+</project_license>
+</component>
diff --git a/icecat.sh.in b/icecat.sh.in
new file mode 100644
index 0000000..9cd8c21
--- /dev/null
+++ b/icecat.sh.in
@@ -0,0 +1,254 @@
+#!/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
+# except in compliance with the License. You may obtain a copy of
+# the License at
http://www.mozilla.org/NPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is
mozilla.org code.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+##
+## Usage:
+##
+## $ icecat
+##
+## This script is meant to run a mozilla program from the mozilla
+## rpm installation.
+##
+## The script will setup all the environment voodoo needed to make
+## mozilla work.
+
+cmdname=`basename $0`
+
+##
+## Variables
+##
+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="/usr/lib"
+ SECONDARY_LIB_DIR="/usr/lib64"
+ ;;
+esac
+
+MOZ_FIREFOX_FILE="icecat"
+
+if [ ! -r $MOZ_LIB_DIR/icecat/$MOZ_FIREFOX_FILE ]; then
+ if [ ! -r $SECONDARY_LIB_DIR/icecat/$MOZ_FIREFOX_FILE ]; then
+ echo "Error: $MOZ_LIB_DIR/icecat/$MOZ_FIREFOX_FILE not found"
+ if [ -d $SECONDARY_LIB_DIR ]; then
+ echo " $SECONDARY_LIB_DIR/icecat/$MOZ_FIREFOX_FILE not found"
+ fi
+ exit 1
+ fi
+ MOZ_LIB_DIR="$SECONDARY_LIB_DIR"
+fi
+MOZ_DIST_BIN="$MOZ_LIB_DIR/icecat"
+MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks"
+MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
+MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
+MOZ_LAUNCHER="$MOZ_DIST_BIN/run-icecat.sh"
+
+##
+## Set MOZ_GRE_CONF
+##
+MOZ_GRE_CONF=/etc/gre.d/gre.conf
+if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then
+ MOZ_GRE_CONF=/etc/gre.d/gre64.conf
+fi
+export MOZ_GRE_CONF
+
+##
+## Set MOZILLA_FIVE_HOME
+##
+MOZILLA_FIVE_HOME="$MOZ_DIST_BIN"
+
+export MOZILLA_FIVE_HOME
+
+##
+## Make sure that we set the plugin path
+##
+MOZ_PLUGIN_DIR="plugins"
+
+if [ "$MOZ_PLUGIN_PATH" ]
+then
+
MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/icecat/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
+else
+ MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/icecat/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
+fi
+export MOZ_PLUGIN_PATH
+
+##
+## Set MOZ_APP_LAUNCHER for gnome-session
+##
+export MOZ_APP_LAUNCHER="/usr/bin/icecat"
+
+##
+## Set FONTCONFIG_PATH for Xft/fontconfig
+##
+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
+## may negatively impact performance on some pages. To disable the use of
+## Pango, set MOZ_DISABLE_PANGO=1 in your environment before launching
+## Firefox.
+##
+#
+# MOZ_DISABLE_PANGO=1
+# export MOZ_DISABLE_PANGO
+#
+
+##
+## Disable the GNOME crash dialog, Moz has it's own
+##
+GNOME_DISABLE_CRASH_DIALOG=1
+export GNOME_DISABLE_CRASH_DIALOG
+
+##
+## Disable the SLICE allocator (rhbz#1014858)
+##
+export G_SLICE=always-malloc
+
+##
+## Enable Xinput2 (mozbz#1207973)
+##
+export MOZ_USE_XINPUT2=1
+
+# OK, here's where all the real work gets done
+
+
+##
+## To disable the use of Firefox localization, set MOZ_DISABLE_LANGPACKS=1
+## in your environment before launching Firefox.
+##
+#
+# MOZ_DISABLE_LANGPACKS=1
+# export MOZ_DISABLE_LANGPACKS
+#
+
+##
+## Automatically installed langpacks are tracked by .fedora-langpack-install
+## config file.
+##
+FEDORA_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.fedora-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 icecat running?
+ /usr/bin/pidof icecat > /dev/null 2>&1
+ MOZILLA_DOWN=$?
+ fi
+fi
+
+# Modify language pack configuration only when icecat 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
+ # remove all empty langpacks dirs while they block installation of langpacks
+ rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1
+ fi
+
+ # Get locale from system
+ CURRENT_LOCALE=$LC_ALL
+ CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES}
+ 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"`
+
+ function create_langpack_link() {
+ local language=$*
+ local langpack=langpack-${language}(a)icecat.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),
+ # 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
+ return 0
+ fi
+ return 1
+ }
+
+ create_langpack_link $MOZLOCALE || create_langpack_link $SHORTMOZLOCALE || true
+fi
+
+# BEAST fix (rhbz#1005611)
+NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1}
+export NSS_SSL_CBC_RANDOM_IV
+
+# Prepare command line arguments
+script_args=""
+pass_arg_count=0
+while [ $# -gt $pass_arg_count ]
+do
+ case "$1" in
+ -g | --debug)
+ script_args="$script_args -g"
+ debugging=1
+ shift
+ ;;
+ -d | --debugger)
+ if [ $# -gt 1 ]; then
+ script_args="$script_args -d $2"
+ shift 2
+ else
+ shift
+ fi
+ ;;
+ *)
+ # Move the unrecognized argument to the end of the list.
+ arg="$1"
+ shift
+ set -- "$@" "$arg"
+ pass_arg_count=`expr $pass_arg_count + 1`
+ ;;
+ esac
+done
+
+if ! [ "$GDK_BACKEND" ]; then
+ export GDK_BACKEND=x11
+fi
+
+# Run the browser
+debugging=0
+if [ $debugging = 1 ]
+then
+ echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
+fi
+
+
+exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
diff --git a/icecat.spec b/icecat.spec
index 74a93cb..2d64ea3 100644
--- a/icecat.spec
+++ b/icecat.spec
@@ -38,7 +38,7 @@
# Use system sqlite?
%global system_sqlite 1
-%if %{?system_sqlite}
+%if 0%{?system_sqlite}
%global sqlite_version 3.8.4.2
# The actual sqlite version (see #480989):
%global sqlite_build_version %(pkg-config --silence-errors --modversion sqlite3
2>/dev/null || echo 65536)
@@ -54,7 +54,7 @@
# Use system nspr/nss?
%global system_nss 1
-%if %{?system_nss}
+%if 0%{?system_nss}
%global nspr_version 4.17.0
# NSS/NSPR quite often ends in build override, so as requirement the version
# we're building against could bring us some broken dependencies from time to time.
@@ -69,9 +69,19 @@
%bcond_without pulseaudio
%bcond_without jack
+# Wayland backend is not finished yet, see
+#
https://bugzilla.mozilla.org/show_bug.cgi?id=635134
+# for details.
+#
+# Build with Wayland Gtk+ backend?
+%global wayland_backend 0
+
+# Use mozilla hardening option?
+%global hardened_build 1
+
Name: icecat
-Version: 52.9.0
-Release: 1%{?dist}
+Version: 60.2.0
+Release: 0.1%{?dist}
Summary: GNU version of Firefox browser
## Tri-licensing scheme for Gnuzilla/IceCat in parentheses, and licenses for the
extensions included
@@ -81,16 +91,16 @@ URL:
http://www.gnu.org/software/gnuzilla/
## Source archive created by scripts based on Gnuzilla files.
## Modified files are hosted in a dedicated fork repository:
##
https://fedorapeople.org/cgit/sagitter/public_git/icecat.git/
-Source0:
https://sagitter.fedorapeople.org/icecat/v%{version}/%{name}-%{version}-g...
+#Source0:
https://sagitter.fedorapeople.org/icecat/v%%{version}/%%{name}-%%{version...
+Source0:
http://alpha.gnu.org/gnu/gnuzilla/%{version}/icecat-%{version}-gnu1.tar.bz2
Source1: %{name}.desktop
Source2: %{name}.png
Source3: %{name}-mozconfig-common
-%if %{build_langpacks}
##Language files downloaded by source7 script
+%if %{build_langpacks}
Source4: %{name}-%{version}-langpacks.tar.gz
%endif
-Source7: %{name}-lang_download.sh
##All license files
##Download from
http://www.gnu.org/licenses
@@ -101,19 +111,29 @@ Source5: %{name}-COPYING-licensefiles.tar.gz
##manpage file
Source6: %{name}.1
+Source7: %{name}-lang_download.sh
+
# Whitelisting errors
#
https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#whitelist
Source8: %{name}.rpmlintrc
-# Build patches
-Patch0: firefox-install-dir.patch
-Patch3: mozilla-build-arm.patch
+Source9: %{name}-wayland.desktop
+Source10: %{name}.appdata.xml
+Source11: %{name}.metainfo.xml
+Source12: %{name}-wayland.sh.in
+Source13: %{name}.sh.in
##Using system Python Virtualenv
Patch1: %{name}-virtualenv.patch
-# Remove unrecognized flags
-Patch6: %{name}-remove_unrecognized_flags.patch
+#
+Patch2: %{name}-mozilla-1474265.patch
+
+# Build patches
+Patch3: mozilla-build-arm.patch
+
+#
+Patch4: %{name}-mozilla-1479540.patch
# Unrecognized file?
Patch7: %{name}-fix_jar.patch
@@ -125,21 +145,26 @@ Patch8: %{name}-fix_installer.patch
# Set path of libcxx-devel
Patch9: %{name}-locale.patch
-#
https://bugzilla.redhat.com/show_bug.cgi?id=814879#c3
-Patch18: xulrunner-24.0-jemalloc-ppc.patch
-
-# workaround linking issue on s390 (JSContext::updateMallocCounter(size_t) not found)
-Patch19: xulrunner-24.0-s390-inlines.patch
-Patch20: firefox-build-prbool.patch
Patch26: build-icu-big-endian.patch
+Patch27: mozilla-1335250.patch
+
+# Also fixes s390x:
https://bugzilla.mozilla.org/show_bug.cgi?id=1376268
+Patch29: build-big-endian.patch
+Patch32: build-rust-ppc64le.patch
+Patch35: build-ppc-jit.patch
+# Always feel lucky for unsupported platforms:
+#
https://bugzilla.mozilla.org/show_bug.cgi?id=1347128
+Patch37: build-jit-atomic-always-lucky.patch
+# Fixing missing cacheFlush when JS_CODEGEN_NONE is used (s390x)
+Patch38: build-cacheFlush-missing.patch
+Patch40: build-aarch64-skia.patch
# Fedora specific patches
-# Unable to install addons from https pages
-Patch204: rhbz-966424.patch
Patch219: rhbz-1173156.patch
Patch221: firefox-fedora-ua.patch
Patch224: mozilla-1170092.patch
Patch225: mozilla-1005640-accept-lang.patch
+
#ARM run-time patch
Patch226: rhbz-1354671.patch
@@ -147,17 +172,38 @@ Patch226: rhbz-1354671.patch
Patch227: rhbz-1400293-fix-mozilla-1324096.patch
# Upstream patches
-Patch304: mozilla-1253216.patch
Patch402: mozilla-1196777.patch
Patch406: mozilla-256180.patch
-# Rebase Gtk3 widget code to latest trunk to
-# fix various rendering problems
-Patch407: widget-rebase.patch
-Patch411: mozilla-1158076-1.patch
-Patch412: mozilla-1158076-2.patch
-
-# Debian patches
-Patch500: mozilla-440908.patch
+Patch407: mozilla-1348576.patch
+Patch410: mozilla-1321521.patch
+Patch411: mozilla-1321521-2.patch
+Patch412: mozilla-1337988.patch
+Patch413: mozilla-1353817.patch
+Patch415: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
+Patch416: mozilla-1424422.patch
+Patch417: bug1375074-save-restore-x28.patch
+Patch418: mozilla-1436242.patch
+Patch421: complete-csd-window-offset-mozilla-1457691.patch
+
+# Wayland specific upstream patches
+Patch450: mozilla-1438131.patch
+Patch451: mozilla-1438136.patch
+Patch452: mozilla-1460603.patch
+Patch453: mozilla-1460605-1.patch
+Patch454: mozilla-1460605-2.patch
+Patch455: mozilla-1460810.patch
+Patch456: mozilla-1461306.patch
+Patch457: mozilla-1462622.patch
+Patch458: mozilla-1462642.patch
+Patch459: mozilla-1463753.patch
+Patch560: rb244010.patch
+Patch561: rb244012.patch
+Patch562: rb246410.patch
+Patch563: rb245262.patch
+Patch564: mozilla-1464808.patch
+Patch565: mozilla-1464823.patch
+Patch566: mozilla-1466473.patch
+#
BuildRequires: alsa-lib-devel
BuildRequires: autoconf213
@@ -220,11 +266,7 @@ BuildRequires: python2-ply
BuildRequires: python2-psutil
BuildRequires: python2-setuptools
BuildRequires: python2-virtualenv
-%if 0%{?fedora} > 27
BuildRequires: python2-which
-%else
-BuildRequires: python-which
-%endif
BuildRequires: pkgconfig(gconf-2.0)
BuildRequires: pkgconfig(xrender)
BuildRequires: pkgconfig(libstartup-notification-1.0)
@@ -237,6 +279,12 @@ BuildRequires: pulseaudio-libs-devel
BuildRequires: jack-audio-connection-kit-devel
%endif
BuildRequires: yasm
+BuildRequires: llvm
+BuildRequires: llvm-devel
+BuildRequires: clang
+BuildRequires: clang-libs
+BuildRequires: rust
+BuildRequires: cargo
%if %{?system_sqlite}
BuildRequires: pkgconfig(sqlite3) >= %{sqlite_version}
@@ -245,6 +293,7 @@ Requires: sqlite >= %{sqlite_build_version}
Requires: dconf
Requires: mozilla-filesystem
+Requires: p11-kit-trust
%if %{?system_nss}
Requires: nspr >= %{nspr_build_version}
@@ -285,80 +334,89 @@ Extensions included to this version of IceCat:
%prep
%setup -q -n %{name}-%{version}
-# Remove reference to non-free files
-sed -i '/[test_ril_code_quality.py]/d'
dom/system/gonk/tests/marionette/manifest.ini
-rm -f dom/system/gonk/tests/marionette/test_ril_code_quality.py
-
-##Copy license files
-tar -xf %{SOURCE5}
-
-##Prevent HTTPS-everywhere addon's installation
-sed '/https-everywhere/d' -i ./browser/installer/package-manifest.in
-
#Fix permissions
find . -type f -name "*.h" -exec chmod 0644 '{}' \;
find . -type f -name "*.cpp" -exec chmod 0644 '{}' \;
find . -type f -name "*.cc" -exec chmod 0644 '{}' \;
find . -type f -name "*.c" -exec chmod 0644 '{}' \;
-find . -type f -name "*.py" | xargs sed -i '1s|^#!/usr/bin/env
python|#!%{__python2}|'
-# Build patches, can't change backup suffix from default because during build
-# there is a compare of config and js/config directories and .orig suffix is
-# ignored during this compare.
-%patch0 -p1
-
-%patch18 -p1 -b .jemalloc-ppc
-%patch19 -p2 -b .s390-inlines
-%patch20 -p1 -b .prbool
+##Copy license files
+tar -xf %{SOURCE5}
-%patch3 -p1 -b .arm
+##Prevent HTTPS-everywhere addon's installation
+sed '/https-everywhere/d' -i ./browser/installer/package-manifest.in
-%patch1 -p0
-%patch6 -p0
+%patch2 -p1 -b .1474265
+%patch3 -p1 -b .arm
+%patch4 -p1 -b .1479540
%patch7 -p0
%patch8 -p0
+%patch37 -p1 -b .jit-atomic-lucky
+
# Fedora patches
-%patch204 -p2 -b .966424
%patch219 -p2 -b .rhbz-1173156
%patch221 -p2 -b .fedora-ua
%patch224 -p1 -b .1170092
%patch225 -p1 -b .1005640-accept-lang
+
#ARM run-time patch
%ifarch aarch64
%patch226 -p1 -b .1354671
%endif
-# Fix depends on p11-kit-trust 0.23.4 and enhanced ca-certificates.rpm
-%patch227 -p1 -b .rh1400293
-
-%patch304 -p1 -b .1253216
%patch402 -p1 -b .1196777
%patch406 -p0 -b .256180
-# Rebase Gtk3 widget code to latest trunk to
-# fix various rendering problems
-%patch407 -p1 -b .widget-rebase
-%patch411 -p1 -b .1158076-1
-%patch412 -p1 -b .1158076-2
-
-# Debian extension patch
-%patch500 -p1 -b .440908
+%patch413 -p1 -b .1353817
+%ifarch %{arm}
+%patch415 -p1 -b .mozilla-1238661
+%endif
+%patch416 -p1 -b .1424422
+%patch417 -p1 -b .bug1375074-save-restore-x28
+%patch418 -p1 -b .mozilla-1436242
# Patch for big endian platforms only
%if 0%{?big_endian}
%patch26 -p1 -b .icu
-%if 0%{?fedora} > 26
%patch9 -p0 -b .locale
+%patch29 -p1 -b .big-endian
%endif
+
+# Wayland specific upstream patches
+%if %{?wayland_backend}
+%patch453 -p1 -b .mozilla-1460605-1
+%patch454 -p1 -b .mozilla-1460605-2
+%patch455 -p1 -b .mozilla-1460810
+%patch456 -p1 -b .mozilla-1461306
+%patch457 -p1 -b .mozilla-1462622
+%patch451 -p1 -b .mozilla-1438136
+%patch450 -p1 -b .mozilla-1438131
+%patch459 -p1 -b .mozilla-1463753
+%patch458 -p1 -b .mozilla-1462642
+%patch452 -p1 -b .mozilla-1460603
+%patch560 -p1 -b .rb244010
+%patch561 -p1 -b .rb244012
+%patch562 -p1 -b .rb246410
+%patch563 -p1 -b .rb245262
+%patch564 -p1 -b .mozilla-1464808
+%patch565 -p1 -b .mozilla-1464823
+%patch566 -p1 -b .mozilla-1466473
%endif
+
##Remove default configuration and copy the customized one
%{__rm} -f .mozconfig
cp -p %{SOURCE3} .mozconfig
+%if 0%{?wayland_backend}
+echo "ac_add_options --enable-default-toolkit=cairo-gtk3-wayland" >>
.mozconfig
+%else
+echo "ac_add_options --enable-default-toolkit=cairo-gtk3" >> .mozconfig
+%endif
+
echo "ac_add_options --enable-official-branding" >> .mozconfig
-%ifnarch %{arm}
+%ifarch %{ix86} x86_64
echo "ac_add_options --enable-webrtc" >> .mozconfig
%else
echo "ac_add_options --disable-webrtc" >> .mozconfig
@@ -376,7 +434,7 @@ echo "ac_add_options --enable-jack" >> .mozconfig
echo "ac_add_options --disable-jemalloc" >> .mozconfig
%endif
-%if %{?system_nss}
+%if 0%{?system_nss}
echo "ac_add_options --with-nspr-cflags='%(%{_bindir}/nspr-config
--cflags)'" >> .mozconfig
echo "ac_add_options --with-nspr-libs='%(%{_bindir}/nspr-config
--libs)'" >> .mozconfig
echo "ac_add_options --with-system-nss" >>.mozconfig
@@ -384,7 +442,7 @@ echo "ac_add_options --with-system-nss" >>.mozconfig
%ifarch %{arm}
echo "ac_add_options --disable-elf-hack" >> .mozconfig
%endif
-%if %{?system_libicu}
+%if 0%{?system_libicu}
echo "ac_add_options --with-system-icu" >> .mozconfig
%else
echo "ac_add_options --without-system-icu" >> .mozconfig
@@ -392,7 +450,7 @@ echo "ac_add_options --without-system-icu" >>
.mozconfig
echo "ac_add_options --disable-system-cairo" >> .mozconfig
echo "ac_add_options --enable-system-hunspell" >> .mozconfig
echo "ac_add_options --enable-system-pixman" >> .mozconfig
-%if %{?system_sqlite}
+%if 0%{?system_sqlite}
echo "ac_add_options --enable-system-sqlite" >> .mozconfig
%else
echo "ac_add_options --disable-system-sqlite" >> .mozconfig
@@ -408,20 +466,20 @@ echo "ac_add_options --disable-crashreporter" >>
.mozconfig
echo "ac_add_options --disable-eme" >> .mozconfig
%ifarch aarch64 ppc64 s390x %{arm} %{ix86}
-echo "ac_add_options --disable-skia" >> .mozconfig
+#echo "ac_add_options --disable-skia" >> .mozconfig
%endif
-%if %{?debug_build}
+%if 0%{?debug_build}
echo "ac_add_options --enable-debug" >> .mozconfig
echo "ac_add_options --disable-optimize" >> .mozconfig
echo "ac_add_options --enable-dtrace" >> .mozconfig
%else
%define optimize_flags "none"
# Fedora with GCC-7 needs to disable default build flags (mozbz#1342344)
-%ifnarch s390 s390x
+%ifnarch s390x
%define optimize_flags "-g -O2"
%endif
-%ifarch %{arm} s390 s390x
+%ifarch %{arm} s390x
# ARMv7 need that (rhbz#1426850)
%define optimize_flags "-g -O2 -fno-schedule-insns"
%endif
@@ -436,19 +494,25 @@ echo 'ac_add_options --enable-optimize' >> .mozconfig
echo "ac_add_options --disable-debug" >> .mozconfig
%endif
-%if %{?debug_build}
-echo "ac_add_options --enable-debug" >> .mozconfig
-echo "ac_add_options --disable-optimize" >> .mozconfig
-%else
-echo "ac_add_options --disable-debug" >> .mozconfig
-%endif
echo "ac_add_options --disable-strip" >> .mozconfig
echo "ac_add_options --disable-install-strip" >> .mozconfig
echo "ac_add_options --disable-tests" >> .mozconfig
echo "ac_add_options --with-l10n-base=$PWD/l10n" >> .mozconfig
+echo "ac_add_options --disable-rust-tests" >> .mozconfig
+echo "ac_add_options --disable-gtest-in-build" >> .mozconfig
+
+%if 0%{?hardened_build}
+echo "ac_add_options --enable-hardening" >> .mozconfig
+%endif
+
+# Remove executable bit to make brp-mangle-shebangs happy.
+chmod -x third_party/rust/itertools/src/lib.rs
+
+#---------------------------------------------------------------------
+
%build
-%if %{?system_sqlite}
+%if 0%{?system_sqlite}
# Do not proceed with build if the sqlite require would be broken:
# make sure the minimum requirement is non-empty, ...
sqlite_version=$(expr "%{sqlite_version}" : '\([0-9]*\.\)[0-9]*\.') ||
exit 1
@@ -491,16 +555,19 @@ MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -fPIC -Wl,-z,relro
-Wl,-z,now"
%if %{?debug_build}
MOZ_OPT_FLAGS=$(echo "$MOZ_OPT_FLAGS" | %{__sed} -e 's/-O2//')
%endif
-%ifarch s390 s390x %{arm}
+%ifarch s390x %{arm}
MOZ_OPT_FLAGS=$(echo "$MOZ_OPT_FLAGS" | %{__sed} -e 's/-g/-g1/' -e
's/-O2/-O1/')
# If MOZ_DEBUG_FLAGS is empty, firefox's build will default it to "-g"
which
# overrides the -g1 from line above and breaks building on s390
# (OOM when linking, rhbz#1238225)
export MOZ_DEBUG_FLAGS=" "
%endif
-%ifarch s390 s390x %{arm} %{power64} aarch64 %{arm}
+%ifarch s390x %{arm} %{power64} aarch64 %{arm}
MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
%endif
+%ifarch %{arm}
+export RUSTFLAGS="-Cdebuginfo=0"
+%endif
export CFLAGS=$MOZ_OPT_FLAGS
export CXXFLAGS=$MOZ_OPT_FLAGS
export LDFLAGS=$MOZ_LINK_FLAGS
@@ -521,13 +588,18 @@ MOZ_SMP_FLAGS=-j1
[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8
%endif
-make -f client.mk build STRIP="/bin/true"
MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" MOZ_OPTIMIZE_FLAGS=" -freorder-blocks
-fno-reorder-functions" MOZ_SERVICES_SYNC="1"
+#make -f client.mk build STRIP="/bin/true"
MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" MOZ_OPTIMIZE_FLAGS=" -freorder-blocks
-fno-reorder-functions" MOZ_SERVICES_SYNC="1"
+export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS"
+export MOZ_SERVICES_SYNC="1"
+export MOZ_OPTIMIZE_FLAGS=" -freorder-blocks -fno-reorder-functions"
+export STRIP=/bin/true
+MOZ_RUN_GTEST=0 ./mach -v build
%install
# set up our default bookmarks
-%{__cp} -p %{default_bookmarks_file}
objdir/dist/bin/browser/chrome/en-US/locale/browser/bookmarks.html
+cp -p %{default_bookmarks_file}
objdir/dist/bin/browser/chrome/en-US/locale/browser/bookmarks.html
-make -C objdir install DESTDIR=$RPM_BUILD_ROOT
+%make_install -C objdir
##Resize IceCat icon
for i in 16 22 24 32 36 48 64 72 96 128 256 ; do
@@ -537,7 +609,17 @@ done
##desktop file installation
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
-install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/applications
+desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE1}
+
+# set up the icecat start script
+rm -rf $RPM_BUILD_ROOT%{_bindir}/%{name}
+cat %{SOURCE13} > $RPM_BUILD_ROOT%{_bindir}/%{name}
+chmod 755 $RPM_BUILD_ROOT%{_bindir}/%{name}
+%if %{?wayland_backend}
+desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE9}
+cat %{SOURCE12} > $RPM_BUILD_ROOT%{_bindir}/%{name}-wayland
+chmod 755 $RPM_BUILD_ROOT%{_bindir}/%{name}-wayland
+%endif
##Install man page
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
@@ -582,9 +664,9 @@ echo "%%lang($language_short)
%{langpackdir}/langpack-$language_short(a)icecat.moz
%endif
# Remove copied libraries to speed up build
-ln -sf %{icecatappdir}/libmozjs.so
${RPM_BUILD_ROOT}%{_libdir}/%{icecat_devel}/sdk/lib/libmozjs.so
-ln -sf %{icecatappdir}/libmozalloc.so
${RPM_BUILD_ROOT}%{_libdir}/%{icecat_devel}/sdk/lib/libmozalloc.so
-ln -sf %{icecatappdir}/libxul.so
${RPM_BUILD_ROOT}%{_libdir}/%{icecat_devel}/sdk/lib/libxul.so
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/%{icecat_devel}/sdk/lib/libmozjs.so
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/%{icecat_devel}/sdk/lib/libmozalloc.so
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/%{icecat_devel}/sdk/lib/libxul.so
# Remove useless backup files
rm -rf ${RPM_BUILD_ROOT}%{icecatappdir}/browser/extensions/SimpleSumOfUs(a)0xbeef.coffee
@@ -596,6 +678,9 @@ ln -sf %{icecatappdir}/%{name}-bin
${RPM_BUILD_ROOT}%{icecatappdir}/%{name}
rm -rf ${RPM_BUILD_ROOT}%{icecatappdir}/dictionaries
ln -s %{_datadir}/myspell ${RPM_BUILD_ROOT}%{icecatappdir}/dictionaries
+# Copy over run-icecat.sh
+cp -p build/unix/run-%{name}.sh %{buildroot}%{icecatappdir}/
+
# Remove unused directories
rm -rf $RPM_BUILD_ROOT%{_libdir}/%{icecat_devel}
rm -rf $RPM_BUILD_ROOT%{_datadir}/idl/%{icecat_ver}
@@ -603,81 +688,8 @@ rm -rf $RPM_BUILD_ROOT%{_includedir}/%{icecat_ver}
rm -rf $RPM_BUILD_ROOT%{icecatappdir}/removed-files
mkdir -p $RPM_BUILD_ROOT%{_metainfodir}
-cat > $RPM_BUILD_ROOT%{_metainfodir}/icecat.appdata.xml <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<component type="desktop">
- <id type="desktop">icecat.desktop</id>
- <metadata_license>CC0-1.0</metadata_license>
- <summary>GNU version of Firefox browser</summary>
- <name>icecat</name>
- <project_license>(MPL-1.1 or GPL-2.0+ or LGPL-2.0+) and GPL-3.0+ and MIT and BSD
and ISC and ASL-2.0 and MPL-2.0</project_license>
- <categories>
- <category>Internet</category>
- <category>Web Browser</category>
- </categories>
- <description>
- <p>
- GNUzilla is the GNU version of the Mozilla suite, and GNU IceCat is the GNU version
of the Firefox ESR browser.
- </p>
- <p>
- Its main advantage is an ethical one: it is entirely free software:
- while the Firefox source code from the Mozilla project is free software,
- they distribute and recommend non-free software as plug-ins and addons.
- Also their trademark license restricts distribution in several ways incompatible
with freedom 0.
- </p>
- <p>
- Extensions included to this version of IceCat:
- - LibreJS
- GNU LibreJS aims to address the JavaScript problem described in Richard
- Stallman's article The JavaScript Trap.
- - SpyBlock
- Blocks privacy trackers while in normal browsing mode, and all third party
- requests when in private browsing mode. Based on Adblock Plus.
- - AboutIceCat
- Adds a custom "about:icecat" homepage with links to information about
the
- free software and privacy features in IceCat, and check-boxes to enable
- and disable the ones more prone to break websites.
- - HTML5-video-everywhere
- Uses the native video player to play embedded videos from different sources
- - Fingerprinting countermeasures: Fingerprinting is a series of techniques
- allowing to uniquely identify a browser based on specific characteristics of
- that particular instance (like what fonts are available in that machine).
- Unlike cookies the user cannot opt-out of being tracked this way,
- so the browser has to avoid giving away that kind of hints.
- </p>
- </description>
- <url
type="homepage">http://www.gnu.org/software/gnuzilla/</ur...
- <screenshots>
- <screenshot type="default">
-
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
- </screenshot>
- <screenshot>
-
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
- </screenshot>
- <screenshot>
-
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
- </screenshot>
- <screenshot>
-
<
image>https://sagitter.fedorapeople.org/icecat/icecat-screenshots/icec...
- </screenshot>
- </screenshots>
- <updatecontact>sagitter_at_fedoraproject.org</updatecontact>
-</component>
-EOF
-
-cat > $RPM_BUILD_ROOT%{_metainfodir}/icecat.metainfo.xml <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<component type="addon">
- <id>mozilla-requestpolicy</id>
- <extends>icecat.desktop</extends>
- <name>mozilla-requestpolicy</name>
- <summary>Extension that gives you control over cross-site
requests</summary>
- <url
type="homepage">https://requestpolicycontinued.github.io/</url>
- <url
type="bugtracker">https://github.com/requestpolicycontinued/...
- <metadata_license>CC0-1.0</metadata_license>
- <project_license>GPL-3.0+ and LGPL-3.0+</project_license>
-</component>
-EOF
+install -pm 644 %{SOURCE10} $RPM_BUILD_ROOT%{_metainfodir}/
+install -pm 644 %{SOURCE11} $RPM_BUILD_ROOT%{_metainfodir}/
# Moves defaults/preferences to browser/defaults/preferences
%pretrans -p <lua>
@@ -699,7 +711,6 @@ if
(posix.stat("%{icecatappdir}/browser/defaults/preferences", "type") ==
"link"
end
%check
-desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
appstream-util validate-relax --nonet $RPM_BUILD_ROOT%{_metainfodir}/*.appdata.xml
%if %{build_langpacks}
@@ -710,11 +721,15 @@ appstream-util validate-relax --nonet
$RPM_BUILD_ROOT%{_metainfodir}/*.appdata.x
%doc Changelog.IceCat README.* AUTHORS
%license LICENSE LEGAL COPYING-*
%{_bindir}/%{name}
-%{_datadir}/applications/%{name}.desktop
+%if %{?wayland_backend}
+%{_bindir}/%{name}-wayland
+%endif
+%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*x*/apps/%{name}*.png
-%{_metainfodir}/%{name}.appdata.xml
+%{_metainfodir}/*.appdata.xml
%{_metainfodir}/%{name}.metainfo.xml
%{_mandir}/man1/%{name}*
+%dir %{icecatappdir}
%{icecatappdir}/browser/
%{icecatappdir}/defaults/
%{icecatappdir}/dictionaries
@@ -725,13 +740,11 @@ appstream-util validate-relax --nonet
$RPM_BUILD_ROOT%{_metainfodir}/*.appdata.x
%{icecatappdir}/run-icecat.sh
%{icecatappdir}/dependentlibs.list
%{icecatappdir}/plugin-container
+%{icecatappdir}/pingsender
%{icecatappdir}/gmp-clearkey/
%{icecatappdir}/chrome.manifest
%{icecatappdir}/fonts/EmojiOneMozilla.ttf
%{icecatappdir}/gtk2/*.so
-%if !%{?system_libicu}
-%{icecatappdir}/icudt*.dat
-%endif
%if !%{?system_nss}
%{icecatappdir}/libfreeblpriv3.chk
%{icecatappdir}/libnssdbm3.chk
@@ -742,6 +755,11 @@ appstream-util validate-relax --nonet
$RPM_BUILD_ROOT%{_metainfodir}/*.appdata.x
%endif
%changelog
+* Fri Sep 14 2018 Antonio Trande <sagitterATfedoraproject.org> - 60.2.0-0.1
+- Pre-release 60.2.0
+- Integrate firefox patches for wayland (disabled)
+- Setting of upstream patches for ESR60
+
* Sun Aug 05 2018 Antonio Trande <sagitterATfedoraproject.org> - 52.9.0-1
- Update to 52.9.0
diff --git a/mozilla-1158076-1.patch b/mozilla-1158076-1.patch
deleted file mode 100644
index e409386..0000000
--- a/mozilla-1158076-1.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-diff -up firefox-52.0.2/modules/libpref/init/all.js.1158076-1
firefox-52.0.2/modules/libpref/init/all.js
---- firefox-52.0.2/modules/libpref/init/all.js.1158076-1 2017-03-31 09:44:28.377647329
+0200
-+++ firefox-52.0.2/modules/libpref/init/all.js 2017-03-31 09:46:02.847234586 +0200
-@@ -4646,6 +4646,8 @@ pref("gfx.apitrace.enabled",false);
- pref("gfx.content.use-native-pushlayer", true);
- #ifdef MOZ_WIDGET_GTK
- pref("gfx.xrender.enabled",false);
-+pref("widget.chrome.allow-gtk-dark-theme", false);
-+pref("widget.content.allow-gtk-dark-theme", false);
- #endif
- #endif
-
-diff -up firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp.1158076-1
firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp
---- firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp.1158076-1 2017-03-31 09:44:28.374647342
+0200
-+++ firefox-52.0.2/widget/gtk/nsLookAndFeel.cpp 2017-03-31 09:44:35.125617758 +0200
-@@ -1134,16 +1134,27 @@ nsLookAndFeel::Init()
- // with wrong color theme, see Bug 972382
- GtkSettings *settings = gtk_settings_get_for_screen(gdk_screen_get_default());
-
-- // Disable dark theme because it interacts poorly with widget styling in
-- // web content (see bug 1216658).
-- // To avoid triggering reload of theme settings unnecessarily, only set the
-- // setting when necessary.
- const gchar* dark_setting = "gtk-application-prefer-dark-theme";
-- gboolean dark;
-- g_object_get(settings, dark_setting, &dark, nullptr);
-+ gboolean darkThemeDefault;
-+ g_object_get(settings, dark_setting, &darkThemeDefault, nullptr);
-
-- if (dark && !PR_GetEnv("MOZ_ALLOW_GTK_DARK_THEME")) {
-- g_object_set(settings, dark_setting, FALSE, nullptr);
-+ // Dark themes interacts poorly with widget styling (see bug 1216658).
-+ // We disable dark themes by default for all processes (chrome, web content)
-+ // but allow user to overide it by prefs.
-+ if (darkThemeDefault) {
-+ bool allowDarkTheme;
-+ if (XRE_IsContentProcess()) {
-+ allowDarkTheme =
-+
mozilla::Preferences::GetBool("widget.content.allow-gtk-dark-theme",
-+ false);
-+ } else {
-+ allowDarkTheme = (PR_GetEnv("MOZ_ALLOW_GTK_DARK_THEME") !=
nullptr) ||
-+
mozilla::Preferences::GetBool("widget.chrome.allow-gtk-dark-theme",
-+ false);
-+ }
-+ if (!allowDarkTheme) {
-+ g_object_set(settings, dark_setting, FALSE, nullptr);
-+ }
- }
-
- // Scrollbar colors
diff --git a/mozilla-1158076-2.patch b/mozilla-1158076-2.patch
deleted file mode 100644
index 16079b3..0000000
--- a/mozilla-1158076-2.patch
+++ /dev/null
@@ -1,184 +0,0 @@
-diff --git a/widget/gtk/nsLookAndFeel.h b/widget/gtk/nsLookAndFeel.h
---- a/widget/gtk/nsLookAndFeel.h
-+++ b/widget/gtk/nsLookAndFeel.h
-@@ -76,13 +76,14 @@ protected:
- nscolor sTextSelectedBackground;
- nscolor sMozScrollbar;
- #if (MOZ_WIDGET_GTK == 3)
- nscolor sInfoBarText;
- #endif
- char16_t sInvisibleCharacter;
- float sCaretRatio;
- bool sMenuSupportsDrag;
-+ bool mInitialized;
-
-- void Init();
-+ void EnsureInit();
- };
-
- #endif
-
-diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
---- a/widget/gtk/nsLookAndFeel.cpp
-+++ b/widget/gtk/nsLookAndFeel.cpp
-@@ -45,19 +45,19 @@ using mozilla::LookAndFeel;
- (int)((c).blue*255), (int)((c).alpha*255)))
-
- nsLookAndFeel::nsLookAndFeel()
- : nsXPLookAndFeel(),
- #if (MOZ_WIDGET_GTK == 2)
- mStyle(nullptr),
- #endif
- mDefaultFontCached(false), mButtonFontCached(false),
-- mFieldFontCached(false), mMenuFontCached(false)
-+ mFieldFontCached(false), mMenuFontCached(false),
-+ mInitialized(false)
- {
-- Init();
- }
-
- nsLookAndFeel::~nsLookAndFeel()
- {
- #if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
- #endif
- }
-@@ -219,16 +219,18 @@ GetBorderColors(GtkStyleContext* aContex
- *aDarkColor = GDK_RGBA_TO_NS_RGBA(darkColor);
- return ret;
- }
- #endif
-
- nsresult
- nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
- {
-+ EnsureInit();
-+
- #if (MOZ_WIDGET_GTK == 3)
- GdkRGBA gdk_color;
- #endif
- nsresult res = NS_OK;
-
- switch (aID) {
- // These colors don't seem to be used for anything anymore in Mozilla
- // (except here at least TextSelectBackground and TextSelectForeground)
-@@ -670,16 +672,21 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
- break;
- }
-
- res = nsXPLookAndFeel::GetIntImpl(aID, aResult);
- if (NS_SUCCEEDED(res))
- return res;
- res = NS_OK;
-
-+ // We use delayed initialization by EnsureInit() here
-+ // to make sure mozilla::Preferences is available (Bug 115807).
-+ // eIntID_UseAccessibilityTheme is requested before user preferences
-+ // are read, and so EnsureInit(), which depends on preference values,
-+ // is deliberately delayed until required.
- switch (aID) {
- case eIntID_CaretBlinkTime:
- {
- GtkSettings *settings;
- gint blink_time;
- gboolean blink;
-
- settings = gtk_settings_get_default ();
-@@ -832,16 +839,17 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
- case eIntID_IMESelectedRawTextUnderlineStyle:
- case eIntID_IMESelectedConvertedTextUnderline:
- aResult = NS_STYLE_TEXT_DECORATION_STYLE_NONE;
- break;
- case eIntID_SpellCheckerUnderlineStyle:
- aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
- break;
- case eIntID_MenuBarDrag:
-+ EnsureInit();
- aResult = sMenuSupportsDrag;
- break;
- case eIntID_ScrollbarButtonAutoRepeatBehavior:
- aResult = 1;
- break;
- case eIntID_SwipeAnimationEnabled:
- aResult = 0;
- break;
-@@ -872,16 +880,17 @@ nsLookAndFeel::GetFloatImpl(FloatID aID,
- switch (aID) {
- case eFloatID_IMEUnderlineRelativeSize:
- aResult = 1.0f;
- break;
- case eFloatID_SpellCheckerUnderlineRelativeSize:
- aResult = 1.0f;
- break;
- case eFloatID_CaretAspectRatio:
-+ EnsureInit();
- aResult = sCaretRatio;
- break;
- default:
- aResult = -1.0;
- res = NS_ERROR_FAILURE;
- }
- return res;
- }
-@@ -1052,21 +1061,25 @@ nsLookAndFeel::GetFontImpl(FontID aID, n
- }
-
- aFontName = *cachedFontName;
- aFontStyle = *cachedFontStyle;
- return true;
- }
-
- void
--nsLookAndFeel::Init()
-+nsLookAndFeel::EnsureInit()
- {
- GdkColor colorValue;
- GdkColor *colorValuePtr;
-
-+ if (mInitialized)
-+ return;
-+ mInitialized = true;
-+
- #if (MOZ_WIDGET_GTK == 2)
- NS_ASSERTION(!mStyle, "already initialized");
- // GtkInvisibles come with a refcount that is not floating
- // (since their initialization code calls g_object_ref_sink) and
- // their destroy code releases that reference (which means they
- // have to be explicitly destroyed, since calling unref enough
- // to cause destruction would lead to *another* unref).
- // However, this combination means that it's actually still ok
-@@ -1445,16 +1458,17 @@ nsLookAndFeel::Init()
-
- gtk_widget_destroy(window);
- }
-
- // virtual
- char16_t
- nsLookAndFeel::GetPasswordCharacterImpl()
- {
-+ EnsureInit();
- return sInvisibleCharacter;
- }
-
- void
- nsLookAndFeel::RefreshImpl()
- {
- nsXPLookAndFeel::RefreshImpl();
-
-@@ -1463,15 +1477,15 @@ nsLookAndFeel::RefreshImpl()
- mFieldFontCached = false;
- mMenuFontCached = false;
-
- #if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
- mStyle = nullptr;
- #endif
-
-- Init();
-+ mInitialized = false;
- }
-
- bool
- nsLookAndFeel::GetEchoPasswordImpl() {
- return false;
- }
diff --git a/mozilla-1170092.patch b/mozilla-1170092.patch
index 2b10f06..9e8906f 100644
--- a/mozilla-1170092.patch
+++ b/mozilla-1170092.patch
@@ -1,11 +1,11 @@
-diff -up firefox-45.0.1/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092
firefox-45.0.1/extensions/pref/autoconfig/src/nsReadConfig.cpp
---- firefox-45.0.1/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2016-03-15
23:37:54.000000000 +0100
-+++ firefox-45.0.1/extensions/pref/autoconfig/src/nsReadConfig.cpp 2016-03-21
16:10:42.540417899 +0100
-@@ -245,8 +245,20 @@ nsresult nsReadConfig::openAndEvaluateJS
+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;
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
-- if (NS_FAILED(rv))
+- if (NS_FAILED(rv))
- return rv;
+ if (NS_FAILED(rv)) {
+ // Look for cfg file in /etc/<application>/pref
@@ -17,29 +17,29 @@ diff -up
firefox-45.0.1/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092
+ 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/");
-diff -up firefox-45.0.1/modules/libpref/Preferences.cpp.1170092
firefox-45.0.1/modules/libpref/Preferences.cpp
---- firefox-45.0.1/modules/libpref/Preferences.cpp.1170092 2016-03-21 16:10:42.540417899
+0100
-+++ firefox-45.0.1/modules/libpref/Preferences.cpp 2016-03-21 16:13:29.145888710 +0100
-@@ -1214,6 +1214,8 @@ static nsresult pref_InitInitialObjects(
- // - jar:$gre/omni.jar!/defaults/preferences/*.js
- // Thus, in omni.jar case, we always load app-specific default preferences
- // from omni.jar, whether or not $app == $gre.
+ 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()
+ //
+ // 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
- nsZipFind *findPtr;
- nsAutoPtr<nsZipFind> find;
-diff -up firefox-45.0.1/toolkit/xre/nsXREDirProvider.cpp.1170092
firefox-45.0.1/toolkit/xre/nsXREDirProvider.cpp
---- firefox-45.0.1/toolkit/xre/nsXREDirProvider.cpp.1170092 2016-03-15 23:37:46.000000000
+0100
-+++ firefox-45.0.1/toolkit/xre/nsXREDirProvider.cpp 2016-03-21 16:12:06.498655156 +0100
-@@ -51,6 +51,7 @@
+ 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 @@
#endif
#ifdef XP_UNIX
#include <ctype.h>
@@ -47,7 +47,7 @@ diff -up firefox-45.0.1/toolkit/xre/nsXREDirProvider.cpp.1170092
firefox-45.0.1/
#endif
#ifdef XP_IOS
#include "UIKitDirProvider.h"
-@@ -457,6 +458,20 @@ nsXREDirProvider::GetFile(const char* aP
+@@ -554,6 +555,20 @@ nsXREDirProvider::GetFile(const char* aP
}
}
}
@@ -68,7 +68,7 @@ diff -up firefox-45.0.1/toolkit/xre/nsXREDirProvider.cpp.1170092
firefox-45.0.1/
if (NS_FAILED(rv) || !file)
return NS_ERROR_FAILURE;
-@@ -753,6 +768,14 @@ nsXREDirProvider::GetFilesInternal(const
+@@ -887,6 +902,14 @@ nsXREDirProvider::GetFilesInternal(const
LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
LoadDirsIntoArray(mAppBundleDirectories,
kAppendPrefDir, directories);
@@ -83,12 +83,12 @@ diff -up firefox-45.0.1/toolkit/xre/nsXREDirProvider.cpp.1170092
firefox-45.0.1/
rv = NS_NewArrayEnumerator(aResult, directories);
}
-diff -up firefox-45.0.1/xpcom/io/nsAppDirectoryServiceDefs.h.1170092
firefox-45.0.1/xpcom/io/nsAppDirectoryServiceDefs.h
---- firefox-45.0.1/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2016-03-15
23:37:47.000000000 +0100
-+++ firefox-45.0.1/xpcom/io/nsAppDirectoryServiceDefs.h 2016-03-21 16:10:42.541417902
+0100
-@@ -67,6 +67,7 @@
+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_EXT_PREFS_DEFAULTS_DIR_LIST "ExtPrefDL"
#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
diff --git a/mozilla-1253216.patch b/mozilla-1253216.patch
deleted file mode 100644
index c9252da..0000000
--- a/mozilla-1253216.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-48.0/js/src/jit/AtomicOperations.h.old
firefox-48.0/js/src/jit/AtomicOperations.h
---- firefox-48.0/js/src/jit/AtomicOperations.h.old 2016-07-27 09:42:43.148175449 +0200
-+++ firefox-48.0/js/src/jit/AtomicOperations.h 2016-07-27 09:41:13.000000000 +0200
-@@ -340,7 +340,7 @@ AtomicOperations::isLockfree(int32_t siz
- # elif defined(__aarch64__)
- # include "jit/arm64/AtomicOperations-arm64.h"
- # else
--# include "jit/none/AtomicOperations-none.h" // These MOZ_CRASH() always
-+# include "jit/none/AtomicOperations-ppc.h"
- # endif
- #elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
- # include "jit/x86-shared/AtomicOperations-x86-shared.h"
diff --git a/mozilla-1321521-2.patch b/mozilla-1321521-2.patch
new file mode 100644
index 0000000..8aec21e
--- /dev/null
+++ b/mozilla-1321521-2.patch
@@ -0,0 +1,37 @@
+
+# HG changeset patch
+# User Lars T Hansen <lhansen(a)mozilla.com>
+# Date 1485506824 -3600
+# Node ID 97c45b13a1654bce114ace1de67c5aacb12a75fd
+# Parent 0fc3d0ffe71e44819c6ffaf3a41b781e50504576
+Bug 1321521 - fix include order. r=me
+
+diff --git a/js/src/jit/none/Architecture-none.h b/js/src/jit/none/Architecture-none.h
+--- a/js/src/jit/none/Architecture-none.h
++++ b/js/src/jit/none/Architecture-none.h
+@@ -2,22 +2,22 @@
+ * vim: set ts=8 sts=4 et sw=4 tw=99:
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at
http://mozilla.org/MPL/2.0/. */
+
+ #ifndef jit_none_Architecture_none_h
+ #define jit_none_Architecture_none_h
+
+-#include "jit/shared/Architecture-shared.h"
+-
+ // JitSpewer.h is included through MacroAssembler implementations for other
+ // platforms, so include it here to avoid inadvertent build bustage.
+ #include "jit/JitSpewer.h"
+
++#include "jit/shared/Architecture-shared.h"
++
+ namespace js {
+ namespace jit {
+
+ static const bool SupportsSimd = false;
+ static const uint32_t SimdMemoryAlignment = 4; // Make it 4 to avoid a bunch of
div-by-zero warnings
+ static const uint32_t WasmStackAlignment = 8;
+
+ // Does this architecture support SIMD conversions between Uint32x4 and Float32x4?
+
diff --git a/mozilla-1321521.patch b/mozilla-1321521.patch
new file mode 100644
index 0000000..48ec355
--- /dev/null
+++ b/mozilla-1321521.patch
@@ -0,0 +1,62 @@
+
+# HG changeset patch
+# User Lars T Hansen <lhansen(a)mozilla.com>
+# Date 1485504866 -3600
+# Node ID 2c924fb664c18fb3c17bdbf6fc4d808b9107b87a
+# Parent 505e39fbc5ed9857ba12c1c12608fc1cca5c43be
+Bug 1321521 - register set adjustments for 'none' platform, r=me
+
+diff --git a/js/src/jit/none/Architecture-none.h b/js/src/jit/none/Architecture-none.h
+--- a/js/src/jit/none/Architecture-none.h
++++ b/js/src/jit/none/Architecture-none.h
+@@ -2,16 +2,18 @@
+ * vim: set ts=8 sts=4 et sw=4 tw=99:
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at
http://mozilla.org/MPL/2.0/. */
+
+ #ifndef jit_none_Architecture_none_h
+ #define jit_none_Architecture_none_h
+
++#include "jit/shared/Architecture-shared.h"
++
+ // JitSpewer.h is included through MacroAssembler implementations for other
+ // platforms, so include it here to avoid inadvertent build bustage.
+ #include "jit/JitSpewer.h"
+
+ namespace js {
+ namespace jit {
+
+ static const bool SupportsSimd = false;
+@@ -126,16 +128,30 @@ struct FloatRegister
+ bool aliases(FloatRegister) const { MOZ_CRASH(); }
+ uint32_t numAliased() const { MOZ_CRASH(); }
+ void aliased(uint32_t, FloatRegister*) { MOZ_CRASH(); }
+ bool equiv(FloatRegister) const { MOZ_CRASH(); }
+ uint32_t size() const { MOZ_CRASH(); }
+ uint32_t numAlignedAliased() const { MOZ_CRASH(); }
+ void alignedAliased(uint32_t, FloatRegister*) { MOZ_CRASH(); }
+ SetType alignedOrDominatedAliasedSet() const { MOZ_CRASH(); }
++
++ static constexpr RegTypeName DefaultType = RegTypeName::Float64;
++
++ template <RegTypeName = DefaultType>
++ static SetType LiveAsIndexableSet(SetType s) {
++ return SetType(0);
++ }
++
++ template <RegTypeName Name = DefaultType>
++ static SetType AllocatableAsIndexableSet(SetType s) {
++ static_assert(Name != RegTypeName::Any, "Allocatable set are not
iterable");
++ return SetType(0);
++ }
++
+ template <typename T> static T ReduceSetForPush(T) { MOZ_CRASH(); }
+ uint32_t getRegisterDumpOffsetInBytes() { MOZ_CRASH(); }
+ static uint32_t SetSize(SetType x) { MOZ_CRASH(); }
+ static Code FromName(const char* name) { MOZ_CRASH(); }
+
+ // This is used in static initializers, so produce a bogus value instead of
crashing.
+ static uint32_t GetPushSizeInBytes(const TypedRegisterSet<FloatRegister>&)
{ return 0; }
+ };
+
diff --git a/mozilla-1335250.patch b/mozilla-1335250.patch
new file mode 100644
index 0000000..8f7436c
--- /dev/null
+++ b/mozilla-1335250.patch
@@ -0,0 +1,30 @@
+diff -up firefox-53.0/dom/media/webrtc/MediaEngine.h.1335250
firefox-53.0/dom/media/webrtc/MediaEngine.h
+--- firefox-53.0/dom/media/webrtc/MediaEngine.h.1335250 2017-04-11 06:15:22.000000000
+0200
++++ firefox-53.0/dom/media/webrtc/MediaEngine.h 2017-04-19 20:35:55.264741939 +0200
+@@ -226,7 +226,7 @@ public:
+ ~AllocationHandle() {}
+ public:
+ AllocationHandle(const dom::MediaTrackConstraints& aConstraints,
+- const ipc::PrincipalInfo& aPrincipalInfo,
++ const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
+ const MediaEnginePrefs& aPrefs,
+ const nsString& aDeviceId)
+
+@@ -236,7 +236,7 @@ public:
+ mDeviceId(aDeviceId) {}
+ public:
+ NormalizedConstraints mConstraints;
+- ipc::PrincipalInfo mPrincipalInfo;
++ mozilla::ipc::PrincipalInfo mPrincipalInfo;
+ MediaEnginePrefs mPrefs;
+ nsString mDeviceId;
+ };
+@@ -327,7 +327,7 @@ public:
+ virtual nsresult Allocate(const dom::MediaTrackConstraints &aConstraints,
+ const MediaEnginePrefs &aPrefs,
+ const nsString& aDeviceId,
+- const ipc::PrincipalInfo& aPrincipalInfo,
++ const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
+ AllocationHandle** aOutHandle,
+ const char** aOutBadConstraint)
+ {
diff --git a/mozilla-1337988.patch b/mozilla-1337988.patch
new file mode 100644
index 0000000..8c40445
--- /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<NPObjWrapperHashEntry*>(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<typename T>
+ 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<T>, 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<T, Heap
+ static_assert(js::IsHeapConstructibleType<T>::value,
+ "Type T must be a public GC pointer type");
+ public:
+- using ElementType = T;
+-
+ Heap() {
+ static_assert(sizeof(T) == sizeof(Heap<T>),
+ "Heap<T> must be binary compatible with T.");
+@@ -385,8 +387,6 @@ template <typename T>
+ class TenuredHeap : public js::HeapBase<T, TenuredHeap<T>>
+ {
+ public:
+- using ElementType = T;
+-
+ TenuredHeap() : bits(0) {
+ static_assert(sizeof(T) == sizeof(TenuredHeap<T>),
+ "TenuredHeap<T> 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<T>& p) : bits(0) {
setPtr(p.getPtr()); }
+
++ bool operator==(const TenuredHeap<T>& other) { return bits == other.bits;
}
++ bool operator!=(const TenuredHeap<T>& other) { return bits != other.bits;
}
++
+ void setPtr(T newPtr) {
+ MOZ_ASSERT((reinterpret_cast<uintptr_t>(newPtr) & flagsMask) == 0);
+ if (newPtr)
+@@ -470,8 +473,6 @@ class MOZ_NONHEAP_CLASS Handle : public
+ friend class JS::MutableHandle<T>;
+
+ public:
+- using ElementType = T;
+-
+ /* Creates a handle from a handle of a type convertible to T. */
+ template <typename S>
+ MOZ_IMPLICIT Handle(Handle<S> handle,
+@@ -533,6 +534,7 @@ class MOZ_NONHEAP_CLASS Handle : public
+ MOZ_IMPLICIT Handle(MutableHandle<S>& root,
+ typename mozilla::EnableIf<mozilla::IsConvertible<S,
T>::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 <typename T>
+ class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T,
MutableHandle<T>>
+ {
+ public:
+- using ElementType = T;
+-
+ inline MOZ_IMPLICIT MutableHandle(Rooted<T>* root);
+ inline MOZ_IMPLICIT MutableHandle(PersistentRooted<T>* 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 <typename RootingContext>
+ explicit Rooted(const RootingContext& cx)
+ : ptr(GCPolicy<T>::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 <typename T>
+ class MOZ_RAII FakeRooted : public RootedBase<T, FakeRooted<T>>
+ {
+ public:
+- using ElementType = T;
+-
+ template <typename CX>
+ explicit FakeRooted(CX* cx) : ptr(JS::GCPolicy<T>::initial()) {}
+
+ template <typename CX>
+ 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 <typename T>
+ class FakeMutableHandle : public js::MutableHandleBase<T,
FakeMutableHandle<T>>
+ {
+ 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<T>::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<JSObject*> value;
+
+ public:
+- using ElementType = JSObject*;
+-
+ ObjectPtr() : value(nullptr) {}
+
+ explicit ObjectPtr(JSObject* obj) : value(obj) {}
+@@ -1342,177 +1336,6 @@ Swap(JS::TenuredHeap<T>& 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 <typename T>
+-struct DefineComparisonOps : mozilla::FalseType {};
+-
+-template <typename T>
+-struct DefineComparisonOps<JS::Heap<T>> : mozilla::TrueType {
+- static const T& get(const JS::Heap<T>& v) { return v.unbarrieredGet();
}
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<JS::TenuredHeap<T>> : mozilla::TrueType {
+- static const T get(const JS::TenuredHeap<T>& v) { return
v.unbarrieredGetPtr(); }
+-};
+-
+-template <>
+-struct DefineComparisonOps<JS::ObjectPtr> : mozilla::TrueType {
+- static const JSObject* get(const JS::ObjectPtr& v) { return v.unbarrieredGet();
}
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<JS::Rooted<T>> : mozilla::TrueType {
+- static const T& get(const JS::Rooted<T>& v) { return v.get(); }
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<JS::Handle<T>> : mozilla::TrueType {
+- static const T& get(const JS::Handle<T>& v) { return v.get(); }
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<JS::MutableHandle<T>> : mozilla::TrueType {
+- static const T& get(const JS::MutableHandle<T>& v) { return v.get();
}
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<JS::PersistentRooted<T>> : mozilla::TrueType {
+- static const T& get(const JS::PersistentRooted<T>& v) { return
v.get(); }
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<js::FakeRooted<T>> : mozilla::TrueType {
+- static const T& get(const js::FakeRooted<T>& v) { return v.get(); }
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<js::FakeMutableHandle<T>> : mozilla::TrueType {
+- static const T& get(const js::FakeMutableHandle<T>& 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 T, typename U>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- js::detail::DefineComparisonOps<U>::value,
bool>::Type
+-operator==(const T& a, const U& b) {
+- return js::detail::DefineComparisonOps<T>::get(a) ==
js::detail::DefineComparisonOps<U>::get(b);
+-}
+-
+-template <typename T, typename U>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- js::detail::DefineComparisonOps<U>::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 T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value,
bool>::Type
+-operator==(const T& a, const typename T::ElementType& b) {
+- return js::detail::DefineComparisonOps<T>::get(a) == b;
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value,
bool>::Type
+-operator!=(const T& a, const typename T::ElementType& b) {
+- return !(a == b);
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value,
bool>::Type
+-operator==(const typename T::ElementType& a, const T& b) {
+- return a == js::detail::DefineComparisonOps<T>::get(b);
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::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 T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::value,
bool>::Type
+-operator==(const typename mozilla::RemovePointer<typename T::ElementType>::Type*
a, const T& b) {
+- return a == js::detail::DefineComparisonOps<T>::get(b);
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::value,
bool>::Type
+-operator!=(const typename mozilla::RemovePointer<typename T::ElementType>::Type*
a, const T& b) {
+- return !(a == b);
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::value,
bool>::Type
+-operator==(const T& a, const typename mozilla::RemovePointer<typename
T::ElementType>::Type* b) {
+- return js::detail::DefineComparisonOps<T>::get(a) == b;
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::value,
bool>::Type
+-operator!=(const T& a, const typename mozilla::RemovePointer<typename
T::ElementType>::Type* b) {
+- return !(a == b);
+-}
+-
+-// Case 4: For pointer wrappers, comparison between the wrapper and nullptr.
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::value,
bool>::Type
+-operator==(std::nullptr_t a, const T& b) {
+- return a == js::detail::DefineComparisonOps<T>::get(b);
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::value,
bool>::Type
+-operator!=(std::nullptr_t a, const T& b) {
+- return !(a == b);
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::value,
bool>::Type
+-operator==(const T& a, std::nullptr_t b) {
+- return js::detail::DefineComparisonOps<T>::get(a) == b;
+-}
+-
+-template <typename T>
+-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value
&&
+- mozilla::IsPointer<typename T::ElementType>::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<T>(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<T>::isMarkable(this->value))
+- this->read();
++ const T get() const {
++ if (!InternalBarrierMethods<T>::isMarkable(this->value))
++ return JS::GCPolicy<T>::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<WasmTableObject*>
+
+ typedef ReadBarriered<Value> ReadBarrieredValue;
+
+-namespace detail {
+-
+-template <typename T>
+-struct DefineComparisonOps<PreBarriered<T>> : mozilla::TrueType {
+- static const T& get(const PreBarriered<T>& v) { return v.get(); }
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<GCPtr<T>> : mozilla::TrueType {
+- static const T& get(const GCPtr<T>& v) { return v.get(); }
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<HeapPtr<T>> : mozilla::TrueType {
+- static const T& get(const HeapPtr<T>& v) { return v.get(); }
+-};
+-
+-template <typename T>
+-struct DefineComparisonOps<ReadBarriered<T>> : mozilla::TrueType {
+- static const T& get(const ReadBarriered<T>& v) { return
v.unbarrieredGet(); }
+-};
+-
+-template <>
+-struct DefineComparisonOps<HeapSlot> : 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<typename T>
+ class SharedMem
+ {
+- // static_assert(mozilla::IsPointer<T>::value,
+- // "SharedMem encapsulates pointer types");
++ static_assert(mozilla::IsPointer<T>::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-1348576.patch b/mozilla-1348576.patch
new file mode 100644
index 0000000..ce6dad2
--- /dev/null
+++ b/mozilla-1348576.patch
@@ -0,0 +1,47 @@
+diff -up firefox-53.0/browser/extensions/e10srollout/bootstrap.js.1348576
firefox-53.0/browser/extensions/e10srollout/bootstrap.js
+--- firefox-53.0/browser/extensions/e10srollout/bootstrap.js.1348576 2017-04-18
13:06:29.660860929 +0200
++++ firefox-53.0/browser/extensions/e10srollout/bootstrap.js 2017-04-18
13:07:34.804627469 +0200
+@@ -9,6 +9,7 @@ const {classes: Cc, interfaces: Ci, util
+ Cu.import("resource://gre/modules/Preferences.jsm");
+ Cu.import("resource://gre/modules/Services.jsm");
+ Cu.import("resource://gre/modules/UpdateUtils.jsm");
++Cu.import("resource://gre/modules/AppConstants.jsm");
+
+ // The amount of people to be part of e10s
+ const TEST_THRESHOLD = {
+@@ -23,6 +24,23 @@ const ADDON_ROLLOUT_POLICY = {
+ "esr" : "esrA", // WebExtensions and Addons with mpc=true
+ };
+
++if (AppConstants.RELEASE_OR_BETA) {
++ // Bug 1348576 - e10s is never enabled for non-official release builds
++ // This is hacky, but the problem it solves is the following:
++ // the e10s rollout is controlled by the channel name, which
++ // is the only way to distinguish between Beta and Release.
++ // However, non-official release builds (like the ones done by distros
++ // to ship Firefox on their package managers) do not set a value
++ // for the release channel, which gets them to the default value
++ // of.. (drumroll) "default".
++ // But we can't just always configure the same settings for the
++ // "default" channel because that's also the name that a locally
++ // built Firefox gets, and e10s is managed in a different way
++ // there (directly by prefs, on Nightly and Aurora).
++ TEST_THRESHOLD.default = TEST_THRESHOLD.release;
++ ADDON_ROLLOUT_POLICY.default = ADDON_ROLLOUT_POLICY.release;
++}
++
+ const PREF_COHORT_SAMPLE = "e10s.rollout.cohortSample";
+ const PREF_COHORT_NAME = "e10s.rollout.cohort";
+ const PREF_E10S_OPTED_IN = "browser.tabs.remote.autostart";
+diff -up firefox-53.0/browser/extensions/e10srollout/install.rdf.in.1348576
firefox-53.0/browser/extensions/e10srollout/install.rdf.in
+--- firefox-53.0/browser/extensions/e10srollout/install.rdf.in.1348576 2017-04-11
06:15:16.000000000 +0200
++++ firefox-53.0/browser/extensions/e10srollout/install.rdf.in 2017-04-18
13:06:29.660860929 +0200
+@@ -10,7 +10,7 @@
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>e10srollout@mozilla.org</em:id>
+- <em:version>1.14</em:version>
++ <em:version>1.15</em:version>
+ <em:type>2</em:type>
+ <em:bootstrap>true</em:bootstrap>
+ <em:multiprocessCompatible>true</em:multiprocessCompatible>
diff --git a/mozilla-1353817.patch b/mozilla-1353817.patch
new file mode 100644
index 0000000..dc8d8f8
--- /dev/null
+++ b/mozilla-1353817.patch
@@ -0,0 +1,27 @@
+From 1cc652f5525f458b0b4ceb12af24bf5a4367db32 Mon Sep 17 00:00:00 2001
+From: Nicolas Dufresne <nicolas.dufresne(a)collabora.com>
+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-1424422.patch b/mozilla-1424422.patch
new file mode 100644
index 0000000..cc8b31f
--- /dev/null
+++ b/mozilla-1424422.patch
@@ -0,0 +1,188 @@
+diff -up firefox-60.0/browser/base/content/browser.js.1424422
firefox-60.0/browser/base/content/browser.js
+--- firefox-60.0/browser/base/content/browser.js.1424422 2018-04-26 22:07:20.000000000
+0200
++++ firefox-60.0/browser/base/content/browser.js 2018-04-30 11:49:51.609458857 +0200
+@@ -1259,6 +1259,9 @@ var gBrowserInit = {
+
+ if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+ gDragSpaceObserver.init();
++ if (AppConstants.platform == "linux") {
++ gLightThemeObserver.init();
++ }
+ }
+
+ BrowserSearch.initPlaceHolder();
+@@ -1826,6 +1829,9 @@ var gBrowserInit = {
+
+ if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+ gDragSpaceObserver.uninit();
++ if (AppConstants.platform == "linux") {
++ gLightThemeObserver.uninit();
++ }
+ }
+
+ TabsInTitlebar.uninit();
+@@ -5781,6 +5787,24 @@ var gDragSpaceObserver = {
+ },
+ };
+
++var gLightThemeObserver = {
++ init() {
++ Services.obs.addObserver(this, "lightweight-theme-styling-update");
++ },
++
++ uninit() {
++ Services.obs.removeObserver(this, "lightweight-theme-styling-update");
++ },
++
++ observe(aSubject, aTopic, aData) {
++ switch (aTopic) {
++ case "lightweight-theme-styling-update":
++ TabsInTitlebar.updateAppearance(true);
++ break;
++ }
++ },
++};
++
+ // Updates the UI density (for touch and compact mode) based on the uidensity pref.
+ var gUIDensity = {
+ MODE_NORMAL: 0,
+diff -up firefox-60.0/browser/themes/linux/browser.css.1424422
firefox-60.0/browser/themes/linux/browser.css
+--- firefox-60.0/browser/themes/linux/browser.css.1424422 2018-04-26 22:07:21.000000000
+0200
++++ firefox-60.0/browser/themes/linux/browser.css 2018-04-30 11:45:40.388172492 +0200
+@@ -691,12 +691,34 @@ notification[value="translation"] menuli
+ padding-bottom: 2px;
+ }
+
++ /* When default theme is used render titlebar command buttons
++ * according to system config.
++ *
++ * When -moz-lwtheme is enabled use similar approach as on Windows platform.
++ */
++ .titlebar-button:-moz-lwtheme {
++ border: none;
++ margin: 0 !important;
++ padding: 8px 17px;
++ }
++ .titlebar-button:-moz-lwtheme > .toolbarbutton-icon {
++ width: 12px;
++ height: 12px;
++ }
++ .titlebar-button:hover:-moz-lwtheme {
++ background-color: Highlight;
++ }
++
+ /* Render titlebar command buttons according to system config.
+ * Use full scale icons here as the Gtk+ does.
+ */
+ @media (-moz-gtk-csd-minimize-button) {
+- #titlebar-min {
+- -moz-appearance: -moz-window-button-minimize;
++ #titlebar-min:not(:-moz-lwtheme) {
++ -moz-appearance: -moz-window-button-minimize;
++ }
++ #titlebar-min:-moz-lwtheme {
++ -moz-appearance: none !important;
++ list-style-image: url(chrome://browser/skin/window-controls/minimize-themes.svg);
+ }
+ }
+ @media (-moz-gtk-csd-minimize-button: 0) {
+@@ -706,12 +728,20 @@ notification[value="translation"] menuli
+ }
+
+ @media (-moz-gtk-csd-maximize-button) {
+- #titlebar-max {
++ #titlebar-max:not(:-moz-lwtheme) {
+ -moz-appearance: -moz-window-button-maximize;
+ }
+- :root[sizemode="maximized"] #titlebar-max {
++ #titlebar-max:-moz-lwtheme {
++ -moz-appearance: none !important;
++ list-style-image: url(chrome://browser/skin/window-controls/maximize-themes.svg);
++ }
++ :root[sizemode="maximized"] #titlebar-max:not(:-moz-lwtheme) {
+ -moz-appearance: -moz-window-button-restore;
+ }
++ :root[sizemode="maximized"] #titlebar-max:-moz-lwtheme {
++ -moz-appearance: none !important;
++ list-style-image: url(chrome://browser/skin/window-controls/restore-themes.svg);
++ }
+ }
+ @media (-moz-gtk-csd-maximize-button: 0) {
+ #titlebar-max {
+@@ -720,9 +750,13 @@ notification[value="translation"] menuli
+ }
+
+ @media (-moz-gtk-csd-close-button) {
+- #titlebar-close {
++ #titlebar-close:not(:-moz-lwtheme) {
+ -moz-appearance: -moz-window-button-close;
+ }
++ #titlebar-close:-moz-lwtheme {
++ -moz-appearance: none !important;
++ list-style-image: url(chrome://browser/skin/window-controls/close-themes.svg);
++ }
+ }
+ @media (-moz-gtk-csd-close-button: 0) {
+ #titlebar-close {
+diff -up firefox-60.0/browser/themes/linux/jar.mn.1424422
firefox-60.0/browser/themes/linux/jar.mn
+--- firefox-60.0/browser/themes/linux/jar.mn.1424422 2018-04-26 22:07:20.000000000 +0200
++++ firefox-60.0/browser/themes/linux/jar.mn 2018-04-30 11:45:40.388172492 +0200
+@@ -49,9 +49,12 @@ browser.jar:
+ * skin/classic/browser/preferences/in-content/dialog.css
(preferences/in-content/dialog.css)
+ skin/classic/browser/preferences/applications.css (preferences/applications.css)
+ skin/classic/browser/tabbrowser/tabDragIndicator.png
(tabbrowser/tabDragIndicator.png)
+-
+ skin/classic/browser/sync-desktopIcon.svg (../shared/sync-desktopIcon.svg)
+ skin/classic/browser/sync-mobileIcon.svg (../shared/sync-mobileIcon.svg)
++ skin/classic/browser/window-controls/close-themes.svg
(window-controls/close-themes.svg)
++ skin/classic/browser/window-controls/maximize-themes.svg
(window-controls/maximize-themes.svg)
++ skin/classic/browser/window-controls/minimize-themes.svg
(window-controls/minimize-themes.svg)
++ skin/classic/browser/window-controls/restore-themes.svg
(window-controls/restore-themes.svg)
+ skin/classic/browser/e10s-64(a)2x.png (../shared/e10s-64(a)2x.png)
+
+ [extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}] chrome.jar:
+diff -up firefox-60.0/browser/themes/linux/window-controls/close-themes.svg.1424422
firefox-60.0/browser/themes/linux/window-controls/close-themes.svg
+--- firefox-60.0/browser/themes/linux/window-controls/close-themes.svg.1424422 2018-04-30
11:45:40.388172492 +0200
++++ firefox-60.0/browser/themes/linux/window-controls/close-themes.svg 2018-04-30
11:45:40.388172492 +0200
+@@ -0,0 +1,7 @@
++<!-- This Source Code Form is subject to the terms of the Mozilla Public
++ - License, v. 2.0. If a copy of the MPL was not distributed with this
++ - file, You can obtain one at
http://mozilla.org/MPL/2.0/. -->
++<svg width="12" height="12"
xmlns="http://www.w3.org/2000/svg">
++ <path stroke="black" stroke-width="3.6"
stroke-opacity=".75" d="M1,1 l 10,10 M1,11 l 10,-10"/>
++ <path stroke="white" stroke-width="1.9" d="M1.75,1.75 l
8.5,8.5 M1.75,10.25 l 8.5,-8.5"/>
++</svg>
+diff -up firefox-60.0/browser/themes/linux/window-controls/maximize-themes.svg.1424422
firefox-60.0/browser/themes/linux/window-controls/maximize-themes.svg
+---
firefox-60.0/browser/themes/linux/window-controls/maximize-themes.svg.1424422 2018-04-30
11:45:40.388172492 +0200
++++ firefox-60.0/browser/themes/linux/window-controls/maximize-themes.svg 2018-04-30
11:45:40.388172492 +0200
+@@ -0,0 +1,7 @@
++<!-- This Source Code Form is subject to the terms of the Mozilla Public
++ - License, v. 2.0. If a copy of the MPL was not distributed with this
++ - file, You can obtain one at
http://mozilla.org/MPL/2.0/. -->
++<svg width="12" height="12"
xmlns="http://www.w3.org/2000/svg" shape-rendering="crispEdges"
fill="none">
++ <rect stroke="black" stroke-width="3.6"
stroke-opacity=".75" x="2" y="2" width="8"
height="8"/>
++ <rect stroke="white" stroke-width="1.9" x="2"
y="2" width="8" height="8"/>
++</svg>
+diff -up firefox-60.0/browser/themes/linux/window-controls/minimize-themes.svg.1424422
firefox-60.0/browser/themes/linux/window-controls/minimize-themes.svg
+---
firefox-60.0/browser/themes/linux/window-controls/minimize-themes.svg.1424422 2018-04-30
11:45:40.388172492 +0200
++++ firefox-60.0/browser/themes/linux/window-controls/minimize-themes.svg 2018-04-30
11:45:40.388172492 +0200
+@@ -0,0 +1,7 @@
++<!-- This Source Code Form is subject to the terms of the Mozilla Public
++ - License, v. 2.0. If a copy of the MPL was not distributed with this
++ - file, You can obtain one at
http://mozilla.org/MPL/2.0/. -->
++<svg width="12" height="12"
xmlns="http://www.w3.org/2000/svg" shape-rendering="crispEdges">
++ <line stroke="black" stroke-width="3.6"
stroke-opacity=".75" x1="0" y1="6" x2="12"
y2="6"/>
++ <line stroke="white" stroke-width="1.9" x1="1"
y1="6" x2="11" y2="6"/>
++</svg>
+diff -up firefox-60.0/browser/themes/linux/window-controls/restore-themes.svg.1424422
firefox-60.0/browser/themes/linux/window-controls/restore-themes.svg
+---
firefox-60.0/browser/themes/linux/window-controls/restore-themes.svg.1424422 2018-04-30
11:45:40.388172492 +0200
++++ firefox-60.0/browser/themes/linux/window-controls/restore-themes.svg 2018-04-30
11:45:40.388172492 +0200
+@@ -0,0 +1,8 @@
++<!-- This Source Code Form is subject to the terms of the Mozilla Public
++ - License, v. 2.0. If a copy of the MPL was not distributed with this
++ - file, You can obtain one at
http://mozilla.org/MPL/2.0/. -->
++<svg width="12" height="12"
xmlns="http://www.w3.org/2000/svg" shape-rendering="crispEdges"
fill="none" stroke="white">
++ <path stroke="black" stroke-width="3.6"
stroke-opacity=".75" d="M2,4 l 6,0 l 0,6 l -6,0z M2.5,1.5 l 8,0 l
0,8"/>
++ <rect stroke-width="1.9" x="2" y="4"
width="6" height="6"/>
++ <polyline stroke-width=".9" points="3.5,1.5 10.5,1.5
10.5,8.5"/>
++</svg>
diff --git a/mozilla-1436242.patch b/mozilla-1436242.patch
new file mode 100644
index 0000000..570b7c5
--- /dev/null
+++ b/mozilla-1436242.patch
@@ -0,0 +1,56 @@
+
+# HG changeset patch
+# User Jed Davis <jld(a)mozilla.com>
+# Date 1526943705 21600
+# Node ID 6bb3adfa15c6877f7874429462dad88f8c978c4f
+# Parent 4c71c8454879c841871ecf3afb7dbdc96bad97fc
+Bug 1436242 - Avoid undefined behavior in IPC fd-passing code. r=froydnj
+
+MozReview-Commit-ID: 3szIPUssgF5
+
+diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+--- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
++++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+@@ -418,20 +418,37 @@ bool Channel::ChannelImpl::ProcessIncomi
+ const int* fds;
+ unsigned num_fds;
+ unsigned fds_i = 0; // the index of the first unused descriptor
+
+ if (input_overflow_fds_.empty()) {
+ fds = wire_fds;
+ num_fds = num_wire_fds;
+ } else {
+- const size_t prev_size = input_overflow_fds_.size();
+- input_overflow_fds_.resize(prev_size + num_wire_fds);
+- memcpy(&input_overflow_fds_[prev_size], wire_fds,
+- num_wire_fds * sizeof(int));
++ // This code may look like a no-op in the case where
++ // num_wire_fds == 0, but in fact:
++ //
++ // 1. wire_fds will be nullptr, so passing it to memcpy is
++ // undefined behavior according to the C standard, even though
++ // the memcpy length is 0.
++ //
++ // 2. prev_size will be an out-of-bounds index for
++ // input_overflow_fds_; this is undefined behavior according to
++ // the C++ standard, even though the element only has its
++ // pointer taken and isn't accessed (and the corresponding
++ // operation on a C array would be defined).
++ //
++ // UBSan makes #1 a fatal error, and assertions in libstdc++ do
++ // the same for #2 if enabled.
++ if (num_wire_fds > 0) {
++ const size_t prev_size = input_overflow_fds_.size();
++ input_overflow_fds_.resize(prev_size + num_wire_fds);
++ memcpy(&input_overflow_fds_[prev_size], wire_fds,
++ num_wire_fds * sizeof(int));
++ }
+ fds = &input_overflow_fds_[0];
+ num_fds = input_overflow_fds_.size();
+ }
+
+ // The data for the message we're currently reading consists of any data
+ // stored in incoming_message_ followed by data in input_buf_ (followed by
+ // other messages).
+
+
diff --git a/mozilla-1438131.patch b/mozilla-1438131.patch
new file mode 100644
index 0000000..e77186d
--- /dev/null
+++ b/mozilla-1438131.patch
@@ -0,0 +1,1558 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky(a)redhat.com>
+# Date 1522937803 -7200
+# Node ID 7e4166e13b3ec513ef3003527df601adf85f654b
+# Parent bf4962739d38ac21ba6ba216fa61f572e7976354
+Bug 1438131 - Implement Drop on Wayland, r=jhorak
+
+This patch implements Drop operation on Wayland/Gtk+. That's because drop operations
are part
+of clipboard on Wayland and we use our own paste clipboard handler on Wayland (Bug
1282015).
+
+Wayland drop data are provided by wl_data_device_listener, it provides us drag and drop
callbacks
+which we route to nsDragService module.
+
+MozReview-Commit-ID: 9uGYPg9YF6P
+
+diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
+--- a/widget/gtk/nsClipboardWayland.cpp
++++ b/widget/gtk/nsClipboardWayland.cpp
+@@ -18,16 +18,17 @@
+ #include "nsPrimitiveHelpers.h"
+ #include "nsIServiceManager.h"
+ #include "nsImageToPixbuf.h"
+ #include "nsStringStream.h"
+ #include "nsIObserverService.h"
+ #include "mozilla/Services.h"
+ #include "mozilla/RefPtr.h"
+ #include "mozilla/TimeStamp.h"
++#include "nsDragService.h"
+
+ #include "imgIContainer.h"
+
+ #include <gtk/gtk.h>
+ #include <poll.h>
+ #include <sys/epoll.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -41,16 +42,54 @@
+ const char*
+ nsRetrievalContextWayland::sTextMimeTypes[TEXT_MIME_TYPES_NUM] =
+ {
+ "text/plain;charset=utf-8",
+ "UTF8_STRING",
+ "COMPOUND_TEXT"
+ };
+
++static inline GdkDragAction
++wl_to_gdk_actions(uint32_t dnd_actions)
++{
++ GdkDragAction actions = GdkDragAction(0);
++
++ if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
++ actions = GdkDragAction(actions|GDK_ACTION_COPY);
++ if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
++ actions = GdkDragAction(actions|GDK_ACTION_MOVE);
++
++ return actions;
++}
++
++static inline uint32_t
++gdk_to_wl_actions(GdkDragAction action)
++{
++ uint32_t dnd_actions = 0;
++
++ if (action & (GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_PRIVATE))
++ dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
++ if (action & GDK_ACTION_MOVE)
++ dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
++
++ return dnd_actions;
++}
++
++static GtkWidget*
++get_gtk_widget_for_wl_surface(struct wl_surface *surface)
++{
++ GdkWindow *gdkParentWindow =
++ static_cast<GdkWindow*>(wl_surface_get_user_data(surface));
++
++ gpointer user_data = nullptr;
++ gdk_window_get_user_data(gdkParentWindow, &user_data);
++
++ return GTK_WIDGET(user_data);
++}
++
+ void
+ DataOffer::AddMIMEType(const char *aMimeType)
+ {
+ GdkAtom atom = gdk_atom_intern(aMimeType, FALSE);
+ mTargetMIMETypes.AppendElement(atom);
+ }
+
+ GdkAtom*
+@@ -150,44 +189,99 @@ WaylandDataOffer::RequestDataTransfer(co
+ if (mWaylandDataOffer) {
+ wl_data_offer_receive(mWaylandDataOffer, aMimeType, fd);
+ return true;
+ }
+
+ return false;
+ }
+
++void
++WaylandDataOffer::DragOfferAccept(const char* aMimeType, uint32_t aTime)
++{
++ wl_data_offer_accept(mWaylandDataOffer, aTime, aMimeType);
++}
++
++/* We follow logic of gdk_wayland_drag_context_commit_status()/gdkdnd-wayland.c
++ * here.
++ */
++void
++WaylandDataOffer::SetDragStatus(GdkDragAction aAction, uint32_t aTime)
++{
++ uint32_t dnd_actions = gdk_to_wl_actions(aAction);
++ uint32_t all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY |
++ WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
++
++ wl_data_offer_set_actions(mWaylandDataOffer, all_actions, dnd_actions);
++
++ /* Workaround Wayland D&D architecture here. To get the data_device_drop()
++ signal (which routes to nsDragService::GetData() call) we need to
++ accept at least one mime type before data_device_leave().
++
++ Real wl_data_offer_accept() for actualy requested data mime type is
++ called from nsDragService::GetData().
++ */
++ if (mTargetMIMETypes[0]) {
++ wl_data_offer_accept(mWaylandDataOffer, aTime,
++ gdk_atom_name(mTargetMIMETypes[0]));
++ }
++}
++
++void
++WaylandDataOffer::SetSelectedDragAction(uint32_t aWaylandAction)
++{
++ mSelectedDragAction = aWaylandAction;
++}
++
++GdkDragAction
++WaylandDataOffer::GetSelectedDragAction()
++{
++ return wl_to_gdk_actions(mSelectedDragAction);
++}
++
+ static void
+ data_offer_offer (void *data,
+ struct wl_data_offer *wl_data_offer,
+ const char *type)
+ {
+ auto *offer = static_cast<DataOffer*>(data);
+ offer->AddMIMEType(type);
+ }
+
++/* Advertise all available drag and drop actions from source.
++ * We don't use that but follow gdk_wayland_drag_context_commit_status()
++ * from gdkdnd-wayland.c here.
++ */
+ static void
+ data_offer_source_actions(void *data,
+ struct wl_data_offer *wl_data_offer,
+ uint32_t source_actions)
+ {
+ }
+
++/* Advertise recently selected drag and drop action by compositor, based
++ * on source actions and user choice (key modifiers, etc.).
++ */
+ static void
+ data_offer_action(void *data,
+ struct wl_data_offer *wl_data_offer,
+ uint32_t dnd_action)
+ {
++ auto *offer = static_cast<WaylandDataOffer*>(data);
++ offer->SetSelectedDragAction(dnd_action);
+ }
+
+ /* wl_data_offer callback description:
+ *
+ * data_offer_offer - Is called for each MIME type available at wl_data_offer.
+- * data_offer_source_actions - Exposes all available D&D actions.
+- * data_offer_action - Expose one actually selected D&D action.
++ * data_offer_source_actions - This event indicates the actions offered by
++ * the data source.
++ * data_offer_action - This event indicates the action selected by
++ * the compositor after matching the source/destination
++ * side actions.
+ */
+ static const struct wl_data_offer_listener data_offer_listener = {
+ data_offer_offer,
+ data_offer_source_actions,
+ data_offer_action
+ };
+
+ WaylandDataOffer::WaylandDataOffer(wl_data_offer* aWaylandDataOffer)
+@@ -241,92 +335,203 @@ PrimaryDataOffer::PrimaryDataOffer(gtk_p
+
+ PrimaryDataOffer::~PrimaryDataOffer(void)
+ {
+ if(mPrimaryDataOffer) {
+ gtk_primary_selection_offer_destroy(mPrimaryDataOffer);
+ }
+ }
+
++NS_IMPL_ISUPPORTS(nsWaylandDragContext, nsISupports);
++
++nsWaylandDragContext::nsWaylandDragContext(WaylandDataOffer* aDataOffer,
++ wl_display *aDisplay)
++ : mDataOffer(aDataOffer)
++ , mDisplay(aDisplay)
++ , mTime(0)
++ , mGtkWidget(nullptr)
++ , mX(0)
++ , mY(0)
++{
++}
++
+ void
+-nsRetrievalContextWayland::RegisterDataOffer(wl_data_offer *aWaylandDataOffer)
++nsWaylandDragContext::DropDataEnter(GtkWidget* aGtkWidget, uint32_t aTime,
++ nscoord aX, nscoord aY)
++{
++ mTime = aTime;
++ mGtkWidget = aGtkWidget;
++ mX = aX;
++ mY = aY;
++}
++
++void
++nsWaylandDragContext::DropMotion(uint32_t aTime, nscoord aX, nscoord aY)
++{
++ mTime = aTime;
++ mX = aX;
++ mY = aY;
++}
++
++void
++nsWaylandDragContext::GetLastDropInfo(uint32_t *aTime, nscoord *aX, nscoord *aY)
++{
++ *aTime = mTime;
++ *aX = mX;
++ *aY = mY;
++}
++
++void
++nsWaylandDragContext::SetDragStatus(GdkDragAction aAction)
++{
++ mDataOffer->SetDragStatus(aAction, mTime);
++}
++
++GdkDragAction
++nsWaylandDragContext::GetSelectedDragAction()
++{
++ return mDataOffer->GetSelectedDragAction();
++}
++
++GList*
++nsWaylandDragContext::GetTargets()
++{
++ int targetNums;
++ GdkAtom *atoms = mDataOffer->GetTargets(&targetNums);
++
++ GList* targetList = nullptr;
++ for (int i = 0; i < targetNums; i++) {
++ targetList = g_list_append(targetList, GDK_ATOM_TO_POINTER(atoms[i]));
++ }
++
++ return targetList;
++}
++
++char*
++nsWaylandDragContext::GetData(const char* aMimeType, uint32_t* aContentLength)
++{
++ mDataOffer->DragOfferAccept(aMimeType, mTime);
++ return mDataOffer->GetData(mDisplay, aMimeType, aContentLength);
++}
++
++void
++nsRetrievalContextWayland::RegisterNewDataOffer(wl_data_offer *aWaylandDataOffer)
+ {
+ DataOffer* dataOffer =
+ static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
+ aWaylandDataOffer));
++ MOZ_ASSERT(dataOffer == nullptr,
++ "Registered WaylandDataOffer already exists. Wayland protocol error?");
++
+ if (!dataOffer) {
+ dataOffer = new WaylandDataOffer(aWaylandDataOffer);
+ g_hash_table_insert(mActiveOffers, aWaylandDataOffer, dataOffer);
+ }
+ }
+
+ void
+-nsRetrievalContextWayland::RegisterDataOffer(
++nsRetrievalContextWayland::RegisterNewDataOffer(
+ gtk_primary_selection_offer *aPrimaryDataOffer)
+ {
+ DataOffer* dataOffer =
+ static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
+ aPrimaryDataOffer));
++ MOZ_ASSERT(dataOffer == nullptr,
++ "Registered PrimaryDataOffer already exists. Wayland protocol error?");
++
+ if (!dataOffer) {
+ dataOffer = new PrimaryDataOffer(aPrimaryDataOffer);
+ g_hash_table_insert(mActiveOffers, aPrimaryDataOffer, dataOffer);
+ }
+ }
+
+ void
+ nsRetrievalContextWayland::SetClipboardDataOffer(wl_data_offer *aWaylandDataOffer)
+ {
++ // Delete existing clipboard data offer
++ mClipboardOffer = nullptr;
++
+ DataOffer* dataOffer =
+ static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
+ aWaylandDataOffer));
+ NS_ASSERTION(dataOffer, "We're missing clipboard data offer!");
+ if (dataOffer) {
+ g_hash_table_remove(mActiveOffers, aWaylandDataOffer);
+ mClipboardOffer = dataOffer;
+ }
+ }
+
+ void
+ nsRetrievalContextWayland::SetPrimaryDataOffer(
+ gtk_primary_selection_offer *aPrimaryDataOffer)
+ {
+- if (aPrimaryDataOffer == nullptr) {
+- // Release any primary offer we have.
+- mPrimaryOffer = nullptr;
+- } else {
++ // Release any primary offer we have.
++ mPrimaryOffer = nullptr;
++
++ // aPrimaryDataOffer can be null which means we lost
++ // the mouse selection.
++ if (aPrimaryDataOffer) {
+ DataOffer* dataOffer =
+ static_cast<DataOffer*>(g_hash_table_lookup(mActiveOffers,
+ aPrimaryDataOffer));
+ NS_ASSERTION(dataOffer, "We're missing primary data offer!");
+ if (dataOffer) {
+ g_hash_table_remove(mActiveOffers, aPrimaryDataOffer);
+ mPrimaryOffer = dataOffer;
+ }
+ }
+ }
+
+ void
+-nsRetrievalContextWayland::ClearDataOffers(void)
++nsRetrievalContextWayland::AddDragAndDropDataOffer(wl_data_offer *aDropDataOffer)
++{
++ // Remove any existing D&D contexts.
++ mDragContext = nullptr;
++
++ WaylandDataOffer* dataOffer =
++ static_cast<WaylandDataOffer*>(g_hash_table_lookup(mActiveOffers,
++ aDropDataOffer));
++ NS_ASSERTION(dataOffer, "We're missing drag and drop data offer!");
++ if (dataOffer) {
++ g_hash_table_remove(mActiveOffers, aDropDataOffer);
++ mDragContext = new nsWaylandDragContext(dataOffer, mDisplay);
++ }
++}
++
++nsWaylandDragContext*
++nsRetrievalContextWayland::GetDragContext(void)
++{
++ return mDragContext;
++}
++
++void
++nsRetrievalContextWayland::ClearClipboardDataOffers(void)
+ {
+ if (mClipboardOffer)
+ mClipboardOffer = nullptr;
+ if (mPrimaryOffer)
+ mPrimaryOffer = nullptr;
+ }
+
++void
++nsRetrievalContextWayland::ClearDragAndDropDataOffer(void)
++{
++ mDragContext = nullptr;
++}
++
+ // We have a new fresh data content.
+ // We should attach listeners to it and save for further use.
+ static void
+ data_device_data_offer (void *data,
+ struct wl_data_device *data_device,
+ struct wl_data_offer *offer)
+ {
+ nsRetrievalContextWayland *context =
+ static_cast<nsRetrievalContextWayland*>(data);
+- context->RegisterDataOffer(offer);
++ context->RegisterNewDataOffer(offer);
+ }
+
+ // The new fresh data content is clipboard.
+ static void
+ data_device_selection (void *data,
+ struct wl_data_device *wl_data_device,
+ struct wl_data_offer *offer)
+ {
+@@ -336,41 +541,88 @@ data_device_selection (void
+ }
+
+ // The new fresh wayland data content is drag and drop.
+ static void
+ data_device_enter (void *data,
+ struct wl_data_device *data_device,
+ uint32_t time,
+ struct wl_surface *surface,
+- int32_t x,
+- int32_t y,
++ int32_t x_fixed,
++ int32_t y_fixed,
+ struct wl_data_offer *offer)
+ {
++ nsRetrievalContextWayland *context =
++ static_cast<nsRetrievalContextWayland*>(data);
++ context->AddDragAndDropDataOffer(offer);
++
++ nsWaylandDragContext* dragContext = context->GetDragContext();
++
++ GtkWidget* gtkWidget = get_gtk_widget_for_wl_surface(surface);
++ if (!gtkWidget) {
++ NS_WARNING("DragAndDrop: Unable to get GtkWidget for wl_surface!");
++ return;
++ }
++
++ LOGDRAG(("nsWindow data_device_enter for GtkWidget %p\n",
++ (void*)gtkWidget));
++
++ dragContext->DropDataEnter(gtkWidget, time,
++ wl_fixed_to_int(x_fixed),
++ wl_fixed_to_int(y_fixed));
+ }
+
+ static void
+ data_device_leave (void *data,
+ struct wl_data_device *data_device)
+ {
++ nsRetrievalContextWayland *context =
++ static_cast<nsRetrievalContextWayland*>(data);
++
++ nsWaylandDragContext* dropContext = context->GetDragContext();
++ WindowDragLeaveHandler(dropContext->GetWidget());
++
++ context->ClearDragAndDropDataOffer();
+ }
+
+ static void
+ data_device_motion (void *data,
+ struct wl_data_device *data_device,
+ uint32_t time,
+- int32_t x,
+- int32_t y)
++ int32_t x_fixed,
++ int32_t y_fixed)
+ {
++ nsRetrievalContextWayland *context =
++ static_cast<nsRetrievalContextWayland*>(data);
++
++ nsWaylandDragContext* dropContext = context->GetDragContext();
++
++ nscoord x = wl_fixed_to_int(x_fixed);
++ nscoord y = wl_fixed_to_int(y_fixed);
++ dropContext->DropMotion(time, x, y);
++
++ WindowDragMotionHandler(dropContext->GetWidget(), nullptr,
++ dropContext, x, y, time);
+ }
+
+ static void
+ data_device_drop (void *data,
+ struct wl_data_device *data_device)
+ {
++ nsRetrievalContextWayland *context =
++ static_cast<nsRetrievalContextWayland*>(data);
++
++ nsWaylandDragContext* dropContext = context->GetDragContext();
++
++ uint32_t time;
++ nscoord x, y;
++ dropContext->GetLastDropInfo(&time, &x, &y);
++
++ WindowDragDropHandler(dropContext->GetWidget(), nullptr, dropContext,
++ x, y, time);
+ }
+
+ /* wl_data_device callback description:
+ *
+ * data_device_data_offer - It's called when there's a new wl_data_offer
+ * available. We need to attach wl_data_offer_listener
+ * to it to get available MIME types.
+ *
+@@ -400,29 +652,41 @@ static const struct wl_data_device_liste
+ static void
+ primary_selection_data_offer (void *data,
+ struct gtk_primary_selection_device
*gtk_primary_selection_device,
+ struct gtk_primary_selection_offer *gtk_primary_offer)
+ {
+ // create and add listener
+ nsRetrievalContextWayland *context =
+ static_cast<nsRetrievalContextWayland*>(data);
+- context->RegisterDataOffer(gtk_primary_offer);
++ context->RegisterNewDataOffer(gtk_primary_offer);
+ }
+
+ static void
+ primary_selection_selection (void *data,
+ struct gtk_primary_selection_device
*gtk_primary_selection_device,
+ struct gtk_primary_selection_offer *gtk_primary_offer)
+ {
+ nsRetrievalContextWayland *context =
+ static_cast<nsRetrievalContextWayland*>(data);
+ context->SetPrimaryDataOffer(gtk_primary_offer);
+ }
+
++/* gtk_primary_selection_device callback description:
++ *
++ * primary_selection_data_offer - It's called when there's a new
++ * gtk_primary_selection_offer available.
++ * We need to attach gtk_primary_selection_offer_listener
++ * to it to get available MIME types.
++ *
++ * primary_selection_selection - It's called when the new
gtk_primary_selection_offer
++ * is a primary selection content. It can be also called with
++ * gtk_primary_selection_offer = null which means there's
no
++ * primary selection.
++ */
+ static const struct
+ gtk_primary_selection_device_listener primary_selection_device_listener = {
+ primary_selection_data_offer,
+ primary_selection_selection,
+ };
+
+ bool
+ nsRetrievalContextWayland::HasSelectionSupport(void)
+@@ -446,17 +710,17 @@ keyboard_handle_enter(void *data, struct
+ static void
+ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, struct wl_surface *surface)
+ {
+ // We lost focus so our clipboard data are outdated
+ nsRetrievalContextWayland *context =
+ static_cast<nsRetrievalContextWayland*>(data);
+
+- context->ClearDataOffers();
++ context->ClearClipboardDataOffers();
+ }
+
+ static void
+ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, uint32_t time, uint32_t key,
+ uint32_t state)
+ {
+ }
+@@ -568,16 +832,17 @@ nsRetrievalContextWayland::nsRetrievalCo
+ : mInitialized(false)
+ , mSeat(nullptr)
+ , mDataDeviceManager(nullptr)
+ , mPrimarySelectionDataDeviceManager(nullptr)
+ , mKeyboard(nullptr)
+ , mActiveOffers(g_hash_table_new(NULL, NULL))
+ , mClipboardOffer(nullptr)
+ , mPrimaryOffer(nullptr)
++ , mDragContext(nullptr)
+ , mClipboardRequestNumber(0)
+ , mClipboardData(nullptr)
+ , mClipboardDataLength(0)
+ {
+ // Available as of GTK 3.8+
+ static auto sGdkWaylandDisplayGetWlDisplay =
+ (wl_display *(*)(GdkDisplay *))
+ dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
+@@ -611,18 +876,31 @@ nsRetrievalContextWayland::nsRetrievalCo
+ mSeat);
+ gtk_primary_selection_device_add_listener(primaryDataDevice,
+ &primary_selection_device_listener, this);
+ }
+
+ mInitialized = true;
+ }
+
++static gboolean
++offer_hash_remove(gpointer wl_offer, gpointer aDataOffer, gpointer user_data)
++{
++#ifdef DEBUG
++ nsPrintfCString msg("nsRetrievalContextWayland(): leaked nsDataOffer
%p\n",
++ aDataOffer);
++ NS_WARNING(msg.get());
++#endif
++ delete static_cast<DataOffer*>(aDataOffer);
++ return true;
++}
++
+ nsRetrievalContextWayland::~nsRetrievalContextWayland(void)
+ {
++ g_hash_table_foreach_remove(mActiveOffers, offer_hash_remove, nullptr);
+ g_hash_table_destroy(mActiveOffers);
+ }
+
+ GdkAtom*
+ nsRetrievalContextWayland::GetTargets(int32_t aWhichClipboard,
+ int* aTargetNum)
+ {
+ if (GetSelectionAtom(aWhichClipboard) == GDK_SELECTION_CLIPBOARD) {
+diff --git a/widget/gtk/nsClipboardWayland.h b/widget/gtk/nsClipboardWayland.h
+--- a/widget/gtk/nsClipboardWayland.h
++++ b/widget/gtk/nsClipboardWayland.h
+@@ -27,65 +27,108 @@ public:
+
+ char* GetData(wl_display* aDisplay, const char* aMimeType,
+ uint32_t* aContentLength);
+
+ virtual ~DataOffer() {};
+ private:
+ virtual bool RequestDataTransfer(const char* aMimeType, int fd) = 0;
+
++protected:
+ nsTArray<GdkAtom> mTargetMIMETypes;
+ };
+
+ class WaylandDataOffer : public DataOffer
+ {
+ public:
+ WaylandDataOffer(wl_data_offer* aWaylandDataOffer);
+
++ void DragOfferAccept(const char* aMimeType, uint32_t aTime);
++ void SetDragStatus(GdkDragAction aAction, uint32_t aTime);
++
++ GdkDragAction GetSelectedDragAction();
++ void SetSelectedDragAction(uint32_t aWaylandAction);
++
++ void SetSourceDragActions(uint32_t aWaylandActions);
++
++ virtual ~WaylandDataOffer();
+ private:
+- virtual ~WaylandDataOffer();
+ bool RequestDataTransfer(const char* aMimeType, int fd) override;
+
+ wl_data_offer* mWaylandDataOffer;
++ uint32_t mSelectedDragAction;
+ };
+
+ class PrimaryDataOffer : public DataOffer
+ {
+ public:
+ PrimaryDataOffer(gtk_primary_selection_offer* aPrimaryDataOffer);
++ void SetAvailableDragActions(uint32_t aWaylandActions) {};
+
++ virtual ~PrimaryDataOffer();
+ private:
+- virtual ~PrimaryDataOffer();
+ bool RequestDataTransfer(const char* aMimeType, int fd) override;
+
+ gtk_primary_selection_offer* mPrimaryDataOffer;
+ };
+
++class nsWaylandDragContext : public nsISupports
++{
++ NS_DECL_ISUPPORTS
++
++public:
++ nsWaylandDragContext(WaylandDataOffer* aWaylandDataOffer,
++ wl_display *aDisplay);
++
++ void DropDataEnter(GtkWidget* aGtkWidget, uint32_t aTime,
++ nscoord aX, nscoord aY);
++ void DropMotion(uint32_t aTime, nscoord aX, nscoord aY);
++ void GetLastDropInfo(uint32_t *aTime, nscoord *aX, nscoord *aY);
++
++ void SetDragStatus(GdkDragAction action);
++ GdkDragAction GetSelectedDragAction();
++
++ GtkWidget* GetWidget() { return mGtkWidget; }
++ GList* GetTargets();
++ char* GetData(const char* aMimeType, uint32_t* aContentLength);
++private:
++ virtual ~nsWaylandDragContext() {};
++
++ nsAutoPtr<WaylandDataOffer> mDataOffer;
++ wl_display* mDisplay;
++ uint32_t mTime;
++ GtkWidget* mGtkWidget;
++ nscoord mX, mY;
++};
++
+ class nsRetrievalContextWayland : public nsRetrievalContext
+ {
+ public:
+ nsRetrievalContextWayland();
+
+ virtual const char* GetClipboardData(const char* aMimeType,
+ int32_t aWhichClipboard,
+ uint32_t* aContentLength) override;
+ virtual const char* GetClipboardText(int32_t aWhichClipboard) override;
+ virtual void ReleaseClipboardData(const char* aClipboardData) override;
+
+ virtual GdkAtom* GetTargets(int32_t aWhichClipboard,
+ int* aTargetNum) override;
+ virtual bool HasSelectionSupport(void) override;
+
+- void RegisterDataOffer(wl_data_offer *aWaylandDataOffer);
+- void RegisterDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
++ void RegisterNewDataOffer(wl_data_offer *aWaylandDataOffer);
++ void RegisterNewDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
+
+ void SetClipboardDataOffer(wl_data_offer *aWaylandDataOffer);
+ void SetPrimaryDataOffer(gtk_primary_selection_offer *aPrimaryDataOffer);
++ void AddDragAndDropDataOffer(wl_data_offer *aWaylandDataOffer);
++ nsWaylandDragContext* GetDragContext();
+
+- void ClearDataOffers();
++ void ClearClipboardDataOffers();
++ void ClearDragAndDropDataOffer();
+
+ void ConfigureKeyboard(wl_seat_capability caps);
+ void TransferFastTrackClipboard(int aClipboardRequestNumber,
+ GtkSelectionData *aSelectionData);
+
+ void InitDataDeviceManager(wl_registry *registry, uint32_t id, uint32_t version);
+ void InitPrimarySelectionDataDeviceManager(wl_registry *registry, uint32_t id);
+ void InitSeat(wl_registry *registry, uint32_t id, uint32_t version, void *data);
+@@ -98,16 +141,17 @@ private:
+ wl_data_device_manager *mDataDeviceManager;
+ gtk_primary_selection_device_manager *mPrimarySelectionDataDeviceManager;
+ wl_keyboard *mKeyboard;
+
+ // Data offers provided by Wayland data device
+ GHashTable* mActiveOffers;
+ nsAutoPtr<DataOffer> mClipboardOffer;
+ nsAutoPtr<DataOffer> mPrimaryOffer;
++ RefPtr<nsWaylandDragContext> mDragContext;
+
+ int mClipboardRequestNumber;
+ char* mClipboardData;
+ uint32_t mClipboardDataLength;
+
+ // Mime types used for text data at Gtk+, see request_text_received_func()
+ // at gtkclipboard.c.
+ #define TEXT_MIME_TYPES_NUM 3
+diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp
+--- a/widget/gtk/nsDragService.cpp
++++ b/widget/gtk/nsDragService.cpp
+@@ -37,16 +37,19 @@
+ #include "nsViewManager.h"
+ #include "nsIFrame.h"
+ #include "nsGtkUtils.h"
+ #include "nsGtkKeyUtils.h"
+ #include "mozilla/gfx/2D.h"
+ #include "gfxPlatform.h"
+ #include "ScreenHelperGTK.h"
+ #include "nsArrayUtils.h"
++#ifdef MOZ_WAYLAND
++#include "nsClipboardWayland.h"
++#endif
+
+ using namespace mozilla;
+ using namespace mozilla::gfx;
+
+ // This sets how opaque the drag image is
+ #define DRAG_IMAGE_ALPHA_LEVEL 0.5
+
+ // These values are copied from GtkDragResult (rather than using GtkDragResult
+@@ -93,16 +96,20 @@ invisibleSourceDragDataGet(GtkWidget
+ GtkSelectionData *aSelectionData,
+ guint aInfo,
+ guint32 aTime,
+ gpointer aData);
+
+ nsDragService::nsDragService()
+ : mScheduledTask(eDragTaskNone)
+ , mTaskSource(0)
++#ifdef MOZ_WAYLAND
++ , mPendingWaylandDragContext(nullptr)
++ , mTargetWaylandDragContext(nullptr)
++#endif
+ {
+ // We have to destroy the hidden widget before the event loop stops
+ // running.
+ nsCOMPtr<nsIObserverService> obsServ =
+ mozilla::services::GetObserverService();
+ obsServ->AddObserver(this, "quit-application", false);
+
+ // our hidden source widget
+@@ -509,16 +516,19 @@ nsDragService::EndDragSession(bool aDone
+ }
+ }
+
+ // unset our drag action
+ SetDragAction(DRAGDROP_ACTION_NONE);
+
+ // We're done with the drag context.
+ mTargetDragContextForRemote = nullptr;
++#ifdef MOZ_WAYLAND
++ mTargetWaylandDragContextForRemote = nullptr;
++#endif
+
+ return nsBaseDragService::EndDragSession(aDoneDrag, aKeyModifiers);
+ }
+
+ // nsIDragSession
+ NS_IMETHODIMP
+ nsDragService::SetCanDrop(bool aCanDrop)
+ {
+@@ -629,16 +639,24 @@ nsDragService::GetNumDropItems(uint32_t
+ if (!mTargetWidget) {
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("*** warning: GetNumDropItems \
+ called without a valid target widget!\n"));
+ *aNumItems = 0;
+ return NS_OK;
+ }
+
++#ifdef MOZ_WAYLAND
++ // TODO: Wayland implementation of text/uri-list.
++ if (!mTargetDragContext) {
++ *aNumItems = 1;
++ return NS_OK;
++ }
++#endif
++
+ bool isList = IsTargetContextList();
+ if (isList)
+ mSourceDataItems->GetLength(aNumItems);
+ else {
+ GdkAtom gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE);
+ GetTargetDragData(gdkFlavor);
+ if (mTargetDragData) {
+ const char *data = reinterpret_cast<char*>(mTargetDragData);
+@@ -1020,19 +1038,28 @@ nsDragService::IsDataFlavorSupported(con
+ }
+ }
+ }
+ }
+ return NS_OK;
+ }
+
+ // check the target context vs. this flavor, one at a time
+- GList *tmp;
+- for (tmp = gdk_drag_context_list_targets(mTargetDragContext);
+- tmp; tmp = tmp->next) {
++ GList *tmp = nullptr;
++ if (mTargetDragContext) {
++ tmp = gdk_drag_context_list_targets(mTargetDragContext);
++ }
++#ifdef MOZ_WAYLAND
++ else {
++ tmp = mTargetWaylandDragContext->GetTargets();
++ }
++#endif
++ GList *tmp_head = tmp;
++
++ for (; tmp; tmp = tmp->next) {
+ /* Bug 331198 */
+ GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
+ gchar *name = nullptr;
+ name = gdk_atom_name(atom);
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("checking %s against %s\n", name, aDataFlavor));
+ if (name && (strcmp(name, aDataFlavor) == 0)) {
+ MOZ_LOG(sDragLm, LogLevel::Debug, ("good!\n"));
+@@ -1067,16 +1094,23 @@ nsDragService::IsDataFlavorSupported(con
+ (strcmp(aDataFlavor, kFileMime) == 0))) {
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("good! ( it's text plain and we're checking \
+ against text/unicode or application/x-moz-file)\n"));
+ *_retval = true;
+ }
+ g_free(name);
+ }
++
++ // mTargetWaylandDragContext->GetTargets allocates the list
++ // so we need to free it here.
++ if (!mTargetDragContext) {
++ g_list_free(tmp_head);
++ }
++
+ return NS_OK;
+ }
+
+ void
+ nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext)
+ {
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("nsDragService::ReplyToDragMotion %d", mCanDrop));
+@@ -1098,16 +1132,46 @@ nsDragService::ReplyToDragMotion(GdkDrag
+ action = GDK_ACTION_MOVE;
+ break;
+ }
+ }
+
+ gdk_drag_status(aDragContext, action, mTargetTime);
+ }
+
++#ifdef MOZ_WAYLAND
++void
++nsDragService::ReplyToDragMotion(nsWaylandDragContext* aDragContext)
++{
++ MOZ_LOG(sDragLm, LogLevel::Debug,
++ ("nsDragService::ReplyToDragMotion %d", mCanDrop));
++
++ GdkDragAction action = (GdkDragAction)0;
++ if (mCanDrop) {
++ // notify the dragger if we can drop
++ switch (mDragAction) {
++ case DRAGDROP_ACTION_COPY:
++ action = GDK_ACTION_COPY;
++ break;
++ case DRAGDROP_ACTION_LINK:
++ action = GDK_ACTION_LINK;
++ break;
++ case DRAGDROP_ACTION_NONE:
++ action = (GdkDragAction)0;
++ break;
++ default:
++ action = GDK_ACTION_MOVE;
++ break;
++ }
++ }
++
++ aDragContext->SetDragStatus(action);
++}
++#endif
++
+ void
+ nsDragService::TargetDataReceived(GtkWidget *aWidget,
+ GdkDragContext *aContext,
+ gint aX,
+ gint aY,
+ GtkSelectionData *aSelectionData,
+ guint aInfo,
+ guint32 aTime)
+@@ -1129,16 +1193,22 @@ nsDragService::TargetDataReceived(GtkWid
+ }
+ }
+
+ bool
+ nsDragService::IsTargetContextList(void)
+ {
+ bool retval = false;
+
++#ifdef MOZ_WAYLAND
++ // TODO: We need a wayland implementation here.
++ if (!mTargetDragContext)
++ return retval;
++#endif
++
+ // gMimeListType drags only work for drags within a single process. The
+ // gtk_drag_get_source_widget() function will return nullptr if the source
+ // of the drag is another app, so we use it to check if a gMimeListType
+ // drop will work or not.
+ if (gtk_drag_get_source_widget(mTargetDragContext) == nullptr)
+ return retval;
+
+ GList *tmp;
+@@ -1167,27 +1237,38 @@ void
+ nsDragService::GetTargetDragData(GdkAtom aFlavor)
+ {
+ MOZ_LOG(sDragLm, LogLevel::Debug, ("getting data flavor %p\n", aFlavor));
+ MOZ_LOG(sDragLm, LogLevel::Debug, ("mLastWidget is %p and mLastContext is
%p\n",
+ mTargetWidget.get(),
+ mTargetDragContext.get()));
+ // reset our target data areas
+ TargetResetData();
+- gtk_drag_get_data(mTargetWidget, mTargetDragContext, aFlavor, mTargetTime);
++
++ if (mTargetDragContext) {
++ gtk_drag_get_data(mTargetWidget, mTargetDragContext, aFlavor, mTargetTime);
+
+- MOZ_LOG(sDragLm, LogLevel::Debug, ("about to start inner iteration."));
+- PRTime entryTime = PR_Now();
+- while (!mTargetDragDataReceived && mDoingDrag) {
+- // check the number of iterations
+- MOZ_LOG(sDragLm, LogLevel::Debug, ("doing iteration...\n"));
+- PR_Sleep(20*PR_TicksPerSecond()/1000); /* sleep for 20 ms/iteration */
+- if (PR_Now()-entryTime > NS_DND_TIMEOUT) break;
+- gtk_main_iteration();
++ MOZ_LOG(sDragLm, LogLevel::Debug, ("about to start inner
iteration."));
++ PRTime entryTime = PR_Now();
++ while (!mTargetDragDataReceived && mDoingDrag) {
++ // check the number of iterations
++ MOZ_LOG(sDragLm, LogLevel::Debug, ("doing iteration...\n"));
++ PR_Sleep(20*PR_TicksPerSecond()/1000); /* sleep for 20 ms/iteration */
++ if (PR_Now()-entryTime > NS_DND_TIMEOUT) break;
++ gtk_main_iteration();
++ }
+ }
++#ifdef MOZ_WAYLAND
++ else {
++ mTargetDragData =
++ mTargetWaylandDragContext->GetData(gdk_atom_name(aFlavor),
++ &mTargetDragDataLen);
++ mTargetDragDataReceived = true;
++ }
++#endif
+ MOZ_LOG(sDragLm, LogLevel::Debug, ("finished inner iteration\n"));
+ }
+
+ void
+ nsDragService::TargetResetData(void)
+ {
+ mTargetDragDataReceived = false;
+ // make sure to free old data if we have to
+@@ -1428,17 +1509,17 @@ nsDragService::SourceEndDragSession(GdkD
+ }
+ }
+
+ if (mDataTransfer) {
+ mDataTransfer->SetDropEffectInt(dropEffect);
+ }
+
+ // Schedule the appropriate drag end dom events.
+- Schedule(eDragTaskSourceEnd, nullptr, nullptr, LayoutDeviceIntPoint(), 0);
++ Schedule(eDragTaskSourceEnd, nullptr, nullptr, nullptr, LayoutDeviceIntPoint(), 0);
+ }
+
+ static void
+ CreateUriList(nsIArray *items, gchar **text, gint *length)
+ {
+ uint32_t i, count;
+ GString *uriList = g_string_new(nullptr);
+
+@@ -1778,64 +1859,68 @@ invisibleSourceDragEnd(GtkWidget
+ //
+ // No Gecko drag events are dispatched (during nested event loops) while other
+ // Gecko drag events are in flight. This helps event handlers that may not
+ // expect nested events, while accessing an event's dataTransfer for example.
+
+ gboolean
+ nsDragService::ScheduleMotionEvent(nsWindow *aWindow,
+ GdkDragContext *aDragContext,
++ nsWaylandDragContext *aWaylandDragContext,
+ LayoutDeviceIntPoint aWindowPoint, guint aTime)
+ {
+- if (mScheduledTask == eDragTaskMotion) {
++ if (aDragContext && mScheduledTask == eDragTaskMotion) {
+ // The drag source has sent another motion message before we've
+ // replied to the previous. That shouldn't happen with Xdnd. The
+ // spec for Motif drags is less clear, but we'll just update the
+ // scheduled task with the new position reply only to the most
+ // recent message.
+ NS_WARNING("Drag Motion message received before previous reply was
sent");
+ }
+
+ // Returning TRUE means we'll reply with a status message, unless we first
+ // get a leave.
+- return Schedule(eDragTaskMotion, aWindow, aDragContext,
++ return Schedule(eDragTaskMotion, aWindow, aDragContext, aWaylandDragContext,
+ aWindowPoint, aTime);
+ }
+
+ void
+ nsDragService::ScheduleLeaveEvent()
+ {
+ // We don't know at this stage whether a drop signal will immediately
+ // follow. If the drop signal gets sent it will happen before we return
+ // to the main loop and the scheduled leave task will be replaced.
+- if (!Schedule(eDragTaskLeave, nullptr, nullptr, LayoutDeviceIntPoint(), 0)) {
++ if (!Schedule(eDragTaskLeave, nullptr, nullptr, nullptr,
++ LayoutDeviceIntPoint(), 0)) {
+ NS_WARNING("Drag leave after drop");
+ }
+ }
+
+ gboolean
+ nsDragService::ScheduleDropEvent(nsWindow *aWindow,
+ GdkDragContext *aDragContext,
++ nsWaylandDragContext *aWaylandDragContext,
+ LayoutDeviceIntPoint aWindowPoint, guint aTime)
+ {
+ if (!Schedule(eDragTaskDrop, aWindow,
+- aDragContext, aWindowPoint, aTime)) {
++ aDragContext, aWaylandDragContext, aWindowPoint, aTime)) {
+ NS_WARNING("Additional drag drop ignored");
+ return FALSE;
+ }
+
+ SetDragEndPoint(aWindowPoint + aWindow->WidgetToScreenOffset());
+
+ // We'll reply with gtk_drag_finish().
+ return TRUE;
+ }
+
+ gboolean
+ nsDragService::Schedule(DragTask aTask, nsWindow *aWindow,
+ GdkDragContext *aDragContext,
++ nsWaylandDragContext *aWaylandDragContext,
+ LayoutDeviceIntPoint aWindowPoint, guint aTime)
+ {
+ // If there is an existing leave or motion task scheduled, then that
+ // will be replaced. When the new task is run, it will dispatch
+ // any necessary leave or motion events.
+
+ // If aTask is eDragTaskSourceEnd, then it will replace even a scheduled
+ // drop event (which could happen if the drop event has not been processed
+@@ -1844,16 +1929,19 @@ nsDragService::Schedule(DragTask aTask,
+ // drop.
+ if (mScheduledTask == eDragTaskSourceEnd ||
+ (mScheduledTask == eDragTaskDrop && aTask != eDragTaskSourceEnd))
+ return FALSE;
+
+ mScheduledTask = aTask;
+ mPendingWindow = aWindow;
+ mPendingDragContext = aDragContext;
++#ifdef MOZ_WAYLAND
++ mPendingWaylandDragContext = aWaylandDragContext;
++#endif
+ mPendingWindowPoint = aWindowPoint;
+ mPendingTime = aTime;
+
+ if (!mTaskSource) {
+ // High priority is used here because the native events involved have
+ // already waited at default priority. Perhaps a lower than default
+ // priority could be used for motion tasks because there is a chance
+ // that a leave or drop is waiting, but managing different priorities
+@@ -1919,17 +2007,24 @@ nsDragService::RunScheduledTask()
+ // This may be the start of a destination drag session.
+ StartDragSession();
+
+ // mTargetWidget may be nullptr if the window has been destroyed.
+ // (The leave event is not scheduled if a drop task is still scheduled.)
+ // We still reply appropriately to indicate that the drop will or didn't
+ // succeeed.
+ mTargetWidget = mTargetWindow->GetMozContainerWidget();
+- mTargetDragContext.steal(mPendingDragContext);
++ if (mTargetDragContext) {
++ mTargetDragContext.steal(mPendingDragContext);
++ }
++#ifdef MOZ_WAYLAND
++ else {
++ mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
++ }
++#endif
+ mTargetTime = mPendingTime;
+
+ //
http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag...
+ // (as at 27 December 2010) indicates that a "drop" event should only be
+ // fired (at the current target element) if the current drag operation is
+ // not none. The current drag operation will only be set to a non-none
+ // value during a "dragover" event.
+ //
+@@ -1951,44 +2046,59 @@ nsDragService::RunScheduledTask()
+ // protocol is used.
+ if (task == eDragTaskMotion || positionHasChanged) {
+ UpdateDragAction();
+ TakeDragEventDispatchedToChildProcess(); // Clear the old value.
+ DispatchMotionEvents();
+ if (task == eDragTaskMotion) {
+ if (TakeDragEventDispatchedToChildProcess()) {
+ mTargetDragContextForRemote = mTargetDragContext;
++#ifdef MOZ_WAYLAND
++ mTargetWaylandDragContextForRemote = mTargetWaylandDragContext;
++#endif
+ } else {
+ // Reply to tell the source whether we can drop and what
+ // action would be taken.
+- ReplyToDragMotion(mTargetDragContext);
++ if (mTargetDragContext) {
++ ReplyToDragMotion(mTargetDragContext);
++ }
++#ifdef MOZ_WAYLAND
++ else {
++ ReplyToDragMotion(mTargetWaylandDragContext);
++ }
++#endif
+ }
+ }
+ }
+
+ if (task == eDragTaskDrop) {
+ gboolean success = DispatchDropEvent();
+
+ // Perhaps we should set the del parameter to TRUE when the drag
+ // action is move, but we don't know whether the data was successfully
+ // transferred.
+- gtk_drag_finish(mTargetDragContext, success,
+- /* del = */ FALSE, mTargetTime);
++ if (mTargetDragContext) {
++ gtk_drag_finish(mTargetDragContext, success,
++ /* del = */ FALSE, mTargetTime);
++ }
+
+ // This drag is over, so clear out our reference to the previous
+ // window.
+ mTargetWindow = nullptr;
+ // Make sure to end the drag session. If this drag started in a
+ // different app, we won't get a drag_end signal to end it from.
+ EndDragSession(true, GetCurrentModifiers());
+ }
+
+ // We're done with the drag context.
+ mTargetWidget = nullptr;
+ mTargetDragContext = nullptr;
++#ifdef MOZ_WAYLAND
++ mTargetWaylandDragContext = nullptr;
++#endif
+
+ // If we got another drag signal while running the sheduled task, that
+ // must have happened while running a nested event loop. Leave the task
+ // source on the event loop.
+ if (mScheduledTask != eDragTaskNone)
+ return TRUE;
+
+ // We have no task scheduled.
+@@ -2008,17 +2118,26 @@ nsDragService::UpdateDragAction()
+ // nsContentUtils::SetDataTransferInEvent() to set the initial
+ // dataTransfer.dropEffect, so GdkDragContext::suggested_action would be
+ // more appropriate. GdkDragContext::actions should be used to set
+ // dataTransfer.effectAllowed, which doesn't currently happen with
+ // external sources.
+
+ // default is to do nothing
+ int action = nsIDragService::DRAGDROP_ACTION_NONE;
+- GdkDragAction gdkAction = gdk_drag_context_get_actions(mTargetDragContext);
++ GdkDragAction gdkAction = GDK_ACTION_DEFAULT;
++ if (mTargetDragContext) {
++ gdkAction = gdk_drag_context_get_actions(mTargetDragContext);
++ }
++#ifdef MOZ_WAYLAND
++ else {
++ // We got the selected D&D action from compositor on Wayland.
++ gdkAction = mTargetWaylandDragContext->GetSelectedDragAction();
++ }
++#endif
+
+ // set the default just in case nothing matches below
+ if (gdkAction & GDK_ACTION_DEFAULT)
+ action = nsIDragService::DRAGDROP_ACTION_MOVE;
+
+ // first check to see if move is set
+ if (gdkAction & GDK_ACTION_MOVE)
+ action = nsIDragService::DRAGDROP_ACTION_MOVE;
+@@ -2037,16 +2156,22 @@ nsDragService::UpdateDragAction()
+
+ NS_IMETHODIMP
+ nsDragService::UpdateDragEffect()
+ {
+ if (mTargetDragContextForRemote) {
+ ReplyToDragMotion(mTargetDragContextForRemote);
+ mTargetDragContextForRemote = nullptr;
+ }
++#ifdef MOZ_WAYLAND
++ else if (mTargetWaylandDragContextForRemote) {
++ ReplyToDragMotion(mTargetWaylandDragContextForRemote);
++ mTargetWaylandDragContextForRemote = nullptr;
++ }
++#endif
+ return NS_OK;
+ }
+
+ void
+ nsDragService::DispatchMotionEvents()
+ {
+ mCanDrop = false;
+
+diff --git a/widget/gtk/nsDragService.h b/widget/gtk/nsDragService.h
+--- a/widget/gtk/nsDragService.h
++++ b/widget/gtk/nsDragService.h
+@@ -9,16 +9,17 @@
+
+ #include "mozilla/RefPtr.h"
+ #include "nsBaseDragService.h"
+ #include "nsIObserver.h"
+ #include "nsAutoRef.h"
+ #include <gtk/gtk.h>
+
+ class nsWindow;
++class nsWaylandDragContext;
+
+ namespace mozilla {
+ namespace gfx {
+ class SourceSurface;
+ }
+ }
+
+ #ifndef HAVE_NSGOBJECTREFTRAITS
+@@ -93,21 +94,23 @@ public:
+ gint aX,
+ gint aY,
+ GtkSelectionData *aSelection_data,
+ guint aInfo,
+ guint32 aTime);
+
+ gboolean ScheduleMotionEvent(nsWindow *aWindow,
+ GdkDragContext *aDragContext,
++ nsWaylandDragContext* aPendingWaylandDragContext,
+ mozilla::LayoutDeviceIntPoint aWindowPoint,
+ guint aTime);
+ void ScheduleLeaveEvent();
+ gboolean ScheduleDropEvent(nsWindow *aWindow,
+ GdkDragContext *aDragContext,
++ nsWaylandDragContext* aPendingWaylandDragContext,
+ mozilla::LayoutDeviceIntPoint aWindowPoint,
+ guint aTime);
+
+ nsWindow* GetMostRecentDestWindow()
+ {
+ return mScheduledTask == eDragTaskNone ? mTargetWindow
+ : mPendingWindow;
+ }
+@@ -153,30 +156,39 @@ private:
+
+ // mPendingWindow, mPendingWindowPoint, mPendingDragContext, and
+ // mPendingTime, carry information from the GTK signal that will be used
+ // when the scheduled task is run. mPendingWindow and mPendingDragContext
+ // will be nullptr if the scheduled task is eDragTaskLeave.
+ RefPtr<nsWindow> mPendingWindow;
+ mozilla::LayoutDeviceIntPoint mPendingWindowPoint;
+ nsCountedRef<GdkDragContext> mPendingDragContext;
++#ifdef MOZ_WAYLAND
++ RefPtr<nsWaylandDragContext> mPendingWaylandDragContext;
++#endif
+ guint mPendingTime;
+
+ // mTargetWindow and mTargetWindowPoint record the position of the last
+ // eDragTaskMotion or eDragTaskDrop task that was run or is still running.
+ // mTargetWindow is cleared once the drag has completed or left.
+ RefPtr<nsWindow> mTargetWindow;
+ mozilla::LayoutDeviceIntPoint mTargetWindowPoint;
+ // mTargetWidget and mTargetDragContext are set only while dispatching
+ // motion or drop events. mTime records the corresponding timestamp.
+ nsCountedRef<GtkWidget> mTargetWidget;
+ nsCountedRef<GdkDragContext> mTargetDragContext;
++#ifdef MOZ_WAYLAND
++ RefPtr<nsWaylandDragContext> mTargetWaylandDragContext;
++#endif
+ // mTargetDragContextForRemote is set while waiting for a reply from
+ // a child process.
+ nsCountedRef<GdkDragContext> mTargetDragContextForRemote;
++#ifdef MOZ_WAYLAND
++ RefPtr<nsWaylandDragContext> mTargetWaylandDragContextForRemote;
++#endif
+ guint mTargetTime;
+
+ // is it OK to drop on us?
+ bool mCanDrop;
+
+ // have we received our drag data?
+ bool mTargetDragDataReceived;
+ // last data received and its length
+@@ -207,22 +219,25 @@ private:
+ bool SetAlphaPixmap(SourceSurface *aPixbuf,
+ GdkDragContext *aContext,
+ int32_t aXOffset,
+ int32_t aYOffset,
+ const mozilla::LayoutDeviceIntRect &dragRect);
+
+ gboolean Schedule(DragTask aTask, nsWindow *aWindow,
+ GdkDragContext *aDragContext,
++ nsWaylandDragContext* aPendingWaylandDragContext,
+ mozilla::LayoutDeviceIntPoint aWindowPoint, guint aTime);
+
+ // Callback for g_idle_add_full() to run mScheduledTask.
+ static gboolean TaskDispatchCallback(gpointer data);
+ gboolean RunScheduledTask();
+ void UpdateDragAction();
+ void DispatchMotionEvents();
+ void ReplyToDragMotion(GdkDragContext* aDragContext);
++#ifdef MOZ_WAYLAND
++ void ReplyToDragMotion(nsWaylandDragContext* aDragContext);
++#endif
+ gboolean DispatchDropEvent();
+ static uint32_t GetCurrentModifiers();
+ };
+
+ #endif // nsDragService_h__
+-
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -6081,23 +6081,23 @@ touch_event_cb(GtkWidget* aWidget, GdkEv
+ void
+ nsWindow::InitDragEvent(WidgetDragEvent &aEvent)
+ {
+ // set the keyboard modifiers
+ guint modifierState = KeymapWrapper::GetCurrentModifierState();
+ KeymapWrapper::InitInputEvent(aEvent, modifierState);
+ }
+
+-static gboolean
+-drag_motion_event_cb(GtkWidget *aWidget,
+- GdkDragContext *aDragContext,
+- gint aX,
+- gint aY,
+- guint aTime,
+- gpointer aData)
++gboolean
++WindowDragMotionHandler(GtkWidget *aWidget,
++ GdkDragContext *aDragContext,
++ nsWaylandDragContext *aWaylandDragContext,
++ gint aX,
++ gint aY,
++ guint aTime)
+ {
+ RefPtr<nsWindow> window = get_window_for_gtk_widget(aWidget);
+ if (!window)
+ return FALSE;
+
+ // figure out which internal widget this drag motion actually happened on
+ nscoord retx = 0;
+ nscoord rety = 0;
+@@ -6112,25 +6112,34 @@ drag_motion_event_cb(GtkWidget *aWidget,
+ }
+
+ LOGDRAG(("nsWindow drag-motion signal for %p\n",
(void*)innerMostWindow));
+
+ LayoutDeviceIntPoint point = window->GdkPointToDevicePixels({ retx, rety });
+
+ RefPtr<nsDragService> dragService = nsDragService::GetInstance();
+ return dragService->
+- ScheduleMotionEvent(innerMostWindow, aDragContext,
++ ScheduleMotionEvent(innerMostWindow, aDragContext, aWaylandDragContext,
+ point, aTime);
+ }
+
+-static void
+-drag_leave_event_cb(GtkWidget *aWidget,
+- GdkDragContext *aDragContext,
+- guint aTime,
+- gpointer aData)
++static gboolean
++drag_motion_event_cb(GtkWidget *aWidget,
++ GdkDragContext *aDragContext,
++ gint aX,
++ gint aY,
++ guint aTime,
++ gpointer aData)
++{
++ return WindowDragMotionHandler(aWidget, aDragContext, nullptr,
++ aX, aY, aTime);
++}
++
++void
++WindowDragLeaveHandler(GtkWidget *aWidget)
+ {
+ RefPtr<nsWindow> window = get_window_for_gtk_widget(aWidget);
+ if (!window)
+ return;
+
+ RefPtr<nsDragService> dragService = nsDragService::GetInstance();
+
+ nsWindow *mostRecentDragWindow = dragService->GetMostRecentDestWindow();
+@@ -6153,24 +6162,32 @@ drag_leave_event_cb(GtkWidget *aWidget,
+ }
+
+ LOGDRAG(("nsWindow drag-leave signal for %p\n",
+ (void*)mostRecentDragWindow));
+
+ dragService->ScheduleLeaveEvent();
+ }
+
+-
+-static gboolean
+-drag_drop_event_cb(GtkWidget *aWidget,
+- GdkDragContext *aDragContext,
+- gint aX,
+- gint aY,
+- guint aTime,
+- gpointer aData)
++static void
++drag_leave_event_cb(GtkWidget *aWidget,
++ GdkDragContext *aDragContext,
++ guint aTime,
++ gpointer aData)
++{
++ WindowDragLeaveHandler(aWidget);
++}
++
++gboolean
++WindowDragDropHandler(GtkWidget *aWidget,
++ GdkDragContext *aDragContext,
++ nsWaylandDragContext *aWaylandDragContext,
++ gint aX,
++ gint aY,
++ guint aTime)
+ {
+ RefPtr<nsWindow> window = get_window_for_gtk_widget(aWidget);
+ if (!window)
+ return FALSE;
+
+ // figure out which internal widget this drag motion actually happened on
+ nscoord retx = 0;
+ nscoord rety = 0;
+@@ -6185,20 +6202,31 @@ drag_drop_event_cb(GtkWidget *aWidget,
+ }
+
+ LOGDRAG(("nsWindow drag-drop signal for %p\n", (void*)innerMostWindow));
+
+ LayoutDeviceIntPoint point = window->GdkPointToDevicePixels({ retx, rety });
+
+ RefPtr<nsDragService> dragService = nsDragService::GetInstance();
+ return dragService->
+- ScheduleDropEvent(innerMostWindow, aDragContext,
++ ScheduleDropEvent(innerMostWindow, aDragContext, aWaylandDragContext,
+ point, aTime);
+ }
+
++static gboolean
++drag_drop_event_cb(GtkWidget *aWidget,
++ GdkDragContext *aDragContext,
++ gint aX,
++ gint aY,
++ guint aTime,
++ gpointer aData)
++{
++ return WindowDragDropHandler(aWidget, aDragContext, nullptr, aX, aY, aTime);
++}
++
+ static void
+ drag_data_received_event_cb(GtkWidget *aWidget,
+ GdkDragContext *aDragContext,
+ gint aX,
+ gint aY,
+ GtkSelectionData *aSelectionData,
+ guint aInfo,
+ guint aTime,
+diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
+--- a/widget/gtk/nsWindow.h
++++ b/widget/gtk/nsWindow.h
+@@ -61,16 +61,31 @@ extern mozilla::LazyLogModule gWidgetDra
+
+ #define LOG(args)
+ #define LOGFOCUS(args)
+ #define LOGDRAG(args)
+ #define LOGDRAW(args)
+
+ #endif /* MOZ_LOGGING */
+
++#ifdef MOZ_WAYLAND
++class nsWaylandDragContext;
++
++gboolean
++WindowDragMotionHandler(GtkWidget *aWidget, GdkDragContext *aDragContext,
++ nsWaylandDragContext *aWaylandDragContext,
++ gint aX, gint aY, guint aTime);
++gboolean
++WindowDragDropHandler(GtkWidget *aWidget, GdkDragContext *aDragContext,
++ nsWaylandDragContext *aWaylandDragContext, gint aX, gint aY,
++ guint aTime);
++void
++WindowDragLeaveHandler(GtkWidget *aWidget);
++#endif
++
+ class gfxPattern;
+
+ namespace mozilla {
+ class TimeStamp;
+ class CurrentX11TimeGetter;
+ }
+
+ class nsWindow final : public nsBaseWidget
+
diff --git a/mozilla-1438136.patch b/mozilla-1438136.patch
new file mode 100644
index 0000000..6462a41
--- /dev/null
+++ b/mozilla-1438136.patch
@@ -0,0 +1,34 @@
+
+# HG changeset patch
+# User Evan Klitzke <evan(a)eklitzke.org>
+# Date 1526337180 -10800
+# Node ID 5c1d015760f220f5438ffa23a585140db7a9801d
+# Parent 505667081ae29ee0a66ef5ba19c3870570b08564
+Bug 1438136 - [Wayland/Clipboard] Null terminate text string returned by
GetClipboardText(), r=stransky
+
+diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
+--- a/widget/gtk/nsClipboardWayland.cpp
++++ b/widget/gtk/nsClipboardWayland.cpp
+@@ -666,19 +666,20 @@ void
+ nsRetrievalContextWayland::TransferFastTrackClipboard(
+ int aClipboardRequestNumber, GtkSelectionData *aSelectionData)
+ {
+ if (mClipboardRequestNumber == aClipboardRequestNumber) {
+ int dataLength = gtk_selection_data_get_length(aSelectionData);
+ if (dataLength > 0) {
+ mClipboardDataLength = dataLength;
+ mClipboardData = reinterpret_cast<char*>(
+- g_malloc(sizeof(char)*mClipboardDataLength));
++ g_malloc(sizeof(char)*(mClipboardDataLength+1)));
+ memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),
+ sizeof(char)*mClipboardDataLength);
++ mClipboardData[mClipboardDataLength] = '\0';
+ }
+ } else {
+ NS_WARNING("Received obsoleted clipboard data!");
+ }
+ }
+
+ const char*
+ nsRetrievalContextWayland::GetClipboardData(const char* aMimeType,
+
diff --git a/mozilla-1460603.patch b/mozilla-1460603.patch
new file mode 100644
index 0000000..3e705b5
--- /dev/null
+++ b/mozilla-1460603.patch
@@ -0,0 +1,46 @@
+diff -up firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp.mozilla-1460603
firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp
+--- firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp.mozilla-1460603 2018-05-16 07:38:30.000000000
+0200
++++ firefox-60.0.1/gfx/gl/GLLibraryEGL.cpp 2018-05-25 10:58:45.170047851 +0200
+@@ -31,6 +31,13 @@
+ #include "GLContextProvider.h"
+ #include "gfxPrefs.h"
+ #include "ScopedGLHelpers.h"
++#ifdef MOZ_WIDGET_GTK
++#include <gdk/gdk.h>
++#ifdef MOZ_WAYLAND
++#include <gdk/gdkwayland.h>
++#include <dlfcn.h>
++#endif // MOZ_WIDGET_GTK
++#endif // MOZ_WAYLAND
+
+ namespace mozilla {
+ namespace gl {
+@@ -566,7 +573,22 @@ GLLibraryEGL::EnsureInitialized(bool for
+ mIsWARP = true;
+ }
+ } else {
+- chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);
++ void *nativeDisplay = EGL_DEFAULT_DISPLAY;
++#ifdef MOZ_WAYLAND
++ // Some drivers doesn't support EGL_DEFAULT_DISPLAY
++ GdkDisplay *gdkDisplay = gdk_display_get_default();
++ if (GDK_IS_WAYLAND_DISPLAY(gdkDisplay)) {
++ static auto sGdkWaylandDisplayGetWlDisplay =
++ (wl_display *(*)(GdkDisplay *))
++ dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
++ nativeDisplay = sGdkWaylandDisplayGetWlDisplay(gdkDisplay);
++ if (!nativeDisplay) {
++ NS_WARNING("Failed to get wl_display.");
++ return false;
++ }
++ }
++#endif
++ chosenDisplay = GetAndInitDisplay(*this, nativeDisplay);
+ }
+
+ if (!chosenDisplay) {
+@@ -872,4 +894,3 @@ AfterEGLCall(const char* glFunction)
+
+ } /* namespace gl */
+ } /* namespace mozilla */
+-
diff --git a/mozilla-1460605-1.patch b/mozilla-1460605-1.patch
new file mode 100644
index 0000000..70806bf
--- /dev/null
+++ b/mozilla-1460605-1.patch
@@ -0,0 +1,40 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky(a)redhat.com>
+# Date 1525961643 -7200
+# Node ID c085f9360dfa4d0fc3d04d6db40d37e1369616b3
+# Parent acaaa40ebdf142fda38d5661f7631f029a2406c6
+Bug 1460605 - Use NS_NATIVE_EGL_WINDOW instead of NS_NATIVE_WINDOW on GTK r=lsalzman
+
+Original patch author is Takuro Ashie <ashie(a)clear-code.com>
+
+NS_NATIVE_EGL_WINDOW is exported by Gtk toolkit code and provides both X11 window
+handle for X11 Gtk backend and EGL window handle for Wayland backend.
+
+MozReview-Commit-ID: DEmlaLL7zGY
+
+diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
+--- a/gfx/gl/GLContextProviderEGL.cpp
++++ b/gfx/gl/GLContextProviderEGL.cpp
+@@ -1,18 +1,16 @@
+ /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at
http://mozilla.org/MPL/2.0/. */
+
+ #if defined(MOZ_WIDGET_GTK)
+- #include <gdk/gdkx.h>
+- // we're using default display for now
+- #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget)
((EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->GetNativeData(NS_NATIVE_WINDOW)))
+- #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget)
((EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow*)aWidget->RealWidget()->GetNativeData(NS_NATIVE_WINDOW)))
++ #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget)
((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_EGL_WINDOW))
++ #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget)
((EGLNativeWindowType)aWidget->RealWidget()->GetNativeData(NS_NATIVE_EGL_WINDOW))
+ #elif defined(MOZ_WIDGET_ANDROID)
+ #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget)
((EGLNativeWindowType)aWidget->GetNativeData(NS_JAVA_SURFACE))
+ #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget)
(aWidget->AsAndroid()->GetEGLNativeWindow())
+ #elif defined(XP_WIN)
+ #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget)
((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
+ #define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget)
((EGLNativeWindowType)aWidget->AsWindows()->GetHwnd())
+ #else
+ #define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget)
((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
+
diff --git a/mozilla-1460605-2.patch b/mozilla-1460605-2.patch
new file mode 100644
index 0000000..157e2fd
--- /dev/null
+++ b/mozilla-1460605-2.patch
@@ -0,0 +1,292 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky(a)redhat.com>
+# Date 1525961060 -7200
+# Node ID acaaa40ebdf142fda38d5661f7631f029a2406c6
+# Parent 5543294befe9494593370f33c40ba50c8239e0c6
+Bug 1460605 - Provide NS_NATIVE_EGL_WINDOW to get a native EGL window on Wayland,
r=jhorak
+
+Original patch author is Takuro Ashie <ashie(a)clear-code.com>
+
+Provide ability to create native EGL window and provide it under NS_NATIVE_EGL_WINDOW
+to GL code. The native EGL window is owned/managed by mozcontainer.
+
+MozReview-Commit-ID: 4d0Kk6DRSaD
+
+diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -1334,8 +1334,14 @@ if CONFIG['MOZ_SYSTEM_ICU']:
+ 'unicode/unistr.h',
+ 'unicode/unorm.h',
+ 'unicode/unum.h',
+ 'unicode/upluralrules.h',
+ 'unicode/ureldatefmt.h',
+ 'unicode/ustring.h',
+ 'unicode/utypes.h',
+ ]
++
++if CONFIG['MOZ_WAYLAND']:
++ system_headers += [
++ 'wayland-client.h',
++ 'wayland-egl.h',
++ ]
+diff --git a/widget/gtk/mozcontainer.cpp b/widget/gtk/mozcontainer.cpp
+--- a/widget/gtk/mozcontainer.cpp
++++ b/widget/gtk/mozcontainer.cpp
+@@ -5,16 +5,17 @@
+ * 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 "mozcontainer.h"
+ #include <gtk/gtk.h>
+ #ifdef MOZ_WAYLAND
+ #include <gdk/gdkx.h>
+ #include <gdk/gdkwayland.h>
++#include <wayland-egl.h>
+ #endif
+ #include <stdio.h>
+ #include <dlfcn.h>
+
+ #ifdef ACCESSIBILITY
+ #include <atk/atk.h>
+ #include "maiRedundantObjectFactory.h"
+ #endif
+@@ -202,16 +203,21 @@ void
+ moz_container_init (MozContainer *container)
+ {
+ gtk_widget_set_can_focus(GTK_WIDGET(container), TRUE);
+ gtk_container_set_resize_mode(GTK_CONTAINER(container), GTK_RESIZE_IMMEDIATE);
+ gtk_widget_set_redraw_on_allocate(GTK_WIDGET(container), FALSE);
+
+ #if defined(MOZ_WAYLAND)
+ {
++ container->subcompositor = nullptr;
++ container->surface = nullptr;
++ container->subsurface = nullptr;
++ container->eglwindow = nullptr;
++
+ GdkDisplay *gdk_display = gtk_widget_get_display(GTK_WIDGET(container));
+ if (GDK_IS_WAYLAND_DISPLAY (gdk_display)) {
+ // Available as of GTK 3.8+
+ static auto sGdkWaylandDisplayGetWlDisplay =
+ (wl_display *(*)(GdkDisplay *))
+ dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
+
+ wl_display* display = sGdkWaylandDisplayGetWlDisplay(gdk_display);
+@@ -284,16 +290,17 @@ moz_container_map_surface(MozContainer *
+ wl_region_destroy(region);
+ }
+ return true;
+ }
+
+ static void
+ moz_container_unmap_surface(MozContainer *container)
+ {
++ g_clear_pointer(&container->eglwindow, wl_egl_window_destroy);
+ g_clear_pointer(&container->subsurface, wl_subsurface_destroy);
+ g_clear_pointer(&container->surface, wl_surface_destroy);
+ }
+
+ #endif
+
+ void
+ moz_container_map (GtkWidget *widget)
+@@ -429,16 +436,21 @@ moz_container_size_allocate (GtkWidget
+ // We need to position our subsurface according to GdkWindow
+ // when offset changes (GdkWindow is maximized for instance).
+ // see gtk-clutter-embed.c for reference.
+ if (container->subsurface) {
+ gint x, y;
+ gdk_window_get_position(gtk_widget_get_window(widget), &x, &y);
+ wl_subsurface_set_position(container->subsurface, x, y);
+ }
++ if (container->eglwindow) {
++ wl_egl_window_resize(container->eglwindow,
++ allocation->width, allocation->height,
++ 0, 0);
++ }
+ #endif
+ }
+
+ void
+ moz_container_remove (GtkContainer *container, GtkWidget *child_widget)
+ {
+ MozContainerChild *child;
+ MozContainer *moz_container;
+@@ -554,9 +566,32 @@ moz_container_get_wl_surface(MozContaine
+ if (!gdk_window_is_visible(window))
+ return nullptr;
+
+ moz_container_map_surface(container);
+ }
+
+ return container->surface;
+ }
++
++struct wl_egl_window *
++moz_container_get_wl_egl_window(MozContainer *container)
++{
++ if (!container->eglwindow) {
++ struct wl_surface *wlsurf = moz_container_get_wl_surface(container);
++ if (!wlsurf)
++ return nullptr;
++
++ GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(container));
++ container->eglwindow
++ = wl_egl_window_create(wlsurf,
++ gdk_window_get_width(window),
++ gdk_window_get_height(window));
++ }
++ return container->eglwindow;
++}
++
++gboolean
++moz_container_has_wl_egl_window(MozContainer *container)
++{
++ return container->eglwindow ? true : false;
++}
+ #endif
+diff --git a/widget/gtk/mozcontainer.h b/widget/gtk/mozcontainer.h
+--- a/widget/gtk/mozcontainer.h
++++ b/widget/gtk/mozcontainer.h
+@@ -67,16 +67,17 @@ struct _MozContainer
+ {
+ GtkContainer container;
+ GList *children;
+
+ #ifdef MOZ_WAYLAND
+ struct wl_subcompositor *subcompositor;
+ struct wl_surface *surface;
+ struct wl_subsurface *subsurface;
++ struct wl_egl_window *eglwindow;
+ #endif
+ };
+
+ struct _MozContainerClass
+ {
+ GtkContainerClass parent_class;
+ };
+
+@@ -90,11 +91,13 @@ void moz_container_move (
+ GtkWidget *child_widget,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+
+ #ifdef MOZ_WAYLAND
+ struct wl_surface* moz_container_get_wl_surface(MozContainer *container);
++struct wl_egl_window* moz_container_get_wl_egl_window(MozContainer *container);
++gboolean moz_container_has_wl_egl_window(MozContainer *container);
+ #endif
+
+ #endif /* __MOZ_CONTAINER_H__ */
+diff --git a/widget/gtk/mozwayland/mozwayland.c b/widget/gtk/mozwayland/mozwayland.c
+--- a/widget/gtk/mozwayland/mozwayland.c
++++ b/widget/gtk/mozwayland/mozwayland.c
+@@ -266,8 +266,26 @@ wl_display_read_events(struct wl_display
+ return -1;
+ }
+
+ MOZ_EXPORT void
+ wl_log_set_handler_client(wl_log_func_t handler)
+ {
+ }
+
++MOZ_EXPORT struct wl_egl_window *
++wl_egl_window_create(struct wl_surface *surface,
++ int width, int height)
++{
++ return NULL;
++}
++
++MOZ_EXPORT void
++wl_egl_window_destroy(struct wl_egl_window *egl_window)
++{
++}
++
++MOZ_EXPORT void
++wl_egl_window_resize(struct wl_egl_window *egl_window,
++ int width, int height,
++ int dx, int dy)
++{
++}
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -1734,16 +1734,25 @@ nsWindow::GetNativeData(uint32_t aDataTy
+ return mIMContext.get();
+ }
+ case NS_NATIVE_OPENGL_CONTEXT:
+ return nullptr;
+ #ifdef MOZ_X11
+ case NS_NATIVE_COMPOSITOR_DISPLAY:
+ return gfxPlatformGtk::GetPlatform()->GetCompositorDisplay();
+ #endif // MOZ_X11
++ case NS_NATIVE_EGL_WINDOW: {
++ if (mIsX11Display)
++ return mGdkWindow ? (void*)GDK_WINDOW_XID(mGdkWindow) : nullptr;
++#ifdef MOZ_WAYLAND
++ if (mContainer)
++ return moz_container_get_wl_egl_window(mContainer);
++#endif
++ return nullptr;
++ }
+ default:
+ NS_WARNING("nsWindow::GetNativeData called with bad value");
+ return nullptr;
+ }
+ }
+
+ nsresult
+ nsWindow::SetTitle(const nsAString& aTitle)
+@@ -4303,16 +4312,26 @@ nsWindow::NativeShow(bool aAction)
+ else if (mContainer) {
+ gtk_widget_show(GTK_WIDGET(mContainer));
+ }
+ else if (mGdkWindow) {
+ gdk_window_show_unraised(mGdkWindow);
+ }
+ }
+ else {
++#ifdef MOZ_WAYLAND
++ if (mContainer && moz_container_has_wl_egl_window(mContainer)) {
++ // Because wl_egl_window is destroyed on moz_container_unmap(),
++ // the current compositor cannot use it anymore. To avoid crash,
++ // destroy the compositor & recreate a new compositor on next
++ // expose event.
++ DestroyLayerManager();
++ }
++#endif
++
+ if (mIsTopLevel) {
+ // Workaround window freezes on GTK versions before 3.21.2 by
+ // ensuring that configure events get dispatched to windows before
+ // they are unmapped. See bug 1225044.
+ if (gtk_check_version(3, 21, 2) != nullptr && mPendingConfigures
> 0) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(GTK_WIDGET(mShell), &allocation);
+
+diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h
+--- a/widget/nsIWidget.h
++++ b/widget/nsIWidget.h
+@@ -138,16 +138,17 @@ typedef void* nsNativeWidget;
+ #define NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW 105
+ #endif
+ #if defined(MOZ_WIDGET_GTK)
+ // set/get nsPluginNativeWindowGtk, e10s specific
+ #define NS_NATIVE_PLUGIN_OBJECT_PTR 104
+ #ifdef MOZ_X11
+ #define NS_NATIVE_COMPOSITOR_DISPLAY 105
+ #endif // MOZ_X11
++#define NS_NATIVE_EGL_WINDOW 106
+ #endif
+ #ifdef MOZ_WIDGET_ANDROID
+ #define NS_JAVA_SURFACE 100
+ #define NS_PRESENTATION_WINDOW 101
+ #define NS_PRESENTATION_SURFACE 102
+ #endif
+
+ // Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
+
diff --git a/mozilla-1460810.patch b/mozilla-1460810.patch
new file mode 100644
index 0000000..016f75f
--- /dev/null
+++ b/mozilla-1460810.patch
@@ -0,0 +1,30 @@
+# HG changeset patch
+# User Evan Klitzke <evan(a)eklitzke.org>
+# Parent c5e0ee17388381f96d0acf4bdd9d163827719096
+Bug 1460810 - [Gtk/Wayland] Handle error value (-1) returned by
gtk_section_data_get_length(), r=stransky
+
+diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
+--- a/widget/gtk/nsClipboardWayland.cpp
++++ b/widget/gtk/nsClipboardWayland.cpp
+@@ -662,18 +662,19 @@ wayland_clipboard_contents_received(GtkC
+ delete fastTrack;
+ }
+
+ void
+ nsRetrievalContextWayland::TransferFastTrackClipboard(
+ int aClipboardRequestNumber, GtkSelectionData *aSelectionData)
+ {
+ if (mClipboardRequestNumber == aClipboardRequestNumber) {
+- mClipboardDataLength = gtk_selection_data_get_length(aSelectionData);
+- if (mClipboardDataLength > 0) {
++ int dataLength = gtk_selection_data_get_length(aSelectionData);
++ if (dataLength > 0) {
++ mClipboardDataLength = dataLength;
+ mClipboardData = reinterpret_cast<char*>(
+ g_malloc(sizeof(char)*mClipboardDataLength));
+ memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),
+ sizeof(char)*mClipboardDataLength);
+ }
+ } else {
+ NS_WARNING("Received obsoleted clipboard data!");
+ }
diff --git a/mozilla-1461306.patch b/mozilla-1461306.patch
new file mode 100644
index 0000000..84ee6c6
--- /dev/null
+++ b/mozilla-1461306.patch
@@ -0,0 +1,33 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky(a)redhat.com>
+# Date 1526299286 -7200
+# Node ID 6495ae9d01e06109539413c538fd25ed942f6eb8
+# Parent 67553a1262de53d0ec85fdfcf1a2b55631eaca44
+Bug 1461306 - [Wayland] Don't use sizeof() to get mime type array size, r=jhorak
+
+MozReview-Commit-ID: GE5helkqoUt
+
+diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
+--- a/widget/gtk/nsClipboardWayland.cpp
++++ b/widget/gtk/nsClipboardWayland.cpp
+@@ -723,17 +723,17 @@ const char*
+ nsRetrievalContextWayland::GetClipboardText(int32_t aWhichClipboard)
+ {
+ GdkAtom selection = GetSelectionAtom(aWhichClipboard);
+ DataOffer* dataOffer = (selection == GDK_SELECTION_PRIMARY) ?
+ mPrimaryOffer : mClipboardOffer;
+ if (!dataOffer)
+ return nullptr;
+
+- for (unsigned int i = 0; i < sizeof(sTextMimeTypes); i++) {
++ for (unsigned int i = 0; i < TEXT_MIME_TYPES_NUM; i++) {
+ if (dataOffer->HasTarget(sTextMimeTypes[i])) {
+ uint32_t unused;
+ return GetClipboardData(sTextMimeTypes[i], aWhichClipboard,
+ &unused);
+ }
+ }
+ return nullptr;
+ }
+
diff --git a/mozilla-1462622.patch b/mozilla-1462622.patch
new file mode 100644
index 0000000..a1903dc
--- /dev/null
+++ b/mozilla-1462622.patch
@@ -0,0 +1,36 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky(a)redhat.com>
+# Date 1526647470 -7200
+# Node ID d41fee41e38400fab5da0689c1f49e30f80e2d1b
+# Parent d2b91476bebc48f9e89f9d3e6c7b33decb2ae941
+Bug 1462622 - [Gtk/Linux] Don't use GLXVsyncSource() on non-X11 displays, r=lsalzman
+
+MozReview-Commit-ID: BBtnNLWqSiq
+
+diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
+--- a/gfx/thebes/gfxPlatformGtk.cpp
++++ b/gfx/thebes/gfxPlatformGtk.cpp
+@@ -736,18 +736,20 @@ private:
+ };
+
+ already_AddRefed<gfx::VsyncSource>
+ gfxPlatformGtk::CreateHardwareVsyncSource()
+ {
+ // 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 (gl::sGLXLibrary.SupportsVideoSync()) {
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
++ gl::sGLXLibrary.SupportsVideoSync()) {
+ RefPtr<VsyncSource> vsyncSource = new GLXVsyncSource();
+ VsyncSource::Display& display = vsyncSource->GetGlobalDisplay();
+ if (!static_cast<GLXVsyncSource::GLXDisplay&>(display).Setup()) {
+ NS_WARNING("Failed to setup GLContext, falling back to software
vsync.");
+ return gfxPlatform::CreateHardwareVsyncSource();
+ }
+ return vsyncSource.forget();
+ }
+
diff --git a/mozilla-1462642.patch b/mozilla-1462642.patch
new file mode 100644
index 0000000..9bd6ab8
--- /dev/null
+++ b/mozilla-1462642.patch
@@ -0,0 +1,183 @@
+diff -up firefox-60.0.1/gfx/gl/GLContextEGL.h.mozilla-1462642
firefox-60.0.1/gfx/gl/GLContextEGL.h
+--- firefox-60.0.1/gfx/gl/GLContextEGL.h.mozilla-1462642 2018-05-16 07:38:29.000000000
+0200
++++ firefox-60.0.1/gfx/gl/GLContextEGL.h 2018-05-25 10:54:09.271902218 +0200
+@@ -133,6 +133,10 @@ protected:
+ static EGLSurface CreatePBufferSurfaceTryingPowerOfTwo(EGLConfig config,
+ EGLenum bindToTextureFormat,
+ gfx::IntSize& pbsize);
++#if defined(MOZ_WAYLAND)
++ static EGLSurface CreateWaylandBufferSurface(EGLConfig config,
++ gfx::IntSize& pbsize);
++#endif
+ #if defined(MOZ_WIDGET_ANDROID)
+ public:
+ EGLSurface CreateCompatibleSurface(void* aWindow);
+diff -up firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp.mozilla-1462642
firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp
+--- firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp.mozilla-1462642 2018-05-25
10:54:09.258902265 +0200
++++ firefox-60.0.1/gfx/gl/GLContextProviderEGL.cpp 2018-05-25 10:55:57.634553279 +0200
+@@ -63,6 +63,17 @@
+ #include "ScopedGLHelpers.h"
+ #include "TextureImageEGL.h"
+
++#if defined(MOZ_WAYLAND)
++#include "nsAutoPtr.h"
++#include "nsDataHashtable.h"
++
++#include <gtk/gtk.h>
++#include <gdk/gdkx.h>
++#include <gdk/gdkwayland.h>
++#include <wayland-egl.h>
++#include <dlfcn.h>
++#endif
++
+ using namespace mozilla::gfx;
+
+ namespace mozilla {
+@@ -70,6 +81,35 @@ namespace gl {
+
+ using namespace mozilla::widget;
+
++#if defined(MOZ_WAYLAND)
++class WaylandGLSurface {
++public:
++ WaylandGLSurface(struct wl_surface *aWaylandSurface,
++ struct wl_egl_window *aEGLWindow);
++ ~WaylandGLSurface();
++private:
++ struct wl_surface *mWaylandSurface;
++ struct wl_egl_window *mEGLWindow;
++};
++
++static nsDataHashtable<nsPtrHashKey<void>, WaylandGLSurface*>
++ sWaylandGLSurface;
++
++void
++DeleteWaylandGLSurface(EGLSurface surface)
++{
++ // We're running on Wayland which means our EGLSurface may
++ // have attached Wayland backend data which must be released.
++ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
++ auto entry = sWaylandGLSurface.Lookup(surface);
++ if (entry) {
++ delete entry.Data();
++ entry.Remove();
++ }
++ }
++}
++#endif
++
+ #define ADD_ATTR_2(_array, _k, _v) do { \
+ (_array).AppendElement(_k); \
+ (_array).AppendElement(_v); \
+@@ -125,6 +165,9 @@ DestroySurface(EGLSurface oldSurface) {
+ EGL_NO_SURFACE, EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+ sEGLLibrary.fDestroySurface(EGL_DISPLAY(), oldSurface);
++#if defined(MOZ_WAYLAND)
++ DeleteWaylandGLSurface(oldSurface);
++#endif
+ }
+ }
+
+@@ -588,6 +631,52 @@ TRY_AGAIN_POWER_OF_TWO:
+ return surface;
+ }
+
++#if defined(MOZ_WAYLAND)
++WaylandGLSurface::WaylandGLSurface(struct wl_surface *aWaylandSurface,
++ struct wl_egl_window *aEGLWindow)
++ : mWaylandSurface(aWaylandSurface)
++ , mEGLWindow(aEGLWindow)
++{
++}
++
++WaylandGLSurface::~WaylandGLSurface()
++{
++ wl_egl_window_destroy(mEGLWindow);
++ wl_surface_destroy(mWaylandSurface);
++}
++
++EGLSurface
++GLContextEGL::CreateWaylandBufferSurface(EGLConfig config,
++ mozilla::gfx::IntSize& pbsize)
++{
++ // Available as of GTK 3.8+
++ static auto sGdkWaylandDisplayGetWlCompositor =
++ (wl_compositor *(*)(GdkDisplay *))
++ dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_compositor");
++
++ if (!sGdkWaylandDisplayGetWlCompositor)
++ return nullptr;
++
++ struct wl_compositor *compositor =
++ sGdkWaylandDisplayGetWlCompositor(gdk_display_get_default());
++ struct wl_surface *wlsurface = wl_compositor_create_surface(compositor);
++ struct wl_egl_window *eglwindow =
++ wl_egl_window_create(wlsurface, pbsize.width, pbsize.height);
++
++ EGLSurface surface =
++ sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, eglwindow, 0);
++
++ if (surface) {
++ WaylandGLSurface* waylandData =
++ new WaylandGLSurface(wlsurface, eglwindow);
++ auto entry = sWaylandGLSurface.LookupForAdd(surface);
++ entry.OrInsert([&waylandData](){ return waylandData; });
++ }
++
++ return surface;
++}
++#endif
++
+ static const EGLint kEGLConfigAttribsOffscreenPBuffer[] = {
+ LOCAL_EGL_SURFACE_TYPE, LOCAL_EGL_PBUFFER_BIT,
+ LOCAL_EGL_RENDERABLE_TYPE, LOCAL_EGL_OPENGL_ES2_BIT,
+@@ -807,7 +896,17 @@ FillContextAttribs(bool alpha, bool dept
+ bool es3, nsTArray<EGLint>* out)
+ {
+ out->AppendElement(LOCAL_EGL_SURFACE_TYPE);
++#if defined(MOZ_WAYLAND)
++ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
++ // Wayland on desktop does not support PBuffer or FBO.
++ // We create a dummy wl_egl_window instead.
++ out->AppendElement(LOCAL_EGL_WINDOW_BIT);
++ } else {
++ out->AppendElement(LOCAL_EGL_PBUFFER_BIT);
++ }
++#else
+ out->AppendElement(LOCAL_EGL_PBUFFER_BIT);
++#endif
+
+ out->AppendElement(LOCAL_EGL_RENDERABLE_TYPE);
+ if (es3) {
+@@ -926,9 +1025,17 @@ GLContextEGL::CreateEGLPBufferOffscreenC
+ }
+
+ mozilla::gfx::IntSize pbSize(size);
+- EGLSurface surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(config,
+-
LOCAL_EGL_NONE,
+- pbSize);
++ EGLSurface surface = nullptr;
++#if defined(MOZ_WAYLAND)
++ if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) {
++ surface = GLContextEGL::CreateWaylandBufferSurface(config, pbSize);
++ } else
++#endif
++ {
++ surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(config,
++ LOCAL_EGL_NONE,
++ pbSize);
++ }
+ if (!surface) {
+ *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_POT");
+ NS_WARNING("Failed to create PBuffer for context!");
+@@ -941,6 +1048,9 @@ GLContextEGL::CreateEGLPBufferOffscreenC
+ if (!gl) {
+ NS_WARNING("Failed to create GLContext from PBuffer");
+ sEGLLibrary.fDestroySurface(sEGLLibrary.Display(), surface);
++#if defined(MOZ_WAYLAND)
++ DeleteWaylandGLSurface(surface);
++#endif
+ return nullptr;
+ }
+
diff --git a/mozilla-1463753.patch b/mozilla-1463753.patch
new file mode 100644
index 0000000..4e83fd4
--- /dev/null
+++ b/mozilla-1463753.patch
@@ -0,0 +1,127 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky(a)redhat.com>
+# Date 1527155477 -7200
+# Node ID 172827af80fa02953e0c7723c0dee915c411c286
+# Parent a5c04fe7278db916b3efd5f06a5f2a9da0d64ad2
+Bug 1463753 - [DragAndDrop] Update mTarget(Wayland)DragContext unconditionally and check
its validity after that, r=jhorak
+
+MozReview-Commit-ID: KiNaPDDVvLu
+
+diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp
+--- a/widget/gtk/nsDragService.cpp
++++ b/widget/gtk/nsDragService.cpp
+@@ -1043,21 +1043,21 @@ nsDragService::IsDataFlavorSupported(con
+ }
+
+ // check the target context vs. this flavor, one at a time
+ GList *tmp = nullptr;
+ if (mTargetDragContext) {
+ tmp = gdk_drag_context_list_targets(mTargetDragContext);
+ }
+ #ifdef MOZ_WAYLAND
+- else {
++ else if (mTargetWaylandDragContext) {
+ tmp = mTargetWaylandDragContext->GetTargets();
+ }
++ GList *tmp_head = tmp;
+ #endif
+- GList *tmp_head = tmp;
+
+ for (; tmp; tmp = tmp->next) {
+ /* Bug 331198 */
+ GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
+ gchar *name = nullptr;
+ name = gdk_atom_name(atom);
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("checking %s against %s\n", name, aDataFlavor));
+@@ -1095,21 +1095,23 @@ nsDragService::IsDataFlavorSupported(con
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+ ("good! ( it's text plain and we're checking \
+ against text/unicode or application/x-moz-file)\n"));
+ *_retval = true;
+ }
+ g_free(name);
+ }
+
++#ifdef MOZ_WAYLAND
+ // mTargetWaylandDragContext->GetTargets allocates the list
+ // so we need to free it here.
+- if (!mTargetDragContext) {
++ if (!mTargetDragContext && tmp_head) {
+ g_list_free(tmp_head);
+ }
++#endif
+
+ return NS_OK;
+ }
+
+ void
+ nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext)
+ {
+ MOZ_LOG(sDragLm, LogLevel::Debug,
+@@ -2007,23 +2009,19 @@ nsDragService::RunScheduledTask()
+ // This may be the start of a destination drag session.
+ StartDragSession();
+
+ // mTargetWidget may be nullptr if the window has been destroyed.
+ // (The leave event is not scheduled if a drop task is still scheduled.)
+ // We still reply appropriately to indicate that the drop will or didn't
+ // succeeed.
+ mTargetWidget = mTargetWindow->GetMozContainerWidget();
+- if (mTargetDragContext) {
+- mTargetDragContext.steal(mPendingDragContext);
+- }
++ mTargetDragContext.steal(mPendingDragContext);
+ #ifdef MOZ_WAYLAND
+- else {
+- mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
+- }
++ mTargetWaylandDragContext = mPendingWaylandDragContext.forget();
+ #endif
+ mTargetTime = mPendingTime;
+
+ //
http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag...
+ // (as at 27 December 2010) indicates that a "drop" event should only be
+ // fired (at the current target element) if the current drag operation is
+ // not none. The current drag operation will only be set to a non-none
+ // value during a "dragover" event.
+@@ -2056,17 +2054,17 @@ nsDragService::RunScheduledTask()
+ #endif
+ } else {
+ // Reply to tell the source whether we can drop and what
+ // action would be taken.
+ if (mTargetDragContext) {
+ ReplyToDragMotion(mTargetDragContext);
+ }
+ #ifdef MOZ_WAYLAND
+- else {
++ else if (mTargetWaylandDragContext) {
+ ReplyToDragMotion(mTargetWaylandDragContext);
+ }
+ #endif
+ }
+ }
+ }
+
+ if (task == eDragTaskDrop) {
+@@ -2123,17 +2121,17 @@ nsDragService::UpdateDragAction()
+
+ // default is to do nothing
+ int action = nsIDragService::DRAGDROP_ACTION_NONE;
+ GdkDragAction gdkAction = GDK_ACTION_DEFAULT;
+ if (mTargetDragContext) {
+ gdkAction = gdk_drag_context_get_actions(mTargetDragContext);
+ }
+ #ifdef MOZ_WAYLAND
+- else {
++ else if (mTargetWaylandDragContext) {
+ // We got the selected D&D action from compositor on Wayland.
+ gdkAction = mTargetWaylandDragContext->GetSelectedDragAction();
+ }
+ #endif
+
+ // set the default just in case nothing matches below
+ if (gdkAction & GDK_ACTION_DEFAULT)
+ action = nsIDragService::DRAGDROP_ACTION_MOVE;
+
diff --git a/mozilla-1464808.patch b/mozilla-1464808.patch
new file mode 100644
index 0000000..6cb6bde
--- /dev/null
+++ b/mozilla-1464808.patch
@@ -0,0 +1,31 @@
+diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
+--- a/widget/gtk/nsClipboardWayland.cpp
++++ b/widget/gtk/nsClipboardWayland.cpp
+@@ -201,21 +201,25 @@ WaylandDataOffer::DragOfferAccept(const
+ }
+
+ /* We follow logic of gdk_wayland_drag_context_commit_status()/gdkdnd-wayland.c
+ * here.
+ */
+ void
+ WaylandDataOffer::SetDragStatus(GdkDragAction aAction, uint32_t aTime)
+ {
+- uint32_t dnd_actions = gdk_to_wl_actions(aAction);
+ uint32_t all_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY |
+ WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
+
+- wl_data_offer_set_actions(mWaylandDataOffer, all_actions, dnd_actions);
++ /* Default Firefox D&D action is move so set it here as a preferred one.
++ Actual D&D action will be select by Wayland compositor and reported
++ at data_offer_action() callback.
++ */
++ wl_data_offer_set_actions(mWaylandDataOffer, all_actions,
++ WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE);
+
+ /* Workaround Wayland D&D architecture here. To get the data_device_drop()
+ signal (which routes to nsDragService::GetData() call) we need to
+ accept at least one mime type before data_device_leave().
+
+ Real wl_data_offer_accept() for actualy requested data mime type is
+ called from nsDragService::GetData().
+ */
diff --git a/mozilla-1464823.patch b/mozilla-1464823.patch
new file mode 100644
index 0000000..9870d98
--- /dev/null
+++ b/mozilla-1464823.patch
@@ -0,0 +1,27 @@
+Bug 1464823 - Don't sync rendering on Mesa as the Mesa Wayland implementation is
buggy.
+
+diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
+--- a/gfx/gl/GLContextProviderEGL.cpp
++++ b/gfx/gl/GLContextProviderEGL.cpp
+@@ -273,20 +273,17 @@ GLContextEGLFactory::Create(EGLNativeWin
+ if (!gl) {
+ gfxCriticalNote << "Failed to create EGLContext!";
+ mozilla::gl::DestroySurface(surface);
+ return nullptr;
+ }
+
+ gl->MakeCurrent();
+ gl->SetIsDoubleBuffered(doubleBuffered);
+- if (aWebRender && sEGLLibrary.IsANGLE()) {
+- MOZ_ASSERT(doubleBuffered);
+- sEGLLibrary.fSwapInterval(EGL_DISPLAY(), 0);
+- }
++ sEGLLibrary.fSwapInterval(EGL_DISPLAY(), 0);
+ return gl.forget();
+ }
+
+ GLContextEGL::GLContextEGL(CreateContextFlags flags, const SurfaceCaps& caps,
+ bool isOffscreen, EGLConfig config, EGLSurface surface,
+ EGLContext context)
+ : GLContext(flags, caps, nullptr, isOffscreen, false)
+ , mConfig(config)
diff --git a/mozilla-1466473.patch b/mozilla-1466473.patch
new file mode 100644
index 0000000..5ee521d
--- /dev/null
+++ b/mozilla-1466473.patch
@@ -0,0 +1,42 @@
+diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
+--- a/toolkit/xre/moz.build
++++ b/toolkit/xre/moz.build
+@@ -116,17 +116,17 @@ UNIFIED_SOURCES += [
+ # they pull in OS X system headers.
+ # nsEmbedFunctions.cpp cannot be built in unified mode because it pulls in X11 headers.
+ SOURCES += [
+ 'nsAppRunner.cpp',
+ 'nsEmbedFunctions.cpp',
+ 'ProfileReset.cpp',
+ ]
+
+-if CONFIG['MOZ_GL_DEFAULT_PROVIDER'] == 'GLX':
++if CONFIG['MOZ_X11']:
+ UNIFIED_SOURCES += [
+ 'glxtest.cpp',
+ ]
+
+ if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
+ UNIFIED_SOURCES += [
+ 'EventTracer.cpp',
+ ]
+@@ -142,17 +142,17 @@ if CONFIG['MOZ_PDF_PRINTING']:
+ LOCAL_INCLUDES += [
+ '../components/printingui',
+ ]
+
+ include('/ipc/chromium/chromium-config.mozbuild')
+
+ FINAL_LIBRARY = 'xul'
+
+-if CONFIG['MOZ_GL_DEFAULT_PROVIDER'] == 'GLX':
++if CONFIG['MOZ_X11']:
+ DEFINES['USE_GLX_TEST'] = True
+
+ for var in ('MOZ_APP_NAME', 'MOZ_APP_BASENAME',
'MOZ_APP_DISPLAYNAME',
+ 'MOZ_APP_VERSION', 'OS_TARGET',
'MOZ_WIDGET_TOOLKIT'):
+ DEFINES[var] = '"%s"' % CONFIG[var]
+
+ if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] !=
'android':
+ DEFINES['MOZ_UPDATER'] = True
+
diff --git a/mozilla-440908.patch b/mozilla-440908.patch
deleted file mode 100644
index 2d4a609..0000000
--- a/mozilla-440908.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-diff -up firefox-50.0/modules/libpref/prefapi.cpp.440908
firefox-50.0/modules/libpref/prefapi.cpp
---- firefox-50.0/modules/libpref/prefapi.cpp.440908 2016-10-31 21:15:26.000000000 +0100
-+++ firefox-50.0/modules/libpref/prefapi.cpp 2016-11-10 10:32:48.796115692 +0100
-@@ -997,8 +997,8 @@ void PREF_ReaderCallback(void *clo
- PrefValue value,
- PrefType type,
- bool isDefault,
-- bool isStickyDefault)
--
-+ bool isStickyDefault,
-+ bool isLocked)
- {
- uint32_t flags = 0;
- if (isDefault) {
-@@ -1010,4 +1010,6 @@ void PREF_ReaderCallback(void *clo
- flags |= kPrefForceSet;
- }
- pref_HashPref(pref, value, type, flags);
-+ if (isLocked)
-+ PREF_LockPref(pref, true);
- }
-diff -up firefox-50.0/modules/libpref/prefapi.h.440908
firefox-50.0/modules/libpref/prefapi.h
---- firefox-50.0/modules/libpref/prefapi.h.440908 2016-11-10 10:32:48.796115692 +0100
-+++ firefox-50.0/modules/libpref/prefapi.h 2016-11-10 10:34:58.013159112 +0100
-@@ -243,8 +243,8 @@ void PREF_ReaderCallback( void *closure,
- PrefValue value,
- PrefType type,
- bool isDefault,
-- bool isStickyDefault);
--
-+ bool isStickyDefault,
-+ bool isLocked);
-
- /*
- * Callback whenever we change a preference
-diff -up firefox-50.0/modules/libpref/prefread.cpp.440908
firefox-50.0/modules/libpref/prefread.cpp
---- firefox-50.0/modules/libpref/prefread.cpp.440908 2016-09-05 22:12:58.000000000 +0200
-+++ firefox-50.0/modules/libpref/prefread.cpp 2016-11-10 10:32:48.796115692 +0100
-@@ -43,6 +43,7 @@ enum {
- #define BITS_PER_HEX_DIGIT 4
-
- static const char kUserPref[] = "user_pref";
-+static const char kLockPref[] = "lockPref";
- static const char kPref[] = "pref";
- static const char kPrefSticky[] = "sticky_pref";
- static const char kTrue[] = "true";
-@@ -146,7 +147,7 @@ pref_DoCallback(PrefParseState *ps)
- break;
- }
- (*ps->reader)(ps->closure, ps->lb, value, ps->vtype, ps->fdefault,
-- ps->fstickydefault);
-+ ps->fstickydefault, ps->flock);
- return true;
- }
-
-@@ -215,6 +216,7 @@ PREF_ParseBuf(PrefParseState *ps, const
- ps->vtype = PrefType::Invalid;
- ps->fdefault = false;
- ps->fstickydefault = false;
-+ ps->flock = false;
- }
- switch (c) {
- case '/': /* begin comment block or line? */
-@@ -225,11 +227,14 @@ PREF_ParseBuf(PrefParseState *ps, const
- break;
- case 'u': /* indicating user_pref */
- case 's': /* indicating sticky_pref */
-+ case 'l': /* indicating lockPref */
- case 'p': /* indicating pref */
- if (c == 'u') {
- ps->smatch = kUserPref;
- } else if (c == 's') {
- ps->smatch = kPrefSticky;
-+ } else if (c == 'l') {
-+ ps->smatch = kLockPref;
- } else {
- ps->smatch = kPref;
- }
-@@ -277,8 +282,10 @@ PREF_ParseBuf(PrefParseState *ps, const
- /* name parsing */
- case PREF_PARSE_UNTIL_NAME:
- if (c == '\"' || c == '\'') {
-- ps->fdefault = (ps->smatch == kPref || ps->smatch ==
kPrefSticky);
-+ ps->fdefault = (ps->smatch == kPref || ps->smatch ==
kPrefSticky
-+ || ps->smatch == kLockPref);
- ps->fstickydefault = (ps->smatch == kPrefSticky);
-+ ps->flock = (ps->smatch == kLockPref);
- ps->quotechar = c;
- ps->nextstate = PREF_PARSE_UNTIL_COMMA; /* return here when done */
- state = PREF_PARSE_QUOTED_STRING;
-diff -up firefox-50.0/modules/libpref/prefread.h.440908
firefox-50.0/modules/libpref/prefread.h
---- firefox-50.0/modules/libpref/prefread.h.440908 2016-09-05 22:12:58.000000000 +0200
-+++ firefox-50.0/modules/libpref/prefread.h 2016-11-10 10:32:48.796115692 +0100
-@@ -34,7 +34,8 @@ typedef void (*PrefReader)(void *c
- PrefValue val,
- PrefType type,
- bool defPref,
-- bool stickyPref);
-+ bool stickyPref,
-+ bool lockPref);
-
- /**
- * Report any errors or warnings we encounter during parsing.
-@@ -62,6 +63,7 @@ typedef struct PrefParseState {
- PrefType vtype; /* PREF_STRING,INT,BOOL */
- bool fdefault; /* true if (default) pref */
- bool fstickydefault; /* true if (sticky) pref */
-+ bool flock; /* true if pref to be locked */
- } PrefParseState;
-
- /**
-@@ -90,7 +92,7 @@ void PREF_InitParseState(PrefParseState
- *
- * @param ps
- * PrefParseState instance.
-- */
-+ */
- void PREF_FinalizeParseState(PrefParseState *ps);
-
- /**
diff --git a/mozilla-build-arm.patch b/mozilla-build-arm.patch
index 1e1e57c..e390a28 100644
--- a/mozilla-build-arm.patch
+++ b/mozilla-build-arm.patch
@@ -12,27 +12,3 @@ diff -up firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h.arm
firefox-52.0/
//////////////////////////////////////////////////////////////////////
#if !defined(SKIA_IMPLEMENTATION)
-diff -up firefox-52.0/media/webrtc/trunk/webrtc/build/common.gypi.arm
firefox-52.0/media/webrtc/trunk/webrtc/build/common.gypi
---- firefox-52.0/media/webrtc/trunk/webrtc/build/common.gypi.arm 2016-09-05
22:12:57.000000000 +0200
-+++ firefox-52.0/media/webrtc/trunk/webrtc/build/common.gypi 2017-03-03
13:53:52.480754536 +0100
-@@ -312,20 +312,6 @@
- 'defines': [
- 'WEBRTC_ARCH_ARM',
- ],
-- 'conditions': [
-- ['arm_version>=7', {
-- 'defines': ['WEBRTC_ARCH_ARM_V7',
-- 'WEBRTC_BUILD_NEON_LIBS'],
-- 'conditions': [
-- ['arm_neon==1', {
-- 'defines': ['WEBRTC_ARCH_ARM_NEON',],
-- }],
-- ['arm_neon==0 and arm_neon_optional==1', {
-- 'defines': ['WEBRTC_DETECT_ARM_NEON',],
-- }],
-- ],
-- }],
-- ],
- }],
- ['os_bsd==1', {
- 'defines': [
diff --git a/rb244010.patch b/rb244010.patch
new file mode 100644
index 0000000..0df8c3b
--- /dev/null
+++ b/rb244010.patch
@@ -0,0 +1,149 @@
+diff --git a/gfx/gl/GLContextProviderWayland.cpp b/gfx/gl/GLContextProviderWayland.cpp
+new file mode 100644
+--- /dev/null
++++ b/gfx/gl/GLContextProviderWayland.cpp
+@@ -0,0 +1,99 @@
++/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at
http://mozilla.org/MPL/2.0/. */
++
++#ifdef MOZ_WIDGET_GTK
++#include <gdk/gdk.h>
++#include <gdk/gdkx.h>
++#endif
++
++#include "GLContextProvider.h"
++
++namespace mozilla {
++namespace gl {
++
++using namespace mozilla::gfx;
++using namespace mozilla::widget;
++
++static class GLContextProviderGLX sGLContextProviderGLX;
++static class GLContextProviderEGL sGLContextProviderEGL;
++
++already_AddRefed<GLContext>
++GLContextProviderWayland::CreateWrappingExisting(void* aContext, void* aSurface)
++{
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
++ return sGLContextProviderGLX.CreateWrappingExisting(aContext, aSurface);
++ } else {
++ return sGLContextProviderEGL.CreateWrappingExisting(aContext, aSurface);
++ }
++}
++
++already_AddRefed<GLContext>
++GLContextProviderWayland::CreateForCompositorWidget(CompositorWidget* aCompositorWidget,
bool aForceAccelerated)
++{
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
++ return sGLContextProviderGLX.CreateForCompositorWidget(aCompositorWidget,
aForceAccelerated);
++ } else {
++ return sGLContextProviderEGL.CreateForCompositorWidget(aCompositorWidget,
aForceAccelerated);
++ }
++}
++
++already_AddRefed<GLContext>
++GLContextProviderWayland::CreateForWindow(nsIWidget* aWidget,
++ bool aWebRender,
++ bool aForceAccelerated)
++{
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
++ return sGLContextProviderGLX.CreateForWindow(aWidget, aWebRender,
aForceAccelerated);
++ } else {
++ return sGLContextProviderEGL.CreateForWindow(aWidget, aWebRender,
aForceAccelerated);
++ }
++}
++
++/*static*/ already_AddRefed<GLContext>
++GLContextProviderWayland::CreateHeadless(CreateContextFlags flags,
++ nsACString* const out_failureId)
++{
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
++ return sGLContextProviderGLX.CreateHeadless(flags, out_failureId);
++ } else {
++ return sGLContextProviderEGL.CreateHeadless(flags, out_failureId);
++ }
++}
++
++/*static*/ already_AddRefed<GLContext>
++GLContextProviderWayland::CreateOffscreen(const IntSize& size,
++ const SurfaceCaps& minCaps,
++ CreateContextFlags flags,
++ nsACString* const out_failureId)
++{
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
++ return sGLContextProviderGLX.CreateOffscreen(size, minCaps, flags,
out_failureId);
++ } else {
++ return sGLContextProviderEGL.CreateOffscreen(size, minCaps, flags,
out_failureId);
++ }
++}
++
++/*static*/ GLContext*
++GLContextProviderWayland::GetGlobalContext()
++{
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
++ return sGLContextProviderGLX.GetGlobalContext();
++ } else {
++ return sGLContextProviderEGL.GetGlobalContext();
++ }
++}
++
++/*static*/ void
++GLContextProviderWayland::Shutdown()
++{
++ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
++ sGLContextProviderGLX.Shutdown();
++ } else {
++ sGLContextProviderEGL.Shutdown();
++ }
++}
++
++} /* namespace gl */
++} /* namespace mozilla */
+diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
+--- a/gfx/gl/moz.build
++++ b/gfx/gl/moz.build
+@@ -8,17 +8,17 @@ gl_provider = 'Null'
+
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+ gl_provider = 'WGL'
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ gl_provider = 'CGL'
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
+ gl_provider = 'EAGL'
+ elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+- if CONFIG['MOZ_EGL_XRENDER_COMPOSITE'] or CONFIG['MOZ_WAYLAND']:
++ if CONFIG['MOZ_EGL_XRENDER_COMPOSITE']:
+ gl_provider = 'EGL'
+ else:
+ gl_provider = 'GLX'
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
+ gl_provider = 'EGL'
+
+ if CONFIG['MOZ_GL_PROVIDER']:
+ gl_provider = CONFIG['MOZ_GL_PROVIDER']
+@@ -114,16 +114,21 @@ elif gl_provider == 'GLX':
+ SOURCES += [
+ 'GLContextProviderGLX.cpp',
+ 'SharedSurfaceGLX.cpp'
+ ]
+ EXPORTS += [
+ 'SharedSurfaceGLX.h'
+ ]
+
++if CONFIG['MOZ_WAYLAND']:
++ SOURCES += [
++ 'GLContextProviderWayland.cpp',
++ ]
++
+ UNIFIED_SOURCES += [
+ 'AndroidSurfaceTexture.cpp',
+ 'DecomposeIntoNoRepeatTriangles.cpp',
+ 'EGLUtils.cpp',
+ 'GfxTexturesReporter.cpp',
+ 'GLBlitHelper.cpp',
+ 'GLContext.cpp',
+ 'GLContextFeatures.cpp',
+
diff --git a/rb244012.patch b/rb244012.patch
new file mode 100644
index 0000000..a096b0e
--- /dev/null
+++ b/rb244012.patch
@@ -0,0 +1,44 @@
+diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h
+--- a/gfx/gl/GLContextProvider.h
++++ b/gfx/gl/GLContextProvider.h
+@@ -36,30 +36,38 @@ namespace gl {
+
+ #ifdef XP_MACOSX
+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderCGL
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderCGL
+ #endif
+
+-#if defined(MOZ_X11) && !defined(MOZ_WAYLAND)
++#if defined(MOZ_X11)
+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderGLX
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderGLX
+ #endif
+
+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderEGL
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+ #ifndef GL_CONTEXT_PROVIDER_DEFAULT
+ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL
+ #endif
+
++#if defined(MOZ_WAYLAND)
++ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderWayland
++ #include "GLContextProviderImpl.h"
++ #undef GL_CONTEXT_PROVIDER_NAME
++ #undef GL_CONTEXT_PROVIDER_DEFAULT
++ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWayland
++#endif
++
+ #if defined(MOZ_WIDGET_UIKIT)
+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderEAGL
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+ #ifndef GL_CONTEXT_PROVIDER_DEFAULT
+ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEAGL
+ #endif
+ #endif
+
diff --git a/rb245262.patch b/rb245262.patch
new file mode 100644
index 0000000..25550b5
--- /dev/null
+++ b/rb245262.patch
@@ -0,0 +1,29 @@
+diff --git a/security/sandbox/linux/SandboxFilter.cpp
b/security/sandbox/linux/SandboxFilter.cpp
+--- a/security/sandbox/linux/SandboxFilter.cpp
++++ b/security/sandbox/linux/SandboxFilter.cpp
+@@ -1048,16 +1048,24 @@ public:
+
+ case __NR_mprotect:
+ case __NR_brk:
+ case __NR_madvise:
+ // libc's realloc uses mremap (Bug 1286119); wasm does too (bug 1342385).
+ case __NR_mremap:
+ return Allow();
+
++ // Bug 1462640: Mesa libEGL uses mincore to test whether values
++ // are pointers, for reasons.
++ case __NR_mincore: {
++ Arg<size_t> length(1);
++ return If(length == getpagesize(), Allow())
++ .Else(SandboxPolicyCommon::EvaluateSyscall(sysno));
++ }
++
+ case __NR_sigaltstack:
+ return Allow();
+
+ #ifdef __NR_set_thread_area
+ case __NR_set_thread_area:
+ return Allow();
+ #endif
+
+
diff --git a/rb246410.patch b/rb246410.patch
new file mode 100644
index 0000000..ef31278
--- /dev/null
+++ b/rb246410.patch
@@ -0,0 +1,314 @@
+diff -up firefox-60.0.1/gfx/gl/GLScreenBuffer.cpp.rb246410
firefox-60.0.1/gfx/gl/GLScreenBuffer.cpp
+--- firefox-60.0.1/gfx/gl/GLScreenBuffer.cpp.rb246410 2018-05-16 07:38:30.000000000
+0200
++++ firefox-60.0.1/gfx/gl/GLScreenBuffer.cpp 2018-05-25 11:50:38.260890405 +0200
+@@ -29,7 +29,7 @@
+ #include "SharedSurfaceIO.h"
+ #endif
+
+-#ifdef GL_PROVIDER_GLX
++#ifdef MOZ_X11
+ #include "GLXLibrary.h"
+ #include "SharedSurfaceGLX.h"
+ #endif
+@@ -83,7 +83,7 @@ GLScreenBuffer::CreateFactory(GLContext*
+ if (useGl) {
+ #if defined(XP_MACOSX)
+ factory = SurfaceFactory_IOSurface::Create(gl, caps, ipcChannel, flags);
+-#elif defined(GL_PROVIDER_GLX)
++#elif defined(MOZ_X11)
+ if (sGLXLibrary.UseTextureFromPixmap())
+ factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
+ #elif defined(MOZ_WIDGET_UIKIT)
+@@ -119,7 +119,7 @@ GLScreenBuffer::CreateFactory(GLContext*
+ #endif
+ }
+
+-#ifdef GL_PROVIDER_GLX
++#ifdef MOZ_X11
+ if (!factory && sGLXLibrary.UseTextureFromPixmap()) {
+ factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
+ }
+diff -up firefox-60.0.1/gfx/layers/client/TextureClient.cpp.rb246410
firefox-60.0.1/gfx/layers/client/TextureClient.cpp
+--- firefox-60.0.1/gfx/layers/client/TextureClient.cpp.rb246410 2018-05-16
07:38:30.000000000 +0200
++++ firefox-60.0.1/gfx/layers/client/TextureClient.cpp 2018-05-25 11:50:38.260890405
+0200
+@@ -45,10 +45,8 @@
+ #endif
+ #ifdef MOZ_X11
+ #include "mozilla/layers/TextureClientX11.h"
+-#ifdef GL_PROVIDER_GLX
+ #include "GLXLibrary.h"
+ #endif
+-#endif
+
+ #ifdef XP_MACOSX
+ #include "mozilla/layers/MacIOSurfaceTextureClientOGL.h"
+@@ -1122,7 +1120,6 @@ TextureClient::CreateForDrawing(TextureF
+ {
+ data = X11TextureData::Create(aSize, aFormat, aTextureFlags, aAllocator);
+ }
+-#ifdef GL_PROVIDER_GLX
+ if (!data && aLayersBackend == LayersBackend::LAYERS_OPENGL &&
+ type == gfxSurfaceType::Xlib &&
+ aFormat != SurfaceFormat::A8 &&
+@@ -1131,7 +1128,6 @@ TextureClient::CreateForDrawing(TextureF
+ data = X11TextureData::Create(aSize, aFormat, aTextureFlags, aAllocator);
+ }
+ #endif
+-#endif
+
+ #ifdef XP_MACOSX
+ if (!data && gfxPrefs::UseIOSurfaceTextures()) {
+diff -up firefox-60.0.1/gfx/layers/composite/X11TextureHost.cpp.rb246410
firefox-60.0.1/gfx/layers/composite/X11TextureHost.cpp
+--- firefox-60.0.1/gfx/layers/composite/X11TextureHost.cpp.rb246410 2018-05-16
07:38:29.000000000 +0200
++++ firefox-60.0.1/gfx/layers/composite/X11TextureHost.cpp 2018-05-25 11:50:38.260890405
+0200
+@@ -7,10 +7,8 @@
+ #include "X11TextureHost.h"
+ #include "mozilla/layers/BasicCompositor.h"
+ #include "mozilla/layers/X11TextureSourceBasic.h"
+-#ifdef GL_PROVIDER_GLX
+ #include "mozilla/layers/CompositorOGL.h"
+ #include "mozilla/layers/X11TextureSourceOGL.h"
+-#endif
+ #include "gfxXlibSurface.h"
+ #include "gfx2DGlue.h"
+
+@@ -43,12 +41,10 @@ X11TextureHost::Lock()
+ mTextureSource =
+ new X11TextureSourceBasic(mCompositor->AsBasicCompositor(), mSurface);
+ break;
+-#ifdef GL_PROVIDER_GLX
+ case LayersBackend::LAYERS_OPENGL:
+ mTextureSource =
+ new X11TextureSourceOGL(mCompositor->AsCompositorOGL(), mSurface);
+ break;
+-#endif
+ default:
+ return false;
+ }
+@@ -78,11 +74,9 @@ X11TextureHost::GetFormat() const
+ return SurfaceFormat::UNKNOWN;
+ }
+ gfxContentType type = mSurface->GetContentType();
+-#ifdef GL_PROVIDER_GLX
+ if (mCompositor->GetBackendType() == LayersBackend::LAYERS_OPENGL) {
+ return X11TextureSourceOGL::ContentTypeToSurfaceFormat(type);
+ }
+-#endif
+ return X11TextureSourceBasic::ContentTypeToSurfaceFormat(type);
+ }
+
+diff -up firefox-60.0.1/gfx/layers/ipc/ShadowLayerUtilsX11.cpp.rb246410
firefox-60.0.1/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
+--- firefox-60.0.1/gfx/layers/ipc/ShadowLayerUtilsX11.cpp.rb246410 2018-05-16
07:38:30.000000000 +0200
++++ firefox-60.0.1/gfx/layers/ipc/ShadowLayerUtilsX11.cpp 2018-05-25 11:50:38.260890405
+0200
+@@ -74,11 +74,9 @@ SurfaceDescriptorX11::SurfaceDescriptorX
+ mFormat = cairo_xlib_surface_get_visual(aSurf->CairoSurface())->visualid;
+ }
+
+-#ifdef GL_PROVIDER_GLX
+ if (aForwardGLX) {
+ mGLXPixmap = aSurf->GetGLXPixmap();
+ }
+-#endif
+ }
+
+ SurfaceDescriptorX11::SurfaceDescriptorX11(Drawable aDrawable, XID aFormatID,
+@@ -109,10 +107,8 @@ SurfaceDescriptorX11::OpenForeign() cons
+ surf = new gfxXlibSurface(display, mId, visual, mSize);
+ }
+
+-#ifdef GL_PROVIDER_GLX
+ if (mGLXPixmap)
+ surf->BindGLXPixmap(mGLXPixmap);
+-#endif
+
+ return surf->CairoStatus() ? nullptr : surf.forget();
+ }
+diff -up firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.cpp.rb246410
firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.cpp
+--- firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.cpp.rb246410 2018-05-16
07:38:30.000000000 +0200
++++ firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.cpp 2018-05-25
11:50:38.260890405 +0200
+@@ -4,7 +4,7 @@
+ * 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/. */
+
+-#ifdef GL_PROVIDER_GLX
++#ifdef MOZ_X11
+
+ #include "X11TextureSourceOGL.h"
+ #include "gfxXlibSurface.h"
+diff -up firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.h.rb246410
firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.h
+--- firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.h.rb246410 2018-05-16
07:38:30.000000000 +0200
++++ firefox-60.0.1/gfx/layers/opengl/X11TextureSourceOGL.h 2018-05-25 11:50:38.260890405
+0200
+@@ -7,7 +7,7 @@
+ #ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H
+ #define MOZILLA_GFX_X11TEXTURESOURCEOGL__H
+
+-#ifdef GL_PROVIDER_GLX
++#ifdef MOZ_X11
+
+ #include "mozilla/layers/CompositorOGL.h"
+ #include "mozilla/layers/TextureHostOGL.h"
+diff -up firefox-60.0.1/gfx/thebes/gfxPlatformGtk.cpp.rb246410
firefox-60.0.1/gfx/thebes/gfxPlatformGtk.cpp
+--- firefox-60.0.1/gfx/thebes/gfxPlatformGtk.cpp.rb246410 2018-05-25 11:50:38.250890430
+0200
++++ firefox-60.0.1/gfx/thebes/gfxPlatformGtk.cpp 2018-05-25 11:52:21.336628487 +0200
+@@ -41,11 +41,9 @@
+ #include "mozilla/Preferences.h"
+ #include "mozilla/X11Util.h"
+
+-#ifdef GL_PROVIDER_GLX
+ #include "GLContextProvider.h"
+ #include "GLContextGLX.h"
+ #include "GLXLibrary.h"
+-#endif
+
+ /* Undefine the Status from Xlib since it will conflict with system headers on OSX */
+ #if defined(__APPLE__) && defined(Status)
+@@ -528,7 +526,7 @@ gfxPlatformGtk::GetPlatformCMSOutputProf
+ }
+
+
+-#ifdef GL_PROVIDER_GLX
++#ifdef MOZ_X11
+
+ class GLXVsyncSource final : public VsyncSource
+ {
+diff -up firefox-60.0.1/gfx/thebes/gfxPlatformGtk.h.rb246410
firefox-60.0.1/gfx/thebes/gfxPlatformGtk.h
+--- firefox-60.0.1/gfx/thebes/gfxPlatformGtk.h.rb246410 2018-05-16 07:38:30.000000000
+0200
++++ firefox-60.0.1/gfx/thebes/gfxPlatformGtk.h 2018-05-25 11:50:38.260890405 +0200
+@@ -117,7 +117,7 @@ public:
+
+ bool AccelerateLayersByDefault() override;
+
+-#ifdef GL_PROVIDER_GLX
++#ifdef MOZ_X11
+ already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource()
override;
+ #endif
+
+diff -up firefox-60.0.1/gfx/thebes/gfxXlibSurface.cpp.rb246410
firefox-60.0.1/gfx/thebes/gfxXlibSurface.cpp
+--- firefox-60.0.1/gfx/thebes/gfxXlibSurface.cpp.rb246410 2018-05-16 07:38:30.000000000
+0200
++++ firefox-60.0.1/gfx/thebes/gfxXlibSurface.cpp 2018-05-25 11:51:59.741683360 +0200
+@@ -25,9 +25,7 @@ using namespace mozilla::gfx;
+
+ gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual)
+ : mPixmapTaken(false), mDisplay(dpy), mDrawable(drawable)
+-#if defined(GL_PROVIDER_GLX)
+ , mGLXPixmap(X11None)
+-#endif
+ {
+ const gfx::IntSize size = DoSizeQuery();
+ cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, size.width,
size.height);
+@@ -36,9 +34,7 @@ gfxXlibSurface::gfxXlibSurface(Display *
+
+ gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const
gfx::IntSize& size)
+ : mPixmapTaken(false), mDisplay(dpy), mDrawable(drawable)
+-#if defined(GL_PROVIDER_GLX)
+ , mGLXPixmap(X11None)
+-#endif
+ {
+ NS_ASSERTION(Factory::CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
+ "Bad size");
+@@ -51,9 +47,7 @@ gfxXlibSurface::gfxXlibSurface(Screen *s
+ const gfx::IntSize& size)
+ : mPixmapTaken(false), mDisplay(DisplayOfScreen(screen)),
+ mDrawable(drawable)
+-#if defined(GL_PROVIDER_GLX)
+- , mGLXPixmap(X11None)
+-#endif
++ , mGLXPixmap(X11None)
+ {
+ NS_ASSERTION(Factory::CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
+ "Bad Size");
+@@ -67,9 +61,7 @@ gfxXlibSurface::gfxXlibSurface(Screen *s
+
+ gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf)
+ : mPixmapTaken(false)
+-#if defined(GL_PROVIDER_GLX)
+- , mGLXPixmap(X11None)
+-#endif
++ , mGLXPixmap(X11None)
+ {
+ NS_PRECONDITION(cairo_surface_status(csurf) == 0,
+ "Not expecting an error surface");
+@@ -84,11 +76,9 @@ gfxXlibSurface::~gfxXlibSurface()
+ {
+ // gfxASurface's destructor calls RecordMemoryFreed().
+ if (mPixmapTaken) {
+-#if defined(GL_PROVIDER_GLX)
+ if (mGLXPixmap) {
+ gl::sGLXLibrary.DestroyPixmap(mDisplay, mGLXPixmap);
+ }
+-#endif
+ XFreePixmap (mDisplay, mDrawable);
+ }
+ }
+@@ -120,7 +110,7 @@ gfxXlibSurface::TakePixmap()
+ // The bit depth returned from Cairo is technically int, but this is
+ // the last place we'd be worried about that scenario.
+ unsigned int bitDepth = cairo_xlib_surface_get_depth(CairoSurface());
+- MOZ_ASSERT((bitDepth % 8) == 0, "Memory used not recorded correctly");
++ MOZ_ASSERT((bitDepth % 8) == 0, "Memory used not recorded correctly");
+
+ // Divide by 8 because surface_get_depth gives us the number of *bits* per
+ // pixel.
+@@ -272,7 +262,7 @@ gfxXlibSurface::CreateSimilarSurface(gfx
+ void
+ gfxXlibSurface::Finish()
+ {
+-#if defined(GL_PROVIDER_GLX)
++#if defined(MOZ_X11)
+ if (mPixmapTaken && mGLXPixmap) {
+ gl::sGLXLibrary.DestroyPixmap(mDisplay, mGLXPixmap);
+ mGLXPixmap = X11None;
+@@ -498,7 +488,7 @@ gfxXlibSurface::DepthOfVisual(const Scre
+ NS_ERROR("Visual not on Screen.");
+ return 0;
+ }
+-
++
+ /* static */
+ Visual*
+ gfxXlibSurface::FindVisual(Screen *screen, gfxImageFormat format)
+@@ -587,7 +577,7 @@ gfxXlibSurface::XRenderFormat()
+ return cairo_xlib_surface_get_xrender_format(CairoSurface());
+ }
+
+-#if defined(GL_PROVIDER_GLX)
++#if defined(MOZ_X11)
+ GLXPixmap
+ gfxXlibSurface::GetGLXPixmap()
+ {
+diff -up firefox-60.0.1/gfx/thebes/gfxXlibSurface.h.rb246410
firefox-60.0.1/gfx/thebes/gfxXlibSurface.h
+--- firefox-60.0.1/gfx/thebes/gfxXlibSurface.h.rb246410 2018-05-16 07:38:30.000000000
+0200
++++ firefox-60.0.1/gfx/thebes/gfxXlibSurface.h 2018-05-25 11:50:38.261890402 +0200
+@@ -12,9 +12,7 @@
+ #include <X11/Xlib.h>
+ #include "X11UndefineNone.h"
+
+-#if defined(GL_PROVIDER_GLX)
+ #include "GLXLibrary.h"
+-#endif
+
+ #include "nsSize.h"
+
+@@ -86,12 +84,10 @@ public:
+ // Find a visual and colormap pair suitable for rendering to this surface.
+ bool GetColormapAndVisual(Colormap* colormap, Visual **visual);
+
+-#if defined(GL_PROVIDER_GLX)
+ GLXPixmap GetGLXPixmap();
+ // Binds a GLXPixmap backed by this context's surface.
+ // Primarily for use in sharing surfaces.
+ void BindGLXPixmap(GLXPixmap aPixmap);
+-#endif
+
+ // Return true if cairo will take its slow path when this surface is used
+ // in a pattern with EXTEND_PAD. As a workaround for XRender's RepeatPad
+@@ -114,9 +110,7 @@ protected:
+
+ const mozilla::gfx::IntSize DoSizeQuery();
+
+-#if defined(GL_PROVIDER_GLX)
+ GLXPixmap mGLXPixmap;
+-#endif
+ };
+
+ #endif /* GFX_XLIBSURFACE_H */
diff --git a/rhbz-1354671.patch b/rhbz-1354671.patch
index 7164e3d..6ee89b7 100644
--- a/rhbz-1354671.patch
+++ b/rhbz-1354671.patch
@@ -1,16 +1,12 @@
-@@ -, +, @@
----
- layout/base/nsIPresShell.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
---- a/layout/base/nsIPresShell.h
-+++ a/layout/base/nsIPresShell.h
-@@ -224,7 +224,7 @@ public:
- * to the same aSize value. AllocateFrame returns zero-filled memory.
- * AllocateFrame is infallible and will abort on out-of-memory.
+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:
+ * 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);
---
diff --git a/rhbz-966424.patch b/rhbz-966424.patch
deleted file mode 100644
index 7579d09..0000000
--- a/rhbz-966424.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -up firefox-33.0/mozilla-release/toolkit/modules/CertUtils.jsm.966424
firefox-33.0/mozilla-release/toolkit/modules/CertUtils.jsm
---- firefox-33.0/mozilla-release/toolkit/modules/CertUtils.jsm.966424 2014-10-14
08:12:14.358697255 +0200
-+++ firefox-33.0/mozilla-release/toolkit/modules/CertUtils.jsm 2014-10-14
08:17:59.962181908 +0200
-@@ -174,7 +174,9 @@ this.checkCert =
- }
-
- function isBuiltinToken(tokenName) {
-- return tokenName == "Builtin Object Token";
-+ return tokenName == "Builtin Object Token" ||
-+ tokenName == "Default Trust" ||
-+ tokenName == "System Trust";
- }
-
- /**
diff --git a/sources b/sources
index 3f3046e..3269786 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (icecat-52.9.0-gnu1.tar.bz2) =
c0cd14b187c7eef4a515c601fcdfbb5e1f01a461978052d237433f66d5fef97821e9b7f10ee52b81f4067670d5ccbdaee18b57b20baddc3962671a0c5649bc93
+SHA512 (icecat-60.2.0-gnu1.tar.bz2) =
f3030aaefe98adbff092d9281577bbad61f165905d017b2d73c2eae9f43967546c15a71c1f43e086d6bdd026a40d795abaf59da83f249ef4aaed7de712f263b1
SHA512 (icecat-COPYING-licensefiles.tar.gz) =
ed541845170f1d209e322b0def3248d571e0c42c4a17c74e83197e743bd8a128a1475f5312d905c8e70d047eddeac17e604373892eb6d5f1720c5c361849c42c
diff --git a/widget-rebase.patch b/widget-rebase.patch
deleted file mode 100644
index 45a3b91..0000000
--- a/widget-rebase.patch
+++ /dev/null
@@ -1,1159 +0,0 @@
-diff -up firefox-52.0/widget/gtk/gtk3drawing.cpp.widget-rebase
firefox-52.0/widget/gtk/gtk3drawing.cpp
---- firefox-52.0/widget/gtk/gtk3drawing.cpp.widget-rebase 2017-02-27 17:11:05.000000000
+0100
-+++ firefox-52.0/widget/gtk/gtk3drawing.cpp 2017-03-10 12:20:30.232205991 +0100
-@@ -36,6 +36,10 @@ static gboolean is_initialized;
- static gint
- moz_gtk_get_tab_thickness(GtkStyleContext *style);
-
-+static gint
-+moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
-+ GtkWidgetState* state, GtkTextDirection direction);
-+
- // GetStateFlagsFromGtkWidgetState() can be safely used for the specific
- // GtkWidgets that set both prelight and active flags. For other widgets,
- // either the GtkStateFlags or Gecko's GtkWidgetState need to be carefully
-@@ -167,7 +171,7 @@ moz_gtk_menuitem_get_horizontal_padding(
- gint
- moz_gtk_checkmenuitem_get_horizontal_padding(gint* horizontal_padding)
- {
-- GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_CHECKMENUITEM_CONTAINER);
-+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_CHECKMENUITEM);
- gtk_style_context_get_style(style,
- "horizontal-padding", horizontal_padding,
- nullptr);
-@@ -463,7 +467,7 @@ moz_gtk_get_widget_min_size(WidgetNodeTy
- }
-
- static void
--moz_gtk_rectangle_inset(GdkRectangle* rect, GtkBorder& aBorder)
-+Inset(GdkRectangle* rect, GtkBorder& aBorder)
- {
- MOZ_ASSERT(rect);
- rect->x += aBorder.left;
-@@ -472,17 +476,29 @@ moz_gtk_rectangle_inset(GdkRectangle* re
- rect->height -= aBorder.top + aBorder.bottom;
- }
-
--/* Subtracting margin is used to inset drawing of element which can have margins,
-- * like scrollbar, scrollbar's trough, thumb and scrollbar's button */
-+// Inset a rectangle by the margins specified in a style context.
- static void
--moz_gtk_subtract_margin(GtkStyleContext* style, GdkRectangle* rect)
-+InsetByMargin(GdkRectangle* rect, GtkStyleContext* style)
- {
- MOZ_ASSERT(rect);
- GtkBorder margin;
-
- gtk_style_context_get_margin(style, gtk_style_context_get_state(style),
- &margin);
-- moz_gtk_rectangle_inset(rect, margin);
-+ Inset(rect, margin);
-+}
-+
-+// Inset a rectangle by the border and padding specified in a style context.
-+static void
-+InsetByBorderPadding(GdkRectangle* rect, GtkStyleContext* style)
-+{
-+ GtkStateFlags state = gtk_style_context_get_state(style);
-+ GtkBorder padding, border;
-+
-+ gtk_style_context_get_padding(style, state, &padding);
-+ Inset(rect, padding);
-+ gtk_style_context_get_border(style, state, &border);
-+ Inset(rect, border);
- }
-
- static gint
-@@ -528,7 +544,7 @@ moz_gtk_scrollbar_button_paint(cairo_t *
- if (gtk_check_version(3,20,0) == nullptr) {
- // The "trough-border" is not used since GTK 3.20. The stepper margin
- // box occupies the full width of the "contents" gadget content box.
-- moz_gtk_subtract_margin(style, &rect);
-+ InsetByMargin(&rect, style);
- } else {
- // Scrollbar button has to be inset by trough_border because its DOM
- // element is filling width of vertical scrollbar's track (or height
-@@ -601,7 +617,7 @@ moz_gtk_draw_styled_frame(GtkStyleContex
- {
- GdkRectangle rect = *aRect;
- if (gtk_check_version(3, 6, 0) == nullptr) {
-- moz_gtk_subtract_margin(style, &rect);
-+ InsetByMargin(&rect, style);
- }
- gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
- gtk_render_frame(style, cr, rect.x, rect.y, rect.width, rect.height);
-@@ -664,7 +680,7 @@ moz_gtk_scrollbar_thumb_paint(WidgetNode
-
- GdkRectangle rect = *aRect;
- GtkStyleContext* style = ClaimStyleContext(widget, direction, state_flags);
-- moz_gtk_subtract_margin(style, &rect);
-+ InsetByMargin(&rect, style);
-
- gtk_render_slider(style, cr,
- rect.x,
-@@ -865,7 +881,7 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
- }
-
- static gint
--moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* rect,
-+moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* aRect,
- GtkWidgetState* state,
- GtkTextDirection direction)
- {
-@@ -882,24 +898,24 @@ moz_gtk_text_view_paint(cairo_t *cr, Gdk
-
- GtkStyleContext* style_frame =
- ClaimStyleContext(MOZ_GTK_SCROLLED_WINDOW, direction, state_flags);
-- gtk_render_frame(style_frame, cr, rect->x, rect->y, rect->width,
rect->height);
-+ gtk_render_frame(style_frame, cr,
-+ aRect->x, aRect->y, aRect->width, aRect->height);
-+
-+ GdkRectangle rect = *aRect;
-+ InsetByBorderPadding(&rect, style_frame);
-
-- GtkBorder border, padding;
-- gtk_style_context_get_border(style_frame, state_flags, &border);
-- gtk_style_context_get_padding(style_frame, state_flags, &padding);
- ReleaseStyleContext(style_frame);
-
- GtkStyleContext* style =
- ClaimStyleContext(MOZ_GTK_TEXT_VIEW, direction, state_flags);
--
-- gint xthickness = border.left + padding.left;
-- gint ythickness = border.top + padding.top;
--
-- gtk_render_background(style, cr,
-- rect->x + xthickness, rect->y + ythickness,
-- rect->width - 2 * xthickness,
-- rect->height - 2 * ythickness);
--
-+ gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
-+ ReleaseStyleContext(style);
-+ // There is a separate "text" window, which usually provides the
-+ // background behind the text. However, this is transparent in Ambiance
-+ // for GTK 3.20, in which case the MOZ_GTK_TEXT_VIEW background is
-+ // visible.
-+ style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW_TEXT, direction, state_flags);
-+ gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
- ReleaseStyleContext(style);
-
- return MOZ_GTK_SUCCESS;
-@@ -1291,6 +1307,7 @@ moz_gtk_tooltip_paint(cairo_t *cr, const
- GdkRectangle rect = *aRect;
- gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
- gtk_render_frame(style, cr, rect.x, rect.y, rect.width, rect.height);
-+ ReleaseStyleContext(style);
-
- // Horizontal Box drawing
- //
-@@ -1300,33 +1317,26 @@ moz_gtk_tooltip_paint(cairo_t *cr, const
- // 6px margin.
- // For drawing Horizontal Box we have to inset drawing area by that 6px
- // plus its CSS margin.
-- GtkStyleContext* boxStyle =
-- CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0), style);
-+ GtkStyleContext* boxStyle = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX, direction);
-
- rect.x += 6;
- rect.y += 6;
- rect.width -= 12;
- rect.height -= 12;
-
-- moz_gtk_subtract_margin(boxStyle, &rect);
-+ InsetByMargin(&rect, boxStyle);
- gtk_render_background(boxStyle, cr, rect.x, rect.y, rect.width, rect.height);
- gtk_render_frame(boxStyle, cr, rect.x, rect.y, rect.width, rect.height);
-
- // Label drawing
-- GtkBorder padding, border;
-- gtk_style_context_get_padding(boxStyle, GTK_STATE_FLAG_NORMAL, &padding);
-- moz_gtk_rectangle_inset(&rect, padding);
-- gtk_style_context_get_border(boxStyle, GTK_STATE_FLAG_NORMAL, &border);
-- moz_gtk_rectangle_inset(&rect, border);
-+ InsetByBorderPadding(&rect, boxStyle);
-+ ReleaseStyleContext(boxStyle);
-
- GtkStyleContext* labelStyle =
-- CreateStyleForWidget(gtk_label_new(nullptr), boxStyle);
-+ ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX_LABEL, direction);
- moz_gtk_draw_styled_frame(labelStyle, cr, &rect, false);
-- g_object_unref(labelStyle);
-+ ReleaseStyleContext(labelStyle);
-
-- g_object_unref(boxStyle);
--
-- ReleaseStyleContext(style);
- return MOZ_GTK_SUCCESS;
- }
-
-@@ -1335,17 +1345,9 @@ moz_gtk_resizer_paint(cairo_t *cr, GdkRe
- GtkWidgetState* state,
- GtkTextDirection direction)
- {
-- GtkStyleContext* style;
--
-- // gtk_render_handle() draws a background, so use GtkTextView and its
-- // GTK_STYLE_CLASS_VIEW to match the background with textarea elements.
-- // The resizer is drawn with shaded variants of the background color, and
-- // so a transparent background would lead to a transparent resizer.
-- style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW, GTK_TEXT_DIR_LTR,
-- GetStateFlagsFromGtkWidgetState(state));
-- // TODO - we need to save/restore style when gtk 3.20 CSS node path
-- // is used
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
-+ GtkStyleContext* style =
-+ ClaimStyleContext(MOZ_GTK_RESIZER, GTK_TEXT_DIR_LTR,
-+ GetStateFlagsFromGtkWidgetState(state));
-
- // Workaround unico not respecting the text direction for resizers.
- // See bug 1174248.
-@@ -1392,17 +1394,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
- GtkTextDirection direction,
- WidgetNodeType widget)
- {
-- GtkStyleContext* style;
--
-- if (gtk_check_version(3, 20, 0) != nullptr) {
-- /* Ask for MOZ_GTK_PROGRESS_TROUGH instead of MOZ_GTK_PROGRESSBAR
-- * because ClaimStyleContext() saves/restores that style */
-- style = ClaimStyleContext(MOZ_GTK_PROGRESS_TROUGH, direction);
-- gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
-- } else {
-- style = ClaimStyleContext(MOZ_GTK_PROGRESS_CHUNK, direction);
-- }
-+ GtkStyleContext* style =
-+ ClaimStyleContext(MOZ_GTK_PROGRESS_CHUNK, direction);
-
- if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
- widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
-@@ -1786,6 +1779,13 @@ static gint
- moz_gtk_menu_separator_paint(cairo_t *cr, GdkRectangle* rect,
- GtkTextDirection direction)
- {
-+ GtkWidgetState defaultState = { 0 };
-+ moz_gtk_menu_item_paint(MOZ_GTK_MENUSEPARATOR, cr, rect,
-+ &defaultState, direction);
-+
-+ if (gtk_get_minor_version() >= 20)
-+ return MOZ_GTK_SUCCESS;
-+
- GtkStyleContext* style;
- gboolean wide_separators;
- gint separator_height;
-@@ -1833,36 +1833,39 @@ moz_gtk_menu_item_paint(WidgetNodeType w
- GtkWidgetState* state, GtkTextDirection direction)
- {
- gint x, y, w, h;
-+ guint minorVersion = gtk_get_minor_version();
-+ GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
-
-- if (state->inHover && !state->disabled) {
-- GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
-- GtkStyleContext* style =
-- ClaimStyleContext(widget, direction, state_flags);
--
-- bool pre_3_6 = gtk_check_version(3, 6, 0) != nullptr;
-- if (pre_3_6) {
-- // GTK+ 3.4 saves the style context and adds the menubar class to
-- // menubar children, but does each of these only when drawing, not
-- // during layout.
-- gtk_style_context_save(style);
-- if (widget == MOZ_GTK_MENUBARITEM) {
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
-- }
-+ // GTK versions prior to 3.8 render the background and frame only when not
-+ // a separator and in hover prelight.
-+ if (minorVersion < 8 && (widget == MOZ_GTK_MENUSEPARATOR ||
-+ !(state_flags & GTK_STATE_FLAG_PRELIGHT)))
-+ return MOZ_GTK_SUCCESS;
-+
-+ GtkStyleContext* style = ClaimStyleContext(widget, direction, state_flags);
-+
-+ if (minorVersion < 6) {
-+ // GTK+ 3.4 saves the style context and adds the menubar class to
-+ // menubar children, but does each of these only when drawing, not
-+ // during layout.
-+ gtk_style_context_save(style);
-+ if (widget == MOZ_GTK_MENUBARITEM) {
-+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
- }
-+ }
-
-- x = rect->x;
-- y = rect->y;
-- w = rect->width;
-- h = rect->height;
-+ x = rect->x;
-+ y = rect->y;
-+ w = rect->width;
-+ h = rect->height;
-
-- gtk_render_background(style, cr, x, y, w, h);
-- gtk_render_frame(style, cr, x, y, w, h);
-+ gtk_render_background(style, cr, x, y, w, h);
-+ gtk_render_frame(style, cr, x, y, w, h);
-
-- if (pre_3_6) {
-- gtk_style_context_restore(style);
-- }
-- ReleaseStyleContext(style);
-+ if (minorVersion < 6) {
-+ gtk_style_context_restore(style);
- }
-+ ReleaseStyleContext(style);
-
- return MOZ_GTK_SUCCESS;
- }
-@@ -1882,16 +1885,16 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
- return MOZ_GTK_SUCCESS;
- }
-
--// See gtk_real_check_menu_item_draw_indicator() for reference.
-+// For reference, see gtk_check_menu_item_size_allocate() in GTK versions after
-+// 3.20 and gtk_real_check_menu_item_draw_indicator() in earlier versions.
- static gint
--moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
-+moz_gtk_check_menu_item_paint(WidgetNodeType widgetType,
-+ cairo_t *cr, GdkRectangle* rect,
- GtkWidgetState* state,
-- gboolean checked, gboolean isradio,
-- GtkTextDirection direction)
-+ gboolean checked, GtkTextDirection direction)
- {
- GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
- GtkStyleContext* style;
-- GtkBorder padding;
- gint indicator_size, horizontal_padding;
- gint x, y;
-
-@@ -1901,35 +1904,44 @@ moz_gtk_check_menu_item_paint(cairo_t *c
- state_flags = static_cast<GtkStateFlags>(state_flags|checkbox_check_state);
- }
-
-- style = ClaimStyleContext(isradio ? MOZ_GTK_RADIOMENUITEM_CONTAINER :
-- MOZ_GTK_CHECKMENUITEM_CONTAINER,
-- direction);
-+ bool pre_3_20 = gtk_get_minor_version() < 20;
-+ gint offset;
-+ style = ClaimStyleContext(widgetType, direction);
- gtk_style_context_get_style(style,
- "indicator-size", &indicator_size,
- "horizontal-padding",
&horizontal_padding,
- NULL);
-+ if (pre_3_20) {
-+ GtkBorder padding;
-+ gtk_style_context_get_padding(style, state_flags, &padding);
-+ offset = horizontal_padding + padding.left + 2;
-+ } else {
-+ GdkRectangle r = { 0 };
-+ InsetByMargin(&r, style);
-+ InsetByBorderPadding(&r, style);
-+ offset = r.x;
-+ }
- ReleaseStyleContext(style);
-
-- style = ClaimStyleContext(isradio ? MOZ_GTK_RADIOMENUITEM :
-- MOZ_GTK_CHECKMENUITEM,
-- direction, state_flags);
-- gtk_style_context_get_padding(style, state_flags, &padding);
-- gint offset = padding.left + 2;
-+ bool isRadio = (widgetType == MOZ_GTK_RADIOMENUITEM);
-+ WidgetNodeType indicatorType = isRadio ? MOZ_GTK_RADIOMENUITEM_INDICATOR
-+ : MOZ_GTK_CHECKMENUITEM_INDICATOR;
-+ style = ClaimStyleContext(indicatorType, direction, state_flags);
-
- if (direction == GTK_TEXT_DIR_RTL) {
-- x = rect->width - indicator_size - offset - horizontal_padding;
-+ x = rect->width - indicator_size - offset;
- }
- else {
-- x = rect->x + offset + horizontal_padding;
-+ x = rect->x + offset;
- }
- y = rect->y + (rect->height - indicator_size) / 2;
-
-- if (gtk_check_version(3, 20, 0) == nullptr) {
-+ if (!pre_3_20) {
- gtk_render_background(style, cr, x, y, indicator_size, indicator_size);
- gtk_render_frame(style, cr, x, y, indicator_size, indicator_size);
- }
-
-- if (isradio) {
-+ if (isRadio) {
- gtk_render_option(style, cr, x, y, indicator_size, indicator_size);
- } else {
- gtk_render_check(style, cr, x, y, indicator_size, indicator_size);
-@@ -2033,9 +2045,6 @@ moz_gtk_get_widget_border(WidgetNodeType
- if (widget == MOZ_GTK_TOOLBAR_BUTTON)
- gtk_style_context_restore(style);
-
-- // XXX: Subtract 1 pixel from the border to account for the added
-- // -moz-focus-inner border (Bug 1228281).
-- *left -= 1; *top -= 1; *right -= 1; *bottom -= 1;
- moz_gtk_add_style_border(style, left, top, right, bottom);
-
- ReleaseStyleContext(style);
-@@ -2174,12 +2183,15 @@ moz_gtk_get_widget_border(WidgetNodeType
- {
- // Bug 1274143 for MOZ_GTK_MENUBARITEM
- WidgetNodeType type =
-- widget == MOZ_GTK_MENUBARITEM || widget == MOZ_GTK_MENUITEM ?
-- MOZ_GTK_MENUITEM : MOZ_GTK_CHECKMENUITEM_CONTAINER;
-+ widget == MOZ_GTK_MENUBARITEM ? MOZ_GTK_MENUITEM : widget;
- style = ClaimStyleContext(type);
-
-- moz_gtk_add_style_padding(style, left, top, right, bottom);
--
-+ if (gtk_get_minor_version() < 20) {
-+ moz_gtk_add_style_padding(style, left, top, right, bottom);
-+ } else {
-+ moz_gtk_add_margin_border_padding(style,
-+ left, top, right, bottom);
-+ }
- ReleaseStyleContext(style);
- return MOZ_GTK_SUCCESS;
- }
-@@ -2188,7 +2200,6 @@ moz_gtk_get_widget_border(WidgetNodeType
- break;
- case MOZ_GTK_TOOLTIP:
- {
-- style = ClaimStyleContext(MOZ_GTK_TOOLTIP);
- // In GTK 3 there are 6 pixels of additional margin around the box.
- // See details there:
- //
https://github.com/GNOME/gtk/blob/5ea69a136bd7e4970b3a800390e20314665aaed...
-@@ -2197,21 +2208,16 @@ moz_gtk_get_widget_border(WidgetNodeType
- // We also need to add margin/padding/borders from Tooltip content.
- // Tooltip contains horizontal box, where icon and label is put.
- // We ignore icon as long as we don't have support for it.
-- GtkStyleContext* boxStyle =
-- CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0),
-- style);
-+ GtkStyleContext* boxStyle = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX);
- moz_gtk_add_margin_border_padding(boxStyle,
- left, top, right, bottom);
-+ ReleaseStyleContext(boxStyle);
-
-- GtkStyleContext* labelStyle =
-- CreateStyleForWidget(gtk_label_new(nullptr), boxStyle);
-+ GtkStyleContext* labelStyle = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX_LABEL);
- moz_gtk_add_margin_border_padding(labelStyle,
- left, top, right, bottom);
-+ ReleaseStyleContext(labelStyle);
-
-- g_object_unref(labelStyle);
-- g_object_unref(boxStyle);
--
-- ReleaseStyleContext(style);
- return MOZ_GTK_SUCCESS;
- }
- case MOZ_GTK_SCROLLBAR_VERTICAL:
-@@ -2500,11 +2506,11 @@ void
- moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
- gint* scale_height)
- {
-- WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
-- MOZ_GTK_SCALE_HORIZONTAL :
-- MOZ_GTK_SCALE_VERTICAL;
--
- if (gtk_check_version(3, 20, 0) != nullptr) {
-+ WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
-+ MOZ_GTK_SCALE_HORIZONTAL :
-+ MOZ_GTK_SCALE_VERTICAL;
-+
- gint thumb_length, thumb_height, trough_border;
- moz_gtk_get_scalethumb_metrics(orient, &thumb_length, &thumb_height);
-
-@@ -2520,12 +2526,10 @@ moz_gtk_get_scale_metrics(GtkOrientation
- }
- ReleaseStyleContext(style);
- } else {
-- GtkStyleContext* style = ClaimStyleContext(widget);
-- gtk_style_context_get(style, gtk_style_context_get_state(style),
-- "min-width", scale_width,
-- "min-height", scale_height,
-- nullptr);
-- ReleaseStyleContext(style);
-+ WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
-+ MOZ_GTK_SCALE_TROUGH_HORIZONTAL :
-+ MOZ_GTK_SCALE_TROUGH_VERTICAL;
-+ moz_gtk_get_widget_min_size(widget, scale_width, scale_height);
- }
- }
-
-@@ -2548,10 +2552,28 @@ moz_gtk_get_scalethumb_metrics(GtkOrient
- MOZ_GTK_SCALE_THUMB_HORIZONTAL:
- MOZ_GTK_SCALE_THUMB_VERTICAL;
- GtkStyleContext* style = ClaimStyleContext(widget);
-- gtk_style_context_get(style, gtk_style_context_get_state(style),
-- "min-width", thumb_length,
-- "min-height", thumb_height,
-+
-+ gint min_width, min_height;
-+ GtkStateFlags state = gtk_style_context_get_state(style);
-+ gtk_style_context_get(style, state,
-+ "min-width", &min_width,
-+ "min-height", &min_height,
- nullptr);
-+ GtkBorder margin;
-+ gtk_style_context_get_margin(style, state, &margin);
-+ gint margin_width = margin.left + margin.right;
-+ gint margin_height = margin.top + margin.bottom;
-+
-+ // Negative margin of slider element also determines its minimal size
-+ // so use bigger of those two values.
-+ if (min_width < -margin_width)
-+ min_width = -margin_width;
-+ if (min_height < -margin_height)
-+ min_height = -margin_height;
-+
-+ *thumb_length = min_width;
-+ *thumb_height = min_height;
-+
- ReleaseStyleContext(style);
- }
-
-@@ -2791,10 +2813,8 @@ moz_gtk_widget_paint(WidgetNodeType widg
- break;
- case MOZ_GTK_CHECKMENUITEM:
- case MOZ_GTK_RADIOMENUITEM:
-- return moz_gtk_check_menu_item_paint(cr, rect, state,
-- (gboolean) flags,
-- (widget == MOZ_GTK_RADIOMENUITEM),
-- direction);
-+ return moz_gtk_check_menu_item_paint(widget, cr, rect, state,
-+ (gboolean) flags, direction);
- break;
- case MOZ_GTK_SPLITTER_HORIZONTAL:
- return moz_gtk_vpaned_paint(cr, rect, state);
-diff -up firefox-52.0/widget/gtk/gtkdrawing.h.widget-rebase
firefox-52.0/widget/gtk/gtkdrawing.h
---- firefox-52.0/widget/gtk/gtkdrawing.h.widget-rebase 2017-02-27 17:11:05.000000000
+0100
-+++ firefox-52.0/widget/gtk/gtkdrawing.h 2017-03-10 12:20:30.233205986 +0100
-@@ -145,8 +145,11 @@ typedef enum {
- MOZ_GTK_ENTRY,
- /* Paints a GtkExpander. */
- MOZ_GTK_EXPANDER,
-- /* Paints a GtkTextView. */
-+ /* Paints a GtkTextView or gets the style context corresponding to the
-+ root node of a GtkTextView. */
- MOZ_GTK_TEXT_VIEW,
-+ /* The "text" window or node of a GtkTextView */
-+ MOZ_GTK_TEXT_VIEW_TEXT,
- /* Paints a GtkOptionMenu. */
- MOZ_GTK_DROPDOWN,
- /* Paints a dropdown arrow (a GtkButton containing a down GtkArrow). */
-@@ -160,11 +163,15 @@ typedef enum {
- MOZ_GTK_TOOLBAR_SEPARATOR,
- /* Paints a GtkToolTip */
- MOZ_GTK_TOOLTIP,
-+ /* Paints a GtkBox from GtkToolTip */
-+ MOZ_GTK_TOOLTIP_BOX,
-+ /* Paints a GtkLabel of GtkToolTip */
-+ MOZ_GTK_TOOLTIP_BOX_LABEL,
- /* Paints a GtkFrame (e.g. a status bar panel). */
- MOZ_GTK_FRAME,
- /* Paints the border of a GtkFrame */
- MOZ_GTK_FRAME_BORDER,
-- /* Paints a resize grip for a GtkWindow */
-+ /* Paints a resize grip for a GtkTextView */
- MOZ_GTK_RESIZER,
- /* Paints a GtkProgressBar. */
- MOZ_GTK_PROGRESSBAR,
-@@ -210,11 +217,13 @@ typedef enum {
- MOZ_GTK_MENUBARITEM,
- /* Paints items of popup menus. */
- MOZ_GTK_MENUITEM,
-- MOZ_GTK_IMAGEMENUITEM,
-- MOZ_GTK_CHECKMENUITEM_CONTAINER,
-- MOZ_GTK_RADIOMENUITEM_CONTAINER,
-+ /* Paints a menuitem with check indicator, or the gets the style context for
-+ a menuitem that contains a checkbox. */
- MOZ_GTK_CHECKMENUITEM,
-+ /* Gets the style context for a checkbox in a check menuitem. */
-+ MOZ_GTK_CHECKMENUITEM_INDICATOR,
- MOZ_GTK_RADIOMENUITEM,
-+ MOZ_GTK_RADIOMENUITEM_INDICATOR,
- MOZ_GTK_MENUSEPARATOR,
- /* GtkVPaned base class */
- MOZ_GTK_SPLITTER_HORIZONTAL,
-diff -up firefox-52.0/widget/gtk/mozgtk/mozgtk.c.widget-rebase
firefox-52.0/widget/gtk/mozgtk/mozgtk.c
---- firefox-52.0/widget/gtk/mozgtk/mozgtk.c.widget-rebase 2017-02-27 17:11:05.000000000
+0100
-+++ firefox-52.0/widget/gtk/mozgtk/mozgtk.c 2017-03-10 12:20:30.233205986 +0100
-@@ -245,7 +245,6 @@ STUB(gtk_icon_theme_get_icon_sizes)
- STUB(gtk_icon_theme_lookup_by_gicon)
- STUB(gtk_icon_theme_lookup_icon)
- STUB(gtk_image_get_type)
--STUB(gtk_image_menu_item_new)
- STUB(gtk_image_new)
- STUB(gtk_image_new_from_stock)
- STUB(gtk_image_set_from_pixbuf)
-diff -up firefox-52.0/widget/gtk/nsLookAndFeel.cpp.widget-rebase
firefox-52.0/widget/gtk/nsLookAndFeel.cpp
---- firefox-52.0/widget/gtk/nsLookAndFeel.cpp.widget-rebase 2017-02-27 17:11:05.000000000
+0100
-+++ firefox-52.0/widget/gtk/nsLookAndFeel.cpp 2017-03-10 13:54:36.918205357 +0100
-@@ -24,6 +24,7 @@
- #include "nsStyleConsts.h"
- #include "gfxFontConstants.h"
- #include "WidgetUtils.h"
-+#include "nsIXULRuntime.h"
-
- #include <dlfcn.h>
-
-@@ -47,9 +48,6 @@ nsLookAndFeel::nsLookAndFeel()
- : nsXPLookAndFeel(),
- #if (MOZ_WIDGET_GTK == 2)
- mStyle(nullptr),
--#else
-- mBackgroundStyle(nullptr),
-- mButtonStyle(nullptr),
- #endif
- mDefaultFontCached(false), mButtonFontCached(false),
- mFieldFontCached(false), mMenuFontCached(false)
-@@ -61,13 +59,27 @@ nsLookAndFeel::~nsLookAndFeel()
- {
- #if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
--#else
-- g_object_unref(mBackgroundStyle);
-- g_object_unref(mButtonStyle);
- #endif
- }
-
- #if MOZ_WIDGET_GTK != 2
-+// Modifies color |*aDest| as if a pattern of color |aSource| was painted with
-+// CAIRO_OPERATOR_OVER to a surface with color |*aDest|.
-+static void
-+ApplyColorOver(const GdkRGBA& aSource, GdkRGBA* aDest) {
-+ gdouble sourceCoef = aSource.alpha;
-+ gdouble destCoef = aDest->alpha * (1.0 - sourceCoef);
-+ gdouble resultAlpha = sourceCoef + destCoef;
-+ if (resultAlpha != 0.0) { // don't divide by zero
-+ destCoef /= resultAlpha;
-+ sourceCoef /= resultAlpha;
-+ aDest->red = sourceCoef * aSource.red + destCoef * aDest->red;
-+ aDest->green = sourceCoef * aSource.green + destCoef * aDest->green;
-+ aDest->blue = sourceCoef * aSource.blue + destCoef * aDest->blue;
-+ aDest->alpha = resultAlpha;
-+ }
-+}
-+
- static void
- GetLightAndDarkness(const GdkRGBA& aColor,
- double* aLightness, double* aDarkness)
-@@ -377,30 +389,39 @@ nsLookAndFeel::NativeGetColor(ColorID aI
- break;
- #else
- // css2
http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
-- case eColorID_activeborder:
-+ case eColorID_activeborder: {
- // active window border
-- gtk_style_context_get_border_color(mBackgroundStyle,
-+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
-+ gtk_style_context_get_border_color(style,
- GTK_STATE_FLAG_NORMAL, &gdk_color);
- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-+ ReleaseStyleContext(style);
- break;
-- case eColorID_inactiveborder:
-+ }
-+ case eColorID_inactiveborder: {
- // inactive window border
-- gtk_style_context_get_border_color(mBackgroundStyle,
-- GTK_STATE_FLAG_INSENSITIVE,
-+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
-+ gtk_style_context_get_border_color(style,
-+ GTK_STATE_FLAG_INSENSITIVE,
- &gdk_color);
- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-+ ReleaseStyleContext(style);
- break;
-+ }
- case eColorID_graytext: // disabled text in windows, menus, etc.
- case eColorID_inactivecaptiontext: // text in inactive window caption
- aColor = sMenuTextInactive;
- break;
-- case eColorID_inactivecaption:
-+ case eColorID_inactivecaption: {
- // inactive window caption
-- gtk_style_context_get_background_color(mBackgroundStyle,
-+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
-+ gtk_style_context_get_background_color(style,
- GTK_STATE_FLAG_INSENSITIVE,
- &gdk_color);
- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-+ ReleaseStyleContext(style);
- break;
-+ }
- #endif
- case eColorID_infobackground:
- // tooltip background color
-@@ -521,18 +542,24 @@ nsLookAndFeel::NativeGetColor(ColorID aI
- case eColorID__moz_fieldtext:
- aColor = sMozFieldText;
- break;
-- case eColorID__moz_buttondefault:
-- // default button border color
-- gtk_style_context_get_border_color(mButtonStyle,
-+ case eColorID__moz_buttondefault: {
-+ // default button border color
-+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_BUTTON);
-+ gtk_style_context_get_border_color(style,
- GTK_STATE_FLAG_NORMAL, &gdk_color);
- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-+ ReleaseStyleContext(style);
- break;
-- case eColorID__moz_buttonhoverface:
-- gtk_style_context_get_background_color(mButtonStyle,
-+ }
-+ case eColorID__moz_buttonhoverface: {
-+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_BUTTON);
-+ gtk_style_context_get_background_color(style,
- GTK_STATE_FLAG_PRELIGHT,
- &gdk_color);
- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-+ ReleaseStyleContext(style);
- break;
-+ }
- case eColorID__moz_buttonhovertext:
- aColor = sButtonHoverText;
- break;
-@@ -1029,16 +1056,6 @@ nsLookAndFeel::GetFontImpl(FontID aID, n
- return true;
- }
-
--#if (MOZ_WIDGET_GTK == 3)
--static GtkStyleContext*
--create_context(GtkWidgetPath *path)
--{
-- GtkStyleContext *style = gtk_style_context_new();
-- gtk_style_context_set_path(style, path);
-- return(style);
--}
--#endif
--
- void
- nsLookAndFeel::Init()
- {
-@@ -1129,78 +1146,54 @@ nsLookAndFeel::Init()
- g_object_set(settings, dark_setting, FALSE, nullptr);
- }
-
-- GtkWidgetPath *path = gtk_widget_path_new();
-- gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
--
-- mBackgroundStyle = create_context(path);
-- gtk_style_context_add_class(mBackgroundStyle, GTK_STYLE_CLASS_BACKGROUND);
--
-- mButtonStyle = create_context(path);
-- gtk_style_context_add_class(mButtonStyle, GTK_STYLE_CLASS_BUTTON);
--
- // Scrollbar colors
-- style = create_context(path);
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
-+ style = ClaimStyleContext(MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL);
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
-- g_object_unref(style);
-+ ReleaseStyleContext(style);
-
- // Window colors
-- style = create_context(path);
-- gtk_style_context_save(style);
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
-+ style = ClaimStyleContext(MOZ_GTK_WINDOW);
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
-- gtk_style_context_restore(style);
-- g_object_unref(style);
-+ ReleaseStyleContext(style);
-
- // tooltip foreground and background
- style = ClaimStyleContext(MOZ_GTK_TOOLTIP);
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
-- {
-- GtkStyleContext* boxStyle =
-- CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0),
-- style);
-- GtkStyleContext* labelStyle =
-- CreateStyleForWidget(gtk_label_new(nullptr), boxStyle);
-- gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_NORMAL, &color);
-- g_object_unref(labelStyle);
-- g_object_unref(boxStyle);
-- }
-- sInfoText = GDK_RGBA_TO_NS_RGBA(color);
- ReleaseStyleContext(style);
-
-- // menu foreground & menu background
-- GtkWidget *accel_label = gtk_accel_label_new("M");
-- GtkWidget *menuitem = gtk_menu_item_new();
-- GtkWidget *menu = gtk_menu_new();
--
-- g_object_ref_sink(menu);
--
-- gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
-- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
--
-- style = gtk_widget_get_style_context(accel_label);
-+ style = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX_LABEL);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-- sMenuText = GDK_RGBA_TO_NS_RGBA(color);
-- gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
-- sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
-+ sInfoText = GDK_RGBA_TO_NS_RGBA(color);
-+ ReleaseStyleContext(style);
-
-- style = gtk_widget_get_style_context(menu);
-+ style = ClaimStyleContext(MOZ_GTK_MENUITEM);
-+ {
-+ GtkStyleContext* accelStyle =
-+ CreateStyleForWidget(gtk_accel_label_new("M"), style);
-+ gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_NORMAL, &color);
-+ sMenuText = GDK_RGBA_TO_NS_RGBA(color);
-+ gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_INSENSITIVE,
&color);
-+ sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
-+ g_object_unref(accelStyle);
-+ }
-+ ReleaseStyleContext(style);
-+
-+ style = ClaimStyleContext(MOZ_GTK_MENUPOPUP);
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMenuBackground = GDK_RGBA_TO_NS_RGBA(color);
-+ ReleaseStyleContext(style);
-
-- style = gtk_widget_get_style_context(menuitem);
-+ style = ClaimStyleContext(MOZ_GTK_MENUITEM);
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
- sMenuHover = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
- sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
--
-- g_object_unref(menu);
-+ ReleaseStyleContext(style);
- #endif
-
- // button styles
-@@ -1211,9 +1204,6 @@ nsLookAndFeel::Init()
- GtkWidget *combobox = gtk_combo_box_new();
- GtkWidget *comboboxLabel = gtk_label_new("M");
- gtk_container_add(GTK_CONTAINER(combobox), comboboxLabel);
--#else
-- GtkWidget *combobox = gtk_combo_box_new_with_entry();
-- GtkWidget *comboboxLabel = gtk_bin_get_child(GTK_BIN(combobox));
- #endif
- GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
- GtkWidget *treeView = gtk_tree_view_new();
-@@ -1227,7 +1217,9 @@ nsLookAndFeel::Init()
- gtk_container_add(GTK_CONTAINER(parent), button);
- gtk_container_add(GTK_CONTAINER(parent), treeView);
- gtk_container_add(GTK_CONTAINER(parent), linkButton);
-+#if (MOZ_WIDGET_GTK == 2)
- gtk_container_add(GTK_CONTAINER(parent), combobox);
-+#endif
- gtk_container_add(GTK_CONTAINER(parent), menuBar);
- gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), menuBarItem);
- gtk_container_add(GTK_CONTAINER(window), parent);
-@@ -1310,11 +1302,19 @@ nsLookAndFeel::Init()
- }
- #else
- // Text colors
-- style = gtk_widget_get_style_context(textView);
-- gtk_style_context_save(style);
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_VIEW);
-- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
-- sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(color);
-+ GdkRGBA bgColor;
-+ // If the text window background is translucent, then the background of
-+ // the textview root node is visible.
-+ style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW);
-+ gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
-+ &bgColor);
-+ ReleaseStyleContext(style);
-+
-+ style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW_TEXT);
-+ gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
-+ &color);
-+ ApplyColorOver(color, &bgColor);
-+ sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(bgColor);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozFieldText = GDK_RGBA_TO_NS_RGBA(color);
-
-@@ -1327,26 +1327,34 @@ nsLookAndFeel::Init()
-
static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
- &color);
- sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
-- gtk_style_context_restore(style);
-+ ReleaseStyleContext(style);
-
-- // Button text, background, border
-- style = gtk_widget_get_style_context(label);
-- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
-- sButtonText = GDK_RGBA_TO_NS_RGBA(color);
-- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
-- sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
-+ // Button text color
-+ style = ClaimStyleContext(MOZ_GTK_BUTTON);
-+ {
-+ GtkStyleContext* labelStyle =
-+ CreateStyleForWidget(gtk_label_new("M"), style);
-+ gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_NORMAL, &color);
-+ sButtonText = GDK_RGBA_TO_NS_RGBA(color);
-+ gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_PRELIGHT, &color);
-+ sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
-+ g_object_unref(labelStyle);
-+ }
-+ ReleaseStyleContext(style);
-
- // Combobox text color
-- style = gtk_widget_get_style_context(comboboxLabel);
-+ style = ClaimStyleContext(MOZ_GTK_COMBOBOX_ENTRY_TEXTAREA);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sComboBoxText = GDK_RGBA_TO_NS_RGBA(color);
-+ ReleaseStyleContext(style);
-
- // Menubar text and hover text colors
-- style = gtk_widget_get_style_context(menuBarItem);
-+ style = ClaimStyleContext(MOZ_GTK_MENUBARITEM);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMenuBarText = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
- sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color);
-+ ReleaseStyleContext(style);
-
- // GTK's guide to fancy odd row background colors:
- // 1) Check if a theme explicitly defines an odd row color
-@@ -1354,7 +1362,7 @@ nsLookAndFeel::Init()
- // slightly by a hardcoded value (gtkstyle.c)
- // 3) If neither are defined, take the base background color and
- // darken that by a hardcoded value
-- style = gtk_widget_get_style_context(treeView);
-+ style = ClaimStyleContext(MOZ_GTK_TREEVIEW);
-
- // Get odd row background color
- gtk_style_context_save(style);
-@@ -1362,8 +1370,7 @@ nsLookAndFeel::Init()
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_restore(style);
--
-- gtk_widget_path_free(path);
-+ ReleaseStyleContext(style);
-
- // GtkFrame has a "border" subnode on which Adwaita draws the border.
- // Some themes do not draw on this node but draw a border on the widget
-@@ -1448,12 +1455,6 @@ nsLookAndFeel::RefreshImpl()
- #if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
- mStyle = nullptr;
--#else
-- g_object_unref(mBackgroundStyle);
-- g_object_unref(mButtonStyle);
--
-- mBackgroundStyle = nullptr;
-- mButtonStyle = nullptr;
- #endif
-
- Init();
-diff -up firefox-52.0/widget/gtk/WidgetStyleCache.cpp.widget-rebase
firefox-52.0/widget/gtk/WidgetStyleCache.cpp
---- firefox-52.0/widget/gtk/WidgetStyleCache.cpp.widget-rebase 2017-02-27
17:11:05.000000000 +0100
-+++ firefox-52.0/widget/gtk/WidgetStyleCache.cpp 2017-03-10 12:20:30.235205976 +0100
-@@ -434,15 +434,6 @@ CreateScrolledWindowWidget()
- }
-
- static GtkWidget*
--CreateTextViewWidget()
--{
-- GtkWidget* widget = gtk_text_view_new();
-- gtk_container_add(GTK_CONTAINER(GetWidget(MOZ_GTK_SCROLLED_WINDOW)),
-- widget);
-- return widget;
--}
--
--static GtkWidget*
- CreateMenuSeparatorWidget()
- {
- GtkWidget* widget = gtk_separator_menu_item_new();
-@@ -591,8 +582,6 @@ CreateWidget(WidgetNodeType aWidgetType)
- return CreateEntryWidget();
- case MOZ_GTK_SCROLLED_WINDOW:
- return CreateScrolledWindowWidget();
-- case MOZ_GTK_TEXT_VIEW:
-- return CreateTextViewWidget();
- case MOZ_GTK_TREEVIEW:
- return CreateTreeViewWidget();
- case MOZ_GTK_TREE_HEADER_CELL:
-@@ -744,16 +733,38 @@ GetWidgetRootStyle(WidgetNodeType aNodeT
- case MOZ_GTK_MENUITEM:
- style = CreateStyleForWidget(gtk_menu_item_new(), MOZ_GTK_MENUPOPUP);
- break;
-- case MOZ_GTK_IMAGEMENUITEM:
-- style = CreateStyleForWidget(gtk_image_menu_item_new(), MOZ_GTK_MENUPOPUP);
-- break;
-- case MOZ_GTK_CHECKMENUITEM_CONTAINER:
-+ case MOZ_GTK_CHECKMENUITEM:
- style = CreateStyleForWidget(gtk_check_menu_item_new(), MOZ_GTK_MENUPOPUP);
- break;
-- case MOZ_GTK_RADIOMENUITEM_CONTAINER:
-+ case MOZ_GTK_RADIOMENUITEM:
- style = CreateStyleForWidget(gtk_radio_menu_item_new(nullptr),
- MOZ_GTK_MENUPOPUP);
- break;
-+ case MOZ_GTK_TEXT_VIEW:
-+ style = CreateStyleForWidget(gtk_text_view_new(),
-+ MOZ_GTK_SCROLLED_WINDOW);
-+ break;
-+ case MOZ_GTK_TOOLTIP:
-+ if (gtk_check_version(3, 20, 0) != nullptr) {
-+ // The tooltip style class is added first in CreateTooltipWidget()
-+ // and transfered to style in CreateStyleForWidget().
-+ GtkWidget* tooltipWindow = CreateTooltipWidget();
-+ style = CreateStyleForWidget(tooltipWindow, nullptr);
-+ gtk_widget_destroy(tooltipWindow); // Release GtkWindow self-reference.
-+ } else {
-+ // We create this from the path because GtkTooltipWindow is not public.
-+ style = CreateCSSNode("tooltip", nullptr, GTK_TYPE_TOOLTIP);
-+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
-+ }
-+ break;
-+ case MOZ_GTK_TOOLTIP_BOX:
-+ style = CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0),
-+ MOZ_GTK_TOOLTIP);
-+ break;
-+ case MOZ_GTK_TOOLTIP_BOX_LABEL:
-+ style = CreateStyleForWidget(gtk_label_new(nullptr),
-+ MOZ_GTK_TOOLTIP_BOX);
-+ break;
- default:
- GtkWidget* widget = GetWidget(aNodeType);
- MOZ_ASSERT(widget);
-@@ -827,13 +838,13 @@ GetCssNodeStyleInternal(WidgetNodeType a
- style = CreateChildCSSNode(GTK_STYLE_CLASS_CHECK,
- MOZ_GTK_CHECKBUTTON_CONTAINER);
- break;
-- case MOZ_GTK_RADIOMENUITEM:
-+ case MOZ_GTK_RADIOMENUITEM_INDICATOR:
- style = CreateChildCSSNode(GTK_STYLE_CLASS_RADIO,
-- MOZ_GTK_RADIOMENUITEM_CONTAINER);
-+ MOZ_GTK_RADIOMENUITEM);
- break;
-- case MOZ_GTK_CHECKMENUITEM:
-+ case MOZ_GTK_CHECKMENUITEM_INDICATOR:
- style = CreateChildCSSNode(GTK_STYLE_CLASS_CHECK,
-- MOZ_GTK_CHECKMENUITEM_CONTAINER);
-+ MOZ_GTK_CHECKMENUITEM);
- break;
- case MOZ_GTK_PROGRESS_TROUGH:
- /* Progress bar background (trough) */
-@@ -844,11 +855,6 @@ GetCssNodeStyleInternal(WidgetNodeType a
- style = CreateChildCSSNode("progress",
- MOZ_GTK_PROGRESS_TROUGH);
- break;
-- case MOZ_GTK_TOOLTIP:
-- // We create this from the path because GtkTooltipWindow is not public.
-- style = CreateCSSNode("tooltip", nullptr, GTK_TYPE_TOOLTIP);
-- gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
-- break;
- case MOZ_GTK_GRIPPER:
- // TODO - create from CSS node
- return GetWidgetStyleWithClass(MOZ_GTK_GRIPPER,
-@@ -865,10 +871,28 @@ GetCssNodeStyleInternal(WidgetNodeType a
- // TODO - create from CSS node
- return GetWidgetStyleWithClass(MOZ_GTK_SCROLLED_WINDOW,
- GTK_STYLE_CLASS_FRAME);
-- case MOZ_GTK_TEXT_VIEW:
-- // TODO - create from CSS node
-- return GetWidgetStyleWithClass(MOZ_GTK_TEXT_VIEW,
-- GTK_STYLE_CLASS_VIEW);
-+ case MOZ_GTK_TEXT_VIEW_TEXT:
-+ case MOZ_GTK_RESIZER:
-+ style = CreateChildCSSNode("text", MOZ_GTK_TEXT_VIEW);
-+ if (aNodeType == MOZ_GTK_RESIZER) {
-+ // The "grip" class provides the correct builtin icon from
-+ // gtk_render_handle(). The icon is drawn with shaded variants of
-+ // the background color, and so a transparent background would lead to
-+ // a transparent resizer. gtk_render_handle() also uses the
-+ // background color to draw a background, and so this style otherwise
-+ // matches what is used in GtkTextView to match the background with
-+ // textarea elements.
-+ GdkRGBA color;
-+ gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
-+ &color);
-+ if (color.alpha == 0.0) {
-+ g_object_unref(style);
-+ style = CreateStyleForWidget(gtk_text_view_new(),
-+ MOZ_GTK_SCROLLED_WINDOW);
-+ }
-+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
-+ }
-+ break;
- case MOZ_GTK_FRAME_BORDER:
- style = CreateChildCSSNode("border", MOZ_GTK_FRAME);
- break;
-@@ -971,27 +995,20 @@ GetWidgetStyleInternal(WidgetNodeType aN
- case MOZ_GTK_CHECKBUTTON:
- return GetWidgetStyleWithClass(MOZ_GTK_CHECKBUTTON_CONTAINER,
- GTK_STYLE_CLASS_CHECK);
-- case MOZ_GTK_RADIOMENUITEM:
-- return GetWidgetStyleWithClass(MOZ_GTK_RADIOMENUITEM_CONTAINER,
-+ case MOZ_GTK_RADIOMENUITEM_INDICATOR:
-+ return GetWidgetStyleWithClass(MOZ_GTK_RADIOMENUITEM,
- GTK_STYLE_CLASS_RADIO);
-- case MOZ_GTK_CHECKMENUITEM:
-- return GetWidgetStyleWithClass(MOZ_GTK_CHECKMENUITEM_CONTAINER,
-+ case MOZ_GTK_CHECKMENUITEM_INDICATOR:
-+ return GetWidgetStyleWithClass(MOZ_GTK_CHECKMENUITEM,
- GTK_STYLE_CLASS_CHECK);
- case MOZ_GTK_PROGRESS_TROUGH:
- return GetWidgetStyleWithClass(MOZ_GTK_PROGRESSBAR,
- GTK_STYLE_CLASS_TROUGH);
-- case MOZ_GTK_TOOLTIP: {
-- GtkStyleContext* style = sStyleStorage[aNodeType];
-- if (style)
-- return style;
--
-- // The tooltip style class is added first in CreateTooltipWidget() so
-- // that gtk_widget_path_append_for_widget() in CreateStyleForWidget()
-- // will find it.
-- GtkWidget* tooltipWindow = CreateTooltipWidget();
-- style = CreateStyleForWidget(tooltipWindow, nullptr);
-- gtk_widget_destroy(tooltipWindow); // Release GtkWindow self-reference.
-- sStyleStorage[aNodeType] = style;
-+ case MOZ_GTK_PROGRESS_CHUNK: {
-+ GtkStyleContext* style =
-+ GetWidgetStyleWithClass(MOZ_GTK_PROGRESSBAR,
-+ GTK_STYLE_CLASS_PROGRESSBAR);
-+ gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
- return style;
- }
- case MOZ_GTK_GRIPPER:
-@@ -1006,9 +1023,25 @@ GetWidgetStyleInternal(WidgetNodeType aN
- case MOZ_GTK_SCROLLED_WINDOW:
- return GetWidgetStyleWithClass(MOZ_GTK_SCROLLED_WINDOW,
- GTK_STYLE_CLASS_FRAME);
-- case MOZ_GTK_TEXT_VIEW:
-- return GetWidgetStyleWithClass(MOZ_GTK_TEXT_VIEW,
-- GTK_STYLE_CLASS_VIEW);
-+ case MOZ_GTK_TEXT_VIEW_TEXT:
-+ case MOZ_GTK_RESIZER: {
-+ // GTK versions prior to 3.20 do not have the view class on the root
-+ // node, but add this to determine the background for the text window.
-+ GtkStyleContext* style =
-+ GetWidgetStyleWithClass(MOZ_GTK_TEXT_VIEW, GTK_STYLE_CLASS_VIEW);
-+ if (aNodeType == MOZ_GTK_RESIZER) {
-+ // The "grip" class provides the correct builtin icon from
-+ // gtk_render_handle(). The icon is drawn with shaded variants of
-+ // the background color, and so a transparent background would lead to
-+ // a transparent resizer. gtk_render_handle() also uses the
-+ // background color to draw a background, and so this style otherwise
-+ // matches MOZ_GTK_TEXT_VIEW_TEXT to match the background with
-+ // textarea elements. GtkTextView creates a separate text window and
-+ // so the background should not be transparent.
-+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
-+ }
-+ return style;
-+ }
- case MOZ_GTK_FRAME_BORDER:
- return GetWidgetRootStyle(MOZ_GTK_FRAME);
- case MOZ_GTK_TREEVIEW_VIEW:
diff --git a/xulrunner-24.0-jemalloc-ppc.patch b/xulrunner-24.0-jemalloc-ppc.patch
deleted file mode 100644
index b2aaae6..0000000
--- a/xulrunner-24.0-jemalloc-ppc.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-48.0/memory/mozjemalloc/jemalloc.c.jemalloc-ppc
firefox-48.0/memory/mozjemalloc/jemalloc.c
---- firefox-48.0/memory/mozjemalloc/jemalloc.c.jemalloc-ppc 2016-07-26 10:51:46.385434384
+0200
-+++ firefox-48.0/memory/mozjemalloc/jemalloc.c 2016-07-26 10:53:49.061023106 +0200
-@@ -1090,7 +1090,7 @@ static const bool config_recycle = false
- * controlling the malloc behavior are defined as compile-time constants
- * for best performance and cannot be altered at runtime.
- */
--#if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__)
&& !defined(__aarch64__)
-+#if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__)
&& !defined(__aarch64__) && !(defined(__powerpc__))
- #define MALLOC_STATIC_SIZES 1
- #endif
-
diff --git a/xulrunner-24.0-s390-inlines.patch b/xulrunner-24.0-s390-inlines.patch
deleted file mode 100644
index 074f8d9..0000000
--- a/xulrunner-24.0-s390-inlines.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up xulrunner-25.0/mozilla-release/js/src/vm/SPSProfiler.cpp.s390-inlines
xulrunner-25.0/mozilla-release/js/src/vm/SPSProfiler.cpp
---- xulrunner-25.0/mozilla-release/js/src/vm/SPSProfiler.cpp.s390-inlines 2013-10-23
16:04:01.773093979 +0200
-+++ xulrunner-25.0/mozilla-release/js/src/vm/SPSProfiler.cpp 2013-10-23
16:04:44.551134551 +0200
-@@ -4,6 +4,8 @@
- * 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 "jscntxtinlines.h"
-+
- #include "vm/SPSProfiler.h"
-
- #include "mozilla/DebugOnly.h"