summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Stransky <stransky@redhat.com>2017-09-25 10:49:39 +0200
committerMartin Stransky <stransky@redhat.com>2017-09-25 10:49:39 +0200
commit8c8f061c471f460b166992ad0dd599ec142e0041 (patch)
tree94aded19182f9a904a28ab356647b9a51d0b0653
parentAdded switch to build mozbz#1399611 and disable it now for various regressions. (diff)
downloadlibrewolf-fedora-ff-8c8f061c471f460b166992ad0dd599ec142e0041.tar.gz
librewolf-fedora-ff-8c8f061c471f460b166992ad0dd599ec142e0041.tar.bz2
librewolf-fedora-ff-8c8f061c471f460b166992ad0dd599ec142e0041.zip
Update to 56.0
-rw-r--r--.gitignore2
-rw-r--r--build-1360521-missing-cheddar.patch13
-rw-r--r--firefox.spec31
-rw-r--r--mozilla-1170092.patch42
-rw-r--r--mozilla-1337988.patch182
-rw-r--r--mozilla-1399611.patch1467
-rw-r--r--mozilla-440908.patch39
-rw-r--r--rhbz-966424.patch14
-rw-r--r--sources4
-rw-r--r--xulrunner-24.0-s390-inlines.patch12
10 files changed, 81 insertions, 1725 deletions
diff --git a/.gitignore b/.gitignore
index 40551fe..bee3504 100644
--- a/.gitignore
+++ b/.gitignore
@@ -246,3 +246,5 @@ firefox-3.6.4.source.tar.bz2
/firefox-langpacks-55.0.2-20170818.tar.xz
/firefox-55.0.3.source.tar.xz
/firefox-langpacks-55.0.3-20170901.tar.xz
+/firefox-56.0.source.tar.xz
+/firefox-langpacks-56.0-20170925.tar.xz
diff --git a/build-1360521-missing-cheddar.patch b/build-1360521-missing-cheddar.patch
deleted file mode 100644
index 9595164..0000000
--- a/build-1360521-missing-cheddar.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/mozilla-release/media/libstagefright/binding/mp4parse_capi/Cargo.toml b/mozilla-release/media/libstagefright/binding/mp4parse_capi/Cargo.toml
-index aee7ee9471..d7e3f55119 100644
---- a/mozilla-release/media/libstagefright/binding/mp4parse_capi/Cargo.toml
-+++ b/mozilla-release/media/libstagefright/binding/mp4parse_capi/Cargo.toml
-@@ -18,6 +18,8 @@ exclude = [
- "*.mp4",
- ]
-
-+build = false
-+
- [dependencies]
- byteorder = "1.0.0"
- "mp4parse" = {version = "0.6.0", path = "../mp4parse"}
diff --git a/firefox.spec b/firefox.spec
index bff56b1..fa153a8 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -1,6 +1,3 @@
-# Draw shadows/hide titlebar?
-%define csd_emulation 0
-
# Use ALSA backend?
%define alsa_backend 0
@@ -101,14 +98,14 @@
Summary: Mozilla Firefox Web browser
Name: firefox
-Version: 55.0.3
-Release: 4%{?pre_tag}%{?dist}
+Version: 56.0
+Release: 1%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
%if %{build_langpacks}
-Source1: firefox-langpacks-%{version}%{?pre_version}-20170901.tar.xz
+Source1: firefox-langpacks-%{version}%{?pre_version}-20170925.tar.xz
%endif
Source10: firefox-mozconfig
Source12: firefox-redhat-default-prefs.js
@@ -125,13 +122,10 @@ Patch0: firefox-install-dir.patch
Patch3: mozilla-build-arm.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
Patch25: rhbz-1219542-s390-build.patch
Patch26: build-icu-big-endian.patch
Patch27: mozilla-1335250.patch
-Patch28: build-1360521-missing-cheddar.patch
# Also fixes s390x: https://bugzilla.mozilla.org/show_bug.cgi?id=1376268
Patch29: build-big-endian.patch
Patch30: fedora-build.patch
@@ -148,8 +142,6 @@ Patch37: build-jit-atomic-always-lucky.patch
Patch38: build-cacheFlush-missing.patch
# Fedora specific patches
-# Unable to install addons from https pages
-Patch204: rhbz-966424.patch
Patch215: firefox-enable-addons.patch
Patch219: rhbz-1173156.patch
Patch221: firefox-fedora-ua.patch
@@ -167,7 +159,6 @@ Patch410: mozilla-1321521.patch
Patch411: mozilla-1321521-2.patch
Patch412: mozilla-1337988.patch
Patch413: mozilla-1353817.patch
-Patch414: mozilla-1399611.patch
# Debian patches
Patch500: mozilla-440908.patch
@@ -311,30 +302,26 @@ This package contains results of tests executed during build.
%patch18 -p1 -b .jemalloc-ppc
-#%patch19 -p2 -b .s390-inlines
%patch20 -p1 -b .prbool
%ifarch s390
%patch25 -p1 -b .rhbz-1219542-s390
%endif
-#%patch28 -p2 -b .1360521-missing-cheddar
-%patch29 -p1 -b .big-endian
+# don't need that? %patch29 -p1 -b .big-endian
%patch30 -p1 -b .fedora-build
%patch31 -p1 -b .ppc64-s390x-curl
%patch32 -p1 -b .rust-ppc64le
-%patch33 -p1 -b .ppc-s390-dom
-%patch34 -p1 -b .cubeb-pulse-arm
+# don't need that %patch33 -p1 -b .ppc-s390-dom
+# don't need that %patch34 -p1 -b .cubeb-pulse-arm
%ifarch ppc ppc64 ppc64le
%patch35 -p1 -b .ppc-jit
%endif
%patch37 -p1 -b .jit-atomic-lucky
-%patch38 -p1 -b .cacheFlush-missing
%patch3 -p1 -b .arm
# For branding specific patches.
# Fedora patches
-#%patch204 -p2 -b .966424
%patch215 -p1 -b .addons
%patch219 -p2 -b .rhbz-1173156
%patch221 -p2 -b .fedora-ua
@@ -354,9 +341,6 @@ This package contains results of tests executed during build.
%endif
%endif
%patch413 -p1 -b .1353817
-%if %{?csd_emulation}
-%patch414 -p1 -b .1399611
-%endif
# Debian extension patch
%patch500 -p1 -b .440908
@@ -879,6 +863,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
+* Mon Sep 24 2017 Martin Stransky <stransky@redhat.com> - 56.0-1
+- Update to 56.0 (B4)
+
* Fri Sep 15 2017 Martin Stransky <stransky@redhat.com> - 55.0.3-4
- Added switch to build mozbz#1399611 and disable it now
for various regressions.
diff --git a/mozilla-1170092.patch b/mozilla-1170092.patch
index 2b10f06..761fb9e 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-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
+--- firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2017-09-25 10:28:35.413675532 +0200
++++ firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2017-09-25 10:31:06.394196960 +0200
+@@ -243,9 +243,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,17 +17,17 @@ 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(
+ location += aFileName;
+diff -up firefox-56.0/modules/libpref/Preferences.cpp.1170092 firefox-56.0/modules/libpref/Preferences.cpp
+--- firefox-56.0/modules/libpref/Preferences.cpp.1170092 2017-09-14 22:15:52.000000000 +0200
++++ firefox-56.0/modules/libpref/Preferences.cpp 2017-09-25 10:28:35.413675532 +0200
+@@ -1514,6 +1514,8 @@ 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.
@@ -36,10 +36,10 @@ diff -up firefox-45.0.1/modules/libpref/Preferences.cpp.1170092 firefox-45.0.1/m
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 @@
+diff -up firefox-56.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-56.0/toolkit/xre/nsXREDirProvider.cpp
+--- firefox-56.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2017-09-14 22:16:02.000000000 +0200
++++ firefox-56.0/toolkit/xre/nsXREDirProvider.cpp 2017-09-25 10:28:35.414675529 +0200
+@@ -58,6 +58,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
+@@ -570,6 +571,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
+@@ -935,6 +950,14 @@ nsXREDirProvider::GetFilesInternal(const
LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
LoadDirsIntoArray(mAppBundleDirectories,
kAppendPrefDir, directories);
@@ -83,10 +83,10 @@ 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-56.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-56.0/xpcom/io/nsAppDirectoryServiceDefs.h
+--- firefox-56.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2017-09-14 22:16:02.000000000 +0200
++++ firefox-56.0/xpcom/io/nsAppDirectoryServiceDefs.h 2017-09-25 10:28:35.414675529 +0200
+@@ -62,6 +62,7 @@
#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
diff --git a/mozilla-1337988.patch b/mozilla-1337988.patch
index 9d0e30e..8c40445 100644
--- a/mozilla-1337988.patch
+++ b/mozilla-1337988.patch
@@ -1,7 +1,7 @@
-diff -up firefox-55.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 firefox-55.0/dom/plugins/base/nsJSNPRuntime.cpp
---- firefox-55.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0/dom/plugins/base/nsJSNPRuntime.cpp 2017-08-02 14:33:41.736715482 +0200
-@@ -1766,7 +1766,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj,
+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);
@@ -10,9 +10,9 @@ diff -up firefox-55.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 firefox-55.0/do
entry->mJSObj = obj;
}
-diff -up firefox-55.0/js/ipc/JavaScriptShared.cpp.1337988 firefox-55.0/js/ipc/JavaScriptShared.cpp
---- firefox-55.0/js/ipc/JavaScriptShared.cpp.1337988 2017-07-31 18:20:47.000000000 +0200
-+++ firefox-55.0/js/ipc/JavaScriptShared.cpp 2017-08-02 14:33:41.736715482 +0200
+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)
@@ -22,9 +22,9 @@ diff -up firefox-55.0/js/ipc/JavaScriptShared.cpp.1337988 firefox-55.0/js/ipc/Ja
}
#endif
-diff -up firefox-55.0/js/public/RootingAPI.h.1337988 firefox-55.0/js/public/RootingAPI.h
---- firefox-55.0/js/public/RootingAPI.h.1337988 2017-07-31 18:20:47.000000000 +0200
-+++ firefox-55.0/js/public/RootingAPI.h 2017-08-02 15:20:44.873663128 +0200
+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 */
@@ -344,9 +344,9 @@ diff -up firefox-55.0/js/public/RootingAPI.h.1337988 firefox-55.0/js/public/Root
#undef DELETE_ASSIGNMENT_OPS
#endif /* js_RootingAPI_h */
-diff -up firefox-55.0/js/src/gc/Barrier.h.1337988 firefox-55.0/js/src/gc/Barrier.h
---- firefox-55.0/js/src/gc/Barrier.h.1337988 2017-07-31 18:20:47.000000000 +0200
-+++ firefox-55.0/js/src/gc/Barrier.h 2017-08-02 14:33:41.737715470 +0200
+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) {}
@@ -357,7 +357,7 @@ diff -up firefox-55.0/js/src/gc/Barrier.h.1337988 firefox-55.0/js/src/gc/Barrier
DECLARE_POINTER_CONSTREF_OPS(T);
// Use this if the automatic coercion to T isn't working.
-@@ -605,13 +605,14 @@ class ReadBarriered : public ReadBarrier
+@@ -612,13 +612,14 @@ class ReadBarriered : public ReadBarrier
return *this;
}
@@ -376,7 +376,7 @@ diff -up firefox-55.0/js/src/gc/Barrier.h.1337988 firefox-55.0/js/src/gc/Barrier
return this->value;
}
-@@ -619,9 +620,9 @@ class ReadBarriered : public ReadBarrier
+@@ -626,9 +627,9 @@ class ReadBarriered : public ReadBarrier
return bool(this->value);
}
@@ -388,7 +388,7 @@ diff -up firefox-55.0/js/src/gc/Barrier.h.1337988 firefox-55.0/js/src/gc/Barrier
T* unsafeGet() { return &this->value; }
T const* unsafeGet() const { return &this->value; }
-@@ -948,35 +949,6 @@ typedef ReadBarriered<WasmTableObject*>
+@@ -955,35 +956,6 @@ typedef ReadBarriered<WasmTableObject*>
typedef ReadBarriered<Value> ReadBarrieredValue;
@@ -424,9 +424,9 @@ diff -up firefox-55.0/js/src/gc/Barrier.h.1337988 firefox-55.0/js/src/gc/Barrier
} /* namespace js */
#endif /* gc_Barrier_h */
-diff -up firefox-55.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 firefox-55.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp
---- firefox-55.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 2017-07-31 18:20:48.000000000 +0200
-+++ firefox-55.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp 2017-08-02 15:23:03.544362400 +0200
+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/. */
@@ -435,127 +435,9 @@ diff -up firefox-55.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 fire
#include "mozilla/UniquePtr.h"
#include "js/RootingAPI.h"
-@@ -178,117 +177,3 @@ TestHeapPostBarrierInitFailure()
-
- return true;
- }
--
--END_TEST(testGCHeapPostBarriers)
--
--BEGIN_TEST(testUnbarrieredEquality)
--{
--#ifdef JS_GC_ZEAL
-- AutoLeaveZeal nozeal(cx);
--#endif /* JS_GC_ZEAL */
--
-- // Use ArrayBuffers because they have finalizers, which allows using them
-- // in ObjectPtr without awkward conversations about nursery allocatability.
-- JS::RootedObject robj(cx, JS_NewArrayBuffer(cx, 20));
-- JS::RootedObject robj2(cx, JS_NewArrayBuffer(cx, 30));
-- cx->runtime()->gc.evictNursery(); // Need tenured objects
--
-- // Need some bare pointers to compare against.
-- JSObject* obj = robj;
-- JSObject* obj2 = robj2;
-- const JSObject* constobj = robj;
-- const JSObject* constobj2 = robj2;
--
-- // Make them gray. We will make sure they stay gray. (For most reads, the
-- // barrier will unmark gray.)
-- using namespace js::gc;
-- TenuredCell* cell = &obj->asTenured();
-- TenuredCell* cell2 = &obj2->asTenured();
-- cell->markIfUnmarked(GRAY);
-- cell2->markIfUnmarked(GRAY);
-- MOZ_ASSERT(cell->isMarked(GRAY));
-- MOZ_ASSERT(cell2->isMarked(GRAY));
--
-- {
-- JS::Heap<JSObject*> heap(obj);
-- JS::Heap<JSObject*> heap2(obj2);
-- CHECK(TestWrapper(obj, obj2, heap, heap2));
-- CHECK(TestWrapper(constobj, constobj2, heap, heap2));
-- }
--
-- {
-- JS::TenuredHeap<JSObject*> heap(obj);
-- JS::TenuredHeap<JSObject*> heap2(obj2);
-- CHECK(TestWrapper(obj, obj2, heap, heap2));
-- CHECK(TestWrapper(constobj, constobj2, heap, heap2));
-- }
--
-- {
-- JS::ObjectPtr objptr(obj);
-- JS::ObjectPtr objptr2(obj2);
-- CHECK(TestWrapper(obj, obj2, objptr, objptr2));
-- CHECK(TestWrapper(constobj, constobj2, objptr, objptr2));
-- objptr.finalize(cx);
-- objptr2.finalize(cx);
-- }
--
-- // Sanity check that the barriers normally mark things black.
-- {
-- JS::Heap<JSObject*> heap(obj);
-- JS::Heap<JSObject*> heap2(obj2);
-- heap.get();
-- heap2.get();
-- CHECK(cell->isMarked(BLACK));
-- CHECK(cell2->isMarked(BLACK));
-- }
--
-- return true;
--}
--
--template <typename ObjectT, typename WrapperT>
--bool
--TestWrapper(ObjectT obj, ObjectT obj2, WrapperT& wrapper, WrapperT& wrapper2)
--{
-- using namespace js::gc;
--
-- const TenuredCell& cell = obj->asTenured();
-- const TenuredCell& cell2 = obj2->asTenured();
--
-- int x = 0;
--
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
-- x += obj == obj2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
-- x += obj == wrapper2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
-- x += wrapper == obj2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
-- x += wrapper == wrapper2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
--
-- CHECK(x == 0);
--
-- x += obj != obj2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
-- x += obj != wrapper2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
-- x += wrapper != obj2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
-- x += wrapper != wrapper2;
-- CHECK(cell.isMarked(GRAY));
-- CHECK(cell2.isMarked(GRAY));
--
-- CHECK(x == 4);
--
-- return true;
--}
--
--END_TEST(testUnbarrieredEquality)
-diff -up firefox-55.0/js/src/vm/SharedMem.h.1337988 firefox-55.0/js/src/vm/SharedMem.h
---- firefox-55.0/js/src/vm/SharedMem.h.1337988 2017-06-15 22:52:29.000000000 +0200
-+++ firefox-55.0/js/src/vm/SharedMem.h 2017-08-02 14:33:41.737715470 +0200
+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
@@ -567,10 +449,10 @@ diff -up firefox-55.0/js/src/vm/SharedMem.h.1337988 firefox-55.0/js/src/vm/Share
enum Sharedness {
IsUnshared,
-diff -up firefox-55.0/js/xpconnect/src/XPCInlines.h.1337988 firefox-55.0/js/xpconnect/src/XPCInlines.h
---- firefox-55.0/js/xpconnect/src/XPCInlines.h.1337988 2017-07-31 18:20:46.000000000 +0200
-+++ firefox-55.0/js/xpconnect/src/XPCInlines.h 2017-08-02 14:33:41.738715458 +0200
-@@ -471,7 +471,7 @@ inline
+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());
@@ -579,9 +461,9 @@ diff -up firefox-55.0/js/xpconnect/src/XPCInlines.h.1337988 firefox-55.0/js/xpco
mJSObject = obj;
}
-diff -up firefox-55.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 firefox-55.0/js/xpconnect/src/XPCWrappedNative.cpp
---- firefox-55.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 2017-08-02 14:33:41.738715458 +0200
-+++ firefox-55.0/js/xpconnect/src/XPCWrappedNative.cpp 2017-08-02 15:25:43.749014973 +0200
+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)
{
@@ -591,9 +473,9 @@ diff -up firefox-55.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 firefox-55.0
nsWrapperCache* cache = nullptr;
CallQueryInterface(mIdentity, &cache);
-diff -up firefox-55.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 firefox-55.0/js/xpconnect/src/XPCWrappedNativeProto.cpp
---- firefox-55.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 2017-07-31 18:20:47.000000000 +0200
-+++ firefox-55.0/js/xpconnect/src/XPCWrappedNativeProto.cpp 2017-08-02 15:24:15.153207106 +0200
+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)
diff --git a/mozilla-1399611.patch b/mozilla-1399611.patch
deleted file mode 100644
index 5d04664..0000000
--- a/mozilla-1399611.patch
+++ /dev/null
@@ -1,1467 +0,0 @@
-diff -up firefox-55.0.3/browser/app/profile/firefox.js.csd firefox-55.0.3/browser/app/profile/firefox.js
---- firefox-55.0.3/browser/app/profile/firefox.js.csd 2017-09-14 11:29:45.346643502 +0200
-+++ firefox-55.0.3/browser/app/profile/firefox.js 2017-09-14 11:36:31.074589389 +0200
-@@ -463,11 +463,7 @@ pref("browser.tabs.opentabfor.middleclic
- pref("browser.tabs.loadDivertedInBackground", false);
- pref("browser.tabs.loadBookmarksInBackground", false);
- pref("browser.tabs.tabClipWidth", 140);
--#ifdef UNIX_BUT_NOT_MAC
--pref("browser.tabs.drawInTitlebar", false);
--#else
- pref("browser.tabs.drawInTitlebar", true);
--#endif
-
- // When tabs opened by links in other tabs via a combination of
- // browser.link.open_newwindow being set to 3 and target="_blank" etc are
-diff -up firefox-55.0.3/browser/base/content/browser-tabsintitlebar.js.csd firefox-55.0.3/browser/base/content/browser-tabsintitlebar.js
---- firefox-55.0.3/browser/base/content/browser-tabsintitlebar.js.csd 2017-07-31 18:20:46.000000000 +0200
-+++ firefox-55.0.3/browser/base/content/browser-tabsintitlebar.js 2017-09-14 11:29:45.347643499 +0200
-@@ -14,6 +14,11 @@ var TabsInTitlebar = {
- this._readPref();
- Services.prefs.addObserver(this._prefName, this);
-
-+ // Always disable on unsupported GTK versions.
-+ if (AppConstants.MOZ_WIDGET_TOOLKIT == "gtk3") {
-+ this.allowedBy("gtk", window.matchMedia("(-moz-gtk-csd-available)"));
-+ }
-+
- // We need to update the appearance of the titlebar when the menu changes
- // from the active to the inactive state. We can't, however, rely on
- // DOMMenuBarInactive, because the menu fires this event and then removes
-diff -up firefox-55.0.3/browser/base/moz.build.csd firefox-55.0.3/browser/base/moz.build
---- firefox-55.0.3/browser/base/moz.build.csd 2017-07-31 18:20:47.000000000 +0200
-+++ firefox-55.0.3/browser/base/moz.build 2017-09-14 11:29:45.347643499 +0200
-@@ -49,7 +49,7 @@ DEFINES['APP_LICENSE_BLOCK'] = '%s/conte
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):
- DEFINES['CONTEXT_COPY_IMAGE_CONTENTS'] = 1
-
--if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
-+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
- DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
-diff -up firefox-55.0.3/browser/themes/linux/browser.css.csd firefox-55.0.3/browser/themes/linux/browser.css
---- firefox-55.0.3/browser/themes/linux/browser.css.csd 2017-07-31 18:20:49.000000000 +0200
-+++ firefox-55.0.3/browser/themes/linux/browser.css 2017-09-14 11:37:47.545390712 +0200
-@@ -980,8 +980,12 @@ html|span.ac-emphasize-text-url {
- color: -moz-menubartext;
- }
-
-+/* Support dragging the window using the toolbar when drawing our own
-+ * decorations, or where the GTK theme allows. */
- #toolbar-menubar:not([autohide="true"]):not(:-moz-lwtheme):-moz-system-metric(menubar-drag),
--#TabsToolbar:not(:-moz-lwtheme):-moz-system-metric(menubar-drag) {
-+#TabsToolbar:not(:-moz-lwtheme):-moz-system-metric(menubar-drag),
-+#main-window[tabsintitlebar] #toolbar-menubar:not([autohide="true"]),
-+#main-window[tabsintitlebar] #TabsToolbar {
- -moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
- }
-
-@@ -1217,6 +1221,7 @@ notification.pluginVulnerable > .notific
- /* End customization mode */
-
-
-+#main-window[tabsintitlebar][privatebrowsingmode=temporary] > #titlebar,
- #main-window[privatebrowsingmode=temporary] #private-browsing-indicator {
- background: url("chrome://browser/skin/privatebrowsing-mask.png") center no-repeat;
- width: 40px;
-@@ -1272,3 +1277,41 @@ notification.pluginVulnerable > .notific
- .webextension-popup-browser {
- border-radius: inherit;
- }
-+
-+/* Titlebar/CSD */
-+@media (-moz-gtk-csd-available) {
-+ #main-window[tabsintitlebar][sizemode="normal"]:not([customizing]):not(:-moz-lwtheme) > #titlebar {
-+ -moz-appearance: -moz-window-titlebar;
-+ }
-+
-+ #main-window[tabsintitlebar][sizemode="maximized"]:not([customizing]):not(:-moz-lwtheme) > #titlebar {
-+ -moz-appearance: -moz-window-titlebar-maximized;
-+ }
-+
-+ #main-window[tabsintitlebar]:not([sizemode="fullscreen"]) #TabsToolbar {
-+ -moz-appearance: none;
-+ }
-+
-+ /* titlebar command buttons */
-+
-+ #titlebar-min {
-+ list-style-image: url("moz-icon://stock/window-minimize-symbolic?size=menu");
-+ -moz-appearance: -moz-window-button-minimize;
-+ }
-+
-+ #titlebar-max {
-+ list-style-image: url("moz-icon://stock/window-maximize-symbolic?size=menu");
-+ -moz-appearance: -moz-window-button-maximize;
-+ }
-+
-+ #main-window[sizemode="maximized"] #titlebar-max {
-+ list-style-image: url("moz-icon://stock/window-restore-symbolic?size=menu");
-+ -moz-appearance: -moz-window-button-restore;
-+ }
-+
-+ #titlebar-close {
-+ list-style-image: url("moz-icon://stock/window-close-symbolic?size=menu");
-+ -moz-appearance: -moz-window-button-close;
-+ }
-+}
-+
-diff -up firefox-55.0.3/dom/base/nsGkAtomList.h.csd firefox-55.0.3/dom/base/nsGkAtomList.h
---- firefox-55.0.3/dom/base/nsGkAtomList.h.csd 2017-07-31 18:20:51.000000000 +0200
-+++ firefox-55.0.3/dom/base/nsGkAtomList.h 2017-09-14 11:29:45.347643499 +0200
-@@ -2203,6 +2203,7 @@ GK_ATOM(touch_enabled, "touch-enabled")
- GK_ATOM(menubar_drag, "menubar-drag")
- GK_ATOM(swipe_animation_enabled, "swipe-animation-enabled")
- GK_ATOM(physical_home_button, "physical-home-button")
-+GK_ATOM(gtk_csd_available, "gtk-csd-available")
-
- // windows theme selector metrics
- GK_ATOM(windows_classic, "windows-classic")
-@@ -2238,6 +2239,7 @@ GK_ATOM(_moz_device_orientation, "-moz-d
- GK_ATOM(_moz_is_resource_document, "-moz-is-resource-document")
- GK_ATOM(_moz_swipe_animation_enabled, "-moz-swipe-animation-enabled")
- GK_ATOM(_moz_physical_home_button, "-moz-physical-home-button")
-+GK_ATOM(_moz_gtk_csd_available, "-moz-gtk-csd-available")
-
- // application commands
- GK_ATOM(Back, "Back")
-diff -up firefox-55.0.3/gfx/src/nsThemeConstants.h.csd firefox-55.0.3/gfx/src/nsThemeConstants.h
---- firefox-55.0.3/gfx/src/nsThemeConstants.h.csd 2017-07-31 18:20:46.000000000 +0200
-+++ firefox-55.0.3/gfx/src/nsThemeConstants.h 2017-09-14 11:29:45.348643497 +0200
-@@ -299,6 +299,7 @@ enum ThemeWidgetType : uint8_t {
- NS_THEME_MAC_SOURCE_LIST,
- NS_THEME_MAC_SOURCE_LIST_SELECTION,
- NS_THEME_MAC_ACTIVE_SOURCE_LIST_SELECTION,
-+ NS_THEME_GTK_WINDOW_DECORATION,
-
- ThemeWidgetType_COUNT
- };
-diff -up firefox-55.0.3/layout/style/nsCSSRuleProcessor.cpp.csd firefox-55.0.3/layout/style/nsCSSRuleProcessor.cpp
---- firefox-55.0.3/layout/style/nsCSSRuleProcessor.cpp.csd 2017-07-31 18:20:48.000000000 +0200
-+++ firefox-55.0.3/layout/style/nsCSSRuleProcessor.cpp 2017-09-14 11:29:45.348643497 +0200
-@@ -1168,6 +1168,12 @@ nsCSSRuleProcessor::InitSystemMetrics()
- sSystemMetrics->AppendElement(nsGkAtoms::physical_home_button);
- }
-
-+ rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDAvailable,
-+ &metricResult);
-+ if (NS_SUCCEEDED(rv) && metricResult) {
-+ sSystemMetrics->AppendElement(nsGkAtoms::gtk_csd_available);
-+ }
-+
- #ifdef XP_WIN
- if (NS_SUCCEEDED(
- LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsThemeIdentifier,
-diff -up firefox-55.0.3/layout/style/nsMediaFeatures.cpp.csd firefox-55.0.3/layout/style/nsMediaFeatures.cpp
---- firefox-55.0.3/layout/style/nsMediaFeatures.cpp.csd 2017-06-15 22:52:11.000000000 +0200
-+++ firefox-55.0.3/layout/style/nsMediaFeatures.cpp 2017-09-14 11:29:45.348643497 +0200
-@@ -768,6 +768,15 @@ nsMediaFeatures::features[] = {
- GetSystemMetric
- },
-
-+ {
-+ &nsGkAtoms::_moz_gtk_csd_available,
-+ nsMediaFeature::eMinMaxNotAllowed,
-+ nsMediaFeature::eBoolInteger,
-+ nsMediaFeature::eNoRequirements,
-+ { &nsGkAtoms::gtk_csd_available },
-+ GetSystemMetric
-+ },
-+
- // Internal -moz-is-glyph media feature: applies only inside SVG glyphs.
- // Internal because it is really only useful in the user agent anyway
- // and therefore not worth standardizing.
-diff -up firefox-55.0.3/modules/libpref/init/all.js.csd firefox-55.0.3/modules/libpref/init/all.js
---- firefox-55.0.3/modules/libpref/init/all.js.csd 2017-09-14 11:39:55.152059181 +0200
-+++ firefox-55.0.3/modules/libpref/init/all.js 2017-09-14 11:40:08.494024516 +0200
-@@ -4796,6 +4796,7 @@ pref("gfx.apitrace.enabled",false);
- pref("gfx.xrender.enabled",false);
- pref("widget.chrome.allow-gtk-dark-theme", false);
- pref("widget.content.allow-gtk-dark-theme", false);
-+pref("widget.allow-client-side-decoration", false);
- #endif
- #endif
-
-diff -up firefox-55.0.3/toolkit/modules/moz.build.csd firefox-55.0.3/toolkit/modules/moz.build
---- firefox-55.0.3/toolkit/modules/moz.build.csd 2017-07-31 18:20:52.000000000 +0200
-+++ firefox-55.0.3/toolkit/modules/moz.build 2017-09-14 11:29:45.348643497 +0200
-@@ -263,7 +263,7 @@ EXTRA_JS_MODULES.sessionstore += [
- ]
-
- DEFINES['INSTALL_COMPACT_THEMES'] = 1
--if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
-+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
- DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
-diff -up firefox-55.0.3/widget/gtk/gtk3drawing.cpp.csd firefox-55.0.3/widget/gtk/gtk3drawing.cpp
---- firefox-55.0.3/widget/gtk/gtk3drawing.cpp.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/gtk3drawing.cpp 2017-09-14 11:29:45.349643494 +0200
-@@ -17,6 +17,7 @@
- #include "WidgetStyleCache.h"
-
- #include <math.h>
-+#include <dlfcn.h>
-
- static gboolean checkbox_check_state;
- static gboolean notebook_has_tab_gap;
-@@ -39,9 +40,25 @@ static gint
- moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
- GtkWidgetState* state, GtkTextDirection direction);
-
-+static void
-+moz_gtk_add_style_margin(GtkStyleContext* style,
-+ gint* left, gint* top, gint* right, gint* bottom);
-+static void
-+moz_gtk_add_style_border(GtkStyleContext* style,
-+ gint* left, gint* top, gint* right, gint* bottom);
-+static void
-+moz_gtk_add_style_padding(GtkStyleContext* style,
-+ gint* left, gint* top, gint* right, gint* bottom);
-+static void moz_gtk_add_margin_border_padding(GtkStyleContext *style,
-+ gint* left, gint* top,
-+ gint* right, gint* bottom);
-+static void moz_gtk_add_border_padding(GtkStyleContext *style,
-+ gint* left, gint* top,
-+ gint* right, gint* bottom);
- static GtkBorder
- GetMarginBorderPadding(GtkStyleContext* aStyle);
-
-+
- // 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
-@@ -240,6 +257,43 @@ moz_gtk_splitter_get_metrics(gint orient
- return MOZ_GTK_SUCCESS;
- }
-
-+void
-+moz_gtk_get_window_border(gint* top, gint* right, gint* bottom, gint* left)
-+{
-+ MOZ_ASSERT(gtk_check_version(3, 20, 0) == nullptr,
-+ "Window decorations are only supported on GTK 3.20+.");
-+
-+ GtkStyleContext* style = ClaimStyleContext(MOZ_GTK_WINDOW);
-+
-+ *top = *right = *bottom = *left = 0;
-+ moz_gtk_add_border_padding(style, left, top, right, bottom);
-+ GtkBorder windowMargin;
-+ gtk_style_context_get_margin(style, GTK_STATE_FLAG_NORMAL, &windowMargin);
-+
-+ style = ClaimStyleContext(MOZ_GTK_WINDOW_DECORATION);
-+
-+ // Available on GTK 3.20+.
-+ static auto sGtkRenderBackgroundGetClip =
-+ (void (*)(GtkStyleContext*, gdouble, gdouble, gdouble, gdouble, GdkRectangle*))
-+ dlsym(RTLD_DEFAULT, "gtk_render_background_get_clip");
-+
-+ GdkRectangle shadowClip;
-+ sGtkRenderBackgroundGetClip(style, 0, 0, 0, 0, &shadowClip);
-+
-+ // Transfer returned inset rectangle to GtkBorder
-+ GtkBorder shadowBorder = {
-+ static_cast<gint16>(-shadowClip.x), // left
-+ static_cast<gint16>(shadowClip.width + shadowClip.x), // right
-+ static_cast<gint16>(-shadowClip.y), // top
-+ static_cast<gint16>(shadowClip.height + shadowClip.y), // bottom
-+ };
-+
-+ *left += MAX(windowMargin.left, shadowBorder.left);
-+ *right += MAX(windowMargin.right, shadowBorder.right);
-+ *top += MAX(windowMargin.top, shadowBorder.top);
-+ *bottom += MAX(windowMargin.bottom, shadowBorder.bottom);
-+}
-+
- static gint
- moz_gtk_window_paint(cairo_t *cr, GdkRectangle* rect,
- GtkTextDirection direction)
-@@ -311,6 +365,24 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
- }
-
- static gint
-+moz_gtk_header_bar_button_paint(cairo_t *cr, GdkRectangle* rect,
-+ GtkWidgetState* state,
-+ GtkReliefStyle relief, GtkWidget* widget,
-+ GtkTextDirection direction)
-+{
-+ GtkBorder margin;
-+ GtkStyleContext* style = gtk_widget_get_style_context(widget);
-+ gtk_style_context_get_margin(style, GTK_STATE_FLAG_NORMAL, &margin);
-+
-+ rect->x += margin.left;
-+ rect->y += margin.top;
-+ rect->width -= margin.left + margin.right;
-+ rect->height -= margin.top + margin.bottom;
-+
-+ return moz_gtk_button_paint(cr, rect, state, relief, widget, direction);
-+}
-+
-+static gint
- moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect,
- GtkWidgetState* state,
- gboolean selected, gboolean inconsistent,
-@@ -2007,6 +2079,25 @@ moz_gtk_info_bar_paint(cairo_t *cr, GdkR
- return MOZ_GTK_SUCCESS;
- }
-
-+static gint
-+moz_gtk_header_bar_paint(WidgetNodeType widgetType,
-+ cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state)
-+{
-+ GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
-+ GtkStyleContext *style;
-+
-+ style = ClaimStyleContext(widgetType, GTK_TEXT_DIR_LTR,
-+ state_flags);
-+ 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);
-+
-+ ReleaseStyleContext(style);
-+
-+ return MOZ_GTK_SUCCESS;
-+}
-+
- static void
- moz_gtk_add_style_margin(GtkStyleContext* style,
- gint* left, gint* top, gint* right, gint* bottom)
-@@ -2058,6 +2149,14 @@ static void moz_gtk_add_margin_border_pa
- moz_gtk_add_style_padding(style, left, top, right, bottom);
- }
-
-+static void moz_gtk_add_border_padding(GtkStyleContext *style,
-+ gint* left, gint* top,
-+ gint* right, gint* bottom)
-+{
-+ moz_gtk_add_style_border(style, left, top, right, bottom);
-+ moz_gtk_add_style_padding(style, left, top, right, bottom);
-+}
-+
- static GtkBorder
- GetMarginBorderPadding(GtkStyleContext* aStyle)
- {
-@@ -2114,8 +2213,7 @@ moz_gtk_get_widget_border(WidgetNodeType
- // XXX: Subtract 1 pixel from the padding to account for the default
- // padding in forms.css. See bug 1187385.
- *left = *top = *right = *bottom = -1;
-- moz_gtk_add_style_padding(style, left, top, right, bottom);
-- moz_gtk_add_style_border(style, left, top, right, bottom);
-+ moz_gtk_add_border_padding(style, left, top, right, bottom);
-
- ReleaseStyleContext(style);
- return MOZ_GTK_SUCCESS;
-@@ -2140,8 +2238,7 @@ moz_gtk_get_widget_border(WidgetNodeType
- GetWidget(MOZ_GTK_TREE_HEADER_CELL)));
-
- style = ClaimStyleContext(MOZ_GTK_TREE_HEADER_CELL);
-- moz_gtk_add_style_border(style, left, top, right, bottom);
-- moz_gtk_add_style_padding(style, left, top, right, bottom);
-+ moz_gtk_add_border_padding(style, left, top, right, bottom);
- ReleaseStyleContext(style);
- return MOZ_GTK_SUCCESS;
- }
-@@ -2168,8 +2265,7 @@ moz_gtk_get_widget_border(WidgetNodeType
- gtk_container_get_border_width(GTK_CONTAINER(
- GetWidget(MOZ_GTK_COMBOBOX_BUTTON)));
- style = ClaimStyleContext(MOZ_GTK_COMBOBOX_BUTTON);
-- moz_gtk_add_style_padding(style, left, top, right, bottom);
-- moz_gtk_add_style_border(style, left, top, right, bottom);
-+ moz_gtk_add_border_padding(style, left, top, right, bottom);
- ReleaseStyleContext(style);
-
- /* If there is no separator, don't try to count its width. */
-@@ -2224,10 +2320,8 @@ moz_gtk_get_widget_border(WidgetNodeType
- style = gtk_widget_get_style_context(w);
-
- *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
-- moz_gtk_add_style_border(style,
-- left, top, right, bottom);
-- moz_gtk_add_style_padding(style,
-- left, top, right, bottom);
-+ moz_gtk_add_border_padding(style,
-+ left, top, right, bottom);
- return MOZ_GTK_SUCCESS;
- }
- case MOZ_GTK_MENUPOPUP:
-@@ -2277,6 +2371,23 @@ moz_gtk_get_widget_border(WidgetNodeType
-
- return MOZ_GTK_SUCCESS;
- }
-+ case MOZ_GTK_HEADER_BAR:
-+ case MOZ_GTK_HEADER_BAR_MAXIMIZED:
-+ {
-+ style = ClaimStyleContext(widget);
-+ moz_gtk_add_border_padding(style, left, top, right, bottom);
-+ ReleaseStyleContext(style);
-+ return MOZ_GTK_SUCCESS;
-+ }
-+ case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE:
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE:
-+ {
-+ style = ClaimStyleContext(widget);
-+ moz_gtk_add_margin_border_padding(style, left, top, right, bottom);
-+ ReleaseStyleContext(style);
-+ return MOZ_GTK_SUCCESS;
-+ }
-
- /* These widgets have no borders, since they are not containers. */
- case MOZ_GTK_CHECKBUTTON_LABEL:
-@@ -2729,6 +2840,36 @@ GetScrollbarMetrics(GtkOrientation aOrie
- return metrics;
- }
-
-+void
-+moz_gtk_window_decoration_paint(cairo_t *cr, GdkRectangle* rect)
-+{
-+ gint top, right, bottom, left;
-+ moz_gtk_get_window_border(&top, &right, &bottom, &left);
-+
-+ cairo_save(cr);
-+ cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
-+ cairo_rectangle(cr, rect->x, rect->y, left, rect->height);
-+ cairo_fill(cr);
-+ cairo_rectangle(cr, rect->x+rect->width-right, rect->y, right, rect->height);
-+ cairo_fill(cr);
-+ cairo_rectangle(cr, rect->x, rect->y, rect->width, top);
-+ cairo_fill(cr);
-+ cairo_rectangle(cr, rect->x, rect->height-bottom, rect->width, bottom);
-+ cairo_fill(cr);
-+ cairo_restore(cr);
-+
-+ GtkStyleContext* style = ClaimStyleContext(MOZ_GTK_WINDOW_DECORATION,
-+ GTK_TEXT_DIR_NONE);
-+ rect->x += left;
-+ rect->y += top;
-+ rect->width -= left + right;
-+ rect->height -= top + bottom;
-+
-+ 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);
-+}
-+
-+
- /* cairo_t *cr argument has to be a system-cairo. */
- gint
- moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
-@@ -2754,6 +2895,20 @@ moz_gtk_widget_paint(WidgetNodeType widg
- GetWidget(MOZ_GTK_BUTTON),
- direction);
- break;
-+ case MOZ_GTK_HEADER_BAR_BUTTON:
-+ return moz_gtk_header_bar_button_paint(cr, rect, state,
-+ (GtkReliefStyle) flags,
-+ GetWidget(MOZ_GTK_HEADER_BAR_BUTTON),
-+ direction);
-+ break;
-+ case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE:
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE:
-+ return moz_gtk_header_bar_button_paint(cr, rect, state,
-+ (GtkReliefStyle) flags,
-+ GetWidget(widget),
-+ direction);
-+ break;
- case MOZ_GTK_CHECKBUTTON:
- case MOZ_GTK_RADIOBUTTON:
- return moz_gtk_toggle_paint(cr, rect, state,
-@@ -2961,6 +3116,10 @@ moz_gtk_widget_paint(WidgetNodeType widg
- case MOZ_GTK_INFO_BAR:
- return moz_gtk_info_bar_paint(cr, rect, state);
- break;
-+ case MOZ_GTK_HEADER_BAR:
-+ case MOZ_GTK_HEADER_BAR_MAXIMIZED:
-+ return moz_gtk_header_bar_paint(widget, cr, rect, state);
-+ break;
- default:
- g_warning("Unknown widget type: %d", widget);
- }
-diff -up firefox-55.0.3/widget/gtk/gtkdrawing.h.csd firefox-55.0.3/widget/gtk/gtkdrawing.h
---- firefox-55.0.3/widget/gtk/gtkdrawing.h.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/gtkdrawing.h 2017-09-14 11:29:45.349643494 +0200
-@@ -268,8 +268,14 @@ typedef enum {
- MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL,
- /* Paints the background of a window, dialog or page. */
- MOZ_GTK_WINDOW,
-+ /* Used only as a container for MOZ_GTK_HEADER_BAR_MAXIMIZED. */
-+ MOZ_GTK_WINDOW_MAXIMIZED,
- /* Window container for all widgets */
- MOZ_GTK_WINDOW_CONTAINER,
-+ /* Window with the 'csd' style class. */
-+ MOZ_GTK_WINDOW_CSD,
-+ /* Client-side window decoration node. Available on GTK 3.20+. */
-+ MOZ_GTK_WINDOW_DECORATION,
- /* Paints a GtkInfoBar, for notifications. */
- MOZ_GTK_INFO_BAR,
- /* Used for widget tree construction. */
-@@ -290,6 +296,17 @@ typedef enum {
- MOZ_GTK_COMBOBOX_ENTRY_ARROW,
- /* Used for scrolled window shell. */
- MOZ_GTK_SCROLLED_WINDOW,
-+ /* Paints a GtkHeaderBar */
-+ MOZ_GTK_HEADER_BAR,
-+ /* Paints a GtkHeaderBar in maximized state */
-+ MOZ_GTK_HEADER_BAR_MAXIMIZED,
-+ /* Paints a GtkHeaderBar title buttons */
-+ MOZ_GTK_HEADER_BAR_BUTTON_CLOSE,
-+ MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE,
-+ MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE,
-+
-+ /* Paints a GtkHeaderBar title button */
-+ MOZ_GTK_HEADER_BAR_BUTTON,
-
- MOZ_GTK_WIDGET_NODE_COUNT
- } WidgetNodeType;
-@@ -542,6 +559,21 @@ gint moz_gtk_get_menu_separator_height(g
- */
- gint moz_gtk_splitter_get_metrics(gint orientation, gint* size);
-
-+#if (MOZ_WIDGET_GTK == 3)
-+/**
-+ * Gets the margins to be used for window decorations, typically the extra space
-+ * required to draw a drop shadow (obtained from gtk_render_background_get_clip).
-+ * Only available on GTK 3.20+.
-+ */
-+void moz_gtk_get_window_border(gint* top, gint* right, gint* bottom, gint* left);
-+
-+/**
-+ * Draw window decorations, typically a shadow.
-+ * Only available on GTK 3.20+.
-+ */
-+void moz_gtk_window_decoration_paint(cairo_t *cr, GdkRectangle* rect);
-+#endif
-+
- /**
- * Get the YTHICKNESS of a tab (notebook extension).
- */
-diff -up firefox-55.0.3/widget/gtk/mozgtk/mozgtk.c.csd firefox-55.0.3/widget/gtk/mozgtk/mozgtk.c
---- firefox-55.0.3/widget/gtk/mozgtk/mozgtk.c.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/mozgtk/mozgtk.c 2017-09-14 11:29:45.350643492 +0200
-@@ -576,6 +576,8 @@ STUB(gtk_style_context_set_state)
- STUB(gtk_style_properties_lookup_property)
- STUB(gtk_tree_view_column_get_button)
- STUB(gtk_widget_get_preferred_size)
-+STUB(gtk_widget_get_preferred_width)
-+STUB(gtk_widget_get_preferred_height)
- STUB(gtk_widget_get_state_flags)
- STUB(gtk_widget_get_style_context)
- STUB(gtk_widget_path_append_type)
-@@ -585,6 +587,10 @@ STUB(gtk_widget_path_iter_add_class)
- STUB(gtk_widget_path_get_object_type)
- STUB(gtk_widget_path_new)
- STUB(gtk_widget_path_unref)
-+STUB(gtk_widget_set_margin_left)
-+STUB(gtk_widget_set_margin_right)
-+STUB(gtk_widget_set_margin_top)
-+STUB(gtk_widget_set_margin_bottom)
- STUB(gtk_widget_set_visual)
- STUB(gtk_app_chooser_dialog_new_for_content_type)
- STUB(gtk_app_chooser_get_type)
-@@ -597,6 +603,7 @@ STUB(gtk_color_chooser_get_type)
- STUB(gtk_color_chooser_set_rgba)
- STUB(gtk_color_chooser_get_rgba)
- STUB(gtk_color_chooser_set_use_alpha)
-+STUB(gtk_window_get_size)
- #endif
-
- #ifdef GTK2_SYMBOLS
-diff -up firefox-55.0.3/widget/gtk/nsLookAndFeel.cpp.csd firefox-55.0.3/widget/gtk/nsLookAndFeel.cpp
---- firefox-55.0.3/widget/gtk/nsLookAndFeel.cpp.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/nsLookAndFeel.cpp 2017-09-14 11:29:45.350643492 +0200
-@@ -859,6 +859,10 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
- case eIntID_ContextMenuOffsetHorizontal:
- aResult = 2;
- break;
-+ case eIntID_GTKCSDAvailable:
-+ EnsureInit();
-+ aResult = sCSDAvailable;
-+ break;
- default:
- aResult = 0;
- res = NS_ERROR_FAILURE;
-@@ -1468,6 +1472,16 @@ nsLookAndFeel::EnsureInit()
- nullptr);
-
- gtk_widget_destroy(window);
-+
-+ // Require GTK 3.20 for client-side decoration support.
-+ // 3.20 exposes gtk_render_background_get_clip, which is required for
-+ // calculating shadow metrics for decorated windows.
-+ sCSDAvailable = gtk_check_version(3, 20, 0) == nullptr;
-+ if (sCSDAvailable) {
-+ sCSDAvailable =
-+ mozilla::Preferences::GetBool("widget.allow-client-side-decoration",
-+ false);
-+ }
- }
-
- // virtual
-diff -up firefox-55.0.3/widget/gtk/nsLookAndFeel.h.csd firefox-55.0.3/widget/gtk/nsLookAndFeel.h
---- firefox-55.0.3/widget/gtk/nsLookAndFeel.h.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/nsLookAndFeel.h 2017-09-14 11:29:45.350643492 +0200
-@@ -30,6 +30,8 @@ public:
- virtual char16_t GetPasswordCharacterImpl();
- virtual bool GetEchoPasswordImpl();
-
-+ bool IsCSDAvailable() const { return sCSDAvailable; }
-+
- protected:
- #if (MOZ_WIDGET_GTK == 2)
- struct _GtkStyle *mStyle;
-@@ -81,6 +83,7 @@ protected:
- char16_t sInvisibleCharacter;
- float sCaretRatio;
- bool sMenuSupportsDrag;
-+ bool sCSDAvailable;
- bool mInitialized;
-
- void EnsureInit();
-diff -up firefox-55.0.3/widget/gtk/nsNativeThemeGTK.cpp.csd firefox-55.0.3/widget/gtk/nsNativeThemeGTK.cpp
---- firefox-55.0.3/widget/gtk/nsNativeThemeGTK.cpp.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/nsNativeThemeGTK.cpp 2017-09-14 11:35:18.230778645 +0200
-@@ -24,9 +24,7 @@
- #include "nsRenderingContext.h"
- #include "nsGkAtoms.h"
- #include "nsAttrValueInlines.h"
--
--#include "mozilla/EventStates.h"
--#include "mozilla/Services.h"
-+#include "nsWindow.h"
-
- #include <gdk/gdkprivate.h>
- #include <gtk/gtk.h>
-@@ -704,6 +702,24 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
- case NS_THEME_GTK_INFO_BAR:
- aGtkWidgetType = MOZ_GTK_INFO_BAR;
- break;
-+ case NS_THEME_WINDOW_TITLEBAR:
-+ aGtkWidgetType = MOZ_GTK_HEADER_BAR;
-+ break;
-+ case NS_THEME_WINDOW_TITLEBAR_MAXIMIZED:
-+ aGtkWidgetType = MOZ_GTK_HEADER_BAR_MAXIMIZED;
-+ break;
-+ case NS_THEME_WINDOW_BUTTON_CLOSE:
-+ aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_CLOSE;
-+ break;
-+ case NS_THEME_WINDOW_BUTTON_MINIMIZE:
-+ aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE;
-+ break;
-+ case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
-+ aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE;
-+ break;
-+ case NS_THEME_WINDOW_BUTTON_RESTORE:
-+ aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE;
-+ break;
- default:
- return false;
- }
-@@ -1636,6 +1652,10 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
- case NS_THEME_MENULIST:
- case NS_THEME_TOOLBARBUTTON:
- case NS_THEME_TREEHEADERCELL:
-+ case NS_THEME_WINDOW_BUTTON_CLOSE:
-+ case NS_THEME_WINDOW_BUTTON_MINIMIZE:
-+ case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
-+ case NS_THEME_WINDOW_BUTTON_RESTORE:
- {
- if (aWidgetType == NS_THEME_MENULIST) {
- // Include the arrow size.
-@@ -1901,9 +1921,21 @@ nsNativeThemeGTK::ThemeSupportsWidget(ns
- case NS_THEME_DIALOG:
- #if (MOZ_WIDGET_GTK == 3)
- case NS_THEME_GTK_INFO_BAR:
-+ case NS_THEME_GTK_WINDOW_DECORATION:
- #endif
- return !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
-
-+ case NS_THEME_WINDOW_BUTTON_CLOSE:
-+ case NS_THEME_WINDOW_BUTTON_MINIMIZE:
-+ case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
-+ case NS_THEME_WINDOW_BUTTON_RESTORE:
-+ case NS_THEME_WINDOW_TITLEBAR:
-+ case NS_THEME_WINDOW_TITLEBAR_MAXIMIZED:
-+ // GtkHeaderBar is available on GTK 3.10+, which is used for styling
-+ // title bars and title buttons.
-+ return gtk_check_version(3, 10, 0) == nullptr &&
-+ !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
-+
- case NS_THEME_MENULIST_BUTTON:
- if (aFrame && aFrame->GetWritingMode().IsVertical()) {
- return false;
-@@ -1987,6 +2019,13 @@ nsNativeThemeGTK::GetWidgetTransparency(
- #else
- return eTransparent;
- #endif
-+ case NS_THEME_GTK_WINDOW_DECORATION:
-+ {
-+ nsWindow* window = static_cast<nsWindow*>(aFrame->GetNearestWidget());
-+ if (window)
-+ return window->IsComposited() ? eTransparent : eOpaque;
-+ return eOpaque;
-+ }
- }
-
- return eUnknownTransparency;
-diff -up firefox-55.0.3/widget/gtk/nsWindow.cpp.csd firefox-55.0.3/widget/gtk/nsWindow.cpp
---- firefox-55.0.3/widget/gtk/nsWindow.cpp.csd 2017-09-14 11:29:45.342643512 +0200
-+++ firefox-55.0.3/widget/gtk/nsWindow.cpp 2017-09-14 11:34:23.671920392 +0200
-@@ -80,6 +80,7 @@
- #include "nsIPropertyBag2.h"
- #include "GLContext.h"
- #include "gfx2DGlue.h"
-+#include "nsLookAndFeel.h"
-
- #ifdef ACCESSIBILITY
- #include "mozilla/a11y/Accessible.h"
-@@ -133,6 +134,8 @@ using namespace mozilla::widget;
-
- #include "mozilla/layers/APZCTreeManager.h"
-
-+#include "gtkdrawing.h"
-+
- using namespace mozilla;
- using namespace mozilla::gfx;
- using namespace mozilla::widget;
-@@ -180,6 +183,8 @@ static gboolean expose_event_cb
- #else
- static gboolean expose_event_cb (GtkWidget *widget,
- cairo_t *rect);
-+static gboolean expose_event_decoration_draw_cb (GtkWidget *widget,
-+ cairo_t *cr);
- #endif
- static gboolean configure_event_cb (GtkWidget *widget,
- GdkEventConfigure *event);
-@@ -432,6 +437,7 @@ nsWindow::nsWindow()
-
- mContainer = nullptr;
- mGdkWindow = nullptr;
-+ mIsCSDEnabled = false;
- mShell = nullptr;
- mHasMappedToplevel = false;
- mIsFullyObscured = false;
-@@ -472,6 +478,9 @@ nsWindow::nsWindow()
- mLastScrollEventTime = GDK_CURRENT_TIME;
- #endif
- mPendingConfigures = 0;
-+ mDrawWindowDecoration = false;
-+ mDecorationSize = {0,0,0,0};
-+ mDecorationSizeChanged = false;
- }
-
- nsWindow::~nsWindow()
-@@ -1105,6 +1114,12 @@ nsWindow::Resize(double aWidth, double a
- // interpreted as frame bounds, but NativeResize treats these as window
- // bounds (Bug 581866).
-
-+ // When we draw decorations add extra space to draw shadows around the main window.
-+ if (mDrawWindowDecoration) {
-+ width += mDecorationSize.left + mDecorationSize.right;
-+ height += mDecorationSize.top + mDecorationSize.bottom;
-+ }
-+
- mBounds.SizeTo(width, height);
-
- if (!mCreated)
-@@ -1584,6 +1599,10 @@ nsWindow::SetCursor(nsCursor aCursor)
- return;
-
- gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mContainer)), newCursor);
-+ if (IsClientDecorated()) {
-+ gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mShell)),
-+ newCursor);
-+ }
- }
- }
- }
-@@ -1640,6 +1659,10 @@ nsWindow::SetCursor(imgIContainer* aCurs
- if (cursor) {
- if (mContainer) {
- gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mContainer)), cursor);
-+ if (IsClientDecorated()) {
-+ gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mShell)),
-+ cursor);
-+ }
- rv = NS_OK;
- }
- #if (MOZ_WIDGET_GTK == 3)
-@@ -2563,6 +2586,53 @@ nsWindow::OnMotionNotifyEvent(GdkEventMo
- }
- }
- #endif /* MOZ_X11 */
-+ // Client is decorated and we're getting the motion event for mShell
-+ // window which draws the CSD decorations around mContainer.
-+ if (IsClientDecorated()) {
-+ if (aEvent->window == gtk_widget_get_window(mShell)) {
-+ GdkWindowEdge edge;
-+ LayoutDeviceIntPoint refPoint =
-+ GdkEventCoordsToDevicePixels(aEvent->x, aEvent->y);
-+ if (CheckResizerEdge(refPoint, edge)) {
-+ nsCursor cursor = eCursor_none;
-+ switch (edge) {
-+ case GDK_WINDOW_EDGE_NORTH:
-+ cursor = eCursor_n_resize;
-+ break;
-+ case GDK_WINDOW_EDGE_NORTH_WEST:
-+ cursor = eCursor_nw_resize;
-+ break;
-+ case GDK_WINDOW_EDGE_NORTH_EAST:
-+ cursor = eCursor_ne_resize;
-+ break;
-+ case GDK_WINDOW_EDGE_WEST:
-+ cursor = eCursor_w_resize;
-+ break;
-+ case GDK_WINDOW_EDGE_EAST:
-+ cursor = eCursor_e_resize;
-+ break;
-+ case GDK_WINDOW_EDGE_SOUTH:
-+ cursor = eCursor_s_resize;
-+ break;
-+ case GDK_WINDOW_EDGE_SOUTH_WEST:
-+ cursor = eCursor_sw_resize;
-+ break;
-+ case GDK_WINDOW_EDGE_SOUTH_EAST:
-+ cursor = eCursor_se_resize;
-+ break;
-+ }
-+ SetCursor(cursor);
-+ return;
-+ }
-+ }
-+ // We're not on resize handle - check if we need to reset cursor back.
-+ if (mCursor == eCursor_n_resize || mCursor == eCursor_nw_resize ||
-+ mCursor == eCursor_ne_resize || mCursor == eCursor_w_resize ||
-+ mCursor == eCursor_e_resize || mCursor == eCursor_s_resize ||
-+ mCursor == eCursor_sw_resize || mCursor == eCursor_se_resize) {
-+ SetCursor(eCursor_standard);
-+ }
-+ }
-
- WidgetMouseEvent event(true, eMouseMove, this, WidgetMouseEvent::eReal);
-
-@@ -2733,6 +2803,20 @@ nsWindow::OnButtonPressEvent(GdkEventBut
- if (CheckForRollup(aEvent->x_root, aEvent->y_root, false, false))
- return;
-
-+ if (IsClientDecorated() && aEvent->window == gtk_widget_get_window(mShell)) {
-+ // Check to see if the event is within our window's resize region
-+ GdkWindowEdge edge;
-+ LayoutDeviceIntPoint refPoint =
-+ GdkEventCoordsToDevicePixels(aEvent->x, aEvent->y);
-+ if (CheckResizerEdge(refPoint, edge)) {
-+ gdk_window_begin_resize_drag(gtk_widget_get_window(mShell),
-+ edge, aEvent->button,
-+ aEvent->x_root, aEvent->y_root,
-+ aEvent->time);
-+ return;
-+ }
-+ }
-+
- gdouble pressure = 0;
- gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
- mLastMotionPressure = pressure;
-@@ -3318,6 +3402,8 @@ nsWindow::OnWindowStateEvent(GtkWidget *
- #endif //ACCESSIBILITY
- }
-
-+ UpdateClientDecorations();
-+
- if (mWidgetListener) {
- mWidgetListener->SizeModeChanged(mSizeState);
- if (aEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
-@@ -3364,6 +3450,7 @@ nsWindow::OnDPIChanged()
- presShell->ThemeChanged();
- }
- }
-+ UpdateClientDecorations();
- }
-
- void
-@@ -3573,7 +3660,8 @@ nsWindow::Create(nsIWidget* aParent,
- GtkWindow *topLevelParent = nullptr;
- nsWindow *parentnsWindow = nullptr;
- GtkWidget *eventWidget = nullptr;
-- bool shellHasCSD = false;
-+ GtkWidget *drawWidget = nullptr;
-+ bool drawToContainer = false;
-
- if (aParent) {
- parentnsWindow = static_cast<nsWindow*>(aParent);
-@@ -3620,29 +3708,46 @@ nsWindow::Create(nsIWidget* aParent,
- GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP;
- mShell = gtk_window_new(type);
-
-- bool useAlphaVisual = (mWindowType == eWindowType_popup &&
-- aInitData->mSupportTranslucency);
-+ bool useAlphaVisual = false;
-+#if (MOZ_WIDGET_GTK == 3)
-+ // When CSD is available we can emulate it for toplevel windows.
-+ // Content is rendered to mContainer and transparent decorations to mShell.
-+ if (mWindowType == eWindowType_toplevel) {
-+ int32_t isCSDAvailable = false;
-+ nsresult rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDAvailable,
-+ &isCSDAvailable);
-+ if (NS_SUCCEEDED(rv)) {
-+ mIsCSDEnabled = useAlphaVisual = isCSDAvailable;
-+ }
-+ } else
-+#endif
-+ if (mWindowType == eWindowType_popup) {
-+ useAlphaVisual = aInitData->mSupportTranslucency;
-+ }
-
- // mozilla.widget.use-argb-visuals is a hidden pref defaulting to false
- // to allow experimentation
- if (Preferences::GetBool("mozilla.widget.use-argb-visuals", false))
- useAlphaVisual = true;
-
-+ // An ARGB visual is only useful if we are on a compositing
-+ // window manager.
-+ GdkScreen *screen = gtk_widget_get_screen(mShell);
-+ if (useAlphaVisual && !gdk_screen_is_composited(screen)) {
-+ useAlphaVisual = false;
-+ }
-+
- // We need to select an ARGB visual here instead of in
- // SetTransparencyMode() because it has to be done before the
-- // widget is realized. An ARGB visual is only useful if we
-- // are on a compositing window manager.
-+ // widget is realized.
- if (useAlphaVisual) {
-- GdkScreen *screen = gtk_widget_get_screen(mShell);
-- if (gdk_screen_is_composited(screen)) {
- #if (MOZ_WIDGET_GTK == 2)
-- GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
-- gtk_widget_set_colormap(mShell, colormap);
-+ GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
-+ gtk_widget_set_colormap(mShell, colormap);
- #else
-- GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
-- gtk_widget_set_visual(mShell, visual);
-+ GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
-+ gtk_widget_set_visual(mShell, visual);
- #endif
-- }
- }
-
- // We only move a general managed toplevel window if someone has
-@@ -3736,24 +3841,56 @@ nsWindow::Create(nsIWidget* aParent,
- mContainer = MOZ_CONTAINER(container);
-
- #if (MOZ_WIDGET_GTK == 3)
-- // "csd" style is set when widget is realized so we need to call
-- // it explicitly now.
-- gtk_widget_realize(mShell);
--
-- // We can't draw directly to top-level window when client side
-- // decorations are enabled. We use container with GdkWindow instead.
-- GtkStyleContext* style = gtk_widget_get_style_context(mShell);
-- shellHasCSD = gtk_style_context_has_class(style, "csd");
--#endif
-- if (!shellHasCSD) {
-- // Use mShell's window for drawing and events.
-- gtk_widget_set_has_window(container, FALSE);
-- // Prevent GtkWindow from painting a background to flicker.
-- gtk_widget_set_app_paintable(mShell, TRUE);
-- }
-- // Set up event widget
-- eventWidget = shellHasCSD ? container : mShell;
-+ /* There are tree possible situations here:
-+ *
-+ * 1) We're running on Gtk+ < 3.20 without any decorations. Content
-+ * is rendered to mShell window and we listen Gtk+ events on mShell.
-+ * 2) We're running on Gtk+ > 3.20 and window decorations are drawn
-+ * by default by Gtk+. Content is rendered to mContainer,
-+ * we listen events on mContainer. mShell contains default Gtk+
-+ * window decorations rendered by Gtk+.
-+ * 3) We're running on Gtk+ > 3.20 and both window decorations and
-+ * content is rendered by gecko. We emulate Gtk+ decoration rendering
-+ * to mShell and we need to listen Gtk events on both mShell
-+ * and mContainer.
-+ */
-+
-+ // When client side decorations are enabled (rendered by us or by Gtk+)
-+ // the decoration is rendered to mShell (toplevel) window and
-+ // we draw our content to mContainer.
-+ if (mIsCSDEnabled) {
-+ drawToContainer = true;
-+ } else {
-+ // mIsCSDEnabled can be disabled by preference so look at actual
-+ // toplevel window style to to detect active "csd" style.
-+ // The "csd" style is set when widget is realized so we need to call
-+ // it explicitly now.
-+ gtk_widget_realize(mShell);
-+
-+ GtkStyleContext* style = gtk_widget_get_style_context(mShell);
-+ drawToContainer = gtk_style_context_has_class(style, "csd");
-+ }
-+#endif
-+ drawWidget = (drawToContainer) ? container : mShell;
-+ // When we draw decorations on our own we need to handle resize events
-+ // because Gtk+ does not provide resizers for undecorated windows.
-+ // The CSD on mShell borders act as resize handlers
-+ // so we need to listen there.
-+ eventWidget = (drawToContainer && !mIsCSDEnabled) ? container : mShell;
-+
- gtk_widget_add_events(eventWidget, kEvents);
-+ if (eventWidget != drawWidget) {
-+ // CSD is rendered by us (not by Gtk+) so we also need to listen
-+ // at mShell window for events.
-+ gtk_widget_add_events(drawWidget, kEvents);
-+ }
-+
-+ // Prevent GtkWindow from painting a background to flicker.
-+ gtk_widget_set_app_paintable(drawWidget, TRUE);
-+
-+ // gtk_container_add() realizes the child widget so we need to
-+ // set it now.
-+ gtk_widget_set_has_window(container, drawToContainer);
-
- gtk_container_add(GTK_CONTAINER(mShell), container);
- gtk_widget_realize(container);
-@@ -3763,7 +3900,7 @@ nsWindow::Create(nsIWidget* aParent,
- gtk_widget_grab_focus(container);
-
- // the drawing window
-- mGdkWindow = gtk_widget_get_window(eventWidget);
-+ mGdkWindow = gtk_widget_get_window(drawWidget);
-
- if (mWindowType == eWindowType_popup) {
- // gdk does not automatically set the cursor for "temporary"
-@@ -3836,6 +3973,11 @@ nsWindow::Create(nsIWidget* aParent,
-
- // label the drawing window with this object so we can find our way home
- g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", this);
-+ if (mIsCSDEnabled) {
-+ // label the CSD window with this object so we can find our way home
-+ g_object_set_data(G_OBJECT(gtk_widget_get_window(mShell)),
-+ "nsWindow", this);
-+ }
-
- if (mContainer)
- g_object_set_data(G_OBJECT(mContainer), "nsWindow", this);
-@@ -3863,6 +4005,10 @@ nsWindow::Create(nsIWidget* aParent,
- g_signal_connect_after(default_settings,
- "notify::gtk-font-name",
- G_CALLBACK(theme_changed_cb), this);
-+ if (mIsCSDEnabled) {
-+ g_signal_connect(G_OBJECT(mShell), "draw",
-+ G_CALLBACK(expose_event_decoration_draw_cb), nullptr);
-+ }
- }
-
- if (mContainer) {
-@@ -3913,7 +4059,7 @@ nsWindow::Create(nsIWidget* aParent,
- G_CALLBACK(drag_data_received_event_cb), nullptr);
-
- GtkWidget *widgets[] = { GTK_WIDGET(mContainer),
-- !shellHasCSD ? mShell : nullptr };
-+ !drawToContainer ? mShell : nullptr };
- for (size_t i = 0; i < ArrayLength(widgets) && widgets[i]; ++i) {
- // Visibility events are sent to the owning widget of the relevant
- // window but do not propagate to parent widgets so connect on
-@@ -3943,7 +4089,6 @@ nsWindow::Create(nsIWidget* aParent,
- // Don't let GTK mess with the shapes of our GdkWindows
- GTK_PRIVATE_SET_FLAG(eventWidget, GTK_HAS_SHAPE_MASK);
- #endif
--
- // These events are sent to the owning widget of the relevant window
- // and propagate up to the first widget that handles the events, so we
- // need only connect on mShell, if it exists, to catch events on its
-@@ -5492,6 +5637,31 @@ expose_event_cb(GtkWidget *widget, cairo
-
- return FALSE;
- }
-+
-+/* static */
-+gboolean
-+expose_event_decoration_draw_cb(GtkWidget *widget, cairo_t *cr)
-+{
-+ GdkWindow* gdkWindow = gtk_widget_get_window(widget);
-+ if (gtk_cairo_should_draw_window(cr, gdkWindow)) {
-+ RefPtr<nsWindow> window = get_window_for_gtk_widget(widget);
-+ if (!window) {
-+ NS_WARNING("Cannot get nsWindow from GtkWidget");
-+ }
-+ else if (window->IsClientDecorated()) {
-+ cairo_save(cr);
-+ gtk_cairo_transform_to_window(cr, widget, gdkWindow);
-+
-+ GdkRectangle rect = {0,0,0,0};
-+ gtk_window_get_size(GTK_WINDOW(widget), &rect.width, &rect.height);
-+ moz_gtk_window_decoration_paint(cr, &rect);
-+
-+ cairo_restore(cr);
-+ }
-+ }
-+ return TRUE;
-+}
-+
- #endif //MOZ_WIDGET_GTK == 2
-
- static gboolean
-@@ -6526,6 +6696,28 @@ nsWindow::ClearCachedResources()
- }
- }
-
-+NS_IMETHODIMP
-+nsWindow::SetNonClientMargins(LayoutDeviceIntMargin &aMargins)
-+{
-+ SetDrawsInTitlebar(aMargins.top == 0);
-+ return NS_OK;
-+}
-+
-+void
-+nsWindow::SetDrawsInTitlebar(bool aState)
-+{
-+ if (!mIsCSDEnabled || aState == mDrawWindowDecoration)
-+ return;
-+
-+ if (mShell) {
-+ gtk_window_set_decorated(GTK_WINDOW(mShell), !aState);
-+ gtk_widget_set_app_paintable(mShell, aState);
-+ }
-+
-+ mDrawWindowDecoration = aState;
-+ UpdateClientDecorations();
-+}
-+
- gint
- nsWindow::GdkScaleFactor()
- {
-@@ -6796,6 +6988,107 @@ nsWindow::SynthesizeNativeTouchPoint(uin
- }
- #endif
-
-+bool
-+nsWindow::IsClientDecorated() const
-+{
-+ return mDrawWindowDecoration && mSizeState == nsSizeMode_Normal;
-+}
-+
-+int
-+nsWindow::GetClientResizerSize()
-+{
-+ if (!mShell)
-+ return 0;
-+
-+ // GTK uses a default size of 20px as of 3.20.
-+ gint size = 20;
-+ gtk_widget_style_get(mShell, "decoration-resize-handle", &size, nullptr);
-+
-+ return GdkCoordToDevicePixels(size);
-+}
-+
-+void
-+nsWindow::UpdateClientDecorations()
-+{
-+ if (!mDrawWindowDecoration)
-+ return;
-+
-+ gint top = 0, right = 0, bottom = 0, left = 0;
-+ if (mSizeState == nsSizeMode_Normal) {
-+ moz_gtk_get_window_border(&top, &right, &bottom, &left);
-+ }
-+
-+ static auto sGdkWindowSetShadowWidth =
-+ (void (*)(GdkWindow*, gint, gint, gint, gint))
-+ dlsym(RTLD_DEFAULT, "gdk_window_set_shadow_width");
-+ sGdkWindowSetShadowWidth(gtk_widget_get_window(mShell),
-+ left, right, top, bottom);
-+
-+ mDecorationSize.left = left;
-+ mDecorationSize.right = right;
-+ mDecorationSize.top = top;
-+ mDecorationSize.bottom = bottom;
-+
-+ // Gtk+ doesn't like when we set mContainer margin bigger than actual
-+ // mContainer window size. That happens when we're called early and the
-+ // mShell/mContainer is not allocated/resized yet and has default 1x1 size.
-+ // Just resize to some minimal value which will be changed
-+ // by Gecko soon.
-+ GtkAllocation allocation;
-+ gtk_widget_get_allocation(GTK_WIDGET(mContainer), &allocation);
-+ if (allocation.width < left + right || allocation.height < top + bottom) {
-+ gtk_widget_get_preferred_width(GTK_WIDGET(mContainer), nullptr,
-+ &allocation.width);
-+ gtk_widget_get_preferred_height(GTK_WIDGET(mContainer), nullptr,
-+ &allocation.height);
-+ allocation.width += left + right + 1;
-+ allocation.height += top + bottom + 1;
-+ gtk_widget_size_allocate(GTK_WIDGET(mContainer), &allocation);
-+ }
-+
-+ gtk_widget_set_margin_left(GTK_WIDGET(mContainer), mDecorationSize.left);
-+ gtk_widget_set_margin_right(GTK_WIDGET(mContainer), mDecorationSize.right);
-+ gtk_widget_set_margin_top(GTK_WIDGET(mContainer), mDecorationSize.top);
-+ gtk_widget_set_margin_bottom(GTK_WIDGET(mContainer), mDecorationSize.bottom);
-+}
-+
-+bool
-+nsWindow::CheckResizerEdge(LayoutDeviceIntPoint aPoint, GdkWindowEdge& aOutEdge)
-+{
-+ gint scale = GdkScaleFactor();
-+ gint left = scale * mDecorationSize.left;
-+ gint top = scale * mDecorationSize.top;
-+ gint right = scale * mDecorationSize.right;
-+ gint bottom = scale * mDecorationSize.bottom;
-+
-+ int resizerSize = GetClientResizerSize();
-+ int topDist = aPoint.y;
-+ int leftDist = aPoint.x;
-+ int rightDist = mBounds.width - aPoint.x;
-+ int bottomDist = mBounds.height - aPoint.y;
-+
-+ if (leftDist <= resizerSize && topDist <= resizerSize) {
-+ aOutEdge = GDK_WINDOW_EDGE_NORTH_WEST;
-+ } else if (rightDist <= resizerSize && topDist <= resizerSize) {
-+ aOutEdge = GDK_WINDOW_EDGE_NORTH_EAST;
-+ } else if (leftDist <= resizerSize && bottomDist <= resizerSize) {
-+ aOutEdge = GDK_WINDOW_EDGE_SOUTH_WEST;
-+ } else if (rightDist <= resizerSize && bottomDist <= resizerSize) {
-+ aOutEdge = GDK_WINDOW_EDGE_SOUTH_EAST;
-+ } else if (topDist <= top) {
-+ aOutEdge = GDK_WINDOW_EDGE_NORTH;
-+ } else if (leftDist <= left) {
-+ aOutEdge = GDK_WINDOW_EDGE_WEST;
-+ } else if (rightDist <= right) {
-+ aOutEdge = GDK_WINDOW_EDGE_EAST;
-+ } else if (bottomDist <= bottom) {
-+ aOutEdge = GDK_WINDOW_EDGE_SOUTH;
-+ } else {
-+ return false;
-+ }
-+ return true;
-+}
-+
- int32_t
- nsWindow::RoundsWidgetCoordinatesTo()
- {
-diff -up firefox-55.0.3/widget/gtk/nsWindow.h.csd firefox-55.0.3/widget/gtk/nsWindow.h
---- firefox-55.0.3/widget/gtk/nsWindow.h.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/nsWindow.h 2017-09-14 11:33:50.009007850 +0200
-@@ -125,6 +125,7 @@ public:
- double aHeight,
- bool aRepaint) override;
- virtual bool IsEnabled() const override;
-+ bool IsComposited() const;
-
- void SetZIndex(int32_t aZIndex) override;
- virtual void SetSizeMode(nsSizeMode aMode) override;
-@@ -353,6 +354,9 @@ public:
- #endif
- virtual void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData) override;
-
-+ NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
-+ void SetDrawsInTitlebar(bool aState) override;
-+
- // HiDPI scale conversion
- gint GdkScaleFactor();
-
-@@ -369,6 +373,9 @@ public:
- LayoutDeviceIntRect GdkRectToDevicePixels(GdkRectangle rect);
-
- virtual bool WidgetTypeSupportsAcceleration() override;
-+
-+ // Decorations
-+ bool IsClientDecorated() const;
- protected:
- virtual ~nsWindow();
-
-@@ -386,6 +393,16 @@ protected:
-
- virtual void RegisterTouchWindow() override;
-
-+ int GetClientResizerSize();
-+
-+ // Informs the window manager about the size of the shadows surrounding
-+ // a client-side decorated window.
-+ void UpdateClientDecorations();
-+
-+ // Returns true if the given point (in device pixels) is within a resizer
-+ // region of the window. Only used when drawing decorations client side.
-+ bool CheckResizerEdge(LayoutDeviceIntPoint aPoint, GdkWindowEdge& aOutEdge);
-+
- nsCOMPtr<nsIWidget> mParent;
- // Is this a toplevel window?
- bool mIsTopLevel;
-@@ -434,12 +451,12 @@ private:
- gint* aRootX, gint* aRootY);
- void ClearCachedResources();
- nsIWidgetListener* GetListener();
-- bool IsComposited() const;
-
-
- GtkWidget *mShell;
- MozContainer *mContainer;
- GdkWindow *mGdkWindow;
-+ bool mIsCSDEnabled;
-
- uint32_t mHasMappedToplevel : 1,
- mIsFullyObscured : 1,
-@@ -536,6 +553,11 @@ private:
- // leaving fullscreen
- nsSizeMode mLastSizeMode;
-
-+ // If true, draw our own window decorations (where supported).
-+ bool mDrawWindowDecoration;
-+ GtkBorder mDecorationSize;
-+ bool mDecorationSizeChanged;
-+
- static bool DragInProgress(void);
-
- void DispatchMissedButtonReleases(GdkEventCrossing *aGdkEvent);
-diff -up firefox-55.0.3/widget/gtk/WidgetStyleCache.cpp.csd firefox-55.0.3/widget/gtk/WidgetStyleCache.cpp
---- firefox-55.0.3/widget/gtk/WidgetStyleCache.cpp.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/gtk/WidgetStyleCache.cpp 2017-09-14 11:29:45.349643494 +0200
-@@ -26,10 +26,14 @@ static GtkStyleContext*
- GetCssNodeStyleInternal(WidgetNodeType aNodeType);
-
- static GtkWidget*
--CreateWindowWidget()
-+CreateWindowWidget(WidgetNodeType type)
- {
- GtkWidget *widget = gtk_window_new(GTK_WINDOW_POPUP);
- gtk_widget_set_name(widget, "MozillaGtkWidget");
-+ if (type == MOZ_GTK_WINDOW_CSD) {
-+ GtkStyleContext* style = gtk_widget_get_style_context(widget);
-+ gtk_style_context_add_class(style, "csd");
-+ }
- return widget;
- }
-
-@@ -101,7 +105,7 @@ CreateTooltipWidget()
- {
- MOZ_ASSERT(gtk_check_version(3, 20, 0) != nullptr,
- "CreateTooltipWidget should be used for Gtk < 3.20 only.");
-- GtkWidget* widget = CreateWindowWidget();
-+ GtkWidget* widget = CreateWindowWidget(MOZ_GTK_WINDOW);
- GtkStyleContext* style = gtk_widget_get_style_context(widget);
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
- return widget;
-@@ -529,11 +533,73 @@ CreateNotebookWidget()
- }
-
- static GtkWidget*
-+CreateHeaderBar(bool aMaximized)
-+{
-+ MOZ_ASSERT(gtk_check_version(3, 10, 0) == nullptr,
-+ "GtkHeaderBar is only available on GTK 3.10+.");
-+
-+ static auto sGtkHeaderBarNewPtr = (GtkWidget* (*)())
-+ dlsym(RTLD_DEFAULT, "gtk_header_bar_new");
-+ static const char* MOZ_GTK_STYLE_CLASS_TITLEBAR = "titlebar";
-+
-+ GtkWidget* headerbar = sGtkHeaderBarNewPtr();
-+ if (aMaximized) {
-+ GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
-+ gtk_widget_set_name(window, "MozillaMaximizedGtkWidget");
-+ GtkStyleContext* style = gtk_widget_get_style_context(window);
-+ gtk_style_context_add_class(style, "maximized");
-+ GtkWidget *fixed = gtk_fixed_new();
-+ gtk_container_add(GTK_CONTAINER(window), fixed);
-+ gtk_container_add(GTK_CONTAINER(fixed), headerbar);
-+ // Save the window container so we don't leak it.
-+ sWidgetStorage[MOZ_GTK_WINDOW_MAXIMIZED] = window;
-+ } else {
-+ AddToWindowContainer(headerbar);
-+ }
-+
-+ // Emulate what create_titlebar() at gtkwindow.c does.
-+ GtkStyleContext* style = gtk_widget_get_style_context(headerbar);
-+ gtk_style_context_add_class(style, MOZ_GTK_STYLE_CLASS_TITLEBAR);
-+ gtk_style_context_add_class(style, "default-decoration");
-+
-+ return headerbar;
-+}
-+
-+static GtkWidget*
-+CreateHeaderBarButton(WidgetNodeType aWidgetType)
-+{
-+ static const char* MOZ_GTK_STYLE_CLASS_TITLEBUTTON = "titlebutton";
-+
-+ GtkWidget* widget = gtk_button_new();
-+ gtk_container_add(GTK_CONTAINER(GetWidget(MOZ_GTK_HEADER_BAR)), widget);
-+
-+ GtkStyleContext* style = gtk_widget_get_style_context(widget);
-+ gtk_style_context_add_class(style, MOZ_GTK_STYLE_CLASS_TITLEBUTTON);
-+
-+ switch (aWidgetType) {
-+ case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
-+ gtk_style_context_add_class(style, "close");
-+ break;
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE:
-+ gtk_style_context_add_class(style, "minimize");
-+ break;
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE:
-+ gtk_style_context_add_class(style, "maximize");
-+ break;
-+ default:
-+ break;
-+ }
-+
-+ return widget;
-+}
-+
-+static GtkWidget*
- CreateWidget(WidgetNodeType aWidgetType)
- {
- switch (aWidgetType) {
- case MOZ_GTK_WINDOW:
-- return CreateWindowWidget();
-+ case MOZ_GTK_WINDOW_CSD:
-+ return CreateWindowWidget(aWidgetType);
- case MOZ_GTK_WINDOW_CONTAINER:
- return CreateWindowContainerWidget();
- case MOZ_GTK_CHECKBUTTON_CONTAINER:
-@@ -610,6 +676,13 @@ CreateWidget(WidgetNodeType aWidgetType)
- return CreateComboBoxEntryButtonWidget();
- case MOZ_GTK_COMBOBOX_ENTRY_ARROW:
- return CreateComboBoxEntryArrowWidget();
-+ case MOZ_GTK_HEADER_BAR:
-+ case MOZ_GTK_HEADER_BAR_MAXIMIZED:
-+ return CreateHeaderBar(aWidgetType == MOZ_GTK_HEADER_BAR_MAXIMIZED);
-+ case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE:
-+ case MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE:
-+ return CreateHeaderBarButton(aWidgetType);
- default:
- /* Not implemented */
- return nullptr;
-@@ -1031,6 +1104,10 @@ GetCssNodeStyleInternal(WidgetNodeType a
- GtkWidget* widget = GetWidget(MOZ_GTK_NOTEBOOK);
- return gtk_widget_get_style_context(widget);
- }
-+ case MOZ_GTK_WINDOW_DECORATION:
-+ style = CreateChildCSSNode("decoration",
-+ MOZ_GTK_WINDOW_CSD);
-+ break;
- default:
- return GetWidgetRootStyle(aNodeType);
- }
-@@ -1196,6 +1273,8 @@ ResetWidgetCache(void)
- /* This will destroy all of our widgets */
- if (sWidgetStorage[MOZ_GTK_WINDOW])
- gtk_widget_destroy(sWidgetStorage[MOZ_GTK_WINDOW]);
-+ if (sWidgetStorage[MOZ_GTK_WINDOW_MAXIMIZED])
-+ gtk_widget_destroy(sWidgetStorage[MOZ_GTK_WINDOW_MAXIMIZED]);
-
- /* Clear already freed arrays */
- mozilla::PodArrayZero(sWidgetStorage);
-diff -up firefox-55.0.3/widget/LookAndFeel.h.csd firefox-55.0.3/widget/LookAndFeel.h
---- firefox-55.0.3/widget/LookAndFeel.h.csd 2017-07-31 18:20:53.000000000 +0200
-+++ firefox-55.0.3/widget/LookAndFeel.h 2017-09-14 11:29:45.348643497 +0200
-@@ -380,6 +380,12 @@ public:
- eIntID_PhysicalHomeButton,
-
- /*
-+ * A boolean value indicating whether client-side decorations are
-+ * supported by the user's GTK version.
-+ */
-+ eIntID_GTKCSDAvailable,
-+
-+ /*
- * Controls whether overlay scrollbars display when the user moves
- * the mouse in a scrollable frame.
- */
diff --git a/mozilla-440908.patch b/mozilla-440908.patch
index 2d4a609..cce5248 100644
--- a/mozilla-440908.patch
+++ b/mozilla-440908.patch
@@ -1,7 +1,7 @@
-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
+diff -up firefox-56.0/modules/libpref/prefapi.cpp.440908 firefox-56.0/modules/libpref/prefapi.cpp
+--- firefox-56.0/modules/libpref/prefapi.cpp.440908 2017-09-14 22:15:52.000000000 +0200
++++ firefox-56.0/modules/libpref/prefapi.cpp 2017-09-25 10:39:39.266572792 +0200
+@@ -1036,8 +1036,8 @@ void PREF_ReaderCallback(void *clo
PrefValue value,
PrefType type,
bool isDefault,
@@ -12,17 +12,17 @@ diff -up firefox-50.0/modules/libpref/prefapi.cpp.440908 firefox-50.0/modules/li
{
uint32_t flags = 0;
if (isDefault) {
-@@ -1010,4 +1010,6 @@ void PREF_ReaderCallback(void *clo
+@@ -1049,4 +1049,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,
+diff -up firefox-56.0/modules/libpref/prefapi.h.440908 firefox-56.0/modules/libpref/prefapi.h
+--- firefox-56.0/modules/libpref/prefapi.h.440908 2017-07-31 18:20:51.000000000 +0200
++++ firefox-56.0/modules/libpref/prefapi.h 2017-09-25 10:39:39.267572789 +0200
+@@ -246,8 +246,8 @@ void PREF_ReaderCallback( void *closure,
PrefValue value,
PrefType type,
bool isDefault,
@@ -33,9 +33,9 @@ diff -up firefox-50.0/modules/libpref/prefapi.h.440908 firefox-50.0/modules/libp
/*
* 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
+diff -up firefox-56.0/modules/libpref/prefread.cpp.440908 firefox-56.0/modules/libpref/prefread.cpp
+--- firefox-56.0/modules/libpref/prefread.cpp.440908 2017-09-14 22:15:52.000000000 +0200
++++ firefox-56.0/modules/libpref/prefread.cpp 2017-09-25 10:39:39.267572789 +0200
@@ -43,6 +43,7 @@ enum {
#define BITS_PER_HEX_DIGIT 4
@@ -88,9 +88,9 @@ diff -up firefox-50.0/modules/libpref/prefread.cpp.440908 firefox-50.0/modules/l
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
+diff -up firefox-56.0/modules/libpref/prefread.h.440908 firefox-56.0/modules/libpref/prefread.h
+--- firefox-56.0/modules/libpref/prefread.h.440908 2017-09-14 22:15:52.000000000 +0200
++++ firefox-56.0/modules/libpref/prefread.h 2017-09-25 10:39:39.267572789 +0200
@@ -34,7 +34,8 @@ typedef void (*PrefReader)(void *c
PrefValue val,
PrefType type,
@@ -109,12 +109,3 @@ diff -up firefox-50.0/modules/libpref/prefread.h.440908 firefox-50.0/modules/lib
} PrefParseState;
/**
-@@ -90,7 +92,7 @@ void PREF_InitParseState(PrefParseState
- *
- * @param ps
- * PrefParseState instance.
-- */
-+ */
- void PREF_FinalizeParseState(PrefParseState *ps);
-
- /**
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 ea922ba..f66c2d2 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (firefox-55.0.3.source.tar.xz) = 3cacc87b97871f3a8c5e97c17ef7025079cb5c81f32377d9402cdad45815ac6c4c4762c79187f1e477910161c2377c42d41de62a50b6741d5d7c1cd70e8c6416
-SHA512 (firefox-langpacks-55.0.3-20170901.tar.xz) = 582f104e20be5831bc9a3862910a321f8868c26331c3ed01405e484da7909f3e8ff1f491702c48aafd9bc1d2a2fc6cbb15eb6fa94d083076896b8342b14a3466
+SHA512 (firefox-56.0.source.tar.xz) = f187f1c2efa8b6405715780726928812bc330590041cb86cdf62b7aa54dc9a513cb68098aa3f0c0bcd21c006225a68a0a8bb34a4de7ee526059f87e2126ae37d
+SHA512 (firefox-langpacks-56.0-20170925.tar.xz) = 3696b8ac7857fe378dd5f5c77953fa1ebff1e6be1888f4265b2a149d33283572a522f6f57da78837a90818fa121c5eb9c3e314a841652e9c26bc372c526fedad
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"
bgstack15