forward merge from firefox46
authorWolfgang Rosenauer <wr@rosenauer.org>
Tue, 07 Jun 2016 21:44:20 +0200
changeset 915 e969636be188
parent 901 eb9ebe3e2e6a (current diff)
parent 914 20bd16d68ed2 (diff)
child 916 2f9f2e040647
forward merge from firefox46
--- a/MozillaFirefox/MozillaFirefox.changes	Sun Jan 24 13:40:23 2016 +0100
+++ b/MozillaFirefox/MozillaFirefox.changes	Tue Jun 07 21:44:20 2016 +0200
@@ -1,7 +1,242 @@
 -------------------------------------------------------------------
+Wed May  4 10:27:43 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 46.0.1
+  Fixed:
+  * Search plugin issue for various locales
+  * Add-on signing certificate expiration
+  * Service worker update issue
+  * Build issue when jit is disabled
+  * Limit Sync registration updates
+- removed now obsolete mozilla-jit_branch64.patch
+
+-------------------------------------------------------------------
+Tue May  3 15:47:18 UTC 2016 - normand@linux.vnet.ibm.com
+
+- add mozilla-jit_branch64.patch to avoid PowerPC build failure
+  (from bmo#1266366)
+
+-------------------------------------------------------------------
+Wed Apr 27 08:39:28 UTC 2016 - badshah400@gmail.com
+
+- Update mozilla-gtk3_20.patch for Firefox 46.0 (sync to latest
+  version from Fedora).
+
+-------------------------------------------------------------------
+Wed Apr 27 06:09:30 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 46.0 (boo#977333)
+  * Improved security of the JavaScript Just In Time (JIT) Compiler
+  * WebRTC fixes to improve performance and stability
+  * Added support for document.elementsFromPoint
+  * Added HKDF support for Web Crypto API
+  * requires NSPR 4.12 and NSS 3.22.3
+  * added patch to fix unchecked return value
+    mozilla-check_return.patch
+  * Gtk3 builds not supported at the moment
+  security fixes:
+  * MFSA 2016-39/CVE-2016-2804/CVE-2016-2806/CVE-2016-2807
+    (boo#977373, boo#977375, boo#977376)
+    Miscellaneous memory safety hazards
+  * MFSA 2016-40/CVE-2016-2809 (bmo#1212939, boo#977377)
+    Privilege escalation through file deletion by Maintenance Service updater
+    (Windows only)
+  * MFSA 2016-41/CVE-2016-2810 (bmo#1229681, boo#977378)
+    Content provider permission bypass allows malicious application
+    to access data (Android only)
+  * MFSA 2016-42/CVE-2016-2811/CVE-2016-2812
+    (bmo#1252330, bmo#1261776, boo#977379)
+    Use-after-free and buffer overflow in Service Workers
+  * MFSA 2016-43/CVE-2016-2813 (bmo#1197901, bmo#2714650, boo#977380)
+    Disclosure of user actions through JavaScript with motion and
+    orientation sensors (only affects mobile variants)
+  * MFSA 2016-44/CVE-2016-2814 (bmo#1254721, boo#977381)
+    Buffer overflow in libstagefright with CENC offsets
+  * MFSA 2016-45/CVE-2016-2816 (bmo#1223743, boo#977382)
+    CSP not applied to pages sent with multipart/x-mixed-replace
+  * MFSA 2016-46/CVE-2016-2817 (bmo#1227462, boo#977384)
+    Elevation of privilege with chrome.tabs.update API in web extensions
+  * MFSA 2016-47/CVE-2016-2808 (bmo#1246061, boo#977386)
+    Write to invalid HashMap entry through JavaScript.watch()
+  * MFSA 2016-48/CVE-2016-2820 (bmo#870870, boo#977388)
+    Firefox Health Reports could accept events from untrusted domains
+
+-------------------------------------------------------------------
+Thu Apr 21 12:00:28 UTC 2016 - badshah400@gmail.com
+
+- Update mozilla-gtk3_20.patch to fix scrollbar appearance under
+  gtk >= 3.20 (patch synced to Fedora's version).
+
+-------------------------------------------------------------------
+Tue Apr 12 19:11:30 UTC 2016 - badshah400@gmail.com
+
+- Compile against gtk3 depending on whether the macro
+  %firefox_use_gtk3 is defined or not (e.g., at the prjconf
+  level); macro is undefined by default and so gtk2 is used as the
+  default toolkit.
+- Add BuildRequires for additional packages needed when building
+  against gtk3: pkgconfig(glib-2.0), pkgconfig(gobject-2.0),
+  pkgconfig(gtk+-3.0) >= 3.4.0, pkgconfig(gtk+-unix-print-3.0).
+- Add firefox-gtk3_20.patch to fix appearance with gtk3 >= 3.20;
+  patch taken from Fedora (bmo#1230955).
+
+-------------------------------------------------------------------
+Mon Apr 11 22:49:24 UTC 2016 - astieger@suse.com
+
+- Mozilla Firefox 45.0.2:
+  * Fix an issue impacting the cookie header when third-party
+    cookies are blocked (bmo#1257861)
+  * Fix a web compatibility regression impacting the srcset
+    attribute of the image tag (bmo#1259482)
+  * Fix a crash impacting the video playback with Media Source
+    Extension (bmo#1258562)
+  * Fix a regression impacting some specific uploads (bmo#1255735)
+  * Fix a regression with the copy and paste with some old versions
+    of some Gecko applications like Thunderbird (bmo#1254980)
+
+-------------------------------------------------------------------
+Fri Mar 18 08:52:58 UTC 2016 - astieger@suse.com
+
+- Mozilla Firefox 45.0.1:
+  * Fix a regression causing search engine settings to be lost in
+    some context (bmo#1254694)
+  * Bring back non-standard jar: URIs to fix a regression in IBM
+    iNotes (bmo#1255139)
+  * XSLTProcessor.importStylesheet was failing when <import> was
+    used (bmo#1249572)
+  * Fix an issue which could cause the list of search provider to
+    be empty (bmo#1255605)
+  * Fix a regression when using the location bar (bmo#1254503)
+  * Fix some loading issues when Accept third-party cookies: was
+    set to Never (bmo#1254856)
+  * Disabled Graphite font shaping library
+
+-------------------------------------------------------------------
+Sun Mar  6 19:52:13 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 45.0 (boo#969894)
+  * requires NSPR 4.12 / NSS 3.21.1
+  * Instant browser tab sharing through Hello
+  * Synced Tabs button in button bar
+  * Tabs synced via Firefox Accounts from other devices are now shown
+    in dropdown area of Awesome Bar when searching
+  * Introduce a new preference (network.dns.blockDotOnion) to allow
+    blocking .onion at the DNS level
+  * Tab Groups (Panorama) feature removed
+  * MFSA 2016-16/CVE-2016-1952/CVE-2016-1953
+    Miscellaneous memory safety hazards
+  * MFSA 2016-17/CVE-2016-1954 (bmo#1243178)
+    Local file overwriting and potential privilege escalation through
+    CSP reports
+  * MFSA 2016-18/CVE-2016-1955 (bmo#1208946)
+    CSP reports fail to strip location information for embedded iframe pages
+  * MFSA 2016-19/CVE-2016-1956 (bmo#1199923)
+    Linux video memory DOS with Intel drivers
+  * MFSA 2016-20/CVE-2016-1957 (bmo#1227052)
+    Memory leak in libstagefright when deleting an array during MP4
+    processing
+  * MFSA 2016-21/CVE-2016-1958 (bmo#1228754)
+    Displayed page address can be overridden
+  * MFSA 2016-22/CVE-2016-1959 (bmo#1234949)
+    Service Worker Manager out-of-bounds read in Service Worker Manager
+  * MFSA 2016-23/CVE-2016-1960/ZDI-CAN-3545 (bmo#1246014)
+    Use-after-free in HTML5 string parser
+  * MFSA 2016-24/CVE-2016-1961/ZDI-CAN-3574 (bmo#1249377)
+    Use-after-free in SetBody
+  * MFSA 2016-25/CVE-2016-1962 (bmo#1240760)
+    Use-after-free when using multiple WebRTC data channels
+  * MFSA 2016-26/CVE-2016-1963 (bmo#1238440)
+    Memory corruption when modifying a file being read by FileReader
+  * MFSA 2016-27/CVE-2016-1964 (bmo#1243335)
+    Use-after-free during XML transformations
+  * MFSA 2016-28/CVE-2016-1965 (bmo#1245264)
+    Addressbar spoofing though history navigation and Location protocol
+    property
+  * MFSA 2016-29/CVE-2016-1967 (bmo#1246956)
+    Same-origin policy violation using perfomance.getEntries and
+    history navigation with session restore
+  * MFSA 2016-30/CVE-2016-1968 (bmo#1246742)
+    Buffer overflow in Brotli decompression
+  * MFSA 2016-31/CVE-2016-1966 (bmo#1246054)
+    Memory corruption with malicious NPAPI plugin
+  * MFSA 2016-32/CVE-2016-1970/CVE-2016-1971/CVE-2016-1975/
+    CVE-2016-1976/CVE-2016-1972
+    WebRTC and LibVPX vulnerabilities found through code inspection
+  * MFSA 2016-33/CVE-2016-1973 (bmo#1219339)
+    Use-after-free in GetStaticInstance in WebRTC
+  * MFSA 2016-34/CVE-2016-1974 (bmo#1228103)
+    Out-of-bounds read in HTML parser following a failed allocation
+  * MFSA 2016-35/CVE-2016-1950 (bmo#1245528)
+    Buffer overflow during ASN.1 decoding in NSS
+    (fixed by requiring 3.21.1)
+  * MFSA 2016-36/CVE-2016-1979 (bmo#1185033)
+    Use-after-free during processing of DER encoded keys in NSS
+    (fixed by requiring 3.21.1)
+  * MFSA 2016-37/CVE-2016-1977/CVE-2016-2790/CVE-2016-2791/
+    CVE-2016-2792/CVE-2016-2793/CVE-2016-2794/CVE-2016-2795/
+    CVE-2016-2796/CVE-2016-2797/CVE-2016-2798/CVE-2016-2799/
+    CVE-2016-2800/CVE-2016-2801/CVE-2016-2802
+    Font vulnerabilities in the Graphite 2 library
+
+-------------------------------------------------------------------
+Sat Mar  5 15:27:00 UTC 2016 - olaf@aepfle.de
+
+- Remove B_CNT from symbols.zip filename to reduce build-compare noise
+
+-------------------------------------------------------------------
+Fri Feb 26 16:22:52 UTC 2016 - astieger@suse.com
+
+- fix build problems on i586, caused by too large unified compile
+  units - adding mozilla-reduce-files-per-UnifiedBindings.patch
+
+-------------------------------------------------------------------
+Thu Feb 11 07:51:34 UTC 2016 - wr@rosenauer.org
+
+- update to Firefox 44.0.2
+  * MFSA 2016-13/CVE-2016-1949 (bmo#1245724, boo#966438)
+    Same-origin-policy violation using Service Workers with plugins
+  * Fix issue which could lead to the removal of stored passwords
+    under certain circumstances (bmo#1242176)
+  * Allows spaces in cookie names (bmo#1244505)
+  * Disable opus/vorbis audio with H.264 (bmo#1245696)
+  * Fix for graphics startup crash (GNU/Linux) (bmo#1222171)
+  * Fix a crash in cache networking (bmo#1244076)
+  * Fix using WebSockets in service worker controlled pages (bmo#1243942)
+
+-------------------------------------------------------------------
+Sat Jan 30 08:28:17 UTC 2016 - dmueller@suse.com
+
+- build fixes for arm/aarch64:
+  * disable webrtc for arm/aarch64
+  * switch away from openGL-ES backend to default for arm/aarch64
+   since it almost never builds
+  * reenable neon
+- reenable webrtc for powerpc as it seems to build
+
+-------------------------------------------------------------------
 Sun Jan 24 09:33:15 UTC 2016 - wr@rosenauer.org
 
-- update to Firefox 44.0b9
+- update to Firefox 44.0
+  * MFSA 2016-01/CVE-2016-1930/CVE-2016-1931 boo#963633
+    Miscellaneous memory safety hazards
+  * MFSA 2016-02/CVE-2016-1933 (bmo#1231761) boo#963634
+    Out of Memory crash when parsing GIF format images
+  * MFSA 2016-03/CVE-2016-1935 (bmo#1220450) boo#963635
+    Buffer overflow in WebGL after out of memory allocation
+  * MFSA 2016-04/CVE-2015-7208/CVE-2016-1939 (bmo#1191423, bmo#1233784) boo#963637
+    Firefox allows for control characters to be set in cookie names
+  * MFSA 2016-06/CVE-2016-1937 (bmo#724353) boo#963641
+    Missing delay following user click events in protocol handler dialog
+  * MFSA 2016-07/CVE-2016-1938 (bmo#1190248) boo#963731
+    Errors in mp_div and mp_exptmod cryptographic functions in NSS
+    (fixed by requiring NSS 3.21)
+  * MFSA 2016-09/CVE-2016-1942/CVE-2016-1943 (bmo#1189082, bmo#1228590)
+    Addressbar spoofing attacks boo#963643
+  * MFSA 2016-10/CVE-2016-1944/CVE-2016-1945/CVE-2016-1946
+    (bmo#1186621, bmo#1214782, bmo#1232096) boo#963644
+    Unsafe memory manipulation found through code inspection
+  * MFSA 2016-11/CVE-2016-1947 (bmo#1237103) boo#963645
+    Application Reputation service disabled in Firefox 43
   * requires NSPR 4.11
   * requires NSS 3.21
 - prepare mozilla-kde.patch for Gtk3 builds
--- a/MozillaFirefox/MozillaFirefox.spec	Sun Jan 24 13:40:23 2016 +0100
+++ b/MozillaFirefox/MozillaFirefox.spec	Tue Jun 07 21:44:20 2016 +0200
@@ -18,10 +18,10 @@
 
 
 # changed with every update
-%define major 43
-%define mainver %major.99
-%define update_channel beta
-%define releasedate 2016012300
+%define major 46
+%define mainver %major.0.1
+%define update_channel release
+%define releasedate 2016050300
 
 # general build definitions
 %if "%{update_channel}" != "aurora"
@@ -77,8 +77,8 @@
 BuildRequires:  libnotify-devel
 BuildRequires:  libproxy-devel
 BuildRequires:  makeinfo
-BuildRequires:  mozilla-nspr-devel >= 4.11
-BuildRequires:  mozilla-nss-devel >= 3.21
+BuildRequires:  mozilla-nspr-devel >= 4.12
+BuildRequires:  mozilla-nss-devel >= 3.22.3
 BuildRequires:  nss-shared-helper-devel
 BuildRequires:  python-devel
 BuildRequires:  startup-notification-devel
@@ -91,6 +91,12 @@
 BuildRequires:  pkgconfig(gstreamer-app-%gstreamer_ver)
 BuildRequires:  pkgconfig(gstreamer-plugins-base-%gstreamer_ver)
 BuildRequires:  pkgconfig(libpulse)
+%if 0%{?firefox_use_gtk3}
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(gobject-2.0)
+BuildRequires:  pkgconfig(gtk+-3.0) >= 3.4.0
+BuildRequires:  pkgconfig(gtk+-unix-print-3.0)
+%endif
 # libavcodec is already used if available for H.264 but
 # explicitely loaded by FF. For proper H.264 support the
 # openSUSE delivered version is not sufficient but currently
@@ -148,6 +154,7 @@
 Source14:       create-tar.sh
 Source15:       firefox-appdata.xml
 Source16:       MozillaFirefox.changes
+Source17:       l10n_changesets.txt
 # Gecko/Toolkit
 Patch1:         mozilla-nongnome-proxies.patch
 Patch2:         mozilla-shared-nss-db.patch
@@ -159,6 +166,9 @@
 Patch8:         mozilla-openaes-decl.patch
 Patch10:        mozilla-no-stdcxx-check.patch
 Patch11:        mozilla-libproxy.patch
+Patch12:        mozilla-reduce-files-per-UnifiedBindings.patch
+Patch13:        mozilla-gtk3_20.patch
+Patch14:        mozilla-check_return.patch
 # Firefox/browser
 Patch101:       firefox-kde.patch
 Patch102:       firefox-no-default-ualocale.patch
@@ -268,6 +278,11 @@
 %patch8 -p1
 %patch10 -p1
 %patch11 -p1
+%patch12 -p1
+%if 0%{?firefox_use_gtk3}
+%patch13 -p1
+%endif
+%patch14 -p1
 # Firefox
 %patch101 -p1
 %patch102 -p1
@@ -320,8 +335,10 @@
 ac_add_options --mandir=%{_mandir}
 ac_add_options --includedir=%{_includedir}
 ac_add_options --enable-release
-%if 0%{?suse_version} > 1320
-#ac_add_options --enable-default-toolkit=cairo-gtk3
+%if 0%{?firefox_use_gtk3}
+ac_add_options --enable-default-toolkit=cairo-gtk3
+%else
+ac_add_options --enable-default-toolkit=cairo-gtk2
 %endif
 %ifarch %ix86 %arm
 %if 0%{?suse_version} > 1230
@@ -356,17 +373,15 @@
 %if ! %crashreporter
 ac_add_options --disable-crashreporter
 %endif
-# Disable neon for arm as it does not build correctly
 %ifarch %arm
-ac_add_options --disable-neon
+ac_add_options --disable-elf-hack
+ac_add_options --with-fpu=vfpv3-d16
+ac_add_options --with-float-abi=hard
+ac_add_options --with-arch=armv7-a
 %endif
-%ifnarch %ix86 x86_64
+%ifarch %arm aarch64 s390x
 ac_add_options --disable-webrtc
 %endif
-# try to use OpenGL-ES on ARM
-%ifarch %arm aarch64
-ac_add_options --with-gl-provider=EGL
-%endif
 EOF
 make -f client.mk build
 
@@ -522,7 +537,7 @@
 %fdupes %{buildroot}%{_datadir}
 # create breakpad debugsymbols
 %if %crashreporter
-SYMBOLS_NAME="firefox-%{version}-%{release}.%{_arch}-%{suse_version}-symbols"
+SYMBOLS_NAME="firefox-%{version}-` echo '%{release}' | sed 's@\.[^\.]\+$@@' `.%{_arch}-%{suse_version}-symbols"
 make buildsymbols \
   SYMBOL_INDEX_NAME="$SYMBOLS_NAME.txt" \
   SYMBOL_FULL_ARCHIVE_BASENAME="$SYMBOLS_NAME-full" \
@@ -560,19 +575,19 @@
 %dir %{progdir}/browser/extensions/
 %{progdir}/browser/components/
 %{progdir}/browser/defaults
+%{progdir}/browser/features/
 %{progdir}/browser/icons/
 %{progdir}/browser/chrome/icons
-%{progdir}/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+%{progdir}/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
 %{progdir}/browser/blocklist.xml
 %{progdir}/browser/chrome.manifest
 %{progdir}/browser/omni.ja
 %dir %{progdir}/distribution/
 %{progdir}/distribution/extensions/
-%{progdir}/components/
 %{progdir}/defaults/
 %{progdir}/dictionaries/
-%if 0%{?suse_version} > 1320
-#%dir %{progdir}/gtk2
+%if 0%{?firefox_use_gtk3}
+%dir %{progdir}/gtk2
 %{progdir}/gtk2/libmozgtk.so
 %endif
 %{progdir}/webapprt/
@@ -587,7 +602,6 @@
 %{progdir}/platform.ini
 %{progdir}/plugin-container
 %{progdir}/webapprt-stub
-%{progdir}/chrome.manifest
 %if %crashreporter
 %{progdir}/crashreporter
 %{progdir}/crashreporter.ini
--- a/MozillaFirefox/_constraints	Sun Jan 24 13:40:23 2016 +0100
+++ b/MozillaFirefox/_constraints	Tue Jun 07 21:44:20 2016 +0200
@@ -2,10 +2,10 @@
 <constraints>
   <hardware>
     <disk>
-      <size unit="G">9</size>
+      <size unit="G">13</size>
     </disk>
     <memory>
-      <size unit="M">5000</size>
+      <size unit="M">6000</size>
     </memory>
   </hardware>
   <overwrite>
--- a/MozillaFirefox/create-tar.sh	Sun Jan 24 13:40:23 2016 +0100
+++ b/MozillaFirefox/create-tar.sh	Tue Jun 07 21:44:20 2016 +0200
@@ -1,9 +1,14 @@
 #!/bin/bash
 
-CHANNEL="beta"
+# TODO
+# http://ftp.mozilla.org/pub/firefox/candidates/46.0-candidates/build5/linux-x86_64/en-US/firefox-46.0.json
+# "moz_source_stamp": "078baf501b55eaa47f3b189fda4dd28dae1fa257"
+# http://ftp.mozilla.org/pub/firefox/candidates/46.0-candidates/build5/l10n_changesets.txt
+
+CHANNEL="release"
 BRANCH="releases/mozilla-$CHANNEL"
-RELEASE_TAG="FIREFOX_44_0b9_RELEASE"
-VERSION="43.99"
+RELEASE_TAG="FIREFOX_46_0_1_RELEASE"
+VERSION="46.0.1"
 
 # mozilla
 if [ -d mozilla ]; then
@@ -46,9 +51,11 @@
     ja-JP-mac|en-US)
       ;;
     *)
-      echo "fetching $locale ..."
+      echo "reading changeset information for $locale"
+      _changeset=$(grep ^$locale l10n_changesets.txt | awk '{ print $2; }')
+      echo "fetching $locale changeset $_changeset ..."
       hg clone http://hg.mozilla.org/releases/l10n/mozilla-$CHANNEL/$locale l10n/$locale
-      [ "$RELEASE_TAG" == "default" ] || hg -R l10n/$locale up -C -r $RELEASE_TAG
+      [ "$RELEASE_TAG" == "default" ] || hg -R l10n/$locale up -C -r $_changeset
       ;;
   esac
 done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/l10n_changesets.txt	Tue Jun 07 21:44:20 2016 +0200
@@ -0,0 +1,90 @@
+ach 658769a76613
+af 431e02c10881
+an fe436c75f71d
+ar bbcf06888dc5
+as 8313f975ae77
+ast 0300b60cd340
+az fd96727d2a26
+be b72077740aac
+bg 9f7507dd2b92
+bn-BD fe0a6bb82a2d
+bn-IN a2ea6b87d80d
+br 95b028350e29
+bs cfee6f5b1e50
+ca e8ca2d46b4a8
+cs ed6004b91b51
+cy 5bbcbba9b054
+da 324fe068c0b9
+de 217ff3f0054a
+dsb 7cdfb5d9dc5d
+el 22b959c9a739
+en-GB 36012ab486ad
+en-ZA 1c91f05aae5a
+eo 049c1b065f4c
+es-AR b3647b1d5927
+es-CL e45186f983b9
+es-ES 6fe131a8b07f
+es-MX 4cd511663283
+et ecae9df9c92a
+eu 1a65e2c03dda
+fa e5993d9fb76e
+ff 8373353b43c4
+fi b743718650bc
+fr 7d0bb8edc149
+fy-NL 02ee99ad3f83
+ga-IE 713ecb614f77
+gd e5b86736a5f9
+gl c869caff337a
+gn 65b2894520b6
+gu-IN 6245b4309461
+he ee92b661d299
+hi-IN bba2a926e4f8
+hr 8502beb4ee68
+hsb c91a11523487
+hu 09bbddfef7ee
+hy-AM 3d7a9324fb25
+id cb8f841d30d2
+is 46c99105eb3b
+it 6063a6d94e13
+ja 5ff86cadfe9a
+ja-JP-mac ab760b3dcdd1
+kk 5a7bd05bf942
+km 339790840ac1
+kn b23d8fbcf41a
+ko 5f303ed16778
+lij e9113fac3a93
+lt 628e96e62e44
+lv 063998fdecf8
+mai ce010a305377
+mk ffdf2a789185
+ml 1b85d75836cd
+mr 553ff31f4edd
+ms 41bbf86ac0d9
+nb-NO 5e6e5710fac9
+nl ac486141ab40
+nn-NO be9e3eeb75fb
+or febd1b04dbfc
+pa-IN 6c5ed1be55fb
+pl 49e141118acb
+pt-BR cd1aef7b5045
+pt-PT 2e4fd2a1f98f
+rm 0a52db6a6117
+ro c6ac34be77b1
+ru 3f0b3c8e19a4
+si 03a3b09a2203
+sk 3505a5f99bff
+sl 1e098ab8c27a
+son 3ae9a4ff0453
+sq c24e570a4207
+sr 896d72a0fa21
+sv-SE ea1de38fe731
+ta f9dbc2cca1fb
+te 286ff9885ea2
+th d630f05d665f
+tr b751d2d9b6ee
+uk c5cdb9068667
+uz dc28cf99c5cf
+vi 68ce305343a3
+xh f3eb8f92afe8
+zh-CN d73d448f89d6
+zh-TW 44c9950bb3e6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-check_return.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -0,0 +1,1 @@
+../mozilla-check_return.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-gtk3_20.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -0,0 +1,1 @@
+../mozilla-gtk3_20.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-reduce-files-per-UnifiedBindings.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -0,0 +1,1 @@
+../mozilla-reduce-files-per-UnifiedBindings.patch
\ No newline at end of file
--- a/firefox-branded-icons.patch	Sun Jan 24 13:40:23 2016 +0100
+++ b/firefox-branded-icons.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -1,6 +1,6 @@
 # HG changeset patch
 # Parent e0751ad74e835e80041a61ea00c2a63bf6fbe2de
-# Parent  e10e9bf6ab3a74655998bd0286d248f5d17a601a
+# Parent  a5764b0a088418fdbf4b774a8ff2745cc99f6706
 
 diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in
 --- a/browser/app/Makefile.in
@@ -30,26 +30,26 @@
 diff --git a/browser/branding/branding-common.mozbuild b/browser/branding/branding-common.mozbuild
 --- a/browser/branding/branding-common.mozbuild
 +++ b/browser/branding/branding-common.mozbuild
-@@ -32,12 +32,15 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
-         'disk.icns',
-         'document.icns',
-         'dsstore',
-         'firefox.icns',
-     ]
- elif CONFIG['MOZ_WIDGET_GTK']:
-     BRANDING_FILES += [
-         'default16.png',
-+	'default22.png',
-+	'default24.png',
-+	'default256.png',
-         'default32.png',
-         'default48.png',
-         'mozicon128.png',
-     ]
+@@ -34,12 +34,15 @@ def FirefoxBranding():
+             'disk.icns',
+             'document.icns',
+             'dsstore',
+             'firefox.icns',
+         ]
+     elif CONFIG['MOZ_WIDGET_GTK']:
+         BRANDING_FILES += [
+             'default16.png',
++            'default22.png',
++            'default24.png',
++            'default256.png',
+             'default32.png',
+             'default48.png',
+             'mozicon128.png',
+         ]
 diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
 --- a/browser/installer/package-manifest.in
 +++ b/browser/installer/package-manifest.in
-@@ -670,18 +670,21 @@
+@@ -664,18 +664,21 @@
  @RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/icon.png
  @RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
  @RESPATH@/chrome/toolkit@JAREXT@
@@ -64,10 +64,10 @@
  @RESPATH@/browser/chrome/icons/default/default48.png
 +@RESPATH@/browser/chrome/icons/default/default256.png
  #endif
+ @RESPATH@/browser/features/*
  
  ; [Webide Files]
  @RESPATH@/browser/chrome/webide@JAREXT@
  @RESPATH@/browser/chrome/webide.manifest
  @RESPATH@/browser/@PREF_DIR@/webide-prefs.js
  
- ; DevTools
--- a/firefox-kde.patch	Sun Jan 24 13:40:23 2016 +0100
+++ b/firefox-kde.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -1,11 +1,11 @@
 # HG changeset patch
-# Parent  77c3bdc27160dfa96aa4b3288c7f12a72f273967
+# Parent  fd5629206dcf3f64d85ab177be6bc6076f0f1619
 
 diff --git a/browser/base/content/browser-kde.xul b/browser/base/content/browser-kde.xul
 new file mode 100644
 --- /dev/null
 +++ b/browser/base/content/browser-kde.xul
-@@ -0,0 +1,1250 @@
+@@ -0,0 +1,1175 @@
 +#filter substitution
 +<?xml version="1.0"?>
 +# -*- Mode: HTML -*-
@@ -16,7 +16,7 @@
 +
 +<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
-+<?xml-stylesheet href="chrome://devtools/skin/common.css" type="text/css"?>
++<?xml-stylesheet href="chrome://devtools/skin/devtools-browser.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/skin/controlcenter/panel.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/skin/customizableui/panelUIOverlay.css" type="text/css"?>
 +<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
@@ -99,15 +99,6 @@
 +      <menuitem id="context_unpinTab" label="&unpinTab.label;" hidden="true"
 +                accesskey="&unpinTab.accesskey;"
 +                oncommand="gBrowser.unpinTab(TabContextMenu.contextTab);"/>
-+      <menu id="context_tabViewMenu" label="&moveToGroup.label;"
-+            accesskey="&moveToGroup.accesskey;">
-+        <menupopup id="context_tabViewMenuPopup"
-+                   onpopupshowing="if (event.target == this) TabView.moveToGroupPopupShowing(event);">
-+          <menuseparator id="context_tabViewNamedGroups" hidden="true"/>
-+          <menuitem id="context_tabViewNewGroup" label="&moveToNewGroup.label;"
-+                    oncommand="TabView.moveTabTo(TabContextMenu.contextTab, null);"/>
-+        </menupopup>
-+      </menu>
 +      <menuitem id="context_openTabInWindow" label="&moveToNewWindow.label;"
 +                accesskey="&moveToNewWindow.accesskey;"
 +                tbattr="tabbrowser-multiple"
@@ -127,7 +118,7 @@
 +                accesskey="&bookmarkAllTabs.accesskey;"
 +                command="Browser:BookmarkAllTabs"/>
 +      <menuitem id="context_closeTabsToTheEnd" label="&closeTabsToTheEnd.label;" accesskey="&closeTabsToTheEnd.accesskey;"
-+                oncommand="gBrowser.removeTabsToTheEndFrom(TabContextMenu.contextTab);"/>
++                oncommand="gBrowser.removeTabsToTheEndFrom(TabContextMenu.contextTab, {animate: true});"/>
 +      <menuitem id="context_closeOtherTabs" label="&closeOtherTabs.label;" accesskey="&closeOtherTabs.accesskey;"
 +                oncommand="gBrowser.removeAllTabsBut(TabContextMenu.contextTab);"/>
 +      <menuseparator/>
@@ -269,14 +260,6 @@
 +      <box id="UITourHighlight"></box>
 +    </panel>
 +
-+    <panel id="abouthome-search-panel" orient="vertical" type="arrow" hidden="true"
-+           onclick="this.hidePopup()">
-+      <hbox id="abouthome-search-panel-manage"
-+            onclick="openPreferences('paneSearch')">
-+        <label>&changeSearchSettings.button;</label>
-+      </hbox>
-+    </panel>
-+
 +    <panel id="social-share-panel"
 +           class="social-panel"
 +           type="arrow"
@@ -327,26 +310,6 @@
 +           orient="horizontal"
 +           hidden="true"/>
 +
-+    <menupopup id="processHangOptions"
-+               onpopupshowing="ProcessHangMonitor.refreshMenu(window);">
-+      <menuitem id="processHangTerminateScript"
-+                oncommand="ProcessHangMonitor.terminateScript(window)"
-+                accesskey="&processHang.terminateScript.accessKey;"
-+                label="&processHang.terminateScript.label;"/>
-+      <menuitem id="processHangDebugScript"
-+                oncommand="ProcessHangMonitor.debugScript(window)"
-+                accesskey="&processHang.debugScript.accessKey;"
-+                label="&processHang.debugScript.label;"/>
-+      <menuitem id="processHangTerminatePlugin"
-+                oncommand="ProcessHangMonitor.terminatePlugin(window)"
-+                accesskey="&processHang.terminatePlugin.accessKey;"
-+                label="&processHang.terminatePlugin.label;"/>
-+      <menuitem id="processHangTerminateProcess"
-+                oncommand="ProcessHangMonitor.terminateProcess(window)"
-+                accesskey="&processHang.terminateProcess.accessKey;"
-+                label="&processHang.terminateProcess.label;"/>
-+    </menupopup>
-+
 +    <menupopup id="toolbar-context-menu"
 +               onpopupshowing="onViewToolbarsPopupShowing(event, document.getElementById('viewToolbarsMenuSeparator'));">
 +      <menuitem oncommand="gCustomizeMode.addToPanel(document.popupNode)"
@@ -508,17 +471,6 @@
 +
 +    <tooltip id="dynamic-shortcut-tooltip"
 +             onpopupshowing="UpdateDynamicShortcutTooltipText(this);"/>
-+
-+    <menupopup id="emeNotificationsPopup">
-+      <menuitem id="emeNotificationsNotNow"
-+                label="&emeNotificationsNotNow.label;"
-+                acceskey="&emeNotificationsNotNow.accesskey;"
-+                oncommand="gEMEHandler.onNotNow(this);"/>
-+      <menuitem id="emeNotificationsDontAskAgain"
-+                label="&emeNotificationsDontAskAgain.label;"
-+                acceskey="&emeNotificationsDontAskAgain.accesskey;"
-+                oncommand="gEMEHandler.onDontAskAgain(this);"/>
-+    </menupopup>
 +  </popupset>
 +
 +#ifdef CAN_DRAW_IN_TITLEBAR
@@ -626,12 +578,6 @@
 +                     removable="false">
 +        <menupopup id="alltabs-popup"
 +                   position="after_end">
-+          <menuitem id="menu_tabview"
-+                    class="menuitem-iconic"
-+                    key="key_tabview"
-+                    label="&viewTabGroups.label;"
-+                    command="Browser:ToggleTabView"
-+                    observes="tabviewGroupsNumber"/>
 +          <menuitem id="alltabs_undoCloseTab"
 +                    class="menuitem-iconic"
 +                    key="key_undoCloseTab"
@@ -671,9 +617,9 @@
 +             fullscreentoolbar="true" mode="icons" customizable="true"
 +             iconsize="small"
 +#ifdef MOZ_DEV_EDITION
-+             defaultset="urlbar-container,search-container,developer-button,bookmarks-menu-button,pocket-button,downloads-button,home-button,loop-button"
++             defaultset="urlbar-container,search-container,developer-button,bookmarks-menu-button,downloads-button,home-button,loop-button"
 +#else
-+             defaultset="urlbar-container,search-container,bookmarks-menu-button,pocket-button,downloads-button,home-button,loop-button"
++             defaultset="urlbar-container,search-container,bookmarks-menu-button,downloads-button,home-button,loop-button"
 +#endif
 +             customizationtarget="nav-bar-customization-target"
 +             overflowable="true"
@@ -740,7 +686,7 @@
 +                <image id="plugins-notification-icon" class="notification-anchor-icon" role="button"
 +                       aria-label="&urlbar.pluginsNotificationAnchor.label;"/>
 +                <image id="web-notifications-notification-icon" class="notification-anchor-icon" role="button"
-+                       aria-label="&urlbar.webNotsNotificationAnchor.label;"/>
++                       aria-label="&urlbar.webNotsNotificationAnchor3.label;"/>
 +                <image id="webRTC-shareDevices-notification-icon" class="notification-anchor-icon" role="button"
 +                       aria-label="&urlbar.webRTCShareDevicesNotificationAnchor.label;"/>
 +                <image id="webRTC-sharingDevices-notification-icon" class="notification-anchor-icon" role="button"
@@ -774,13 +720,11 @@
 +                   onclick="gIdentityHandler.handleIdentityButtonEvent(event);"
 +                   onkeypress="gIdentityHandler.handleIdentityButtonEvent(event);"
 +                   ondragstart="gIdentityHandler.onDragStart(event);">
-+                <hbox id="identity-icons"
-+                      consumeanchor="identity-box">
-+                  <image id="tracking-protection-icon"/>
-+                  <image id="page-proxy-favicon"
-+                         onclick="PageProxyClickHandler(event);"
-+                         pageproxystate="invalid"/>
-+                </hbox>
++                <image id="identity-icon"
++                       consumeanchor="identity-box"
++                       onclick="PageProxyClickHandler(event);"/>
++                <image id="tracking-protection-icon"/>
++                <image id="connection-icon"/>
 +                <hbox id="identity-icon-labels">
 +                  <label id="identity-icon-label" class="plain" flex="1"/>
 +                  <label id="identity-icon-country-label" class="plain"/>
@@ -851,7 +795,6 @@
 +                     oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
 +                     onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
 +                     onpopupshowing="BookmarkingUI.onPopupShowing(event);
-+                                     BookmarkingUI.updatePocketItemVisibility('BMB_');
 +                                     BookmarkingUI.attachPlacesView(event, this);"
 +                     tooltip="bhTooltip" popupsinherittooltip="true">
 +            <menuitem id="BMB_viewBookmarksSidebar"
@@ -868,11 +811,6 @@
 +                      command="Browser:ShowAllBookmarks"
 +                      key="manBookmarkKb"/>
 +            <menuseparator/>
-+            <menuitem id="BMB_pocket"
-+                      class="menuitem-iconic bookmark-item subviewbutton"
-+                      label="&pocketMenuitem.label;"
-+                      oncommand="openUILink(Pocket.listURL, event);"/>
-+            <menuseparator id="BMB_pocketSeparator"/>
 +            <menuitem id="BMB_subscribeToPageMenuitem"
 +#ifndef XP_MACOSX
 +                      class="menuitem-iconic subviewbutton"
@@ -1091,19 +1029,6 @@
 +                     type="checkbox"
 +                     label="&fullScreenCmd.label;"
 +                     tooltip="dynamic-shortcut-tooltip"/>
-+
-+#ifdef MOZ_SERVICES_SYNC
-+      <toolbarbutton id="sync-button"
-+                     class="toolbarbutton-1 chromeclass-toolbar-additional"
-+                     label="&syncToolbarButton.label;"
-+                     oncommand="gSyncUI.handleToolbarButton()"/>
-+#endif
-+
-+      <toolbarbutton id="tabview-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
-+                     label="&tabGroupsButton.label;"
-+                     command="Browser:ToggleTabView"
-+                     tooltip="dynamic-shortcut-tooltip"
-+                     observes="tabviewGroupsNumber"/>
 +    </toolbarpalette>
 +  </toolbox>
 +
@@ -1259,25 +1184,25 @@
 diff --git a/browser/base/jar.mn b/browser/base/jar.mn
 --- a/browser/base/jar.mn
 +++ b/browser/base/jar.mn
-@@ -70,16 +70,18 @@ browser.jar:
-         content/browser/aboutSocialError.xhtml        (content/aboutSocialError.xhtml)
-         content/browser/aboutProviderDirectory.xhtml  (content/aboutProviderDirectory.xhtml)
+@@ -71,16 +71,18 @@ browser.jar:
          content/browser/aboutTabCrashed.css           (content/aboutTabCrashed.css)
          content/browser/aboutTabCrashed.js            (content/aboutTabCrashed.js)
          content/browser/aboutTabCrashed.xhtml         (content/aboutTabCrashed.xhtml)
+ *       content/browser/aboutTabGroupsMigration.xhtml (content/aboutTabGroupsMigration.xhtml)
+         content/browser/aboutTabGroupsMigration.js    (content/aboutTabGroupsMigration.js)
  *       content/browser/browser.css                   (content/browser.css)
- *       content/browser/browser.js                    (content/browser.js)
+         content/browser/browser.js                    (content/browser.js)
  *       content/browser/browser.xul                   (content/browser.xul)
 +*       content/browser/browser-kde.xul               (content/browser-kde.xul)
 +%       override chrome://browser/content/browser.xul chrome://browser/content/browser-kde.xul desktop=kde
- *       content/browser/browser-tabPreviews.xml       (content/browser-tabPreviews.xml)
- *       content/browser/chatWindow.xul                (content/chatWindow.xul)
-         content/browser/tab-content.js                (content/tab-content.js)
-         content/browser/content.js                    (content/content.js)
-         content/browser/social-content.js             (content/social-content.js)
-         content/browser/defaultthemes/1.footer.jpg    (content/defaultthemes/1.footer.jpg)
-         content/browser/defaultthemes/1.header.jpg    (content/defaultthemes/1.header.jpg)
-         content/browser/defaultthemes/1.icon.jpg      (content/defaultthemes/1.icon.jpg)
+         content/browser/browser-addons.js             (content/browser-addons.js)
+         content/browser/browser-ctrlTab.js            (content/browser-ctrlTab.js)
+         content/browser/browser-customization.js      (content/browser-customization.js)
+         content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
+         content/browser/browser-devedition.js         (content/browser-devedition.js)
+         content/browser/browser-eme.js                (content/browser-eme.js)
+         content/browser/browser-feeds.js              (content/browser-feeds.js)
+         content/browser/browser-fullScreen.js         (content/browser-fullScreen.js)
 diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp
 --- a/browser/components/build/nsModule.cpp
 +++ b/browser/components/build/nsModule.cpp
@@ -1296,11 +1221,11 @@
  
  #if defined(XP_WIN)
  #include "nsIEHistoryEnumerator.h"
- #include "nsEdgeReadingListExtractor.h"
  #endif
  
  #include "rdf.h"
-@@ -32,18 +32,16 @@ using namespace mozilla::browser;
+ #include "nsFeedSniffer.h"
+@@ -31,18 +31,16 @@ using namespace mozilla::browser;
  
  /////////////////////////////////////////////////////////////////////////////
  
@@ -1315,11 +1240,11 @@
  
  #if defined(XP_WIN)
  NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEHistoryEnumerator)
- NS_GENERIC_FACTORY_CONSTRUCTOR(nsEdgeReadingListExtractor)
  #endif
  
  NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
-@@ -63,17 +61,17 @@ NS_DEFINE_NAMED_CID(NS_EDGEREADINGLISTEX
+ 
+@@ -60,17 +58,17 @@ NS_DEFINE_NAMED_CID(NS_WINIEHISTORYENUME
  NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
  #endif
  
@@ -1335,13 +1260,13 @@
      { &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, nullptr, AboutRedirector::Create },
  #if defined(XP_WIN)
      { &kNS_WINIEHISTORYENUMERATOR_CID, false, nullptr, nsIEHistoryEnumeratorConstructor },
-     { &kNS_EDGEREADINGLISTEXTRACTOR_CID, false, nullptr, nsEdgeReadingListExtractorConstructor },
  #elif defined(XP_MACOSX)
      { &kNS_SHELLSERVICE_CID, false, nullptr, nsMacShellServiceConstructor },
+ #endif
 diff --git a/browser/components/preferences/in-content/main.js b/browser/components/preferences/in-content/main.js
 --- a/browser/components/preferences/in-content/main.js
 +++ b/browser/components/preferences/in-content/main.js
-@@ -14,16 +14,22 @@ var gMainPane = {
+@@ -19,16 +19,22 @@ var gMainPane = {
    init: function ()
    {
      function setEventListener(aId, aEventType, aCallback)
@@ -1364,7 +1289,7 @@
      // when the user will select the default.  We refresh here periodically
      // in case the default changes.  On other Windows OS's defaults can also
      // be set while the prefs are open.
-@@ -711,16 +717,27 @@ var gMainPane = {
+@@ -704,16 +710,27 @@ var gMainPane = {
     */
    setDefaultBrowser: function()
    {
@@ -1395,7 +1320,7 @@
 diff --git a/browser/components/shell/moz.build b/browser/components/shell/moz.build
 --- a/browser/components/shell/moz.build
 +++ b/browser/components/shell/moz.build
-@@ -30,16 +30,18 @@ if CONFIG['OS_ARCH'] == 'WINNT':
+@@ -34,16 +34,18 @@ if CONFIG['OS_ARCH'] == 'WINNT':
      ]
  elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
      SOURCES += [
@@ -1418,7 +1343,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/browser/components/shell/nsKDEShellService.cpp
-@@ -0,0 +1,292 @@
+@@ -0,0 +1,203 @@
 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 +/* This Source Code Form is subject to the terms of the Mozilla Public
 + * License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -1449,7 +1374,7 @@
 +    return NS_OK;
 +}
 +
-+NS_IMPL_ISUPPORTS(nsKDEShellService, nsIShellService)
++NS_IMPL_ISUPPORTS(nsKDEShellService, nsIGNOMEShellService, nsIShellService)
 +
 +NS_IMETHODIMP
 +nsKDEShellService::IsDefaultBrowser(bool aStartupCheck,
@@ -1499,95 +1424,6 @@
 +}
 +
 +NS_IMETHODIMP
-+nsKDEShellService::GetShouldSkipCheckDefaultBrowser(bool* aResult)
-+{
-+  NS_ENSURE_ARG_POINTER(aResult);
-+
-+  nsresult rv;
-+  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
-+  if (NS_FAILED(rv)) {
-+    return rv;
-+  }
-+
-+  rv = prefs->GetBoolPref(PREF_SKIPDEFAULTBROWSERCHECK, aResult);
-+  if (NS_FAILED(rv)) {
-+    return rv;
-+  }
-+  if (*aResult) {
-+    // Only skip the default browser check once. The next attempt in
-+    // a new session should proceed.
-+    return prefs->SetBoolPref(PREF_SKIPDEFAULTBROWSERCHECK, false);
-+  }
-+
-+  int32_t defaultBrowserCheckCount;
-+  rv = prefs->GetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT,
-+                         &defaultBrowserCheckCount);
-+  if (NS_FAILED(rv)) {
-+    return rv;
-+  }
-+  if (defaultBrowserCheckCount < 4) {
-+    *aResult = false;
-+    return prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT,
-+                             defaultBrowserCheckCount + 1);
-+  }
-+
-+  // Disable the default browser check after three attempts.
-+  // Don't modify PREF_CHECKDEFAULTBROWSER since that is a
-+  // user-initiated action and it shouldn't get re-enabled
-+  // if it has been user disabled.
-+  *aResult = true;
-+  return rv;
-+}
-+
-+NS_IMETHODIMP
-+nsKDEShellService::GetShouldCheckDefaultBrowser(bool* aResult)
-+{
-+  // If we've already checked, the browser has been started and this is a
-+  // new window open, and we don't want to check again.
-+  if (mCheckedThisSession) {
-+    *aResult = false;
-+    return NS_OK;
-+  }
-+
-+  nsresult rv;
-+#ifndef RELEASE_BUILD
-+  bool skipDefaultBrowserCheck;
-+  rv = GetShouldSkipCheckDefaultBrowser(&skipDefaultBrowserCheck);
-+  if (NS_FAILED(rv)) {
-+    return rv;
-+  }
-+  if (skipDefaultBrowserCheck) {
-+    *aResult = false;
-+    return rv;
-+  }
-+#endif
-+
-+  nsCOMPtr<nsIPrefBranch> prefs;
-+  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
-+  if (pserve)
-+    pserve->GetBranch("", getter_AddRefs(prefs));
-+
-+  if (prefs)
-+    prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
-+
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
-+nsKDEShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
-+{
-+  nsCOMPtr<nsIPrefBranch> prefs;
-+  nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
-+  if (pserve)
-+    pserve->GetBranch("", getter_AddRefs(prefs));
-+
-+  if (prefs)
-+    prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
-+
-+  return NS_OK;
-+}
-+
-+NS_IMETHODIMP
 +nsKDEShellService::GetCanSetDesktopBackground(bool* aResult)
 +{
 +  *aResult = true;
@@ -1715,7 +1551,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/browser/components/shell/nsKDEShellService.h
-@@ -0,0 +1,29 @@
+@@ -0,0 +1,30 @@
 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 +/* This Source Code Form is subject to the terms of the Mozilla Public
 + * License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -1724,16 +1560,17 @@
 +#ifndef nskdeshellservice_h____
 +#define nskdeshellservice_h____
 +
-+#include "nsIShellService.h"
++#include "nsIGNOMEShellService.h"
 +#include "nsStringAPI.h"
 +#include "mozilla/Attributes.h"
 +
-+class nsKDEShellService final : public nsIShellService
++class nsKDEShellService final : public nsIGNOMEShellService
 +{
 +public:
 +  nsKDEShellService() : mCheckedThisSession(false) { }
 +
 +  NS_DECL_ISUPPORTS
++  NS_DECL_NSIGNOMESHELLSERVICE
 +  NS_DECL_NSISHELLSERVICE
 +
 +  nsresult Init();
@@ -1786,7 +1623,7 @@
 +#ifndef nsunixshellservice_h____
 +#define nsunixshellservice_h____
 +
-+#include "nsIShellService.h"
++#include "nsIGNOMEShellService.h"
 +
 +NS_METHOD
 +nsUnixShellServiceConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult);
@@ -1795,9 +1632,9 @@
 diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
 --- a/browser/installer/package-manifest.in
 +++ b/browser/installer/package-manifest.in
-@@ -709,16 +709,17 @@
+@@ -703,16 +703,17 @@
+ @RESPATH@/greprefs.js
  @RESPATH@/defaults/autoconfig/prefcalls.js
- @RESPATH@/browser/defaults/profile/prefs.js
  @RESPATH@/browser/defaults/permissions
  
  ; Warning: changing the path to channel-prefs.js can cause bugs (Bug 756325)
@@ -1810,6 +1647,6 @@
  #ifdef MOZ_SERVICES_NOTIFICATIONS
  @RESPATH@/defaults/pref/services-notifications.js
  #endif
- #ifdef MOZ_SERVICES_SYNC
  @RESPATH@/defaults/pref/services-sync.js
- #endif
+ 
+ ; [Layout Engine Resources]
--- a/firefox-no-default-ualocale.patch	Sun Jan 24 13:40:23 2016 +0100
+++ b/firefox-no-default-ualocale.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -1,14 +1,14 @@
 # HG changeset patch
 # User Wolfgang Rosenauer <wr@rosenauer.org>
 # Parent 099312626f5f7c9cb5573a61d0230574ee12a660
-# Parent  ab1135c098843a4a4c5153bd361b964986fccefa
+# Parent  8015dc2ad5992bfc7d33091fc92edf18ea220a89
 Do not overwrite the locale dynamic pref from xulrunner's all.js with a wrong default value
 
 diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
 --- a/browser/app/profile/firefox.js
 +++ b/browser/app/profile/firefox.js
-@@ -254,17 +254,17 @@ pref("browser.uitour.url", "https://www.
- pref("browser.uitour.readerViewTrigger", "^https:\\/\\/www\\.mozilla\\.org\\/[^\\/]+\\/firefox\\/reading\\/start");
+@@ -216,17 +216,17 @@ pref("browser.uitour.readerViewTrigger",
+ pref("browser.uitour.surveyDuration", 7200);
  
  pref("browser.customizemode.tip0.shown", false);
  pref("browser.customizemode.tip0.learnMoreUrl", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/customize");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-check_return.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -0,0 +1,79 @@
+# HG changeset patch
+# User Wolfgang Rosenauer <wr@rosenauer.org>
+# Parent  5f8b5e8163ece92dc819896dd52b9dbf5f524fe3
+
+diff --git a/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h b/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h
+--- a/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h
++++ b/media/libstagefright/binding/include/mp4_demuxer/ByteWriter.h
+@@ -19,57 +19,64 @@ public:
+   {
+   }
+   ~ByteWriter()
+   {
+   }
+ 
+   void WriteU8(uint8_t aByte)
+   {
+-    mPtr.append(aByte);
++    bool rv;
++    rv = mPtr.append(aByte);
+   }
+ 
+   void WriteU16(uint16_t aShort)
+   {
+     uint8_t c[2];
++    bool rv;
+     mozilla::BigEndian::writeUint16(&c[0], aShort);
+-    mPtr.append(&c[0], 2);
++    rv = mPtr.append(&c[0], 2);
+   }
+ 
+   void WriteU32(uint32_t aLong)
+   {
+     uint8_t c[4];
++    bool rv;
+     mozilla::BigEndian::writeUint32(&c[0], aLong);
+-    mPtr.append(&c[0], 4);
++    rv = mPtr.append(&c[0], 4);
+   }
+ 
+   void Write32(int32_t aLong)
+   {
+     uint8_t c[4];
++    bool rv;
+     mozilla::BigEndian::writeInt32(&c[0], aLong);
+-    mPtr.append(&c[0], 4);
++    rv = mPtr.append(&c[0], 4);
+   }
+ 
+   void WriteU64(uint64_t aLongLong)
+   {
+     uint8_t c[8];
++    bool rv;
+     mozilla::BigEndian::writeUint64(&c[0], aLongLong);
+-    mPtr.append(&c[0], 8);
++    rv = mPtr.append(&c[0], 8);
+   }
+ 
+   void Write64(int64_t aLongLong)
+   {
+     uint8_t c[8];
++    bool rv;
+     mozilla::BigEndian::writeInt64(&c[0], aLongLong);
+-    mPtr.append(&c[0], 8);
++    rv = mPtr.append(&c[0], 8);
+   }
+ 
+   void Write(const uint8_t* aSrc, size_t aCount)
+   {
+-    mPtr.append(aSrc, aCount);
++    bool rv;
++    rv = mPtr.append(aSrc, aCount);
+   }
+ 
+ private:
+   mozilla::Vector<uint8_t>& mPtr;
+ };
+ }
+ 
+ #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-gtk3_20.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -0,0 +1,1615 @@
+diff -up firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20 firefox-46.0/widget/gtk/gtk3drawing.c
+--- firefox-46.0/widget/gtk/gtk3drawing.c.gtk3-20	2016-04-22 02:37:27.000000000 +0200
++++ firefox-46.0/widget/gtk/gtk3drawing.c	2016-04-25 14:56:19.006992927 +0200
+@@ -17,32 +17,79 @@
+ 
+ #include <math.h>
+ 
++#define MOZ_WIDGET_STYLES 4
++
++typedef struct {
++    GtkWidget*            widget;
++
++    union {
++        struct {
++            GtkStyleContext*  style;
++            GtkStyleContext*  styleSelection;
++        } entry;
++
++        struct {
++            GtkStyleContext*  style;
++        } button;
++
++        struct {
++            GtkStyleContext*  style;
++            GtkStyleContext*  styleContents;
++            GtkStyleContext*  styleTrough;
++            GtkStyleContext*  styleSlider;
++        } scroll;
++
++        struct {
++            GtkStyleContext*  style;
++            GtkStyleContext*  styleCheck;
++            GtkStyleContext*  styleLabel;
++        } check;
++
++        struct {
++            GtkStyleContext*  style;
++            GtkStyleContext*  styleTrough;
++            GtkStyleContext*  styleProgress;
++        } progress;
++
++        struct {
++            GtkStyleContext*  style;
++            GtkStyleContext*  styleEntry;
++            GtkStyleContext*  styleButtonUp;
++            GtkStyleContext*  styleButtonDown;
++        } spin;
++
++        struct {
++            GtkStyleContext*  style[MOZ_WIDGET_STYLES];
++        } all;
++    };
++} MozGtkWidget;
++
+ static GtkWidget* gProtoWindow;
+ static GtkWidget* gProtoLayout;
+-static GtkWidget* gButtonWidget;
++static MozGtkWidget gButton;
+ static GtkWidget* gToggleButtonWidget;
+ static GtkWidget* gButtonArrowWidget;
+-static GtkWidget* gCheckboxWidget;
+-static GtkWidget* gRadiobuttonWidget;
+-static GtkWidget* gHorizScrollbarWidget;
+-static GtkWidget* gVertScrollbarWidget;
+-static GtkWidget* gSpinWidget;
++static MozGtkWidget gCheckbox;
++static MozGtkWidget gRadiobutton;
++static MozGtkWidget gVertScrollbar;
++static MozGtkWidget gHorizScrollbar;
++static MozGtkWidget gSpin;
+ static GtkWidget* gHScaleWidget;
+ static GtkWidget* gVScaleWidget;
+-static GtkWidget* gEntryWidget;
++static MozGtkWidget gEntry;
+ static GtkWidget* gComboBoxWidget;
+ static GtkWidget* gComboBoxButtonWidget;
+ static GtkWidget* gComboBoxArrowWidget;
+ static GtkWidget* gComboBoxSeparatorWidget;
+ static GtkWidget* gComboBoxEntryWidget;
+-static GtkWidget* gComboBoxEntryTextareaWidget;
++static MozGtkWidget gComboBoxEntryTextarea;
+ static GtkWidget* gComboBoxEntryButtonWidget;
+ static GtkWidget* gComboBoxEntryArrowWidget;
+ static GtkWidget* gHandleBoxWidget;
+ static GtkWidget* gToolbarWidget;
+ static GtkWidget* gFrameWidget;
+ static GtkWidget* gStatusbarWidget;
+-static GtkWidget* gProgressWidget;
++static MozGtkWidget gProgressBar;
+ static GtkWidget* gTabWidget;
+ static GtkWidget* gTooltipWidget;
+ static GtkWidget* gMenuBarWidget;
+@@ -78,6 +125,37 @@ static gboolean is_initialized;
+ #define GTK_STATE_FLAG_CHECKED (1 << 11)
+ #endif
+ 
++void moz_gtk_widget_free(MozGtkWidget *aMozWidget)
++{
++    // This was removed as a child of gProtoWindow
++    if (aMozWidget->widget) {
++        aMozWidget->widget = NULL;
++    }
++
++    for(int i = 0; i < MOZ_WIDGET_STYLES; i++) {
++        if (aMozWidget->all.style[i]) {
++            g_object_unref(aMozWidget->all.style[i]);
++            aMozWidget->all.style[i] = NULL;
++        }
++    }
++}
++
++// TODO - weak dep!! (dlsym)
++#if GTK_CHECK_VERSION(3, 19, 2)
++#define moz_gtk_path_set_class_name    gtk_widget_path_iter_set_object_name
++#else
++#define moz_gtk_path_set_class_name    gtk_widget_path_iter_add_class
++#endif
++//gtk_widget_path_iter_get_state
++
++static void
++moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
++                         GtkBorder *border);
++
++static void
++moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
++                          GtkBorder *padding);
++
+ static GtkStateFlags
+ GetStateFlagsFromGtkWidgetState(GtkWidgetState* state)
+ {
+@@ -97,6 +175,41 @@ GetStateFlagsFromGtkWidgetState(GtkWidge
+     return stateFlags;
+ }
+ 
++GtkStyleContext *
++moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent)
++{
++  GtkWidgetPath *path;
++  GtkStyleContext *context;
++
++  if (parent)
++    path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
++  else
++    path = gtk_widget_path_new ();
++
++  gtk_widget_path_append_type (path, node->type);
++  if (node->name)
++    moz_gtk_path_set_class_name(path, -1, node->name);
++  if (node->class1)
++    gtk_widget_path_iter_add_class(path, -1, node->class1);
++  if (node->class2)
++    gtk_widget_path_iter_add_class(path, -1, node->class2);
++
++  context = gtk_style_context_new ();
++  gtk_style_context_set_path (context, path);
++  gtk_style_context_set_parent (context, parent);
++
++  if(!gtk_check_version(3, 14, 0)) {
++      /* Unfortunately, we have to explicitly set the state again here
++       * for it to take effect
++       */
++      gtk_style_context_set_state (context, gtk_widget_path_iter_get_state (path, -1));
++  }
++
++  gtk_widget_path_unref (path);
++
++  return context;
++}
++
+ /* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine
+    that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific
+    things they may want to do. */
+@@ -141,9 +254,16 @@ setup_widget_prototype(GtkWidget* widget
+ static gint
+ ensure_button_widget()
+ {
+-    if (!gButtonWidget) {
+-        gButtonWidget = gtk_button_new_with_label("M");
+-        setup_widget_prototype(gButtonWidget);
++    if (!gButton.widget) {
++        GtkCssNode path[] = { 
++            { GTK_TYPE_BUTTON, "button", NULL, NULL }
++        };
++
++        gButton.widget = gtk_button_new_with_label("M");
++        setup_widget_prototype(gButton.widget);
++        gtk_widget_show(gButton.widget);
++
++        gButton.button.style = moz_gtk_style_create(&path[0], NULL);
+     }
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -195,9 +315,21 @@ ensure_button_arrow_widget()
+ static gint
+ ensure_checkbox_widget()
+ {
+-    if (!gCheckboxWidget) {
+-        gCheckboxWidget = gtk_check_button_new_with_label("M");
+-        setup_widget_prototype(gCheckboxWidget);
++   if (!gCheckbox.widget) {
++        GtkCssNode path[] = {
++           { GTK_TYPE_TOGGLE_BUTTON, "checkbutton", NULL, NULL },
++           { G_TYPE_NONE, "check", NULL, NULL },
++           { G_TYPE_NONE, "label", NULL, NULL }
++        };
++
++        gCheckbox.widget = gtk_check_button_new_with_label("M");
++        setup_widget_prototype(gCheckbox.widget);
++
++        gCheckbox.check.style = moz_gtk_style_create(&path[0], NULL);
++        gCheckbox.check.styleCheck = moz_gtk_style_create(&path[1],
++                                       gCheckbox.check.style);
++        gCheckbox.check.styleLabel = moz_gtk_style_create(&path[2],
++                                       gCheckbox.check.style);
+     }
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -205,9 +337,21 @@ ensure_checkbox_widget()
+ static gint
+ ensure_radiobutton_widget()
+ {
+-    if (!gRadiobuttonWidget) {
+-        gRadiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M");
+-        setup_widget_prototype(gRadiobuttonWidget);
++    if (!gRadiobutton.widget) {
++        GtkCssNode path[] = {
++           { GTK_TYPE_TOGGLE_BUTTON, "radiobutton", NULL, NULL },
++           { G_TYPE_NONE, "radio", NULL, NULL },
++           { G_TYPE_NONE, "label", NULL, NULL }
++        };
++
++        gRadiobutton.widget = gtk_radio_button_new_with_label(NULL, "M");
++        setup_widget_prototype(gRadiobutton.widget);
++
++        gRadiobutton.check.style = moz_gtk_style_create(&path[0], NULL);
++        gRadiobutton.check.styleCheck = moz_gtk_style_create(&path[1],
++                                          gRadiobutton.check.style);
++        gRadiobutton.check.styleLabel = moz_gtk_style_create(&path[2],
++                                          gRadiobutton.check.style);
+     }
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -215,25 +359,62 @@ ensure_radiobutton_widget()
+ static gint
+ ensure_scrollbar_widget()
+ {
+-    if (!gVertScrollbarWidget) {
+-        gVertScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
+-        setup_widget_prototype(gVertScrollbarWidget);
+-    }
+-    if (!gHorizScrollbarWidget) {
+-        gHorizScrollbarWidget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL);
+-        setup_widget_prototype(gHorizScrollbarWidget);
+-    }
++    if (!gVertScrollbar.widget && !gHorizScrollbar.widget) {
++        GtkCssNode path[] = {
++            { GTK_TYPE_SCROLLBAR, "scrollbar", "horizontal", "bottom"},
++            { GTK_TYPE_SCROLLBAR, "scrollbar", "vertical", "right" },
++            { G_TYPE_NONE, "contents", NULL, NULL },
++            { G_TYPE_NONE, "trough", NULL, NULL },
++            { G_TYPE_NONE, "slider", NULL, NULL }
++        };
++
++        gHorizScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, NULL);
++        setup_widget_prototype(gHorizScrollbar.widget);
++
++        gHorizScrollbar.scroll.style = moz_gtk_style_create(path, NULL);
++        gHorizScrollbar.scroll.styleContents = moz_gtk_style_create(path+2, 
++                                               gHorizScrollbar.scroll.style);
++        gHorizScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3, 
++                                               gHorizScrollbar.scroll.styleContents);
++        gHorizScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4, 
++                                               gHorizScrollbar.scroll.styleTrough);
++
++        gVertScrollbar.widget = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, NULL);
++        setup_widget_prototype(gVertScrollbar.widget);
++
++        gVertScrollbar.scroll.style = moz_gtk_style_create(path+1, NULL);
++        gVertScrollbar.scroll.styleContents = moz_gtk_style_create(path+2, 
++                                              gVertScrollbar.scroll.style);
++        gVertScrollbar.scroll.styleTrough = moz_gtk_style_create(path+3, 
++                                              gVertScrollbar.scroll.styleContents);
++        gVertScrollbar.scroll.styleSlider = moz_gtk_style_create(path+4, 
++                                              gVertScrollbar.scroll.styleTrough);
++
++     }
+     return MOZ_GTK_SUCCESS;
+ }
+ 
+ static gint
+ ensure_spin_widget()
+ {
+-  if (!gSpinWidget) {
+-    gSpinWidget = gtk_spin_button_new(NULL, 1, 0);
+-    setup_widget_prototype(gSpinWidget);
+-  }
+-  return MOZ_GTK_SUCCESS;
++    if (!gSpin.widget) {
++        GtkCssNode path[] = {
++            { GTK_TYPE_SPIN_BUTTON, "spinbutton", "horizontal", NULL },
++            { GTK_TYPE_SPIN_BUTTON, "spinbutton", "vertical", NULL },
++            { GTK_TYPE_ENTRY, "entry", NULL, NULL },
++            { G_TYPE_NONE, "button", "up", NULL },
++            { G_TYPE_NONE, "button", "down", NULL }
++        };
++
++        gSpin.widget = gtk_spin_button_new(NULL, 1, 0);
++        setup_widget_prototype(gSpin.widget);
++
++        gSpin.spin.style = moz_gtk_style_create(path, NULL);
++        gSpin.spin.styleButtonUp = moz_gtk_style_create(path+3, gSpin.spin.style);
++        gSpin.spin.styleButtonDown = moz_gtk_style_create(path+4, gSpin.spin.style);
++        gSpin.spin.styleEntry = moz_gtk_style_create(path+2, gSpin.spin.style);
++    }
++    return MOZ_GTK_SUCCESS;
+ }
+ 
+ static gint
+@@ -253,9 +434,19 @@ ensure_scale_widget()
+ static gint
+ ensure_entry_widget()
+ {
+-    if (!gEntryWidget) {
+-        gEntryWidget = gtk_entry_new();
+-        setup_widget_prototype(gEntryWidget);
++    if (!gEntry.widget) {
++        GtkCssNode path[] = { 
++            { GTK_TYPE_ENTRY, "entry", NULL, NULL },
++            { G_TYPE_NONE, "selection", NULL, NULL }
++        };
++
++        gEntry.widget = gtk_entry_new();
++        setup_widget_prototype(gEntry.widget);
++        gtk_widget_show(gEntry.widget);
++
++        gEntry.entry.style = moz_gtk_style_create(&path[0], NULL);
++        gEntry.entry.styleSelection = moz_gtk_style_create(&path[1], 
++                                                           gEntry.entry.style);
+     }
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -387,9 +578,9 @@ moz_gtk_get_combo_box_entry_inner_widget
+         g_object_add_weak_pointer(G_OBJECT(widget),
+                                   (gpointer) &gComboBoxEntryButtonWidget);
+     } else if (GTK_IS_ENTRY(widget)) {
+-        gComboBoxEntryTextareaWidget = widget;
++        gComboBoxEntryTextarea.widget = widget;
+         g_object_add_weak_pointer(G_OBJECT(widget),
+-                                  (gpointer) &gComboBoxEntryTextareaWidget);
++                                  (gpointer) &gComboBoxEntryTextarea.widget);
+     } else
+         return;
+     gtk_widget_realize(widget);
+@@ -411,7 +602,7 @@ ensure_combo_box_entry_widgets()
+ {
+     GtkWidget* buttonChild;
+ 
+-    if (gComboBoxEntryTextareaWidget &&
++    if (gComboBoxEntryTextarea.widget &&
+             gComboBoxEntryButtonWidget &&
+             gComboBoxEntryArrowWidget)
+         return MOZ_GTK_SUCCESS;
+@@ -427,9 +618,9 @@ ensure_combo_box_entry_widgets()
+                          moz_gtk_get_combo_box_entry_inner_widgets,
+                          NULL);
+ 
+-    if (!gComboBoxEntryTextareaWidget) {
++    if (!gComboBoxEntryTextarea.widget) {
+         ensure_entry_widget();
+-        gComboBoxEntryTextareaWidget = gEntryWidget;
++        gComboBoxEntryTextarea.widget = gEntry.widget;
+     }
+ 
+     if (gComboBoxEntryButtonWidget) {
+@@ -530,9 +721,21 @@ ensure_tab_widget()
+ static gint
+ ensure_progress_widget()
+ {
+-    if (!gProgressWidget) {
+-        gProgressWidget = gtk_progress_bar_new();
+-        setup_widget_prototype(gProgressWidget);
++    if (!gProgressBar.widget) {
++        GtkCssNode path[] = {
++           { GTK_TYPE_LABEL, "progressbar", NULL, NULL },
++           { G_TYPE_NONE, "trough", NULL, NULL },
++           { G_TYPE_NONE, "progress", NULL, NULL },
++        };
++
++        gProgressBar.widget = gtk_progress_bar_new();
++        setup_widget_prototype(gProgressBar.widget);
++
++        gProgressBar.progress.style = moz_gtk_style_create(&path[0], NULL);
++        gProgressBar.progress.styleTrough = moz_gtk_style_create(&path[1],
++                                              gProgressBar.progress.style);
++        gProgressBar.progress.styleProgress = moz_gtk_style_create(&path[2],
++                                                gProgressBar.progress.styleTrough);
+     }
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -638,6 +841,11 @@ static gint
+ ensure_check_menu_item_widget()
+ {
+     if (!gCheckMenuItemWidget) {
++        GtkCssNode path[] = {
++           { GTK_TYPE_CHECK_MENU_ITEM, "menuitem", NULL, NULL },
++           { G_TYPE_NONE, "check", NULL, NULL }
++        };
++
+         ensure_menu_popup_widget();
+         gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
+         gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
+@@ -752,7 +960,7 @@ moz_gtk_checkbox_get_metrics(gint* indic
+ {
+     ensure_checkbox_widget();
+ 
+-    gtk_widget_style_get (gCheckboxWidget,
++    gtk_widget_style_get (gCheckbox.widget,
+                           "indicator_size", indicator_size,
+                           "indicator_spacing", indicator_spacing,
+                           NULL);
+@@ -765,7 +973,7 @@ moz_gtk_radio_get_metrics(gint* indicato
+ {
+     ensure_radiobutton_widget();
+ 
+-    gtk_widget_style_get (gRadiobuttonWidget,
++    gtk_widget_style_get (gRadiobutton.widget,
+                           "indicator_size", indicator_size,
+                           "indicator_spacing", indicator_spacing,
+                           NULL);
+@@ -778,13 +986,12 @@ moz_gtk_get_focus_outline_size(gint* foc
+ {
+     GtkBorder border;
+     GtkBorder padding;
+-    GtkStyleContext *style;
++    GtkStyleContext* style = gEntry.entry.style;
+ 
+     ensure_entry_widget();
+-    style = gtk_widget_get_style_context(gEntryWidget);
+ 
+-    gtk_style_context_get_border(style, 0, &border);
+-    gtk_style_context_get_padding(style, 0, &padding);
++    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
++    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
+     *focus_h_width = border.left + padding.left;
+     *focus_v_width = border.top + padding.top;
+     return MOZ_GTK_SUCCESS;
+@@ -821,7 +1028,7 @@ moz_gtk_button_get_default_overflow(gint
+     GtkBorder* default_outside_border;
+ 
+     ensure_button_widget();
+-    gtk_widget_style_get(gButtonWidget,
++    gtk_widget_style_get(gButton.widget,
+                          "default-outside-border", &default_outside_border,
+                          NULL);
+ 
+@@ -844,7 +1051,7 @@ moz_gtk_button_get_default_border(gint*
+     GtkBorder* default_border;
+ 
+     ensure_button_widget();
+-    gtk_widget_style_get(gButtonWidget,
++    gtk_widget_style_get(gButton.widget,
+                          "default-border", &default_border,
+                          NULL);
+ 
+@@ -935,7 +1142,7 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
+ 
+     if (state->focused) {
+         GtkBorder border;
+-        gtk_style_context_get_border(style, state_flags, &border);
++        moz_gtk_get_style_border(style, state_flags, &border);
+         x += border.left;
+         y += border.top;
+         width -= (border.left + border.right);
+@@ -956,15 +1163,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+     gint indicator_size, indicator_spacing;
+     gint x, y, width, height;
+     gint focus_x, focus_y, focus_width, focus_height;
+-    GtkWidget *w;
+-    GtkStyleContext *style;
++    MozGtkWidget *w;
+ 
+     if (isradio) {
+         moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing);
+-        w = gRadiobuttonWidget;
++        w = &gRadiobutton;
+     } else {
+         moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing);
+-        w = gCheckboxWidget;
++        w = &gCheckbox;
+     }
+ 
+     // XXX we should assert rect->height >= indicator_size too
+@@ -983,11 +1189,9 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+     focus_width = width + 2 * indicator_spacing;
+     focus_height = height + 2 * indicator_spacing;
+   
+-    style = gtk_widget_get_style_context(w);
+-
+-    gtk_widget_set_sensitive(w, !state->disabled);
+-    gtk_widget_set_direction(w, direction);
+-    gtk_style_context_save(style);
++    gtk_widget_set_sensitive(w->widget, !state->disabled);
++    gtk_widget_set_direction(w->widget, direction);
++    gtk_style_context_save(w->check.styleCheck);
+ 
+     if (selected)
+         state_flags |= checkbox_check_state;
+@@ -995,13 +1199,15 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+     if (inconsistent)
+         state_flags |= GTK_STATE_FLAG_INCONSISTENT;
+ 
+-    gtk_style_context_set_state(style, state_flags);
++    gtk_style_context_set_state(w->check.styleCheck, state_flags);
++
++    gtk_render_background(w->check.styleCheck, cr, x, y, width, height);
++    gtk_render_frame(w->check.styleCheck, cr, x, y, width, height);
+ 
+     if (isradio) {
+-        gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
+-        gtk_render_option(style, cr, x, y, width, height);
++        gtk_render_option(w->check.styleCheck, cr, x, y, width, height);
+         if (state->focused) {
+-            gtk_render_focus(style, cr, focus_x, focus_y,
++            gtk_render_focus(w->check.styleCheck, cr, focus_x, focus_y,
+                             focus_width, focus_height);
+         }
+     }
+@@ -1010,15 +1216,14 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec
+         * 'indeterminate' type on checkboxes. In GTK, the shadow type
+         * must also be changed for the state to be drawn.
+         */        
+-        gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
+-        gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), inconsistent);
+-        gtk_render_check(style, cr, x, y, width, height);        
++        gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(w->widget), inconsistent);
++        gtk_render_check(w->check.styleCheck, cr, x, y, width, height);
+         if (state->focused) {
+-            gtk_render_focus(style, cr, 
++            gtk_render_focus(w->check.styleCheck, cr,
+                              focus_x, focus_y, focus_width, focus_height);
+         }
+     }
+-    gtk_style_context_restore(style);
++    gtk_style_context_restore(w->check.styleCheck);
+ 
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -1035,8 +1240,8 @@ calculate_button_inner_rect(GtkWidget* b
+     style = gtk_widget_get_style_context(button);
+ 
+     /* This mirrors gtkbutton's child positioning */
+-    gtk_style_context_get_border(style, 0, &border);
+-    gtk_style_context_get_padding(style, 0, &padding);
++    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
++    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
+ 
+     inner_rect->x = rect->x + border.left + padding.left;
+     inner_rect->y = rect->y + padding.top + border.top;
+@@ -1099,9 +1304,9 @@ moz_gtk_scrollbar_button_paint(cairo_t *
+     ensure_scrollbar_widget();
+ 
+     if (flags & MOZ_GTK_STEPPER_VERTICAL)
+-        scrollbar = gVertScrollbarWidget;
++        scrollbar = gVertScrollbar.widget;
+     else
+-        scrollbar = gHorizScrollbarWidget;
++        scrollbar = gHorizScrollbar.widget;
+ 
+     gtk_widget_set_direction(scrollbar, direction);
+ 
+@@ -1181,25 +1386,22 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
+                                GtkTextDirection direction)
+ {
+     GtkStyleContext* style;
+-    GtkScrollbar *scrollbar;
+ 
+     ensure_scrollbar_widget();
+ 
+-    if (widget ==  MOZ_GTK_SCROLLBAR_HORIZONTAL)
+-        scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
+-    else
+-        scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
+-
+-    gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
+-    
+     if (flags & MOZ_GTK_TRACK_OPAQUE) {
+         style = gtk_widget_get_style_context(GTK_WIDGET(gProtoWindow));
+         gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
+     }
+ 
+-    style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar));
+-    gtk_style_context_save(style);
+-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
++     if (widget == MOZ_GTK_SCROLLBAR_HORIZONTAL) {
++        gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction);
++        style = gHorizScrollbar.scroll.style;
++    }
++    else {
++        gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction);
++        style = gVertScrollbar.scroll.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);
+@@ -1208,7 +1410,6 @@ moz_gtk_scrollbar_trough_paint(GtkThemeW
+         gtk_render_focus(style, cr,
+                          rect->x, rect->y, rect->width, rect->height);
+     }
+-    gtk_style_context_restore(style);
+     return MOZ_GTK_SUCCESS;
+ }
+ 
+@@ -1220,24 +1421,20 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
+ {
+     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
+     GtkStyleContext* style;
+-    GtkScrollbar *scrollbar;
+     GtkBorder margin;
+ 
+     ensure_scrollbar_widget();
+ 
+-    if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
+-        scrollbar = GTK_SCROLLBAR(gHorizScrollbarWidget);
+-    else
+-        scrollbar = GTK_SCROLLBAR(gVertScrollbarWidget);
+-
+-    gtk_widget_set_direction(GTK_WIDGET(scrollbar), direction);
+-
+-    style = gtk_widget_get_style_context(GTK_WIDGET(scrollbar));
+-    gtk_style_context_save(style);
++    if (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) {
++        style = gHorizScrollbar.scroll.styleSlider;
++        gtk_widget_set_direction(GTK_WIDGET(gHorizScrollbar.widget), direction);
++    }
++    else {
++        style = gVertScrollbar.scroll.styleSlider; 
++        gtk_widget_set_direction(GTK_WIDGET(gVertScrollbar.widget), direction);
++    }
+ 
+-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_SLIDER);
+     gtk_style_context_set_state(style, state_flags);
+-
+     gtk_style_context_get_margin (style, state_flags, &margin);
+ 
+     gtk_render_slider(style, cr,
+@@ -1248,8 +1445,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWi
+                      (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL) ?
+                      GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
+ 
+-    gtk_style_context_restore(style);
+-
+     return MOZ_GTK_SUCCESS;
+ }
+ 
+@@ -1260,8 +1455,8 @@ moz_gtk_spin_paint(cairo_t *cr, GdkRecta
+     GtkStyleContext* style;
+ 
+     ensure_spin_widget();
+-    gtk_widget_set_direction(gSpinWidget, direction);
+-    style = gtk_widget_get_style_context(gSpinWidget);
++    gtk_widget_set_direction(gSpin.widget, direction);
++    style = gSpin.spin.style;
+     gtk_style_context_save(style);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
+     gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
+@@ -1280,11 +1475,10 @@ moz_gtk_spin_updown_paint(cairo_t *cr, G
+     GtkStyleContext* style;
+ 
+     ensure_spin_widget();
+-    style = gtk_widget_get_style_context(gSpinWidget);
++    style = gSpin.spin.style;
+     gtk_style_context_save(style);
+-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_SPINBUTTON);
+     gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
+-    gtk_widget_set_direction(gSpinWidget, direction);
++    gtk_widget_set_direction(gSpin.widget, direction);
+ 
+     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);
+@@ -1450,15 +1644,13 @@ moz_gtk_vpaned_paint(cairo_t *cr, GdkRec
+ static gint
+ moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
+                     GtkWidgetState* state,
+-                    GtkWidget* widget, GtkTextDirection direction)
++                    MozGtkWidget* w, GtkTextDirection direction)
+ {
+     gint x = rect->x, y = rect->y, width = rect->width, height = rect->height;
+-    GtkStyleContext* style;
+     int draw_focus_outline_only = state->depressed; // NS_THEME_FOCUS_OUTLINE
++    GtkStyleContext* style = w->entry.style;
+ 
+-    gtk_widget_set_direction(widget, direction);
+-
+-    style = gtk_widget_get_style_context(widget);
++    gtk_widget_set_direction(w->widget, direction);
+ 
+     if (draw_focus_outline_only) {
+         // Inflate the given 'rect' with the focus outline size.
+@@ -1478,10 +1670,9 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRect
+      * textarea window uses gtk_paint_flat_box when exposed */
+ 
+     /* This gets us a lovely greyish disabledish look */
+-    gtk_widget_set_sensitive(widget, !state->disabled);
++    gtk_widget_set_sensitive(w->widget, !state->disabled);
+ 
+     gtk_style_context_save(style);
+-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_ENTRY);
+   
+     /* Now paint the shadow and focus border.
+      * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad
+@@ -1531,7 +1722,7 @@ moz_gtk_treeview_paint(cairo_t *cr, GdkR
+     style = gtk_widget_get_style_context(gScrolledWindowWidget);
+     gtk_style_context_save(style);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_FRAME);    
+-    gtk_style_context_get_border(style, state_flags, &border);
++    moz_gtk_get_style_border(style, state_flags, &border);
+     xthickness = border.left;
+     ythickness = border.top;    
+ 
+@@ -1702,7 +1893,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, Gdk
+         if (direction == GTK_TEXT_DIR_LTR) {
+             GtkBorder padding;
+             GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
+-            gtk_style_context_get_padding(style, state_flags, &padding);
++            moz_gtk_get_style_padding(style, state_flags, &padding);
+             arrow_rect.x -= padding.left;
+         }
+         else
+@@ -1804,29 +1995,27 @@ moz_gtk_container_paint(cairo_t *cr, Gdk
+                         gboolean isradio, GtkTextDirection direction)
+ {
+     GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
+-    GtkStyleContext* style;
+-    GtkWidget *widget;
++    MozGtkWidget *widget;
+ 
+     if (isradio) {
+         ensure_radiobutton_widget();
+-        widget = gRadiobuttonWidget;
++        widget = &gRadiobutton;
+     } else {
+         ensure_checkbox_widget();
+-        widget = gCheckboxWidget;
++        widget = &gCheckbox;
+     }
+-    gtk_widget_set_direction(widget, direction);
++    gtk_widget_set_direction(widget->widget, direction);
+ 
+-    style = gtk_widget_get_style_context(widget);
+-    gtk_style_context_save(style);
+-    gtk_style_context_set_state(style, state_flags);
++    gtk_style_context_save(widget->check.style);
++    gtk_style_context_set_state(widget->check.style, state_flags);
+   
+     /* this is for drawing a prelight box */
+     if (state_flags & GTK_STATE_FLAG_PRELIGHT) {
+-        gtk_render_background(style, cr,
++        gtk_render_background(widget->check.style, cr,
+                               rect->x, rect->y, rect->width, rect->height);
+     }
+   
+-    gtk_style_context_restore(style);
++    gtk_style_context_restore(widget->check.style);
+   
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -1836,32 +2025,26 @@ moz_gtk_toggle_label_paint(cairo_t *cr,
+                            GtkWidgetState* state, 
+                            gboolean isradio, GtkTextDirection direction)
+ {
+-    GtkStyleContext *style;
+-    GtkWidget *widget;
++    MozGtkWidget *widget;
+ 
+     if (!state->focused)
+         return MOZ_GTK_SUCCESS;
+ 
+     if (isradio) {
+         ensure_radiobutton_widget();
+-        widget = gRadiobuttonWidget;
++        widget = &gRadiobutton;
+     } else {
+         ensure_checkbox_widget();
+-        widget = gCheckboxWidget;
++        widget = &gCheckbox;
+     }
+-    style = gtk_widget_get_style_context(widget);
+-    gtk_style_context_save(style);
+-    if (isradio) {
+-      gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
+-    } else {
+-      gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
+-    }
+-    gtk_widget_set_direction(widget, direction);
++    gtk_style_context_save(widget->check.styleLabel);
++    gtk_widget_set_direction(widget->widget, direction);
+ 
+-    gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
+-    gtk_render_focus(style, cr,
++    gtk_style_context_set_state(widget->check.styleLabel, 
++                                GetStateFlagsFromGtkWidgetState(state));
++    gtk_render_focus(widget->check.styleLabel, cr,
+                     rect->x, rect->y, rect->width, rect->height);
+-    gtk_style_context_restore(style);
++    gtk_style_context_restore(widget->check.styleLabel);
+ 
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -1922,7 +2105,7 @@ moz_gtk_toolbar_separator_paint(cairo_t
+                           rect->height * (end_fraction - start_fraction));
+     } else {
+         GtkBorder padding;
+-        gtk_style_context_get_padding(style, 0, &padding);
++        gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
+     
+         paint_width = padding.left;
+         if (paint_width > rect->width)
+@@ -2006,18 +2189,13 @@ static gint
+ moz_gtk_progressbar_paint(cairo_t *cr, GdkRectangle* rect,
+                           GtkTextDirection direction)
+ {
+-    GtkStyleContext* style;
+-
+     ensure_progress_widget();
+-    gtk_widget_set_direction(gProgressWidget, direction);
++    gtk_widget_set_direction(gProgressBar.widget, direction);
+ 
+-    style = gtk_widget_get_style_context(gProgressWidget);
+-    gtk_style_context_save(style);
+-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
+-    
+-    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);
+-    gtk_style_context_restore(style);
++    gtk_render_background(gProgressBar.progress.styleTrough, cr,
++                          rect->x, rect->y, rect->width, rect->height);
++    gtk_render_frame(gProgressBar.progress.styleTrough, cr,
++                     rect->x, rect->y, rect->width, rect->height);
+ 
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -2027,15 +2205,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
+                              GtkTextDirection direction,
+                              GtkThemeWidgetType widget)
+ {
+-    GtkStyleContext* style;
+-
+     ensure_progress_widget();
+-    gtk_widget_set_direction(gProgressWidget, direction);
+-
+-    style = gtk_widget_get_style_context(gProgressWidget);
+-    gtk_style_context_save(style);
+-    gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
+-    gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
++    gtk_widget_set_direction(gProgressBar.widget, direction);
+ 
+     if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
+         widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
+@@ -2074,12 +2245,14 @@ moz_gtk_progress_chunk_paint(cairo_t *cr
+     // gtk_render_activity was used to render progress chunks on GTK versions
+     // before 3.13.7, see bug 1173907.
+     if (!gtk_check_version(3, 13, 7)) {
+-      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);
++      gtk_render_background(gProgressBar.progress.styleProgress, cr,
++                            rect->x, rect->y, rect->width, rect->height);
++      gtk_render_frame(gProgressBar.progress.styleProgress, cr,
++                       rect->x, rect->y, rect->width, rect->height);
+     } else {
+-      gtk_render_activity(style, cr, rect->x, rect->y, rect->width, rect->height);
++      gtk_render_activity(gProgressBar.progress.styleProgress, cr,
++                          rect->x, rect->y, rect->width, rect->height);
+     }
+-    gtk_style_context_restore(style);
+ 
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -2096,7 +2269,7 @@ moz_gtk_get_tab_thickness(void)
+ 
+     style = gtk_widget_get_style_context(gTabWidget);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_NOTEBOOK);
+-    gtk_style_context_get_border(style, 0, &border);
++    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
+ 
+     if (border.top < 2)
+         return 2; /* some themes don't set ythickness correctly */
+@@ -2292,7 +2465,7 @@ moz_gtk_tab_paint(cairo_t *cr, GdkRectan
+       gtk_style_context_save(style);
+       moz_gtk_tab_prepare_style_context(style, flags);
+ 
+-      gtk_style_context_get_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
++      moz_gtk_get_style_padding(style, GetStateFlagsFromGtkWidgetState(state), &padding);
+ 
+       focusRect.x += padding.left;
+       focusRect.width -= (padding.left + padding.right);
+@@ -2408,7 +2581,7 @@ moz_gtk_tab_scroll_arrow_paint(cairo_t *
+ }
+ 
+ static gint
+-moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect,
++moz_gtk_menu_bar_paint(cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state,
+                        GtkTextDirection direction)
+ {
+     GtkStyleContext* style;
+@@ -2468,7 +2641,7 @@ moz_gtk_menu_separator_paint(cairo_t *cr
+     border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
+ 
+     style = gtk_widget_get_style_context(gMenuSeparatorWidget);
+-    gtk_style_context_get_padding(style, 0, &padding);
++    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
+ 
+     x = rect->x + border_width;
+     y = rect->y + border_width;
+@@ -2521,7 +2694,8 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
+             item_widget = gMenuItemWidget;
+         }
+         style = gtk_widget_get_style_context(item_widget);
+-        gtk_style_context_save(style);
++// TODO - FIX!
++//        gtk_style_context_save(style);
+ 
+         if (flags & MOZ_TOPLEVEL_MENU_ITEM) {
+             gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
+@@ -2540,7 +2714,7 @@ moz_gtk_menu_item_paint(cairo_t *cr, Gdk
+ 
+         gtk_render_background(style, cr, x, y, w, h);
+         gtk_render_frame(style, cr, x, y, w, h);
+-        gtk_style_context_restore(style);
++//        gtk_style_context_restore(style);
+     }
+ 
+     return MOZ_GTK_SUCCESS;
+@@ -2556,7 +2730,10 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, Gd
+ 
+     ensure_menu_item_widget();
+     gtk_widget_set_direction(gMenuItemWidget, direction);
+-
++/*
++    state_flags |= (direction == GTK_TEXT_DIR_LTR) ? GTK_STATE_FLAG_DIR_LTR :
++                                                     GTK_STATE_FLAG_DIR_RTL;
++*/
+     style = gtk_widget_get_style_context(gMenuItemWidget);
+     gtk_style_context_save(style);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUITEM);
+@@ -2606,7 +2783,7 @@ moz_gtk_check_menu_item_paint(cairo_t *c
+     }
+     
+     gtk_style_context_set_state(style, state_flags);
+-    gtk_style_context_get_padding(style, state_flags, &padding);
++    moz_gtk_get_style_padding(style, state_flags, &padding);
+ 
+     offset = gtk_container_get_border_width(GTK_CONTAINER(gCheckMenuItemWidget)) +
+                                             padding.left + 2;
+@@ -2658,7 +2835,7 @@ moz_gtk_add_style_border(GtkStyleContext
+ {
+     GtkBorder border;
+ 
+-    gtk_style_context_get_border(style, 0, &border);
++    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
+ 
+     *left += border.left;
+     *right += border.right;
+@@ -2667,12 +2844,22 @@ moz_gtk_add_style_border(GtkStyleContext
+ }
+ 
+ static void
++moz_gtk_get_style_border(GtkStyleContext* style, GtkStateFlags state_flags,
++                         GtkBorder *border)
++{
++    gtk_style_context_save(style);
++    gtk_style_context_set_state(style, state_flags);
++    gtk_style_context_get_border(style, gtk_style_context_get_state(style), border);
++    gtk_style_context_restore(style);
++}
++
++static void
+ moz_gtk_add_style_padding(GtkStyleContext* style,
+                           gint* left, gint* top, gint* right, gint* bottom)
+ {
+     GtkBorder padding;
+ 
+-    gtk_style_context_get_padding(style, 0, &padding);
++    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
+ 
+     *left += padding.left;
+     *right += padding.right;
+@@ -2680,6 +2867,16 @@ moz_gtk_add_style_padding(GtkStyleContex
+     *bottom += padding.bottom;
+ }
+ 
++static void
++moz_gtk_get_style_padding(GtkStyleContext* style, GtkStateFlags state_flags,
++                          GtkBorder *padding)
++{
++    gtk_style_context_save(style);
++    gtk_style_context_set_state(style, state_flags);
++    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), padding);
++    gtk_style_context_restore(style);
++}
++
+ gint
+ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+                           gint* right, gint* bottom, GtkTextDirection direction,
+@@ -2694,36 +2891,27 @@ moz_gtk_get_widget_border(GtkThemeWidget
+     case MOZ_GTK_TOOLBAR_BUTTON:
+         {
+             ensure_button_widget();
+-            style = gtk_widget_get_style_context(gButtonWidget);
+-
+-            *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButtonWidget));
+ 
+-            if (widget == MOZ_GTK_TOOLBAR_BUTTON) {
+-                gtk_style_context_save(style);
+-                gtk_style_context_add_class(style, "image-button");
+-            }
+-              
+-            moz_gtk_add_style_padding(style, left, top, right, bottom);
+-                
+-            if (widget == MOZ_GTK_TOOLBAR_BUTTON)
+-                gtk_style_context_restore(style);
++            *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButton.widget));
++            moz_gtk_add_style_padding(gButton.button.style, left, top, right, bottom);
+ 
+             // 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);
++            moz_gtk_add_style_border(gButton.button.style, left, top, right, bottom);
++
+             return MOZ_GTK_SUCCESS;
+         }
+     case MOZ_GTK_ENTRY:
+         {
+             ensure_entry_widget();
+-            style = gtk_widget_get_style_context(gEntryWidget);
+ 
+             // 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_style_padding(gEntry.entry.style, left, top, right, bottom);
++            moz_gtk_add_style_border(gEntry.entry.style, left, top, right, bottom);
+ 
+             return MOZ_GTK_SUCCESS;
+         }
+@@ -2759,7 +2947,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
+         break;
+     case MOZ_GTK_DROPDOWN_ENTRY:
+         ensure_combo_box_entry_widgets();
+-        w = gComboBoxEntryTextareaWidget;
++        w = gComboBoxEntryTextarea.widget;
+         break;
+     case MOZ_GTK_DROPDOWN_ARROW:
+         ensure_combo_box_entry_widgets();
+@@ -2795,7 +2983,7 @@ moz_gtk_get_widget_border(GtkThemeWidget
+ 
+                 if (!wide_separators) {
+                     style = gtk_widget_get_style_context(gComboBoxSeparatorWidget);
+-                    gtk_style_context_get_border(style, 0, &border);
++                    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
+                     separator_width = border.left;
+                 }
+             }
+@@ -2814,14 +3002,17 @@ moz_gtk_get_widget_border(GtkThemeWidget
+         w = gTabWidget;
+         break;
+     case MOZ_GTK_PROGRESSBAR:
+-        ensure_progress_widget();
+-        w = gProgressWidget;
+-        break;
++        {
++            ensure_progress_widget();
++            moz_gtk_add_style_border(gProgressBar.progress.styleTrough,
++                                     left, top, right, bottom);
++            return MOZ_GTK_SUCCESS;
++        }
+     case MOZ_GTK_SPINBUTTON_ENTRY:
+     case MOZ_GTK_SPINBUTTON_UP:
+     case MOZ_GTK_SPINBUTTON_DOWN:
+         ensure_spin_widget();
+-        w = gSpinWidget;
++        w = gSpin.widget;
+         break;
+     case MOZ_GTK_SCALE_HORIZONTAL:
+         ensure_scale_widget();
+@@ -2840,12 +3031,13 @@ moz_gtk_get_widget_border(GtkThemeWidget
+         {
+             if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
+                 ensure_checkbox_widget();
+-                w = gCheckboxWidget;
++                w = gCheckbox.widget;
++                style = gCheckbox.check.styleCheck;
+             } else {
+                 ensure_radiobutton_widget();
+-                w = gRadiobuttonWidget;
++                w = gRadiobutton.widget;
++                style = gRadiobutton.check.styleCheck;
+             }
+-            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,
+@@ -2978,6 +3170,32 @@ moz_gtk_get_combo_box_entry_button_size(
+ }
+ 
+ gint
++moz_gtk_get_entry_height(gint* height)
++{
++    GtkRequisition requisition;
++    ensure_entry_widget();
++
++    gtk_widget_get_preferred_size(gEntry.widget, NULL, &requisition);
++    *height = requisition.height;
++
++    return MOZ_GTK_SUCCESS;
++}
++
++
++gint
++moz_gtk_get_button_height(gint* height)
++{
++    GtkRequisition requisition;
++    ensure_entry_widget();
++
++    gtk_widget_get_preferred_size(gButton.widget, NULL, &requisition);
++    *height = requisition.height;
++
++    return MOZ_GTK_SUCCESS;
++}
++
++
++gint
+ moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height)
+ {
+     gint arrow_size;
+@@ -3030,7 +3248,7 @@ moz_gtk_get_toolbar_separator_width(gint
+                          "separator-width", &separator_width,
+                          NULL);
+     /* Just in case... */
+-    gtk_style_context_get_border(style, 0, &border);
++    gtk_style_context_get_border(style, gtk_style_context_get_state(style), &border);
+     *size = MAX(*size, (wide_separators ? separator_width : border.left));
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -3072,7 +3290,7 @@ moz_gtk_get_menu_separator_height(gint *
+     border_width = gtk_container_get_border_width(GTK_CONTAINER(gMenuSeparatorWidget));
+ 
+     style = gtk_widget_get_style_context(gMenuSeparatorWidget);
+-    gtk_style_context_get_padding(style, 0, &padding);
++    gtk_style_context_get_padding(style, gtk_style_context_get_state(style), &padding);
+ 
+     gtk_style_context_save(style);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SEPARATOR);
+@@ -3130,15 +3348,21 @@ moz_gtk_get_scrollbar_metrics(MozGtkScro
+ {
+     ensure_scrollbar_widget();
+ 
+-    gtk_widget_style_get (gHorizScrollbarWidget,
++    gtk_widget_style_get (gHorizScrollbar.widget,
+                           "slider_width", &metrics->slider_width,
+                           "trough_border", &metrics->trough_border,
+                           "stepper_size", &metrics->stepper_size,
+                           "stepper_spacing", &metrics->stepper_spacing,
+                           NULL);
+ 
+-    metrics->min_slider_size = 
+-        gtk_range_get_min_slider_size(GTK_RANGE(gHorizScrollbarWidget));
++    if (!gtk_check_version(3,19,7)) {
++        gtk_style_context_get(gVertScrollbar.scroll.styleSlider, 
++                              gtk_style_context_get_state(gVertScrollbar.scroll.styleSlider), 
++                              "min-height", &metrics->min_slider_size, NULL);
++    } else {
++        metrics->min_slider_size = 
++            gtk_range_get_min_slider_size(GTK_RANGE(gVertScrollbar.widget));
++    }
+ 
+     return MOZ_GTK_SUCCESS;
+ }
+@@ -3163,7 +3387,7 @@ moz_gtk_images_in_buttons()
+     GtkSettings* settings;
+ 
+     ensure_button_widget();
+-    settings = gtk_widget_get_settings(gButtonWidget);
++    settings = gtk_widget_get_settings(gButton.widget);
+ 
+     g_object_get(settings, "gtk-button-images", &result, NULL);
+     return result;
+@@ -3191,7 +3415,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+         }
+         ensure_button_widget();
+         return moz_gtk_button_paint(cr, rect, state,
+-                                    (GtkReliefStyle) flags, gButtonWidget,
++                                    (GtkReliefStyle) flags, gButton.widget,
+                                     direction);
+         break;
+     case MOZ_GTK_CHECKBUTTON:
+@@ -3241,7 +3465,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+     case MOZ_GTK_SPINBUTTON_ENTRY:
+         ensure_spin_widget();
+         return moz_gtk_entry_paint(cr, rect, state,
+-                                   gSpinWidget, direction);
++                                   &gSpin, direction);
+         break;
+     case MOZ_GTK_GRIPPER:
+         return moz_gtk_gripper_paint(cr, rect, state,
+@@ -3268,7 +3492,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+     case MOZ_GTK_ENTRY:
+         ensure_entry_widget();
+         return moz_gtk_entry_paint(cr, rect, state,
+-                                   gEntryWidget, direction);
++                                   &gEntry, direction);
+         break;
+     case MOZ_GTK_DROPDOWN:
+         return moz_gtk_combo_box_paint(cr, rect, state, direction);
+@@ -3280,7 +3504,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+     case MOZ_GTK_DROPDOWN_ENTRY:
+         ensure_combo_box_entry_widgets();
+         return moz_gtk_entry_paint(cr, rect, state,
+-                                   gComboBoxEntryTextareaWidget, direction);
++                                   &gComboBoxEntryTextarea, direction);
+         break;
+     case MOZ_GTK_CHECKBUTTON_CONTAINER:
+     case MOZ_GTK_RADIOBUTTON_CONTAINER:
+@@ -3332,7 +3556,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType
+                                               (GtkArrowType) flags, direction);
+         break;
+     case MOZ_GTK_MENUBAR:
+-        return moz_gtk_menu_bar_paint(cr, rect, direction);
++        return moz_gtk_menu_bar_paint(cr, rect, state, direction);
+         break;
+     case MOZ_GTK_MENUPOPUP:
+         return moz_gtk_menu_popup_paint(cr, rect, direction);
+@@ -3383,7 +3607,7 @@ GtkWidget* moz_gtk_get_scrollbar_widget(
+ {
+     MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
+     ensure_scrollbar_widget();
+-    return gHorizScrollbarWidget;
++    return gVertScrollbar.widget;
+ }
+ 
+ gboolean moz_gtk_has_scrollbar_buttons(void)
+@@ -3391,7 +3615,7 @@ gboolean moz_gtk_has_scrollbar_buttons(v
+     gboolean backward, forward, secondary_backward, secondary_forward;
+     MOZ_ASSERT(is_initialized, "Forgot to call moz_gtk_init()");
+     ensure_scrollbar_widget();
+-    gtk_widget_style_get (gHorizScrollbarWidget,
++    gtk_widget_style_get (gHorizScrollbar.widget,
+                           "has-backward-stepper", &backward,
+                           "has-forward-stepper", &forward,
+                           "has-secondary-backward-stepper", &secondary_backward,
+@@ -3415,17 +3639,19 @@ moz_gtk_shutdown()
+ 
+     gProtoWindow = NULL;
+     gProtoLayout = NULL;
+-    gButtonWidget = NULL;
++
++    // MozWidgets
++    moz_gtk_widget_free(&gButton);
+     gToggleButtonWidget = NULL;
+     gButtonArrowWidget = NULL;
+-    gCheckboxWidget = NULL;
+-    gRadiobuttonWidget = NULL;
+-    gHorizScrollbarWidget = NULL;
+-    gVertScrollbarWidget = NULL;
+-    gSpinWidget = NULL;
++    moz_gtk_widget_free(&gCheckbox);
++    moz_gtk_widget_free(&gRadiobutton);
++    moz_gtk_widget_free(&gHorizScrollbar);
++    moz_gtk_widget_free(&gVertScrollbar);
++    moz_gtk_widget_free(&gSpin);
+     gHScaleWidget = NULL;
+     gVScaleWidget = NULL;
+-    gEntryWidget = NULL;
++    moz_gtk_widget_free(&gEntry);
+     gComboBoxWidget = NULL;
+     gComboBoxButtonWidget = NULL;
+     gComboBoxSeparatorWidget = NULL;
+@@ -3433,12 +3659,12 @@ moz_gtk_shutdown()
+     gComboBoxEntryWidget = NULL;
+     gComboBoxEntryButtonWidget = NULL;
+     gComboBoxEntryArrowWidget = NULL;
+-    gComboBoxEntryTextareaWidget = NULL;
++    moz_gtk_widget_free(&gComboBoxEntryTextarea);
+     gHandleBoxWidget = NULL;
+     gToolbarWidget = NULL;
+     gStatusbarWidget = NULL;
+     gFrameWidget = NULL;
+-    gProgressWidget = NULL;
++    moz_gtk_widget_free(&gProgressBar);
+     gTabWidget = NULL;
+     gTooltipWidget = NULL;
+     gMenuBarWidget = NULL;
+diff -up firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20 firefox-46.0/widget/gtk/gtkdrawing.h
+--- firefox-46.0/widget/gtk/gtkdrawing.h.gtk3-20	2016-04-22 02:37:27.000000000 +0200
++++ firefox-46.0/widget/gtk/gtkdrawing.h	2016-04-25 14:42:42.000000000 +0200
+@@ -67,6 +67,13 @@ typedef enum {
+   MOZ_GTK_TAB_SELECTED        = 1 << 10
+ } GtkTabFlags;
+ 
++typedef struct {
++  GType type;
++  const gchar *name;
++  const gchar *class1;
++  const gchar *class2;
++} GtkCssNode;
++
+ /** flags for menuitems **/
+ typedef enum {
+   /* menuitem is part of the menubar */
+@@ -396,6 +403,9 @@ void
+ moz_gtk_get_arrow_size(GtkThemeWidgetType widgetType,
+                        gint* width, gint* height);
+ 
++gint moz_gtk_get_entry_height(gint* height);
++gint moz_gtk_get_button_height(gint* height);
++
+ /**
+  * Get the desired size of a toolbar separator
+  * size:    [OUT] the desired width
+@@ -466,6 +476,12 @@ gboolean moz_gtk_images_in_buttons(void)
+  */
+ gboolean moz_gtk_has_scrollbar_buttons(void);
+ 
++
++GtkStyleContext *
++moz_gtk_style_create(GtkCssNode *node, GtkStyleContext *parent);
++
++
++
+ #ifdef __cplusplus
+ }
+ #endif /* __cplusplus */
+diff -up firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20 firefox-46.0/widget/gtk/mozgtk/mozgtk.c
+--- firefox-46.0/widget/gtk/mozgtk/mozgtk.c.gtk3-20	2016-04-22 02:37:27.000000000 +0200
++++ firefox-46.0/widget/gtk/mozgtk/mozgtk.c	2016-04-25 14:46:15.299592716 +0200
+@@ -504,6 +504,11 @@ STUB(gtk_window_set_type_hint)
+ STUB(gtk_window_set_wmclass)
+ STUB(gtk_window_unfullscreen)
+ STUB(gtk_window_unmaximize)
++STUB(gtk_widget_get_preferred_height_and_baseline_for_width)
++STUB(gtk_entry_get_text_area)
++STUB(gtk_check_menu_item_get_type)
++STUB(gtk_spin_button_get_type)
++STUB(gtk_button_get_type)
+ #endif
+ 
+ #ifdef GTK3_SYMBOLS
+@@ -581,6 +586,13 @@ 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_style_context_get_path)
++STUB(gtk_widget_path_copy)
++STUB(gtk_widget_path_iter_set_object_name)
++STUB(gtk_widget_path_iter_add_class)
++STUB(gtk_widget_path_iter_get_state)
++STUB(gtk_style_context_set_parent)
++STUB(gtk_widget_path_unref)
+ #endif
+ 
+ #ifdef GTK2_SYMBOLS
+diff -up firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20 firefox-46.0/widget/gtk/nsLookAndFeel.cpp
+--- firefox-46.0/widget/gtk/nsLookAndFeel.cpp.gtk3-20	2016-04-22 02:37:27.000000000 +0200
++++ firefox-46.0/widget/gtk/nsLookAndFeel.cpp	2016-04-25 14:18:25.000000000 +0200
+@@ -353,14 +353,18 @@ nsLookAndFeel::NativeGetColor(ColorID aI
+     case eColorID_activeborder:
+         // active window border
+         gtk_style_context_get_border_color(mBackgroundStyle, 
+-                                           GTK_STATE_FLAG_NORMAL, &gdk_color);
++                                           gtk_style_context_get_state(mBackgroundStyle), 
++                                           &gdk_color);
+         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+         break;
+     case eColorID_inactiveborder:
+         // inactive window border
++        gtk_style_context_save(mBackgroundStyle);
++        gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE);
+         gtk_style_context_get_border_color(mBackgroundStyle, 
+-                                           GTK_STATE_FLAG_INSENSITIVE, 
++                                           gtk_style_context_get_state(mBackgroundStyle), 
+                                            &gdk_color);
++        gtk_style_context_restore(mBackgroundStyle);
+         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+         break;
+     case eColorID_graytext: // disabled text in windows, menus, etc.
+@@ -369,9 +373,12 @@ nsLookAndFeel::NativeGetColor(ColorID aI
+         break;
+     case eColorID_inactivecaption:
+         // inactive window caption
++        gtk_style_context_save(mBackgroundStyle);
++        gtk_style_context_set_state(mBackgroundStyle, GTK_STATE_FLAG_INSENSITIVE);
+         gtk_style_context_get_background_color(mBackgroundStyle, 
+-                                               GTK_STATE_FLAG_INSENSITIVE, 
++                                               gtk_style_context_get_state(mBackgroundStyle), 
+                                                &gdk_color);
++        gtk_style_context_restore(mBackgroundStyle);
+         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+         break;
+ #endif
+@@ -497,13 +504,17 @@ nsLookAndFeel::NativeGetColor(ColorID aI
+     case eColorID__moz_buttondefault:
+       // default button border color
+         gtk_style_context_get_border_color(mButtonStyle, 
+-                                           GTK_STATE_FLAG_NORMAL, &gdk_color);
++                                           gtk_style_context_get_state(mButtonStyle),
++                                           &gdk_color);
+         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+         break;
+     case eColorID__moz_buttonhoverface:
++        gtk_style_context_save(mButtonStyle);
++        gtk_style_context_set_state(mButtonStyle, GTK_STATE_FLAG_PRELIGHT);
+         gtk_style_context_get_background_color(mButtonStyle, 
+-                                               GTK_STATE_FLAG_PRELIGHT, 
++                                               gtk_style_context_get_state(mButtonStyle), 
+                                                &gdk_color);
++        gtk_style_context_restore(mButtonStyle);
+         aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+         break;
+     case eColorID__moz_buttonhovertext:
+@@ -1110,7 +1121,7 @@ nsLookAndFeel::Init()
+     style = create_context(path);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
+-    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
+     sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
+     g_object_unref(style);
+ 
+@@ -1118,18 +1129,18 @@ nsLookAndFeel::Init()
+     style = create_context(path);
+     gtk_style_context_save(style);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
+-    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
+     sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
+     gtk_style_context_restore(style);
+ 
+     // tooltip foreground and background
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_TOOLTIP);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
+-    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
+     sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sInfoText = GDK_RGBA_TO_NS_RGBA(color);
+     g_object_unref(style);
+ 
+@@ -1144,20 +1155,26 @@ nsLookAndFeel::Init()
+     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+ 
+     style = gtk_widget_get_style_context(accel_label);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sMenuText = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
++    gtk_style_context_save(style);
++    gtk_style_context_set_state(style, GTK_STATE_FLAG_INSENSITIVE);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
++    gtk_style_context_restore(style);
+ 
+     style = gtk_widget_get_style_context(menu);
+-    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
+     sMenuBackground = GDK_RGBA_TO_NS_RGBA(color);
+ 
+     style = gtk_widget_get_style_context(menuitem);
+-    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
++    gtk_style_context_save(style);
++    gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
++    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
+     sMenuHover = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
++    gtk_style_context_restore(style);
+ 
+     g_object_unref(menu);
+ #endif
+@@ -1266,44 +1283,54 @@ nsLookAndFeel::Init()
+             GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
+     }
+ #else
++    GtkCssNode labelPath[] = {
++       { GTK_TYPE_LABEL, "label", "view", NULL },
++       { G_TYPE_NONE, "selection", NULL, NULL }
++    };
++
++    GtkStyleContext *styleLabel;
++    GtkStyleContext *styleSelection;
++    GtkBorder padding;
++
+     // 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);
++    styleLabel = moz_gtk_style_create(labelPath, NULL);
++    styleSelection = moz_gtk_style_create(labelPath+1, styleLabel);
++
++    gtk_style_context_get_background_color(styleLabel, gtk_style_context_get_state(styleLabel), &color);
+     sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(styleLabel, gtk_style_context_get_state(styleLabel), &color);
+     sMozFieldText = GDK_RGBA_TO_NS_RGBA(color);
+ 
+     // Selected text and background
+-    gtk_style_context_get_background_color(style,
+-        static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
+-        &color);
++    gtk_style_context_get_background_color(styleSelection, gtk_style_context_get_state(styleSelection), &color);
+     sTextSelectedBackground = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style,
+-        static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
+-        &color);
++    gtk_style_context_get_color(styleSelection, gtk_style_context_get_state(styleSelection), &color);
+     sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_restore(style);
+ 
+     // Button text, background, border
+     style = gtk_widget_get_style_context(label);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sButtonText = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
++    gtk_style_context_save(style);
++    gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
++    gtk_style_context_restore(style);
+ 
+     // Combobox text color
+     style = gtk_widget_get_style_context(comboboxLabel);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sComboBoxText = GDK_RGBA_TO_NS_RGBA(color);
+ 
+     // Menubar text and hover text colors    
+     style = gtk_widget_get_style_context(menuBar);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sMenuBarText = GDK_RGBA_TO_NS_RGBA(color);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
++    gtk_style_context_save(style);
++    gtk_style_context_set_state(style, GTK_STATE_FLAG_PRELIGHT);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color);
++    gtk_style_context_restore(style);
+ 
+     // GTK's guide to fancy odd row background colors:
+     // 1) Check if a theme explicitly defines an odd row color
+@@ -1316,7 +1343,7 @@ nsLookAndFeel::Init()
+     // Get odd row background color
+     gtk_style_context_save(style);
+     gtk_style_context_add_region(style, GTK_STYLE_REGION_ROW, GTK_REGION_ODD);
+-    gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_background_color(style, gtk_style_context_get_state(style), &color);
+     sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
+     gtk_style_context_restore(style);
+ 
+@@ -1334,9 +1361,11 @@ nsLookAndFeel::Init()
+     gtk_container_add(GTK_CONTAINER(parent), infoBar);
+     gtk_container_add(GTK_CONTAINER(infoBarContent), infoBarLabel);
+     style = gtk_widget_get_style_context(infoBarLabel);
++    gtk_style_context_save(style);
+     gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
+-    gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
++    gtk_style_context_get_color(style, gtk_style_context_get_state(style), &color);
+     sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
++    gtk_style_context_restore(style);
+ #endif
+     // Some themes have a unified menu bar, and support window dragging on it
+     gboolean supports_menubar_drag = FALSE;
+diff -up firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20 firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp
+--- firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp.gtk3-20	2016-04-25 14:46:15.300592722 +0200
++++ firefox-46.0/widget/gtk/nsNativeThemeGTK.cpp	2016-04-25 14:40:42.000000000 +0200
+@@ -1567,9 +1567,6 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
+   case NS_THEME_RADIO_CONTAINER:
+   case NS_THEME_CHECKBOX_LABEL:
+   case NS_THEME_RADIO_LABEL:
+-  case NS_THEME_BUTTON:
+-  case NS_THEME_DROPDOWN:
+-  case NS_THEME_TOOLBAR_BUTTON:
+   case NS_THEME_TREEVIEW_HEADER_CELL:
+     {
+       if (aWidgetType == NS_THEME_DROPDOWN) {
+@@ -1588,6 +1585,21 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
+       aResult->height += border.top + border.bottom;
+     }
+     break;
++  case NS_THEME_BUTTON:
++  case NS_THEME_DROPDOWN:
++  case NS_THEME_TOOLBAR_BUTTON:
++    {
++        moz_gtk_get_button_height(&aResult->height);
++    }
++    break;
++  case NS_THEME_FOCUS_OUTLINE:
++  case NS_THEME_NUMBER_INPUT:
++  case NS_THEME_TEXTFIELD:
++  case NS_THEME_TEXTFIELD_MULTILINE:
++    {
++        moz_gtk_get_entry_height(&aResult->height);
++    } 
++    break;
+   case NS_THEME_TOOLBAR_SEPARATOR:
+     {
+       gint separator_width;
+
--- a/mozilla-idldir.patch	Sun Jan 24 13:40:23 2016 +0100
+++ b/mozilla-idldir.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -1,7 +1,7 @@
 # HG changeset patch
 # Parent 1cd1e78dfe63c1a7bcfc0707697bb99bcfea19c4
 # User Wolfgang Rosenauer <wr@rosenauer.org>
-# Parent  015730e17931512895a5ad4d5130eff4258cf03e
+# Parent  b0fb5e009b6af361b8781a923daa65170a2fdedb
 Install IDL files to includedir instead of /usr/share/idl
 
 diff --git a/config/baseconfig.mk b/config/baseconfig.mk
@@ -17,9 +17,9 @@
 +idldir = $(includedir)
  installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
  sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
- ifndef TOP_DIST
- TOP_DIST = dist
+ ifeq (.,$(DEPTH))
+ DIST = dist
+ else
+ DIST = $(DEPTH)/dist
  endif
- ifneq (,$(filter /%,$(TOP_DIST)))
- DIST = $(TOP_DIST)
- else
+ ABS_DIST = $(topobjdir)/dist
--- a/mozilla-kde.patch	Sun Jan 24 13:40:23 2016 +0100
+++ b/mozilla-kde.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -1,34 +1,15 @@
 # HG changeset patch
-# Parent  d9c9ae52f0338a60d1626d9209248341815e597a
+# Parent  61cdc9af8ceaf75083e751e0d6497feddc26f7ba
 Description: Add KDE integration to Firefox (toolkit parts)
 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
 Author: Lubos Lunak <lunak@suse.com>
 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751
      https://bugzilla.novell.com/show_bug.cgi?id=170055
 
-diff --git a/modules/libpref/Makefile.in b/modules/libpref/Makefile.in
---- a/modules/libpref/Makefile.in
-+++ b/modules/libpref/Makefile.in
-@@ -21,13 +21,15 @@ endif
- ifdef MOZ_SERVICES_HEALTHREPORT
- ifneq (android,$(MOZ_WIDGET_TOOLKIT))
- grepref_files += $(topsrcdir)/services/healthreport/healthreport-prefs.js
- else
- grepref_files += $(topsrcdir)/mobile/android/chrome/content/healthreport-prefs.js
- endif
- endif
- 
-+LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
-+
- greprefs.js: $(grepref_files)
- 	$(call py_action,preprocessor,$(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(MOZ_DEBUG_DEFINES) $^ -o $@)
- 
- libs:: greprefs.js
- 	$(INSTALL) $^ $(DIST)/bin/
 diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
 --- a/modules/libpref/Preferences.cpp
 +++ b/modules/libpref/Preferences.cpp
-@@ -30,16 +30,17 @@
+@@ -31,16 +31,17 @@
  #include "nsIZipReader.h"
  #include "nsPrefBranch.h"
  #include "nsXPIDLString.h"
@@ -46,7 +27,7 @@
  #include "prefread.h"
  #include "prefapi_private_data.h"
  
-@@ -1148,16 +1149,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
+@@ -1135,16 +1136,34 @@ pref_LoadPrefsInDir(nsIFile* aDir, char 
  
  static nsresult pref_LoadPrefsInDirList(const char *listId)
  {
@@ -81,7 +62,7 @@
      return NS_OK;
  
    bool hasMore;
-@@ -1173,17 +1192,17 @@ static nsresult pref_LoadPrefsInDirList(
+@@ -1160,17 +1179,17 @@ static nsresult pref_LoadPrefsInDirList(
  
      nsAutoCString leaf;
      path->GetNativeLeafName(leaf);
@@ -100,7 +81,7 @@
  {
    nsZipItemPtr<char> manifest(jarReader, name, true);
    NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
-@@ -1277,26 +1296,38 @@ static nsresult pref_InitInitialObjects(
+@@ -1264,24 +1283,36 @@ static nsresult pref_InitInitialObjects(
    /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */
    static const char* specialFiles[] = {
  #if defined(XP_MACOSX)
@@ -110,9 +91,7 @@
  #elif defined(XP_UNIX)
      "unix.js"
 +    , "" // placeholder for KDE  (empty is otherwise harmless)
- #if defined(VMS)
-     , "openvms.js"
- #elif defined(_AIX)
+ #if defined(_AIX)
      , "aix.js"
  #endif
  #elif defined(XP_BEOS)
@@ -139,6 +118,30 @@
    // or jar:$gre/omni.jar!/defaults/preferences/*.js.
    RefPtr<nsZipArchive> appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
    // GetReader(mozilla::Omnijar::APP) returns null when $app == $gre, in which
+diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
+--- a/modules/libpref/moz.build
++++ b/modules/libpref/moz.build
+@@ -31,16 +31,20 @@ UNIFIED_SOURCES += [
+     'prefread.cpp',
+ ]
+ 
+ # prefapi.cpp cannot be built in unified mode because it uses plarena.h
+ SOURCES += [
+     'prefapi.cpp',
+ ]
+ 
++LOCAL_INCLUDES += [
++    '/toolkit/xre'
++]
++
+ include('/ipc/chromium/chromium-config.mozbuild')
+ 
+ FINAL_LIBRARY = 'xul'
+ 
+ DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
+ DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
+ 
+ if CONFIG['GNU_CXX']:
 diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
 --- a/python/mozbuild/mozpack/chrome/flags.py
 +++ b/python/mozbuild/mozpack/chrome/flags.py
@@ -184,7 +187,7 @@
 diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
 --- a/toolkit/components/downloads/moz.build
 +++ b/toolkit/components/downloads/moz.build
-@@ -65,15 +65,16 @@ if not CONFIG['MOZ_SUITE']:
+@@ -64,15 +64,16 @@ if not CONFIG['MOZ_SUITE']:
          'nsDownloadManagerUI.js',
          'nsDownloadManagerUI.manifest',
      ]
@@ -226,7 +229,7 @@
  #include "AndroidBridge.h"
  #endif
  
-@@ -2714,16 +2718,25 @@ nsDownload::SetState(DownloadState aStat
+@@ -2719,16 +2723,25 @@ nsDownload::SetState(DownloadState aStat
        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
  
        // Master pref to control this function.
@@ -252,7 +255,7 @@
          int64_t goat = PR_Now() - mStartTime;
          showTaskbarAlert = goat > alertIntervalUSec;
  
-@@ -2754,16 +2767,17 @@ nsDownload::SetState(DownloadState aStat
+@@ -2759,16 +2772,17 @@ nsDownload::SetState(DownloadState aStat
                    NS_LITERAL_STRING(DOWNLOAD_MANAGER_ALERT_ICON), title,
                    message, !removeWhenDone,
                    mPrivate ? NS_LITERAL_STRING("private") : NS_LITERAL_STRING("non-private"),
@@ -273,31 +276,31 @@
 diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
 --- a/toolkit/content/jar.mn
 +++ b/toolkit/content/jar.mn
-@@ -64,29 +64,33 @@ toolkit.jar:
+@@ -72,29 +72,33 @@ toolkit.jar:
     content/global/viewZoomOverlay.js
- *+ content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
+    content/global/bindings/autocomplete.xml    (widgets/autocomplete.xml)
     content/global/bindings/browser.xml         (widgets/browser.xml)
     content/global/bindings/button.xml          (widgets/button.xml)
     content/global/bindings/checkbox.xml        (widgets/checkbox.xml)
     content/global/bindings/colorpicker.xml     (widgets/colorpicker.xml)
     content/global/bindings/datetimepicker.xml  (widgets/datetimepicker.xml)
- *+ content/global/bindings/dialog.xml          (widgets/dialog.xml)
-+*+ content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
+ *  content/global/bindings/dialog.xml          (widgets/dialog.xml)
++*  content/global/bindings/dialog-kde.xml      (widgets/dialog-kde.xml)
 +% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde
     content/global/bindings/editor.xml          (widgets/editor.xml)
     content/global/bindings/expander.xml        (widgets/expander.xml)
- *  content/global/bindings/filefield.xml       (widgets/filefield.xml)
- *+ content/global/bindings/findbar.xml         (widgets/findbar.xml)
+    content/global/bindings/filefield.xml       (widgets/filefield.xml)
+ *  content/global/bindings/findbar.xml         (widgets/findbar.xml)
     content/global/bindings/general.xml         (widgets/general.xml)
     content/global/bindings/groupbox.xml        (widgets/groupbox.xml)
- *+ content/global/bindings/listbox.xml         (widgets/listbox.xml)
+    content/global/bindings/listbox.xml         (widgets/listbox.xml)
     content/global/bindings/menu.xml            (widgets/menu.xml)
     content/global/bindings/menulist.xml        (widgets/menulist.xml)
     content/global/bindings/notification.xml    (widgets/notification.xml)
     content/global/bindings/numberbox.xml       (widgets/numberbox.xml)
     content/global/bindings/popup.xml           (widgets/popup.xml)
- *+ content/global/bindings/preferences.xml     (widgets/preferences.xml)
-+*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml)
+ *  content/global/bindings/preferences.xml     (widgets/preferences.xml)
++*  content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml)
 +% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde
     content/global/bindings/progressmeter.xml   (widgets/progressmeter.xml)
     content/global/bindings/radio.xml           (widgets/radio.xml)
@@ -311,7 +314,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/toolkit/content/widgets/dialog-kde.xml
-@@ -0,0 +1,460 @@
+@@ -0,0 +1,463 @@
 +<?xml version="1.0"?>
 +<!-- 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
@@ -345,7 +348,7 @@
 +        <xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
 +#elif XP_UNIX
 +                >
-+	<xul:button dlgtype="help" class="dialog-button" hidden="true"/>
++        <xul:button dlgtype="help" class="dialog-button" hidden="true"/>
 +	<xul:button dlgtype="extra2" class="dialog-button" hidden="true"/>
 +	<xul:spacer anonid="spacer" flex="1"/>
 +	<xul:button dlgtype="accept" class="dialog-button" xbl:inherits="disabled=buttondisabledaccept"/>
@@ -486,6 +489,9 @@
 +        <parameter name="aEvent"/>
 +        <body>
 +        <![CDATA[
++          let { AppConstants } =
++              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
++
 +          function focusInit() {
 +            const dialog = document.documentElement;
 +            const defaultButton = dialog.getButton(dialog.defaultButton);
@@ -511,11 +517,10 @@
 +                    initialFocusedElt.focus();
 +                  }
 +                }
-+#ifndef XP_MACOSX
-+                else if (focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
++                else if (AppConstants.platform != "macosx" &&
++                         focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
 +                  defaultButton.focus();
 +                }
-+#endif
 +              }
 +            }
 +
@@ -632,13 +637,14 @@
 +            for (dlgtype in buttons) 
 +              buttons[dlgtype].hidden = !shown[dlgtype];
 +
-+#ifdef XP_WIN
-+#           show the spacer on Windows only when the extra2 button is present
-+            var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
-+            spacer.removeAttribute("hidden");
-+            spacer.setAttribute("flex", shown["extra2"]?"1":"0");
-+#endif
-+
++            let { AppConstants } =
++                Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
++            // show the spacer on Windows only when the extra2 button is present
++            if (AppConstants.platform == "win") {
++              var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
++              spacer.removeAttribute("hidden");
++              spacer.setAttribute("flex", shown["extra2"]?"1":"0");
++            }
 +          }
 +        ]]>
 +        </body>
@@ -776,7 +782,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/toolkit/content/widgets/preferences-kde.xml
-@@ -0,0 +1,1403 @@
+@@ -0,0 +1,1406 @@
 +<?xml version="1.0"?>
 +
 +<!DOCTYPE bindings [
@@ -1410,19 +1416,22 @@
 +            var acceptButton = docElt.getButton("accept");
 +            acceptButton.hidden = true;
 +            var cancelButton  = docElt.getButton("cancel");
-+#ifdef XP_MACOSX
-+            // no buttons on Mac except Help
-+            cancelButton.hidden = true;
-+            // Move Help button to the end
-+            document.getAnonymousElementByAttribute(this, "anonid", "spacer").hidden = true;         
-+            // Also, don't fire onDialogAccept on enter
-+            acceptButton.disabled = true;
-+#else
-+            // morph the Cancel button into the Close button
-+            cancelButton.setAttribute ("icon", "close");
-+            cancelButton.label = docElt.getAttribute("closebuttonlabel");
-+            cancelButton.accesskey = docElt.getAttribute("closebuttonaccesskey");
-+#endif
++
++            let { AppConstants } =
++                Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
++            if (AppConstants.platform == "macosx") {
++              // no buttons on Mac except Help
++              cancelButton.hidden = true;
++              // Move Help button to the end
++              document.getAnonymousElementByAttribute(this, "anonid", "spacer").hidden = true;         
++              // Also, don't fire onDialogAccept on enter
++              acceptButton.disabled = true;
++            } else {
++              // morph the Cancel button into the Close button
++              cancelButton.setAttribute ("icon", "close");
++              cancelButton.label = docElt.getAttribute("closebuttonlabel");
++              cancelButton.accesskey = docElt.getAttribute("closebuttonaccesskey");
++            }
 +          }
 +        }
 +        this.setAttribute("animated", this._shouldAnimate ? "true" : "false");
@@ -1592,11 +1601,13 @@
 +        <parameter name="aPaneElement"/>
 +        <body>
 +        <![CDATA[
-+#ifdef XP_MACOSX
-+          var paneTitle = aPaneElement.label;
-+          if (paneTitle != "")
-+            document.title = paneTitle;
-+#endif
++          let { AppConstants } =
++              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
++          if (AppConstants.platform == "macosx") {
++            var paneTitle = aPaneElement.label;
++            if (paneTitle != "")
++              document.title = paneTitle;
++          }
 +          var helpButton = document.documentElement.getButton("help");
 +          if (aPaneElement.helpTopic)
 +            helpButton.hidden = false;
@@ -1666,13 +1677,11 @@
 +      <property name="_shouldAnimate">
 +        <getter>
 +        <![CDATA[
++          let { AppConstants } =
++              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
 +          var psvc = Components.classes["@mozilla.org/preferences-service;1"]
 +                               .getService(Components.interfaces.nsIPrefBranch);
-+#ifdef XP_MACOSX
-+          var animate = true;
-+#else
-+          var animate = false;
-+#endif
++          var animate = AppConstants.platform == "macosx";
 +          try {
 +            animate = psvc.getBoolPref("browser.preferences.animateFadeIn");
 +          }
@@ -2697,7 +2706,7 @@
 diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
 --- a/uriloader/exthandler/moz.build
 +++ b/uriloader/exthandler/moz.build
-@@ -72,17 +72,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
+@@ -75,17 +75,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
  else:
      # These files can't be built in unified mode because they redefine LOG.
      SOURCES += [
@@ -2717,7 +2726,7 @@
          'android/nsExternalSharingAppService.cpp',
          'android/nsExternalURLHandlerService.cpp',
          'android/nsMIMEInfoAndroid.cpp',
-@@ -125,16 +127,17 @@ include('/ipc/chromium/chromium-config.m
+@@ -129,16 +131,17 @@ include('/ipc/chromium/chromium-config.m
  
  FINAL_LIBRARY = 'xul'
  
@@ -3662,8 +3671,8 @@
 --- a/xpcom/components/moz.build
 +++ b/xpcom/components/moz.build
 @@ -47,12 +47,13 @@ FINAL_LIBRARY = 'xul'
- GENERATED_INCLUDES += ['..']
  LOCAL_INCLUDES += [
+     '!..',
      '../base',
      '../build',
      '../ds',
@@ -3678,7 +3687,7 @@
 diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
 --- a/xpcom/io/nsLocalFileUnix.cpp
 +++ b/xpcom/io/nsLocalFileUnix.cpp
-@@ -47,16 +47,17 @@
+@@ -44,16 +44,17 @@
  #include "prproces.h"
  #include "nsIDirectoryEnumerator.h"
  #include "nsISimpleEnumerator.h"
@@ -3696,7 +3705,7 @@
  #include "prmem.h"
  #include "plbase64.h"
  
-@@ -1963,42 +1964,52 @@ nsLocalFile::SetPersistentDescriptor(con
+@@ -1948,42 +1949,52 @@ nsLocalFile::SetPersistentDescriptor(con
    return InitWithNativePath(aPersistentDescriptor);
  #endif
  }
@@ -3755,7 +3764,7 @@
      return rv;
    }
    return NS_ERROR_FAILURE;
-@@ -2006,16 +2017,22 @@ nsLocalFile::Reveal()
+@@ -1991,16 +2002,22 @@ nsLocalFile::Reveal()
    return NS_ERROR_FAILURE;
  #endif
  }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-reduce-files-per-UnifiedBindings.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -0,0 +1,28 @@
+From: Andreas Stieger <astieger@suse.com>
+Date: Fri, 26 Feb 2016 16:20:09 +0000
+Subject: For UnifiedBindings*.cpp files, reduce number of files per unified file
+Upstream: no
+
+home/abuild/rpmbuild/BUILD/obj/dom/bindings/UnifiedBindings16.cpp
+[ 1589s] UnifiedBindings17.o
+[ 1612s] [ 1567.621989] Out of memory: Kill process 19849 (cc1plus) score 170 or sacrifice child
+[ 1612s] [ 1567.625099] Killed process 19849 (cc1plus) total-vm:905704kB, anon-rss:102500kB, file-rss:156kB
+[ 1616s] {standard input}: Assembler messages:
+[ 1616s] {standard input}:316015: Warning: end of file not at end of a line; newline inserted
+[ 1635s] {standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive
+[ 1636s] c++: internal compiler error: Killed (program cc1plus)
+[ 1636s] Please submit a full bug report,
+
+Index: mozilla/python/mozbuild/mozbuild/backend/common.py
+===================================================================
+--- mozilla.orig/python/mozbuild/mozbuild/backend/common.py	2016-02-26 17:19:30.331667693 +0100
++++ mozilla/python/mozbuild/mozbuild/backend/common.py	2016-02-26 17:19:39.792569676 +0100
+@@ -333,7 +333,7 @@ class CommonBackend(BuildBackend):
+         unified_source_mapping = list(group_unified_files(webidls.all_regular_cpp_basenames(),
+                                                           unified_prefix='UnifiedBindings',
+                                                           unified_suffix='cpp',
+-                                                          files_per_unified_file=32))
++                                                          files_per_unified_file=16))
+         self._write_unified_files(unified_source_mapping, bindings_dir,
+                                   poison_windows_h=True)
+         self._handle_webidl_build(bindings_dir, unified_source_mapping,
--- a/mozilla-repo.patch	Sun Jan 24 13:40:23 2016 +0100
+++ b/mozilla-repo.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -1,6 +1,6 @@
 # HG changeset patch
 # Parent 80b6464bd883864fce57e8748010869af1be69e9
-# Parent  4799226b419aaf1fcdbbf44c2edb9491d99eb6cb
+# Parent  808d61f33afa6fb9921d3a7f994a71cf2dd9331a
 
 diff --git a/toolkit/mozapps/installer/package-name.mk b/toolkit/mozapps/installer/package-name.mk
 --- a/toolkit/mozapps/installer/package-name.mk
@@ -28,7 +28,7 @@
  
  MOZ_SOURCESTAMP_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).txt
  MOZ_BUILDINFO_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).json
+ MOZ_BUILDID_INFO_TXT_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME)_info.txt
  MOZ_MOZINFO_FILE = $(DIST)/$(PKG_PATH)/$(MOZ_INFO_BASENAME).mozinfo.json
  MOZ_TEST_PACKAGES_FILE = $(DIST)/$(PKG_PATH)/test_packages.json
  MOZ_TEST_PACKAGES_FILE_TC = $(DIST)/$(PKG_PATH)/test_packages_tc.json
- 
--- a/mozilla-shared-nss-db.patch	Sun Jan 24 13:40:23 2016 +0100
+++ b/mozilla-shared-nss-db.patch	Tue Jun 07 21:44:20 2016 +0200
@@ -7,7 +7,7 @@
 diff --git a/configure.in b/configure.in
 --- a/configure.in
 +++ b/configure.in
-@@ -8309,16 +8309,31 @@ if test "$MOZ_ENABLE_SKIA"; then
+@@ -8310,16 +8310,31 @@ if test "$MOZ_ENABLE_SKIA"; then
      AC_DEFINE(USE_SKIA_GPU)
      AC_SUBST(MOZ_ENABLE_SKIA_GPU)
    fi
@@ -42,7 +42,7 @@
 diff --git a/security/manager/ssl/moz.build b/security/manager/ssl/moz.build
 --- a/security/manager/ssl/moz.build
 +++ b/security/manager/ssl/moz.build
-@@ -156,16 +156,19 @@ FAIL_ON_WARNINGS = True
+@@ -160,16 +160,19 @@ UNIFIED_SOURCES += [
  FINAL_LIBRARY = 'xul'
  
  LOCAL_INCLUDES += [
@@ -54,8 +54,8 @@
 +CXXFLAGS += sorted(CONFIG['NSSHELPER_CFLAGS'])
 +OS_LIBS += sorted(CONFIG['NSSHELPER_LIBS'])
 +
- GENERATED_INCLUDES += [
-     '/dist/public/nss',
+ LOCAL_INCLUDES += [
+     '!/dist/public/nss',
  ]
  
  if CONFIG['NSS_DISABLE_DBM']:
@@ -83,38 +83,38 @@
  
  #include "ExtendedValidation.h"
  #include "NSSCertDBTrustDomain.h"
- #include "mozilla/Telemetry.h"
- #include "nsAppDirectoryServiceDefs.h"
- #include "nsCertVerificationThread.h"
- #include "nsAppDirectoryServiceDefs.h"
-@@ -1015,17 +1022,31 @@ nsNSSComponent::InitializeNSS()
-     return NS_ERROR_NOT_AVAILABLE;
+ #include "SharedSSLState.h"
+ #include "mozilla/Preferences.h"
+ #include "mozilla/PublicSSL.h"
+ #include "mozilla/Services.h"
+@@ -1007,17 +1014,31 @@ nsNSSComponent::InitializeNSS()
+       return rv;
+     }
    }
- 
-   SECStatus init_rv = SECFailure;
-   bool nocertdb = Preferences::GetBool("security.nocertdb", false);
+   MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("inSafeMode: %u\n", inSafeMode));
  
    if (!nocertdb && !profileStr.IsEmpty()) {
      // First try to initialize the NSS DB in read/write mode.
+     // Only load PKCS11 modules if we're not in safe mode.
 +#ifdef MOZ_ENABLE_NSSHELPER
 +    if (PR_GetEnv("MOZ_XRE_NO_NSSHELPER")) {
-+      init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
++      init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false, !inSafeMode);
 +    } else {
 +      uint32_t flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
 +      init_rv = ::nsshelp_open_db ("Firefox", profileStr.get(), flags);
 +
 +      if (init_rv != SECSuccess) {
 +        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("can not init NSS using nsshelp_open_db in %s\n", profileStr.get()));
-+        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
++        init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false, !inSafeMode);
 +      }
 +    }
 +#else
-     init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false);
+     init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false, !inSafeMode);
 +#endif
      // If that fails, attempt read-only mode.
      if (init_rv != SECSuccess) {
        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init NSS r/w in %s\n", profileStr.get()));
-       init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), true);
+       init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), true, !inSafeMode);
      }
      if (init_rv != SECSuccess) {
        MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init in r/o either\n"));
--- a/series	Sun Jan 24 13:40:23 2016 +0100
+++ b/series	Tue Jun 07 21:44:20 2016 +0200
@@ -9,9 +9,11 @@
 mozilla-repo.patch
 mozilla-idldir.patch
 mozilla-openaes-decl.patch
-#mozilla-bmo1005535.patch
 mozilla-no-stdcxx-check.patch
 mozilla-libproxy.patch
+mozilla-reduce-files-per-UnifiedBindings.patch
+mozilla-gtk3_20.patch
+mozilla-check_return.patch
 
 # Firefox patches
 firefox-kde.patch