summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--build-jit-CodeAlignment.patch12
-rw-r--r--build-ppc64-s390x-curl.patch13
-rw-r--r--build-with-nss-3.34.0.patch14
-rw-r--r--firefox-fedora-rhbz-1537287-v2.patch52
-rw-r--r--firefox-install-dir.patch12
-rw-r--r--firefox-mozconfig3
-rw-r--r--firefox-wayland.sh.in7
-rw-r--r--firefox-x11.desktop272
-rw-r--r--firefox-x11.sh.in7
-rw-r--r--firefox.sh.in3
-rw-r--r--firefox.spec84
-rw-r--r--mozilla-1399611.patch1312
-rw-r--r--mozilla-1416170.patch50
-rw-r--r--mozilla-1431052.patch21
-rw-r--r--mozilla-1432414.patch58
-rw-r--r--mozilla-1433081.patch51
-rw-r--r--mozilla-1434202.patch25
-rw-r--r--mozilla-1434565.patch16
-rw-r--r--mozilla-1434572.patch93
-rw-r--r--queue-crash.patch26
-rw-r--r--remote-profile.patch19
-rw-r--r--sources4
23 files changed, 634 insertions, 1524 deletions
diff --git a/.gitignore b/.gitignore
index 9e8b681..3712a80 100644
--- a/.gitignore
+++ b/.gitignore
@@ -278,5 +278,5 @@ firefox-3.6.4.source.tar.bz2
/firefox-langpacks-58.0-20180123.tar.xz
/firefox-58.0.1.source.tar.xz
/firefox-langpacks-58.0.1-20180130.tar.xz
-/firefox-58.0.2.source.tar.xz
-/firefox-langpacks-58.0.2-20180214.tar.xz
+/2f6a4d2cf42c9d59626061d45c043817cb220814.tar.bz2
+/firefox-langpacks-59.0-20180306.tar.xz \ No newline at end of file
diff --git a/build-jit-CodeAlignment.patch b/build-jit-CodeAlignment.patch
deleted file mode 100644
index 0f0b10c..0000000
--- a/build-jit-CodeAlignment.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-58.0/js/src/jit/none/MacroAssembler-none.h.old firefox-58.0/js/src/jit/none/MacroAssembler-none.h
---- firefox-58.0/js/src/jit/none/MacroAssembler-none.h.old 2018-01-24 20:33:52.569147937 +0100
-+++ firefox-58.0/js/src/jit/none/MacroAssembler-none.h 2018-01-24 20:34:06.985088057 +0100
-@@ -88,7 +88,7 @@ static constexpr Register WasmTableCallI
- static constexpr Register WasmTlsReg { Registers::invalid_reg };
-
- static constexpr uint32_t ABIStackAlignment = 4;
--static constexpr uint32_t CodeAlignment = 4;
-+static constexpr uint32_t CodeAlignment = 8;
- static constexpr uint32_t JitStackAlignment = 8;
- static constexpr uint32_t JitStackValueAlignment = JitStackAlignment / sizeof(Value);
-
diff --git a/build-ppc64-s390x-curl.patch b/build-ppc64-s390x-curl.patch
deleted file mode 100644
index 6c303f3..0000000
--- a/build-ppc64-s390x-curl.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -up firefox-54.0/toolkit/crashreporter/google-breakpad/src/third_party/curl/curlbuild.h.ppc-curl firefox-54.0/toolkit/crashreporter/google-breakpad/src/third_party/curl/curlbuild.h
---- firefox-54.0/toolkit/crashreporter/google-breakpad/src/third_party/curl/curlbuild.h.ppc-curl 2017-06-09 23:31:15.186207877 +0200
-+++ firefox-54.0/toolkit/crashreporter/google-breakpad/src/third_party/curl/curlbuild.h 2017-06-10 00:21:26.731117206 +0200
-@@ -155,7 +155,8 @@
-
- /* The size of `long', as computed by sizeof. */
- #if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)) || \
-- defined(__aarch64__) || (defined(__mips__) && _MIPS_SIM == _ABI64)
-+ defined(__aarch64__) || (defined(__mips__) && _MIPS_SIM == _ABI64) || \
-+ defined(__PPC64__) || defined(__pcc64le__) || defined(__S390X__) || defined(__s390x__)
- #define CURL_SIZEOF_LONG 8
- #else
- #define CURL_SIZEOF_LONG 4
diff --git a/build-with-nss-3.34.0.patch b/build-with-nss-3.34.0.patch
deleted file mode 100644
index 68bc141..0000000
--- a/build-with-nss-3.34.0.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -up firefox-58.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-58.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium
-diff -up firefox-58.0/media/webrtc/trunk/Makefile.old firefox-58.0/media/webrtc/trunk/Makefile
-diff -up firefox-58.0/old-configure.in.old firefox-58.0/old-configure.in
---- firefox-58.0/old-configure.in.old 2018-01-23 14:49:51.771309172 +0100
-+++ firefox-58.0/old-configure.in 2018-01-23 14:50:04.091265876 +0100
-@@ -1915,7 +1915,7 @@ MOZ_ARG_WITH_BOOL(system-nss,
- _USE_SYSTEM_NSS=1 )
-
- if test -n "$_USE_SYSTEM_NSS"; then
-- AM_PATH_NSS(3.34.1, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
-+ AM_PATH_NSS(3.34.0, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
- fi
-
- if test -n "$MOZ_SYSTEM_NSS"; then
diff --git a/firefox-fedora-rhbz-1537287-v2.patch b/firefox-fedora-rhbz-1537287-v2.patch
deleted file mode 100644
index e7d314e..0000000
--- a/firefox-fedora-rhbz-1537287-v2.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-diff --git a/security/certverifier/NSSCertDBTrustDomain.cpp b/security/certverifier/NSSCertDBTrustDomain.cpp
---- a/security/certverifier/NSSCertDBTrustDomain.cpp
-+++ b/security/certverifier/NSSCertDBTrustDomain.cpp
-@@ -1059,26 +1059,17 @@ InitializeNSS(const nsACString& dir, boo
- // "/usr/lib/nss/libnssckbi.so".
- uint32_t flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
- if (readOnly) {
- flags |= NSS_INIT_READONLY;
- }
- if (!loadPKCS11Modules) {
- flags |= NSS_INIT_NOMODDB;
- }
-- // At the moment, sqldb does not work with non-ASCII file paths on Windows.
-- bool useSQLDB = Preferences::GetBool("security.use_sqldb", false) &&
-- (NS_IsNativeUTF8() || NS_IsAscii(PromiseFlatCString(dir).get()));
- nsAutoCString dbTypeAndDirectory;
-- // Don't change any behavior if the user has specified an alternative database
-- // location with MOZPSM_NSSDBDIR_OVERRIDE.
-- const char* dbDirOverride = getenv("MOZPSM_NSSDBDIR_OVERRIDE");
-- if (useSQLDB && (!dbDirOverride || strlen(dbDirOverride) == 0)) {
-- dbTypeAndDirectory.Append("sql:");
-- }
- dbTypeAndDirectory.Append(dir);
- MOZ_LOG(gCertVerifierLog, LogLevel::Debug,
- ("InitializeNSS(%s, %d, %d)", dbTypeAndDirectory.get(), readOnly,
- loadPKCS11Modules));
- SECStatus srv = NSS_Initialize(dbTypeAndDirectory.get(), "", "",
- SECMOD_DB, flags);
- if (srv != SECSuccess) {
- return srv;
-diff --git a/security/manager/ssl/security-prefs.js b/security/manager/ssl/security-prefs.js
---- a/security/manager/ssl/security-prefs.js
-+++ b/security/manager/ssl/security-prefs.js
-@@ -39,17 +39,17 @@ pref("security.ask_for_password",
- pref("security.password_lifetime", 30);
-
- // If true, use the modern sqlite-backed certificate and key databases in NSS.
- // If false, use the default format. Currently the default in NSS is the old
- // BerkeleyDB format, but this will change in bug 1377940.
- // Changing this requires a restart to take effect.
- // Note that the environment variable MOZPSM_NSSDBDIR_OVERRIDE can override both
- // the behavior of this preference and the NSS default.
--pref("security.use_sqldb", true);
-+pref("security.use_sqldb", false);
-
- // The supported values of this pref are:
- // 0: disable detecting Family Safety mode and importing the root
- // 1: only attempt to detect Family Safety mode (don't import the root)
- // 2: detect Family Safety mode and import the root
- // (This is only relevant to Windows 8.1)
- pref("security.family_safety.mode", 2);
-
diff --git a/firefox-install-dir.patch b/firefox-install-dir.patch
deleted file mode 100644
index 646e0c9..0000000
--- a/firefox-install-dir.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-45.0/firefox-45.0/config/baseconfig.mk.orig firefox-45.0/firefox-45.0/config/baseconfig.mk
---- firefox-45.0/config/baseconfig.mk.orig 2016-03-02 13:26:31.981927073 +0100
-+++ firefox-45.0/config/baseconfig.mk 2016-03-02 13:30:09.044756473 +0100
-@@ -4,7 +4,7 @@
- # whether a normal build is happening or whether the check is running.
- includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
- idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
--installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-+installdir = $(libdir)/$(MOZ_APP_NAME)
- sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
- ifeq (.,$(DEPTH))
- DIST = dist
diff --git a/firefox-mozconfig b/firefox-mozconfig
index 6b4cb54..953df70 100644
--- a/firefox-mozconfig
+++ b/firefox-mozconfig
@@ -1,6 +1,6 @@
. $topsrcdir/browser/config/mozconfig
-ac_add_options --enable-default-toolkit=cairo-gtk3
+ac_add_options --enable-default-toolkit=cairo-gtk3-wayland
ac_add_options --prefix="$PREFIX"
ac_add_options --libdir="$LIBDIR"
@@ -20,6 +20,7 @@ ac_add_options --with-mozilla-api-keyfile=../mozilla-api-key
ac_add_options --with-google-api-keyfile=../google-api-key
ac_add_options --enable-release
ac_add_options --enable-pie
+ac_add_options --with-gl-provider=EGL
# Workaround for mozbz#1341234
ac_add_options BINDGEN_CFLAGS="$(pkg-config nspr pixman-1 --cflags)"
diff --git a/firefox-wayland.sh.in b/firefox-wayland.sh.in
new file mode 100644
index 0000000..108d64c
--- /dev/null
+++ b/firefox-wayland.sh.in
@@ -0,0 +1,7 @@
+#!/bin/bash
+#
+# Run Firefox under Wayland
+#
+
+export GDK_BACKEND=wayland
+/usr/bin/firefox "$@"
diff --git a/firefox-x11.desktop b/firefox-x11.desktop
new file mode 100644
index 0000000..55747b4
--- /dev/null
+++ b/firefox-x11.desktop
@@ -0,0 +1,272 @@
+[Desktop Entry]
+Version=1.0
+Name=Firefox X11
+GenericName=Web Browser
+GenericName[ca]=Navegador web
+GenericName[cs]=Webový prohlížeč
+GenericName[es]=Navegador web
+GenericName[fa]=مرورگر اینترنتی
+GenericName[fi]=WWW-selain
+GenericName[fr]=Navigateur Web
+GenericName[hu]=Webböngésző
+GenericName[it]=Browser Web
+GenericName[ja]=ウェブ・ブラウザ
+GenericName[ko]=웹 브라우저
+GenericName[nb]=Nettleser
+GenericName[nl]=Webbrowser
+GenericName[nn]=Nettlesar
+GenericName[no]=Nettleser
+GenericName[pl]=Przeglądarka WWW
+GenericName[pt]=Navegador Web
+GenericName[pt_BR]=Navegador Web
+GenericName[sk]=Internetový prehliadač
+GenericName[sv]=Webbläsare
+Comment=Browse the Web
+Comment[ca]=Navegueu per el web
+Comment[cs]=Prohlížení stránek World Wide Webu
+Comment[de]=Im Internet surfen
+Comment[es]=Navegue por la web
+Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید
+Comment[fi]=Selaa Internetin WWW-sivuja
+Comment[fr]=Navigue sur Internet
+Comment[hu]=A világháló böngészése
+Comment[it]=Esplora il web
+Comment[ja]=ウェブを閲覧します
+Comment[ko]=웹을 돌아 다닙니다
+Comment[nb]=Surf på nettet
+Comment[nl]=Verken het internet
+Comment[nn]=Surf på nettet
+Comment[no]=Surf på nettet
+Comment[pl]=Przeglądanie stron WWW
+Comment[pt]=Navegue na Internet
+Comment[pt_BR]=Navegue na Internet
+Comment[sk]=Prehliadanie internetu
+Comment[sv]=Surfa på webben
+Exec=firefox-x11 %u
+Icon=firefox
+Terminal=false
+Type=Application
+MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
+StartupNotify=true
+Categories=Network;WebBrowser;
+Keywords=web;browser;internet;
+Actions=new-window;new-private-window;
+
+[Desktop Action new-window]
+Name=Open a New Window (X11)
+Name[ach]=Dirica manyen
+Name[af]=Nuwe venster
+Name[an]=Nueva finestra
+Name[ar]=نافذة جديدة
+Name[as]=নতুন উইন্ডো
+Name[ast]=Ventana nueva
+Name[az]=Yeni Pəncərə
+Name[be]=Новае акно
+Name[bg]=Нов прозорец
+Name[bn-BD]=নতুন উইন্ডো (N)
+Name[bn-IN]=নতুন উইন্ডো
+Name[br]=Prenestr nevez
+Name[brx]=गोदान उइन्ड'(N)
+Name[bs]=Novi prozor
+Name[ca]=Finestra nova
+Name[cak]=K'ak'a' tzuwäch
+Name[cs]=Nové okno
+Name[cy]=Ffenestr Newydd
+Name[da]=Nyt vindue
+Name[de]=Neues Fenster
+Name[dsb]=Nowe wokno
+Name[el]=Νέο παράθυρο
+Name[en-GB]=New Window
+Name[en-US]=New Window
+Name[en-ZA]=New Window
+Name[eo]=Nova fenestro
+Name[es-AR]=Nueva ventana
+Name[es-CL]=Nueva ventana
+Name[es-ES]=Nueva ventana
+Name[es-MX]=Nueva ventana
+Name[et]=Uus aken
+Name[eu]=Leiho berria
+Name[fa]=پنجره جدید‌
+Name[ff]=Henorde Hesere
+Name[fi]=Uusi ikkuna
+Name[fr]=Nouvelle fenêtre
+Name[fy-NL]=Nij finster
+Name[ga-IE]=Fuinneog Nua
+Name[gd]=Uinneag ùr
+Name[gl]=Nova xanela
+Name[gn]=Ovetã pyahu
+Name[gu-IN]=નવી વિન્ડો
+Name[he]=חלון חדש
+Name[hi-IN]=नया विंडो
+Name[hr]=Novi prozor
+Name[hsb]=Nowe wokno
+Name[hu]=Új ablak
+Name[hy-AM]=Նոր Պատուհան
+Name[id]=Jendela Baru
+Name[is]=Nýr gluggi
+Name[it]=Nuova finestra
+Name[ja]=新しいウィンドウ
+Name[ja-JP-mac]=新規ウインドウ
+Name[ka]=ახალი ფანჯარა
+Name[kk]=Жаңа терезе
+Name[km]=បង្អួច​​​ថ្មី
+Name[kn]=ಹೊಸ ಕಿಟಕಿ
+Name[ko]=새 창
+Name[kok]=नवें जनेल
+Name[ks]=نئئ وِنڈو
+Name[lij]=Neuvo barcon
+Name[lo]=ຫນ້າຕ່າງໃຫມ່
+Name[lt]=Naujas langas
+Name[ltg]=Jauns lūgs
+Name[lv]=Jauns logs
+Name[mai]=नव विंडो
+Name[mk]=Нов прозорец
+Name[ml]=പുതിയ ജാലകം
+Name[mr]=नवीन पटल
+Name[ms]=Tetingkap Baru
+Name[my]=ဝင်းဒိုးအသစ်
+Name[nb-NO]=Nytt vindu
+Name[ne-NP]=नयाँ सञ्झ्याल
+Name[nl]=Nieuw venster
+Name[nn-NO]=Nytt vindauge
+Name[or]=ନୂତନ ୱିଣ୍ଡୋ
+Name[pa-IN]=ਨਵੀਂ ਵਿੰਡੋ
+Name[pl]=Nowe okno
+Name[pt-BR]=Nova janela
+Name[pt-PT]=Nova janela
+Name[rm]=Nova fanestra
+Name[ro]=Fereastră nouă
+Name[ru]=Новое окно
+Name[sat]=नावा विंडो (N)
+Name[si]=නව කවුළුවක්
+Name[sk]=Nové okno
+Name[sl]=Novo okno
+Name[son]=Zanfun taaga
+Name[sq]=Dritare e Re
+Name[sr]=Нови прозор
+Name[sv-SE]=Nytt fönster
+Name[ta]=புதிய சாளரம்
+Name[te]=కొత్త విండో
+Name[th]=หน้าต่างใหม่
+Name[tr]=Yeni pencere
+Name[tsz]=Eraatarakua jimpani
+Name[uk]=Нове вікно
+Name[ur]=نیا دریچہ
+Name[uz]=Yangi oyna
+Name[vi]=Cửa sổ mới
+Name[wo]=Palanteer bu bees
+Name[xh]=Ifestile entsha
+Name[zh-CN]=新建窗口
+Name[zh-TW]=開新視窗
+
+
+Exec=firefox-x11 %u
+
+[Desktop Action new-private-window]
+Name=Open a New Private Window (X11)
+Name[ach]=Dirica manyen me mung
+Name[af]=Nuwe privaatvenster
+Name[an]=Nueva finestra privada
+Name[ar]=نافذة خاصة جديدة
+Name[as]=নতুন ব্যক্তিগত উইন্ডো
+Name[ast]=Ventana privada nueva
+Name[az]=Yeni Məxfi Pəncərə
+Name[be]=Новае акно адасаблення
+Name[bg]=Нов прозорец за поверително сърфиране
+Name[bn-BD]=নতুন ব্যক্তিগত উইন্ডো
+Name[bn-IN]=নতুন ব্যক্তিগত উইন্ডো
+Name[br]=Prenestr merdeiñ prevez nevez
+Name[brx]=गोदान प्राइभेट उइन्ड'
+Name[bs]=Novi privatni prozor
+Name[ca]=Finestra privada nova
+Name[cak]=K'ak'a' ichinan tzuwäch
+Name[cs]=Nové anonymní okno
+Name[cy]=Ffenestr Breifat Newydd
+Name[da]=Nyt privat vindue
+Name[de]=Neues privates Fenster
+Name[dsb]=Nowe priwatne wokno
+Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης
+Name[en-GB]=New Private Window
+Name[en-US]=New Private Window
+Name[en-ZA]=New Private Window
+Name[eo]=Nova privata fenestro
+Name[es-AR]=Nueva ventana privada
+Name[es-CL]=Nueva ventana privada
+Name[es-ES]=Nueva ventana privada
+Name[es-MX]=Nueva ventana privada
+Name[et]=Uus privaatne aken
+Name[eu]=Leiho pribatu berria
+Name[fa]=پنجره ناشناس جدید
+Name[ff]=Henorde Suturo Hesere
+Name[fi]=Uusi yksityinen ikkuna
+Name[fr]=Nouvelle fenêtre de navigation privée
+Name[fy-NL]=Nij priveefinster
+Name[ga-IE]=Fuinneog Nua Phríobháideach
+Name[gd]=Uinneag phrìobhaideach ùr
+Name[gl]=Nova xanela privada
+Name[gn]=Ovetã ñemi pyahu
+Name[gu-IN]=નવી ખાનગી વિન્ડો
+Name[he]=חלון פרטי חדש
+Name[hi-IN]=नयी निजी विंडो
+Name[hr]=Novi privatni prozor
+Name[hsb]=Nowe priwatne wokno
+Name[hu]=Új privát ablak
+Name[hy-AM]=Սկսել Գաղտնի դիտարկում
+Name[id]=Jendela Mode Pribadi Baru
+Name[is]=Nýr huliðsgluggi
+Name[it]=Nuova finestra anonima
+Name[ja]=新しいプライベートウィンドウ
+Name[ja-JP-mac]=新規プライベートウインドウ
+Name[ka]=ახალი პირადი ფანჯარა
+Name[kk]=Жаңа жекелік терезе
+Name[km]=បង្អួច​ឯកជន​ថ្មី
+Name[kn]=ಹೊಸ ಖಾಸಗಿ ಕಿಟಕಿ
+Name[ko]=새 사생활 보호 모드
+Name[kok]=नवो खाजगी विंडो
+Name[ks]=نْو پرایوٹ وینڈو&
+Name[lij]=Neuvo barcon privou
+Name[lo]=ເປີດຫນ້າຕ່າງສວນຕົວຂື້ນມາໃຫມ່
+Name[lt]=Naujas privataus naršymo langas
+Name[ltg]=Jauns privatais lūgs
+Name[lv]=Jauns privātais logs
+Name[mai]=नया निज विंडो (W)
+Name[mk]=Нов приватен прозорец
+Name[ml]=പുതിയ സ്വകാര്യ ജാലകം
+Name[mr]=नवीन वैयक्तिक पटल
+Name[ms]=Tetingkap Persendirian Baharu
+Name[my]=New Private Window
+Name[nb-NO]=Nytt privat vindu
+Name[ne-NP]=नयाँ निजी सञ्झ्याल
+Name[nl]=Nieuw privévenster
+Name[nn-NO]=Nytt privat vindauge
+Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ
+Name[pa-IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ
+Name[pl]=Nowe okno prywatne
+Name[pt-BR]=Nova janela privativa
+Name[pt-PT]=Nova janela privada
+Name[rm]=Nova fanestra privata
+Name[ro]=Fereastră privată nouă
+Name[ru]=Новое приватное окно
+Name[sat]=नावा निजेराक् विंडो (W )
+Name[si]=නව පුද්ගලික කවුළුව (W)
+Name[sk]=Nové okno v režime Súkromné prehliadanie
+Name[sl]=Novo zasebno okno
+Name[son]=Sutura zanfun taaga
+Name[sq]=Dritare e Re Private
+Name[sr]=Нови приватан прозор
+Name[sv-SE]=Nytt privat fönster
+Name[ta]=புதிய தனிப்பட்ட சாளரம்
+Name[te]=కొత్త ఆంతరంగిక విండో
+Name[th]=หน้าต่างส่วนตัวใหม่
+Name[tr]=Yeni gizli pencere
+Name[tsz]=Juchiiti eraatarakua jimpani
+Name[uk]=Приватне вікно
+Name[ur]=نیا نجی دریچہ
+Name[uz]=Yangi maxfiy oyna
+Name[vi]=Cửa sổ riêng tư mới
+Name[wo]=Panlanteeru biir bu bees
+Name[xh]=Ifestile yangasese entsha
+Name[zh-CN]=新建隐私浏览窗口
+Name[zh-TW]=新增隱私視窗
+Exec=firefox-x11 --private-window %u
+
diff --git a/firefox-x11.sh.in b/firefox-x11.sh.in
new file mode 100644
index 0000000..d1b48c7
--- /dev/null
+++ b/firefox-x11.sh.in
@@ -0,0 +1,7 @@
+#!/bin/bash
+#
+# Run Firefox under X11
+#
+
+export GDK_BACKEND=x11
+/usr/bin/firefox "$@"
diff --git a/firefox.sh.in b/firefox.sh.in
index a310721..c546795 100644
--- a/firefox.sh.in
+++ b/firefox.sh.in
@@ -65,7 +65,7 @@ MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks"
MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
-
+
##
## Set MOZ_GRE_CONF
##
@@ -246,4 +246,5 @@ then
echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
fi
+
exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@"
diff --git a/firefox.spec b/firefox.spec
index a12bddf..109480d 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -80,27 +80,28 @@
%global mozappdir %{_libdir}/%{name}
%global mozappdirdev %{_libdir}/%{name}-devel-%{version}
%global langpackdir %{mozappdir}/langpacks
-%global tarballdir %{name}-%{version}%{?pre_version}
+%global release_hash 2f6a4d2cf42c9d59626061d45c043817cb220814
+%global tarballdir mozilla-release-%{release_hash}
%global official_branding 1
%global build_langpacks 1
-%global enable_mozilla_crashreporter 0
+%global enable_mozilla_crashreporter 1
%if !%{debug_build}
%ifarch %{ix86} x86_64
-%global enable_mozilla_crashreporter 1
+%global enable_mozilla_crashreporter 0
%endif
%endif
Summary: Mozilla Firefox Web browser
Name: firefox
-Version: 58.0.2
+Version: 59.0
Release: 1%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
-Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
+Source0: https://hg.mozilla.org/releases/mozilla-release/archive/%{release_hash}.tar.bz2
%if %{build_langpacks}
-Source1: firefox-langpacks-%{version}%{?pre_version}-20180214.tar.xz
+Source1: firefox-langpacks-%{version}%{?pre_version}-20180306.tar.xz
%endif
Source10: firefox-mozconfig
Source12: firefox-redhat-default-prefs.js
@@ -111,9 +112,11 @@ Source24: mozilla-api-key
Source25: firefox-symbolic.svg
Source26: distribution.ini
Source27: google-api-key
+Source28: firefox-wayland.sh.in
+Source29: firefox-x11.desktop
+Source30: firefox-x11.sh.in
# Build patches
-Patch0: firefox-install-dir.patch
Patch3: mozilla-build-arm.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=814879#c3
Patch18: xulrunner-24.0-jemalloc-ppc.patch
@@ -122,7 +125,6 @@ Patch26: build-icu-big-endian.patch
Patch27: mozilla-1335250.patch
# Also fixes s390x: https://bugzilla.mozilla.org/show_bug.cgi?id=1376268
Patch29: build-big-endian.patch
-Patch31: build-ppc64-s390x-curl.patch
Patch32: build-rust-ppc64le.patch
Patch35: build-ppc-jit.patch
Patch36: build-missing-xlocale-h.patch
@@ -142,9 +144,6 @@ Patch225: mozilla-1005640-accept-lang.patch
#ARM run-time patch
Patch226: rhbz-1354671.patch
Patch229: firefox-nss-version.patch
-Patch230: firefox-fedora-rhbz-1537287-v2.patch
-Patch231: build-with-nss-3.34.0.patch
-Patch232: build-jit-CodeAlignment.patch
# Upstream patches
Patch402: mozilla-1196777.patch
@@ -154,9 +153,16 @@ Patch410: mozilla-1321521.patch
Patch411: mozilla-1321521-2.patch
Patch412: mozilla-1337988.patch
Patch413: mozilla-1353817.patch
-Patch416: mozilla-1399611.patch
-# ppc64/le build patch
-Patch417: mozilla-1416170.patch
+
+# Wayland patches
+Patch450: mozilla-1431052.patch
+Patch451: mozilla-1432414.patch
+Patch452: mozilla-1434202.patch
+Patch453: mozilla-1433081.patch
+Patch454: remote-profile.patch
+Patch455: mozilla-1434572.patch
+Patch456: mozilla-1434565.patch
+Patch457: queue-crash.patch
# Debian patches
Patch500: mozilla-440908.patch
@@ -294,7 +300,6 @@ This package contains results of tests executed during build.
# Build patches, can't change backup suffix from default because during build
# there is a compare of config and js/config directories and .orig suffix is
# ignored during this compare.
-%patch0 -p1
%patch18 -p1 -b .jemalloc-ppc
@@ -302,12 +307,6 @@ This package contains results of tests executed during build.
%patch25 -p1 -b .rhbz-1219542-s390
%endif
%patch29 -p1 -b .big-endian
-%patch31 -p1 -b .ppc64-s390x-curl
-# Second arch patches - do we still need them?
-#%patch32 -p1 -b .rust-ppc64le
-#%ifarch ppc ppc64 ppc64le
-#%patch35 -p1 -b .ppc-jit
-#%endif
%patch37 -p1 -b .jit-atomic-lucky
%patch39 -p1 -b .fix-attr-order
@@ -323,31 +322,20 @@ This package contains results of tests executed during build.
%ifarch aarch64
%patch226 -p1 -b .1354671
%endif
-%if 0%{?fedora} < 28
-%patch230 -p1 -b .rhbz-1537287
-%endif
-%patch231 -p1
-%patch232 -p1 -b .CodeAlignment
%patch402 -p1 -b .1196777
%patch406 -p1 -b .256180
-# Does not apply
-#%ifarch %{arm}
-#%if 0%{?fedora} < 26
-# Workaround for mozbz#1337988
-#%patch412 -p1 -b .1337988
-#%endif
-#%endif
-
%patch413 -p1 -b .1353817
-# CSD - Disabled now
-%patch416 -p1 -b .1399611
-%patch417 -p1 -b .1416170
-# Debian extension patch
-# Disabled due to new pref module, see
-# https://bugzilla.mozilla.org/show_bug.cgi?id=440908
-#%patch500 -p1 -b .440908
+# Wayland patches
+%patch450 -p1 -b .1431052
+%patch451 -p1 -b .1432414
+%patch452 -p1 -b .1434202
+%patch453 -p1 -b .1433081
+%patch454 -p1 -b .remote-profile
+%patch455 -p1 -b .1434572
+%patch456 -p1 -b .1434565
+%patch457 -p1 -b .queue-crash
# Patch for big endian platforms only
%if 0%{?big_endian}
@@ -465,9 +453,6 @@ echo "ac_add_options --disable-ion" >> .mozconfig
echo "ac_add_options --disable-stylo" >> .mozconfig
%endif
-# Avoid issues with rpm
-chmod a-x third_party/rust/itertools/src/lib.rs
-
#---------------------------------------------------------------------
%build
@@ -835,7 +820,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%dir %{langpackdir}
%endif
%{mozappdir}/browser/omni.ja
-%{mozappdir}/browser/icons
%{mozappdir}/chrome.manifest
%{mozappdir}/run-mozilla.sh
%{mozappdir}/application.ini
@@ -878,18 +862,12 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#---------------------------------------------------------------------
%changelog
-* Wed Feb 14 2018 Jan Horak <jhorak@redhat.com> - 58.0.2-1
-- Update to 58.0.2
+* Tue Mar 6 2018 Martin Stransky <stransky@redhat.com> - 59.0-1
+- Updated to 59.0
* Tue Feb 13 2018 Martin Stransky <stransky@redhat.com> - 58.0.1-3
- Added build fix for gcc8 by Tom Callaway
-* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 58.0.1-2
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
-
-* Tue Jan 30 2018 Martin Stransky <stransky@redhat.com> - 58.0.1-1
-- Update to 58.0.1
-
* Wed Jan 24 2018 Martin Stransky <stransky@redhat.com> - 58.0-4
- Enabled second arches
diff --git a/mozilla-1399611.patch b/mozilla-1399611.patch
deleted file mode 100644
index 34b09a1..0000000
--- a/mozilla-1399611.patch
+++ /dev/null
@@ -1,1312 +0,0 @@
-diff -up firefox-58.0/browser/base/moz.build.1399611 firefox-58.0/browser/base/moz.build
---- firefox-58.0/browser/base/moz.build.1399611 2017-11-02 17:16:30.000000000 +0100
-+++ firefox-58.0/browser/base/moz.build 2018-01-24 10:57:03.717031953 +0100
-@@ -57,7 +57,7 @@ DEFINES['APP_LICENSE_BLOCK'] = '%s/conte
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):
- DEFINES['CONTEXT_COPY_IMAGE_CONTENTS'] = 1
-
--if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
-+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
- DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
-diff -up firefox-58.0/browser/themes/linux/browser.css.1399611 firefox-58.0/browser/themes/linux/browser.css
---- firefox-58.0/browser/themes/linux/browser.css.1399611 2018-01-11 21:16:54.000000000 +0100
-+++ firefox-58.0/browser/themes/linux/browser.css 2018-01-24 10:57:03.718031950 +0100
-@@ -717,7 +717,7 @@ html|span.ac-emphasize-text-url {
- :root[tabsintitlebar] > #titlebar:-moz-lwtheme {
- visibility: hidden;
- }
-- :root[tabsintitlebar] > #titlebar-content:-moz-lwtheme {
-+ :root[tabsintitlebar] #titlebar-content:-moz-lwtheme {
- visibility: visible;
- }
-
-diff -up firefox-58.0/layout/style/nsMediaFeatures.cpp.1399611 firefox-58.0/layout/style/nsMediaFeatures.cpp
---- firefox-58.0/layout/style/nsMediaFeatures.cpp.1399611 2018-01-11 21:17:01.000000000 +0100
-+++ firefox-58.0/layout/style/nsMediaFeatures.cpp 2018-01-24 10:57:03.718031950 +0100
-@@ -831,6 +831,42 @@ nsMediaFeatures::features[] = {
- GetSystemMetric
- },
-
-+ {
-+ &nsGkAtoms::_moz_gtk_csd_available,
-+ nsMediaFeature::eMinMaxNotAllowed,
-+ nsMediaFeature::eBoolInteger,
-+ nsMediaFeature::eNoRequirements,
-+ { &nsGkAtoms::gtk_csd_available },
-+ GetSystemMetric
-+ },
-+
-+ {
-+ &nsGkAtoms::_moz_gtk_csd_minimize_button,
-+ nsMediaFeature::eMinMaxNotAllowed,
-+ nsMediaFeature::eBoolInteger,
-+ nsMediaFeature::eNoRequirements,
-+ { &nsGkAtoms::gtk_csd_minimize_button },
-+ GetSystemMetric
-+ },
-+
-+ {
-+ &nsGkAtoms::_moz_gtk_csd_maximize_button,
-+ nsMediaFeature::eMinMaxNotAllowed,
-+ nsMediaFeature::eBoolInteger,
-+ nsMediaFeature::eNoRequirements,
-+ { &nsGkAtoms::gtk_csd_maximize_button },
-+ GetSystemMetric
-+ },
-+
-+ {
-+ &nsGkAtoms::_moz_gtk_csd_close_button,
-+ nsMediaFeature::eMinMaxNotAllowed,
-+ nsMediaFeature::eBoolInteger,
-+ nsMediaFeature::eNoRequirements,
-+ { &nsGkAtoms::gtk_csd_close_button },
-+ GetSystemMetric
-+ },
-+
- // Internal -moz-is-glyph media feature: applies only inside SVG glyphs.
- // Internal because it is really only useful in the user agent anyway
- // and therefore not worth standardizing.
-diff -up firefox-58.0/toolkit/modules/moz.build.1399611 firefox-58.0/toolkit/modules/moz.build
---- firefox-58.0/toolkit/modules/moz.build.1399611 2018-01-11 21:17:05.000000000 +0100
-+++ firefox-58.0/toolkit/modules/moz.build 2018-01-24 10:57:03.718031950 +0100
-@@ -259,7 +259,7 @@ EXTRA_JS_MODULES.sessionstore += [
- ]
-
- DEFINES['INSTALL_COMPACT_THEMES'] = 1
--if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
-+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
- DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
-diff -up firefox-58.0/widget/gtk/mozgtk/mozgtk.c.1399611 firefox-58.0/widget/gtk/mozgtk/mozgtk.c
---- firefox-58.0/widget/gtk/mozgtk/mozgtk.c.1399611 2018-01-11 21:17:06.000000000 +0100
-+++ firefox-58.0/widget/gtk/mozgtk/mozgtk.c 2018-01-24 10:11:58.638648276 +0100
-@@ -391,6 +391,7 @@ STUB(gtk_separator_menu_item_new)
- STUB(gtk_separator_tool_item_new)
- STUB(gtk_settings_get_default)
- STUB(gtk_settings_get_for_screen)
-+STUB(gtk_show_uri)
- STUB(gtk_socket_add_id)
- STUB(gtk_socket_get_id)
- STUB(gtk_socket_get_type)
-@@ -407,6 +408,7 @@ STUB(gtk_target_list_add_image_targets)
- STUB(gtk_target_list_new)
- STUB(gtk_target_list_unref)
- STUB(gtk_targets_include_image)
-+STUB(gtk_targets_include_text)
- STUB(gtk_target_table_free)
- STUB(gtk_target_table_new_from_list)
- STUB(gtk_text_view_new)
-@@ -479,6 +481,7 @@ STUB(gtk_widget_show_all)
- STUB(gtk_widget_size_allocate)
- STUB(gtk_widget_style_get)
- STUB(gtk_widget_unparent)
-+STUB(gtk_widget_unrealize)
- STUB(gtk_window_deiconify)
- STUB(gtk_window_fullscreen)
- STUB(gtk_window_get_group)
-@@ -582,6 +585,8 @@ STUB(gtk_style_context_set_state)
- STUB(gtk_style_properties_lookup_property)
- STUB(gtk_tree_view_column_get_button)
- STUB(gtk_widget_get_preferred_size)
-+STUB(gtk_widget_get_preferred_width)
-+STUB(gtk_widget_get_preferred_height)
- STUB(gtk_widget_get_state_flags)
- STUB(gtk_widget_get_style_context)
- STUB(gtk_widget_path_append_type)
-diff -up firefox-58.0/widget/gtk/nsLookAndFeel.cpp.1399611 firefox-58.0/widget/gtk/nsLookAndFeel.cpp
---- firefox-58.0/widget/gtk/nsLookAndFeel.cpp.1399611 2018-01-11 21:17:06.000000000 +0100
-+++ firefox-58.0/widget/gtk/nsLookAndFeel.cpp 2018-01-24 10:57:03.718031950 +0100
-@@ -24,6 +24,7 @@
- #include "nsStyleConsts.h"
- #include "gfxFontConstants.h"
- #include "WidgetUtils.h"
-+#include "nsWindow.h"
-
- #include <dlfcn.h>
-
-@@ -740,7 +741,7 @@ GetSystemFontInfo(GtkStyleContext *aStyl
- // Scale fonts up on HiDPI displays.
- // This would be done automatically with cairo, but we manually manage
- // the display scale for platform consistency.
-- size *= ScreenHelperGTK::GetGTKMonitorScaleFactor();
-+ size *= mozilla::widget::ScreenHelperGTK::GetGTKMonitorScaleFactor();
-
- // |size| is now pixels
-
-@@ -1076,17 +1077,13 @@ nsLookAndFeel::EnsureInit()
- gtk_widget_destroy(window);
- g_object_unref(labelWidget);
-
-- // Require GTK 3.20 for client-side decoration support.
-- mCSDAvailable = gtk_check_version(3, 20, 0) == nullptr;
-- if (mCSDAvailable) {
-- mCSDAvailable =
-- mozilla::Preferences::GetBool("widget.allow-client-side-decoration",
-- false);
-- }
-+ // Require GTK 3.10 for GtkHeaderBar support and compatible window manager.
-+ mCSDAvailable = (gtk_check_version(3, 10, 0) == nullptr &&
-+ nsWindow::GetCSDSupportLevel() != nsWindow::CSD_SUPPORT_NONE);
-
- // We need to initialize whole CSD config explicitly because it's queried
- // as -moz-gtk* media features.
-- mCSDCloseButton = false;
-+ mCSDCloseButton = true;
- mCSDMaximizeButton = false;
- mCSDMinimizeButton = false;
-
-@@ -1095,18 +1092,24 @@ nsLookAndFeel::EnsureInit()
- (const gchar* (*)(GtkWidget*))
- dlsym(RTLD_DEFAULT, "gtk_header_bar_get_decoration_layout");
-
-- GtkWidget* headerBar = GetWidget(MOZ_GTK_HEADER_BAR);
-- const gchar* decorationLayout =
-- sGtkHeaderBarGetDecorationLayoutPtr(headerBar);
-- if (!decorationLayout) {
-- g_object_get(settings, "gtk-decoration-layout", &decorationLayout,
-- nullptr);
-- }
-+ if (sGtkHeaderBarGetDecorationLayoutPtr) {
-+ GtkWidget* headerBar = GetWidget(MOZ_GTK_HEADER_BAR);
-+ const gchar* decorationLayout =
-+ sGtkHeaderBarGetDecorationLayoutPtr(headerBar);
-+ if (!decorationLayout) {
-+ g_object_get(settings, "gtk-decoration-layout",
-+ &decorationLayout,
-+ nullptr);
-+ }
-
-- if (decorationLayout) {
-- mCSDCloseButton = (strstr(decorationLayout, "close") != nullptr);
-- mCSDMaximizeButton = (strstr(decorationLayout, "maximize") != nullptr);
-- mCSDMinimizeButton = (strstr(decorationLayout, "minimize") != nullptr);
-+ if (decorationLayout) {
-+ mCSDCloseButton =
-+ (strstr(decorationLayout, "close") != nullptr);
-+ mCSDMaximizeButton =
-+ (strstr(decorationLayout, "maximize") != nullptr);
-+ mCSDMinimizeButton =
-+ (strstr(decorationLayout, "minimize") != nullptr);
-+ }
- }
- }
- }
-diff -up firefox-58.0/widget/gtk/nsNativeThemeGTK.cpp.1399611 firefox-58.0/widget/gtk/nsNativeThemeGTK.cpp
---- firefox-58.0/widget/gtk/nsNativeThemeGTK.cpp.1399611 2018-01-11 21:17:06.000000000 +0100
-+++ firefox-58.0/widget/gtk/nsNativeThemeGTK.cpp 2018-01-24 10:57:03.719031946 +0100
-@@ -29,6 +29,7 @@
-
- #include <gdk/gdkprivate.h>
- #include <gtk/gtk.h>
-+#include <gtk/gtkx.h>
-
- #include "gfxContext.h"
- #include "gfxPlatformGtk.h"
-@@ -51,6 +52,7 @@
-
- using namespace mozilla;
- using namespace mozilla::gfx;
-+using namespace mozilla::widget;
-
- NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeGTK, nsNativeTheme, nsITheme,
- nsIObserver)
-@@ -1375,6 +1377,10 @@ nsNativeThemeGTK::GetWidgetPadding(nsDev
- switch (aWidgetType) {
- case NS_THEME_BUTTON_FOCUS:
- case NS_THEME_TOOLBARBUTTON:
-+ case NS_THEME_WINDOW_BUTTON_CLOSE:
-+ case NS_THEME_WINDOW_BUTTON_MINIMIZE:
-+ case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
-+ case NS_THEME_WINDOW_BUTTON_RESTORE:
- case NS_THEME_DUALBUTTON:
- case NS_THEME_TAB_SCROLL_ARROW_BACK:
- case NS_THEME_TAB_SCROLL_ARROW_FORWARD:
-diff -up firefox-58.0/widget/gtk/nsWindow.cpp.1399611 firefox-58.0/widget/gtk/nsWindow.cpp
---- firefox-58.0/widget/gtk/nsWindow.cpp.1399611 2018-01-24 10:57:03.714031963 +0100
-+++ firefox-58.0/widget/gtk/nsWindow.cpp 2018-01-24 10:57:03.720031943 +0100
-@@ -178,13 +178,8 @@ static int is_parent_ungrab_enter(Gdk
- static int is_parent_grab_leave(GdkEventCrossing *aEvent);
-
- /* callbacks from widgets */
--#if (MOZ_WIDGET_GTK == 2)
--static gboolean expose_event_cb (GtkWidget *widget,
-- GdkEventExpose *event);
--#else
- static gboolean expose_event_cb (GtkWidget *widget,
- cairo_t *rect);
--#endif
- static gboolean configure_event_cb (GtkWidget *widget,
- GdkEventConfigure *event);
- static void container_unrealize_cb (GtkWidget *widget);
-@@ -230,11 +225,9 @@ static void screen_composited_change
- static void widget_composited_changed_cb (GtkWidget* widget,
- gpointer user_data);
-
--#if (MOZ_WIDGET_GTK == 3)
- static void scale_changed_cb (GtkWidget* widget,
- GParamSpec* aPSpec,
- gpointer aPointer);
--#endif
- #if GTK_CHECK_VERSION(3,4,0)
- static gboolean touch_event_cb (GtkWidget* aWidget,
- GdkEventTouch* aEvent);
-@@ -390,7 +383,7 @@ static guint gButtonState;
- static inline int32_t
- GetBitmapStride(int32_t width)
- {
--#if defined(MOZ_X11) || (MOZ_WIDGET_GTK == 2)
-+#if defined(MOZ_X11)
- return (width+7)/8;
- #else
- return cairo_format_stride_for_width(CAIRO_FORMAT_A1, width);
-@@ -458,11 +451,23 @@ nsWindow::nsWindow()
- mXVisual = nullptr;
- mXDepth = 0;
- #endif /* MOZ_X11 */
-+
- if (!gGlobalsInitialized) {
- gGlobalsInitialized = true;
-
- // It's OK if either of these fail, but it may not be one day.
- initialize_prefs();
-+
-+#ifdef MOZ_WAYLAND
-+ // Wayland provides clipboard data to application on focus-in event
-+ // so we need to init our clipboard hooks before we create window
-+ // and get focus.
-+ if (!mIsX11Display) {
-+ nsCOMPtr<nsIClipboard> clipboard =
-+ do_GetService("@mozilla.org/widget/clipboard;1");
-+ NS_ASSERTION(clipboard, "Failed to init clipboard!");
-+ }
-+#endif
- }
-
- mLastMotionPressure = 0;
-@@ -1521,7 +1526,7 @@ nsWindow::UpdateClientOffset()
- {
- AUTO_PROFILER_LABEL("nsWindow::UpdateClientOffset", GRAPHICS);
-
-- if (!mIsTopLevel || !mShell || !mGdkWindow || !mIsX11Display ||
-+ if (!mIsTopLevel || !mShell || !mIsX11Display ||
- gtk_window_get_window_type(GTK_WINDOW(mShell)) == GTK_WINDOW_POPUP) {
- mClientOffset = nsIntPoint(0, 0);
- return;
-@@ -1534,7 +1539,7 @@ nsWindow::UpdateClientOffset()
- int length_returned;
- long *frame_extents;
-
-- if (!gdk_property_get(mGdkWindow,
-+ if (!gdk_property_get(gtk_widget_get_window(mShell),
- gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE),
- cardinal_atom,
- 0, // offset
-@@ -1710,16 +1715,22 @@ nsWindow::GetNativeData(uint32_t aDataTy
- #ifdef MOZ_X11
- GdkDisplay* gdkDisplay = gdk_display_get_default();
- if (GDK_IS_X11_DISPLAY(gdkDisplay)) {
-- return GDK_DISPLAY_XDISPLAY(gdkDisplay);
-+ return GDK_DISPLAY_XDISPLAY(gdkDisplay);
- }
- #endif /* MOZ_X11 */
-+ // Don't bother to return native display on Wayland as it's for
-+ // X11 only NPAPI plugins.
- return nullptr;
- }
- case NS_NATIVE_SHELLWIDGET:
- return GetToplevelWidget();
-
- case NS_NATIVE_SHAREABLE_WINDOW:
-- return (void *) GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow));
-+ if (mIsX11Display) {
-+ return (void *) GDK_WINDOW_XID(gdk_window_get_toplevel(mGdkWindow));
-+ }
-+ NS_WARNING("nsWindow::GetNativeData(): NS_NATIVE_SHAREABLE_WINDOW is not handled on Wayland!");
-+ return nullptr;
- case NS_RAW_NATIVE_IME_CONTEXT: {
- void* pseudoIMEContext = GetPseudoIMEContext();
- if (pseudoIMEContext) {
-@@ -1800,18 +1811,18 @@ nsWindow::SetIcon(const nsAString& aIcon
- // The last two entries (for the old XPM format) will be ignored unless
- // no icons are found using other suffixes. XPM icons are deprecated.
-
-- const char extensions[6][7] = { ".png", "16.png", "32.png", "48.png",
-- ".xpm", "16.xpm" };
-+ const char16_t extensions[9][8] = { u".png", u"16.png", u"32.png",
-+ u"48.png", u"64.png", u"128.png",
-+ u"256.png",
-+ u".xpm", u"16.xpm" };
-
- for (uint32_t i = 0; i < ArrayLength(extensions); i++) {
- // Don't bother looking for XPM versions if we found a PNG.
- if (i == ArrayLength(extensions) - 2 && foundIcon)
- break;
-
-- nsAutoString extension;
-- extension.AppendASCII(extensions[i]);
--
-- ResolveIconName(aIconSpec, extension, getter_AddRefs(iconFile));
-+ ResolveIconName(aIconSpec, nsDependentString(extensions[i]),
-+ getter_AddRefs(iconFile));
- if (iconFile) {
- iconFile->GetNativePath(path);
- GdkPixbuf *icon = gdk_pixbuf_new_from_file(path.get(), nullptr);
-@@ -2024,30 +2035,6 @@ gdk_window_flash(GdkWindow * aGdkWind
- #endif // DEBUG
- #endif
-
--#if (MOZ_WIDGET_GTK == 2)
--static bool
--ExtractExposeRegion(LayoutDeviceIntRegion& aRegion, GdkEventExpose* aEvent)
--{
-- GdkRectangle* rects;
-- gint nrects;
-- gdk_region_get_rectangles(aEvent->region, &rects, &nrects);
--
-- if (nrects > MAX_RECTS_IN_REGION) {
-- // Just use the bounding box
-- rects[0] = aEvent->area;
-- nrects = 1;
-- }
--
-- for (GdkRectangle* r = rects; r < rects + nrects; r++) {
-- aRegion.Or(aRegion, LayoutDeviceIntRect(r->x, r->y, r->width, r->height));
-- LOGDRAW(("\t%d %d %d %d\n", r->x, r->y, r->width, r->height));
-- }
--
-- g_free(rects);
-- return true;
--}
--
--#else
- # ifdef cairo_copy_clip_rectangle_list
- # error "Looks like we're including Mozilla's cairo instead of system cairo"
- # endif
-@@ -2069,15 +2056,9 @@ ExtractExposeRegion(LayoutDeviceIntRegio
- cairo_rectangle_list_destroy(rects);
- return true;
- }
--#endif
-
--#if (MOZ_WIDGET_GTK == 2)
--gboolean
--nsWindow::OnExposeEvent(GdkEventExpose *aEvent)
--#else
- gboolean
- nsWindow::OnExposeEvent(cairo_t *cr)
--#endif
- {
- // Send any pending resize events so that layout can update.
- // May run event loop.
-@@ -2096,11 +2077,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
- return FALSE;
-
- LayoutDeviceIntRegion exposeRegion;
--#if (MOZ_WIDGET_GTK == 2)
-- if (!ExtractExposeRegion(exposeRegion, aEvent)) {
--#else
- if (!ExtractExposeRegion(exposeRegion, cr)) {
--#endif
- return FALSE;
- }
-
-@@ -2141,7 +2118,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
-
- LOGDRAW(("sending expose event [%p] %p 0x%lx (rects follow):\n",
- (void *)this, (void *)mGdkWindow,
-- gdk_x11_window_get_xid(mGdkWindow)));
-+ mIsX11Display ? gdk_x11_window_get_xid(mGdkWindow) : 0));
-
- // Our bounds may have changed after calling WillPaintWindow. Clip
- // to the new bounds here. The region is relative to this
-@@ -2304,19 +2281,11 @@ nsWindow::OnExposeEvent(cairo_t *cr)
- listener->DidPaintWindow();
-
- // Synchronously flush any new dirty areas
--#if (MOZ_WIDGET_GTK == 2)
-- GdkRegion* dirtyArea = gdk_window_get_update_area(mGdkWindow);
--#else
- cairo_region_t* dirtyArea = gdk_window_get_update_area(mGdkWindow);
--#endif
-
- if (dirtyArea) {
- gdk_window_invalidate_region(mGdkWindow, dirtyArea, false);
--#if (MOZ_WIDGET_GTK == 2)
-- gdk_region_destroy(dirtyArea);
--#else
- cairo_region_destroy(dirtyArea);
--#endif
- gdk_window_process_updates(mGdkWindow, false);
- }
-
-@@ -2466,7 +2435,7 @@ nsWindow::OnSizeAllocate(GtkAllocation *
- mBounds.SizeTo(size);
-
- #ifdef MOZ_X11
-- // Notify the X11CompositorWidget of a ClientSizeChange
-+ // Notify the GtkCompositorWidget of a ClientSizeChange
- if (mCompositorWidgetDelegate) {
- mCompositorWidgetDelegate->NotifyClientSizeChanged(GetClientSize());
- }
-@@ -3550,21 +3519,9 @@ CreateGdkWindow(GdkWindow *parent, GtkWi
- attributes.visual = gtk_widget_get_visual(widget);
- attributes.window_type = GDK_WINDOW_CHILD;
-
--#if (MOZ_WIDGET_GTK == 2)
-- attributes_mask |= GDK_WA_COLORMAP;
-- attributes.colormap = gtk_widget_get_colormap(widget);
--#endif
--
- GdkWindow *window = gdk_window_new(parent, &attributes, attributes_mask);
- gdk_window_set_user_data(window, widget);
-
--// GTK3 TODO?
--#if (MOZ_WIDGET_GTK == 2)
-- /* set the default pixmap to None so that you don't end up with the
-- gtk default which is BlackPixel. */
-- gdk_window_set_back_pixmap(window, nullptr, FALSE);
--#endif
--
- return window;
- }
-
-@@ -3653,10 +3610,14 @@ nsWindow::Create(nsIWidget* aParent,
- // which will use a Window with the override-redirect attribute
- // (for temporary windows).
- // For long-lived windows, their stacking order is managed by the
-- // window manager, as indicated by GTK_WINDOW_TOPLEVEL ...
-- GtkWindowType type =
-- mWindowType != eWindowType_popup || aInitData->mNoAutoHide ?
-- GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP;
-+ // window manager, as indicated by GTK_WINDOW_TOPLEVEL.
-+ // For Wayland we have to always use GTK_WINDOW_POPUP to control
-+ // popup window position.
-+ GtkWindowType type = GTK_WINDOW_TOPLEVEL;
-+ if (mWindowType == eWindowType_popup) {
-+ type = (mIsX11Display && aInitData->mNoAutoHide) ?
-+ GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP;
-+ }
- mShell = gtk_window_new(type);
-
- bool useAlphaVisual = (mWindowType == eWindowType_popup &&
-@@ -3674,13 +3635,8 @@ nsWindow::Create(nsIWidget* aParent,
- if (useAlphaVisual) {
- GdkScreen *screen = gtk_widget_get_screen(mShell);
- if (gdk_screen_is_composited(screen)) {
--#if (MOZ_WIDGET_GTK == 2)
-- GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
-- gtk_widget_set_colormap(mShell, colormap);
--#else
- GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
- gtk_widget_set_visual(mShell, visual);
--#endif
- }
- }
-
-@@ -3728,9 +3684,11 @@ nsWindow::Create(nsIWidget* aParent,
- #ifdef MOZ_X11
- // ... but when the window manager offers focus through
- // WM_TAKE_FOCUS, focus is requested on the parent window.
-- gtk_widget_realize(mShell);
-- gdk_window_add_filter(gtk_widget_get_window(mShell),
-- popup_take_focus_filter, nullptr);
-+ if (mIsX11Display) {
-+ gtk_widget_realize(mShell);
-+ gdk_window_add_filter(gtk_widget_get_window(mShell),
-+ popup_take_focus_filter, nullptr);
-+ }
- #endif
- }
-
-@@ -3742,7 +3700,11 @@ nsWindow::Create(nsIWidget* aParent,
- else {
- switch (aInitData->mPopupHint) {
- case ePopupTypeMenu:
-- gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
-+ // Use GDK_WINDOW_TYPE_HINT_UTILITY on Wayland which
-+ // guides Gtk to create the popup as subsurface
-+ // instead of xdg_shell popup (see Bug 1423598).
-+ gtkTypeHint = mIsX11Display ? GDK_WINDOW_TYPE_HINT_POPUP_MENU :
-+ GDK_WINDOW_TYPE_HINT_UTILITY;
- break;
- case ePopupTypeTooltip:
- gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;
-@@ -3769,13 +3731,11 @@ nsWindow::Create(nsIWidget* aParent,
- gtk_window_group_add_window(group, GTK_WINDOW(mShell));
- g_object_unref(group);
-
-- if (GetCSDSupportLevel() != CSD_SUPPORT_NONE) {
-- int32_t isCSDAvailable = false;
-- nsresult rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDAvailable,
-- &isCSDAvailable);
-- if (NS_SUCCEEDED(rv)) {
-- mIsCSDAvailable = isCSDAvailable;
-- }
-+ int32_t isCSDAvailable = false;
-+ nsresult rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDAvailable,
-+ &isCSDAvailable);
-+ if (NS_SUCCEEDED(rv)) {
-+ mIsCSDAvailable = isCSDAvailable;
- }
- }
-
-@@ -3783,7 +3743,6 @@ nsWindow::Create(nsIWidget* aParent,
- GtkWidget *container = moz_container_new();
- mContainer = MOZ_CONTAINER(container);
-
--#if (MOZ_WIDGET_GTK == 3)
- // "csd" style is set when widget is realized so we need to call
- // it explicitly now.
- gtk_widget_realize(mShell);
-@@ -3793,16 +3752,22 @@ nsWindow::Create(nsIWidget* aParent,
- * 1) We're running on Gtk+ without client side decorations.
- * Content is rendered to mShell window and we listen
- * to the Gtk+ events on mShell
-- * 2) We're running on Gtk+ > 3.20 and client side decorations
-+ * 2) We're running on Gtk+ and client side decorations
- * are drawn by Gtk+ to mShell. Content is rendered to mContainer
- * and we listen to the Gtk+ events on mContainer.
-+ * 3) We're running on Wayland. All gecko content is rendered
-+ * to mContainer and we listen to the Gtk+ events on mContainer.
- */
- GtkStyleContext* style = gtk_widget_get_style_context(mShell);
-- drawToContainer = gtk_style_context_has_class(style, "csd");
--#endif
-+ drawToContainer =
-+ !mIsX11Display ||
-+ (mIsCSDAvailable && GetCSDSupportLevel() == CSD_SUPPORT_FLAT ) ||
-+ gtk_style_context_has_class(style, "csd");
- eventWidget = (drawToContainer) ? container : mShell;
-
- gtk_widget_add_events(eventWidget, kEvents);
-+ if (drawToContainer)
-+ gtk_widget_add_events(mShell, GDK_PROPERTY_CHANGE_MASK);
-
- // Prevent GtkWindow from painting a background to avoid flickering.
- gtk_widget_set_app_paintable(eventWidget, TRUE);
-@@ -3839,19 +3804,11 @@ nsWindow::Create(nsIWidget* aParent,
-
- // If the popup ignores mouse events, set an empty input shape.
- if (aInitData->mMouseTransparent) {
--#if (MOZ_WIDGET_GTK == 2)
-- GdkRectangle rect = { 0, 0, 0, 0 };
-- GdkRegion *region = gdk_region_rectangle(&rect);
--
-- gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0);
-- gdk_region_destroy(region);
--#else
- cairo_rectangle_int_t rect = { 0, 0, 0, 0 };
- cairo_region_t *region = cairo_region_create_rectangle(&rect);
-
- gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0);
- cairo_region_destroy(region);
--#endif
- }
- }
- }
-@@ -3893,6 +3850,12 @@ nsWindow::Create(nsIWidget* aParent,
-
- // label the drawing window with this object so we can find our way home
- g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", this);
-+ if (drawToContainer) {
-+ // Also label mShell toplevel window,
-+ // property_notify_event_cb callback also needs to find its way home
-+ g_object_set_data(G_OBJECT(gtk_widget_get_window(mShell)),
-+ "nsWindow", this);
-+ }
-
- if (mContainer)
- g_object_set_data(G_OBJECT(mContainer), "nsWindow", this);
-@@ -3910,12 +3873,12 @@ nsWindow::Create(nsIWidget* aParent,
- G_CALLBACK(window_state_event_cb), nullptr);
- g_signal_connect(mShell, "check-resize",
- G_CALLBACK(check_resize_cb), nullptr);
--
-- GdkScreen *screen = gtk_widget_get_screen(mShell);
--
- g_signal_connect(mShell, "composited-changed",
- G_CALLBACK(widget_composited_changed_cb), nullptr);
-+ g_signal_connect(mShell, "property-notify-event",
-+ G_CALLBACK(property_notify_event_cb), nullptr);
-
-+ GdkScreen *screen = gtk_widget_get_screen(mShell);
- if (!g_signal_handler_find(screen, G_SIGNAL_MATCH_FUNC,
- 0, 0, nullptr,
- FuncToGpointer(screen_composited_changed_cb), 0)) {
-@@ -3940,21 +3903,14 @@ nsWindow::Create(nsIWidget* aParent,
- G_CALLBACK(size_allocate_cb), nullptr);
- g_signal_connect(mContainer, "hierarchy-changed",
- G_CALLBACK(hierarchy_changed_cb), nullptr);
--#if (MOZ_WIDGET_GTK == 3)
- g_signal_connect(mContainer, "notify::scale-factor",
- G_CALLBACK(scale_changed_cb), nullptr);
--#endif
- // Initialize mHasMappedToplevel.
- hierarchy_changed_cb(GTK_WIDGET(mContainer), nullptr);
- // Expose, focus, key, and drag events are sent even to GTK_NO_WINDOW
- // widgets.
--#if (MOZ_WIDGET_GTK == 2)
-- g_signal_connect(mContainer, "expose_event",
-- G_CALLBACK(expose_event_cb), nullptr);
--#else
- g_signal_connect(G_OBJECT(mContainer), "draw",
- G_CALLBACK(expose_event_cb), nullptr);
--#endif
- g_signal_connect(mContainer, "focus_in_event",
- G_CALLBACK(focus_in_event_cb), nullptr);
- g_signal_connect(mContainer, "focus_out_event",
-@@ -4006,10 +3962,6 @@ nsWindow::Create(nsIWidget* aParent,
- }
-
- if (eventWidget) {
--#if (MOZ_WIDGET_GTK == 2)
-- // Don't let GTK mess with the shapes of our GdkWindows
-- GTK_PRIVATE_SET_FLAG(eventWidget, GTK_HAS_SHAPE_MASK);
--#endif
-
- // These events are sent to the owning widget of the relevant window
- // and propagate up to the first widget that handles the events, so we
-@@ -4025,8 +3977,6 @@ nsWindow::Create(nsIWidget* aParent,
- G_CALLBACK(button_press_event_cb), nullptr);
- g_signal_connect(eventWidget, "button-release-event",
- G_CALLBACK(button_release_event_cb), nullptr);
-- g_signal_connect(eventWidget, "property-notify-event",
-- G_CALLBACK(property_notify_event_cb), nullptr);
- g_signal_connect(eventWidget, "scroll-event",
- G_CALLBACK(scroll_event_cb), nullptr);
- #if GTK_CHECK_VERSION(3,4,0)
-@@ -4039,7 +3989,7 @@ nsWindow::Create(nsIWidget* aParent,
- if (mShell) {
- LOG(("\tmShell %p mContainer %p mGdkWindow %p 0x%lx\n",
- mShell, mContainer, mGdkWindow,
-- gdk_x11_window_get_xid(mGdkWindow)));
-+ mIsX11Display ? gdk_x11_window_get_xid(mGdkWindow) : 0));
- } else if (mContainer) {
- LOG(("\tmContainer %p mGdkWindow %p\n", mContainer, mGdkWindow));
- }
-@@ -4063,8 +4013,12 @@ nsWindow::Create(nsIWidget* aParent,
-
- mSurfaceProvider.Initialize(mXDisplay, mXWindow, mXVisual, mXDepth);
- }
-+#ifdef MOZ_WAYLAND
-+ else if (!mIsX11Display) {
-+ mSurfaceProvider.Initialize(this);
-+ }
-+#endif
- #endif
--
- return NS_OK;
- }
-
-@@ -4099,7 +4053,8 @@ nsWindow::SetWindowClass(const nsAString
- res_name[0] = toupper(res_name[0]);
- if (!role) role = res_name;
-
-- gdk_window_set_role(mGdkWindow, role);
-+ GdkWindow* gdkWindow = gtk_widget_get_window(mShell);
-+ gdk_window_set_role(gdkWindow, role);
-
- #ifdef MOZ_X11
- if (mIsX11Display) {
-@@ -4115,7 +4070,7 @@ nsWindow::SetWindowClass(const nsAString
- // a warning & refuses to make the change.
- GdkDisplay *display = gdk_display_get_default();
- XSetClassHint(GDK_DISPLAY_XDISPLAY(display),
-- gdk_x11_window_get_xid(mGdkWindow),
-+ gdk_x11_window_get_xid(gdkWindow),
- class_hint);
- XFree(class_hint);
- }
-@@ -4164,7 +4119,7 @@ nsWindow::NativeResize()
- }
-
- #ifdef MOZ_X11
-- // Notify the X11CompositorWidget of a ClientSizeChange
-+ // Notify the GtkCompositorWidget of a ClientSizeChange
- // This is different than OnSizeAllocate to catch initial sizing
- if (mCompositorWidgetDelegate) {
- mCompositorWidgetDelegate->NotifyClientSizeChanged(GetClientSize());
-@@ -4220,7 +4175,7 @@ nsWindow::NativeMoveResize()
- }
-
- #ifdef MOZ_X11
-- // Notify the X11CompositorWidget of a ClientSizeChange
-+ // Notify the GtkCompositorWidget of a ClientSizeChange
- // This is different than OnSizeAllocate to catch initial sizing
- if (mCompositorWidgetDelegate) {
- mCompositorWidgetDelegate->NotifyClientSizeChanged(GetClientSize());
-@@ -4529,17 +4484,6 @@ nsWindow::SetWindowClipRegion(const nsTA
- if (!mGdkWindow)
- return NS_OK;
-
--#if (MOZ_WIDGET_GTK == 2)
-- GdkRegion *region = gdk_region_new(); // aborts on OOM
-- for (uint32_t i = 0; i < newRects->Length(); ++i) {
-- const LayoutDeviceIntRect& r = newRects->ElementAt(i);
-- GdkRectangle rect = { r.x, r.y, r.width, r.height };
-- gdk_region_union_with_rect(region, &rect);
-- }
--
-- gdk_window_shape_combine_region(mGdkWindow, region, 0, 0);
-- gdk_region_destroy(region);
--#else
- cairo_region_t *region = cairo_region_create();
- for (uint32_t i = 0; i < newRects->Length(); ++i) {
- const LayoutDeviceIntRect& r = newRects->ElementAt(i);
-@@ -4549,7 +4493,6 @@ nsWindow::SetWindowClipRegion(const nsTA
-
- gdk_window_shape_combine_region(mGdkWindow, region, 0, 0);
- cairo_region_destroy(region);
--#endif
-
- return NS_OK;
- }
-@@ -4658,17 +4601,6 @@ nsWindow::ApplyTransparencyBitmap()
- maskPixmap, ShapeSet);
- XFreePixmap(xDisplay, maskPixmap);
- #else
--#if (MOZ_WIDGET_GTK == 2)
-- gtk_widget_reset_shapes(mShell);
-- GdkBitmap* maskBitmap = gdk_bitmap_create_from_data(mGdkWindow,
-- mTransparencyBitmap,
-- mTransparencyBitmapWidth, mTransparencyBitmapHeight);
-- if (!maskBitmap)
-- return;
--
-- gtk_widget_shape_combine_mask(mShell, maskBitmap, 0, 0);
-- g_object_unref(maskBitmap);
--#else
- cairo_surface_t *maskBitmap;
- maskBitmap = cairo_image_surface_create_for_data((unsigned char*)mTransparencyBitmap,
- CAIRO_FORMAT_A1,
-@@ -4682,7 +4614,6 @@ nsWindow::ApplyTransparencyBitmap()
- gtk_widget_shape_combine_region(mShell, maskRegion);
- cairo_region_destroy(maskRegion);
- cairo_surface_destroy(maskBitmap);
--#endif // MOZ_WIDGET_GTK == 2
- #endif // MOZ_X11
- }
-
-@@ -4779,6 +4710,12 @@ nsWindow::GrabPointer(guint32 aTime)
- if (!mGdkWindow)
- return;
-
-+ if (!mIsX11Display) {
-+ // Don't to the grab on Wayland as it causes a regression
-+ // from Bug 1377084.
-+ return;
-+ }
-+
- gint retval;
- retval = gdk_pointer_grab(mGdkWindow, TRUE,
- (GdkEventMask)(GDK_BUTTON_PRESS_MASK |
-@@ -4812,6 +4749,13 @@ nsWindow::ReleaseGrabs(void)
- LOG(("ReleaseGrabs\n"));
-
- mRetryPointerGrab = false;
-+
-+ if (!mIsX11Display) {
-+ // Don't to the ungrab on Wayland as it causes a regression
-+ // from Bug 1377084.
-+ return;
-+ }
-+
- gdk_pointer_ungrab(GDK_CURRENT_TIME);
- }
-
-@@ -5058,7 +5002,7 @@ nsWindow::MakeFullScreen(bool aFullScree
- LOG(("nsWindow::MakeFullScreen [%p] aFullScreen %d\n",
- (void *)this, aFullScreen));
-
-- if (!IsFullscreenSupported(mShell)) {
-+ if (mIsX11Display && !IsFullscreenSupported(mShell)) {
- return NS_ERROR_NOT_AVAILABLE;
- }
-
-@@ -5080,7 +5024,7 @@ nsWindow::MakeFullScreen(bool aFullScree
- }
-
- void
--nsWindow::HideWindowChrome(bool aShouldHide)
-+nsWindow::SetWindowDecoration(nsBorderStyle aStyle)
- {
- if (!mShell) {
- // Pass the request to the toplevel window
-@@ -5092,30 +5036,29 @@ nsWindow::HideWindowChrome(bool aShouldH
- if (!topWindow)
- return;
-
-- topWindow->HideWindowChrome(aShouldHide);
-+ topWindow->SetWindowDecoration(aStyle);
- return;
- }
-
-+ // We can't use mGdkWindow directly here as it can be
-+ // derived from mContainer which is not a top-level GdkWindow.
-+ GdkWindow *window = gtk_widget_get_window(mShell);
-+
- // Sawfish, metacity, and presumably other window managers get
- // confused if we change the window decorations while the window
- // is visible.
- bool wasVisible = false;
-- if (gdk_window_is_visible(mGdkWindow)) {
-- gdk_window_hide(mGdkWindow);
-+ if (gdk_window_is_visible(window)) {
-+ gdk_window_hide(window);
- wasVisible = true;
- }
-
-- gint wmd;
-- if (aShouldHide)
-- wmd = 0;
-- else
-- wmd = ConvertBorderStyles(mBorderStyle);
--
-+ gint wmd = ConvertBorderStyles(aStyle);
- if (wmd != -1)
-- gdk_window_set_decorations(mGdkWindow, (GdkWMDecoration) wmd);
-+ gdk_window_set_decorations(window, (GdkWMDecoration) wmd);
-
- if (wasVisible)
-- gdk_window_show(mGdkWindow);
-+ gdk_window_show(window);
-
- // For some window managers, adding or removing window decorations
- // requires unmapping and remapping our toplevel window. Go ahead
-@@ -5123,10 +5066,19 @@ nsWindow::HideWindowChrome(bool aShouldH
- // error later when this happens (when the persistence timer fires
- // and GetWindowPos is called)
- #ifdef MOZ_X11
-- XSync(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()) , False);
--#else
-- gdk_flush ();
-+ if (mIsX11Display) {
-+ XSync(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()) , False);
-+ } else
- #endif /* MOZ_X11 */
-+ {
-+ gdk_flush ();
-+ }
-+}
-+
-+void
-+nsWindow::HideWindowChrome(bool aShouldHide)
-+{
-+ SetWindowDecoration(aShouldHide ? eBorderStyle_none : mBorderStyle);
- }
-
- bool
-@@ -5237,12 +5189,8 @@ is_mouse_in_window (GdkWindow* aWindow,
- window = gdk_window_get_parent(window);
- }
-
--#if (MOZ_WIDGET_GTK == 2)
-- gdk_drawable_get_size(aWindow, &w, &h);
--#else
- w = gdk_window_get_width(aWindow);
- h = gdk_window_get_height(aWindow);
--#endif
-
- if (aMouseX > x && aMouseX < x + w &&
- aMouseY > y && aMouseY < y + h)
-@@ -5498,18 +5446,6 @@ get_gtk_cursor(nsCursor aCursor)
-
- // gtk callbacks
-
--#if (MOZ_WIDGET_GTK == 2)
--static gboolean
--expose_event_cb(GtkWidget *widget, GdkEventExpose *event)
--{
-- RefPtr<nsWindow> window = get_window_for_gdk_window(event->window);
-- if (!window)
-- return FALSE;
--
-- window->OnExposeEvent(event);
-- return FALSE;
--}
--#else
- void
- draw_window_of_widget(GtkWidget *widget, GdkWindow *aWindow, cairo_t *cr)
- {
-@@ -5561,7 +5497,6 @@ expose_event_cb(GtkWidget *widget, cairo
-
- return FALSE;
- }
--#endif //MOZ_WIDGET_GTK == 2
-
- static gboolean
- configure_event_cb(GtkWidget *widget,
-@@ -5980,7 +5915,6 @@ widget_composited_changed_cb (GtkWidget*
- window->OnCompositedChanged();
- }
-
--#if (MOZ_WIDGET_GTK == 3)
- static void
- scale_changed_cb (GtkWidget* widget, GParamSpec* aPSpec, gpointer aPointer)
- {
-@@ -5996,7 +5930,6 @@ scale_changed_cb (GtkWidget* widget, GPa
- gtk_widget_get_allocation(widget, &allocation);
- window->OnSizeAllocate(&allocation);
- }
--#endif
-
- #if GTK_CHECK_VERSION(3,4,0)
- static gboolean
-@@ -6174,11 +6107,7 @@ get_inner_gdk_window (GdkWindow *aWindow
- child = g_list_previous(child)) {
- auto *childWindow = (GdkWindow *) child->data;
- if (get_window_for_gdk_window(childWindow)) {
--#if (MOZ_WIDGET_GTK == 2)
-- gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch, nullptr);
--#else
- gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch);
--#endif
- if ((cx < x) && (x < (cx + cw)) &&
- (cy < y) && (y < (cy + ch)) &&
- gdk_window_is_visible(childWindow)) {
-@@ -6386,53 +6315,6 @@ nsWindow::GetEditCommands(NativeKeyBindi
- keyBindings->GetEditCommands(aEvent, aCommands);
- }
-
--#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
--/* static */ already_AddRefed<DrawTarget>
--nsWindow::GetDrawTargetForGdkDrawable(GdkDrawable* aDrawable,
-- const IntSize& aSize)
--{
-- GdkVisual* visual = gdk_drawable_get_visual(aDrawable);
-- Screen* xScreen =
-- gdk_x11_screen_get_xscreen(gdk_drawable_get_screen(aDrawable));
-- Display* xDisplay = DisplayOfScreen(xScreen);
-- Drawable xDrawable = gdk_x11_drawable_get_xid(aDrawable);
--
-- RefPtr<gfxASurface> surface;
--
-- if (visual) {
-- Visual* xVisual = gdk_x11_visual_get_xvisual(visual);
--
-- surface = new gfxXlibSurface(xDisplay, xDrawable, xVisual, aSize);
-- } else {
-- // no visual? we must be using an xrender format. Find a format
-- // for this depth.
-- XRenderPictFormat *pf = nullptr;
-- switch (gdk_drawable_get_depth(aDrawable)) {
-- case 32:
-- pf = XRenderFindStandardFormat(xDisplay, PictStandardARGB32);
-- break;
-- case 24:
-- pf = XRenderFindStandardFormat(xDisplay, PictStandardRGB24);
-- break;
-- default:
-- NS_ERROR("Don't know how to handle the given depth!");
-- break;
-- }
--
-- surface = new gfxXlibSurface(xScreen, xDrawable, pf, aSize);
-- }
--
-- RefPtr<DrawTarget> dt =
-- gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surface, aSize);
--
-- if (!dt || !dt->IsValid()) {
-- return nullptr;
-- }
--
-- return dt.forget();
--}
--#endif
--
- already_AddRefed<DrawTarget>
- nsWindow::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode)
- {
-@@ -6649,9 +6531,66 @@ nsWindow::SetDrawsInTitlebar(bool aState
- return;
-
- if (mShell) {
-- gint wmd = aState ? GDK_DECOR_BORDER : ConvertBorderStyles(mBorderStyle);
-- gdk_window_set_decorations(gtk_widget_get_window(mShell),
-- (GdkWMDecoration) wmd);
-+ if (GetCSDSupportLevel() == CSD_SUPPORT_FULL) {
-+ SetWindowDecoration(aState ? eBorderStyle_border : mBorderStyle);
-+ }
-+ else {
-+ /* Window manager does not support GDK_DECOR_BORDER,
-+ * emulate it by CSD.
-+ *
-+ * gtk_window_set_titlebar() works on unrealized widgets only,
-+ * we need to handle mShell carefully here.
-+ * When CSD is enabled mGdkWindow is owned by mContainer which is good
-+ * as we can't delete our mGdkWindow. To make mShell unrealized while
-+ * mContainer is preserved we temporary reparent mContainer to an
-+ * invisible GtkWindow.
-+ */
-+ NativeShow(false);
-+
-+ // Using GTK_WINDOW_POPUP rather than
-+ // GTK_WINDOW_TOPLEVEL in the hope that POPUP results in less
-+ // initialization and window manager interaction.
-+ GtkWidget* tmpWindow = gtk_window_new(GTK_WINDOW_POPUP);
-+ gtk_widget_realize(tmpWindow);
-+
-+ gtk_widget_reparent(GTK_WIDGET(mContainer), tmpWindow);
-+ gtk_widget_unrealize(GTK_WIDGET(mShell));
-+
-+ // Available as of GTK 3.10+
-+ static auto sGtkWindowSetTitlebar = (void (*)(GtkWindow*, GtkWidget*))
-+ dlsym(RTLD_DEFAULT, "gtk_window_set_titlebar");
-+ MOZ_ASSERT(sGtkWindowSetTitlebar,
-+ "Missing gtk_window_set_titlebar(), old Gtk+ library?");
-+
-+ if (aState) {
-+ // Add a hidden titlebar widget to trigger CSD, but disable the default
-+ // titlebar. GtkFixed is a somewhat random choice for a simple unused
-+ // widget. gtk_window_set_titlebar() takes ownership of the titlebar
-+ // widget.
-+ sGtkWindowSetTitlebar(GTK_WINDOW(mShell), gtk_fixed_new());
-+ } else {
-+ sGtkWindowSetTitlebar(GTK_WINDOW(mShell), nullptr);
-+ }
-+
-+ /* A workaround for https://bugzilla.gnome.org/show_bug.cgi?id=791081
-+ * gtk_widget_realize() throws:
-+ * "In pixman_region32_init_rect: Invalid rectangle passed"
-+ * when mShell has default 1x1 size.
-+ */
-+ GtkAllocation allocation = {0, 0, 0, 0};
-+ gtk_widget_get_preferred_width(GTK_WIDGET(mShell), nullptr,
-+ &allocation.width);
-+ gtk_widget_get_preferred_height(GTK_WIDGET(mShell), nullptr,
-+ &allocation.height);
-+ gtk_widget_size_allocate(GTK_WIDGET(mShell), &allocation);
-+
-+ gtk_widget_realize(GTK_WIDGET(mShell));
-+ gtk_widget_reparent(GTK_WIDGET(mContainer), GTK_WIDGET(mShell));
-+ mNeedsShow = true;
-+ NativeResize();
-+
-+ gtk_widget_destroy(tmpWindow);
-+ }
- }
-
- mIsCSDEnabled = aState;
-@@ -6762,11 +6701,9 @@ nsWindow::SynthesizeNativeMouseEvent(Lay
- event.button.window = mGdkWindow;
- event.button.time = GDK_CURRENT_TIME;
-
--#if (MOZ_WIDGET_GTK == 3)
- // Get device for event source
- GdkDeviceManager *device_manager = gdk_display_get_device_manager(display);
- event.button.device = gdk_device_manager_get_client_pointer(device_manager);
--#endif
-
- event.button.x_root = DevicePixelsToGdkCoordRoundDown(aPoint.x);
- event.button.y_root = DevicePixelsToGdkCoordRoundDown(aPoint.y);
-@@ -6809,12 +6746,10 @@ nsWindow::SynthesizeNativeMouseScrollEve
- event.type = GDK_SCROLL;
- event.scroll.window = mGdkWindow;
- event.scroll.time = GDK_CURRENT_TIME;
--#if (MOZ_WIDGET_GTK == 3)
- // Get device for event source
- GdkDisplay* display = gdk_window_get_display(mGdkWindow);
- GdkDeviceManager *device_manager = gdk_display_get_device_manager(display);
- event.scroll.device = gdk_device_manager_get_client_pointer(device_manager);
--#endif
- event.scroll.x_root = DevicePixelsToGdkCoordRoundDown(aPoint.x);
- event.scroll.y_root = DevicePixelsToGdkCoordRoundDown(aPoint.y);
-
-@@ -6938,27 +6873,54 @@ nsWindow::GetCSDSupportLevel() {
- if (sCSDSupportLevel != CSD_SUPPORT_UNKNOWN) {
- return sCSDSupportLevel;
- }
-- // TODO: MATE
-+
- const char* currentDesktop = getenv("XDG_CURRENT_DESKTOP");
- if (currentDesktop) {
-- if (strcmp(currentDesktop, "GNOME") == 0) {
-- sCSDSupportLevel = CSD_SUPPORT_FULL;
-- } else if (strcmp(currentDesktop, "XFCE") == 0) {
-+ if (strstr(currentDesktop, "GNOME") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FULL;
-- } else if (strcmp(currentDesktop, "X-Cinnamon") == 0) {
-+ } else if (strstr(currentDesktop, "XFCE") != nullptr) {
-+ sCSDSupportLevel = CSD_SUPPORT_FLAT;
-+ } else if (strstr(currentDesktop, "X-Cinnamon") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FULL;
-- } else if (strcmp(currentDesktop, "KDE") == 0) {
-+ } else if (strstr(currentDesktop, "KDE") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
-- } else if (strcmp(currentDesktop, "LXDE") == 0) {
-+ } else if (strstr(currentDesktop, "LXDE") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
-- } else if (strcmp(currentDesktop, "openbox") == 0) {
-+ } else if (strstr(currentDesktop, "openbox") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_FLAT;
-- } else if (strcmp(currentDesktop, "i3") == 0) {
-+ } else if (strstr(currentDesktop, "i3") != nullptr) {
- sCSDSupportLevel = CSD_SUPPORT_NONE;
-+ } else if (strstr(currentDesktop, "MATE") != nullptr) {
-+ sCSDSupportLevel = CSD_SUPPORT_FLAT;
-+ } else if (strstr(currentDesktop, "Unity") != nullptr) {
-+ sCSDSupportLevel = CSD_SUPPORT_FLAT;
-+ } else if (strstr(currentDesktop, "Pantheon") != nullptr) {
-+ sCSDSupportLevel = CSD_SUPPORT_FULL;
- } else {
-+ sCSDSupportLevel = CSD_SUPPORT_FLAT;
-+ }
-+ } else {
-+ sCSDSupportLevel = CSD_SUPPORT_NONE;
-+ }
-+
-+ // We don't support CSD_SUPPORT_FULL on Wayland
-+ if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
-+ sCSDSupportLevel == CSD_SUPPORT_FULL) {
-+ sCSDSupportLevel = CSD_SUPPORT_FLAT;
-+ }
-+
-+ // Allow MOZ_GTK_TITLEBAR_DECORATION to override our heuristics
-+ const char* decorationOverride = getenv("MOZ_GTK_TITLEBAR_DECORATION");
-+ if (decorationOverride) {
-+ if (strcmp(decorationOverride, "none") == 0) {
- sCSDSupportLevel = CSD_SUPPORT_NONE;
-+ } else if (strcmp(decorationOverride, "client") == 0) {
-+ sCSDSupportLevel = CSD_SUPPORT_FLAT;
-+ } else if (strcmp(decorationOverride, "system") == 0) {
-+ sCSDSupportLevel = CSD_SUPPORT_FULL;
- }
- }
-+
- return sCSDSupportLevel;
- }
-
-@@ -6991,3 +6953,24 @@ nsWindow::IsComposited() const
- (gdk_window_get_visual(mGdkWindow)
- == gdk_screen_get_rgba_visual(gdkScreen));
- }
-+
-+#ifdef MOZ_WAYLAND
-+wl_display*
-+nsWindow::GetWaylandDisplay()
-+{
-+ // Available as of GTK 3.8+
-+ static auto sGdkWaylandDisplayGetWlDisplay =
-+ (wl_display *(*)(GdkDisplay *))
-+ dlsym(RTLD_DEFAULT, "gdk_wayland_display_get_wl_display");
-+
-+ GdkDisplay* gdkDisplay = gdk_display_get_default();
-+ return mIsX11Display ? nullptr :
-+ sGdkWaylandDisplayGetWlDisplay(gdkDisplay);
-+}
-+
-+wl_surface*
-+nsWindow::GetWaylandSurface()
-+{
-+ return moz_container_get_wl_surface(MOZ_CONTAINER(mContainer));
-+}
-+#endif
-diff -up firefox-58.0/widget/gtk/nsWindow.h.1399611 firefox-58.0/widget/gtk/nsWindow.h
---- firefox-58.0/widget/gtk/nsWindow.h.1399611 2018-01-11 21:17:06.000000000 +0100
-+++ firefox-58.0/widget/gtk/nsWindow.h 2018-01-24 10:57:03.720031943 +0100
-@@ -23,7 +23,11 @@
-
- #ifdef MOZ_X11
- #include <gdk/gdkx.h>
-+#include "X11UndefineNone.h"
- #endif /* MOZ_X11 */
-+#ifdef MOZ_WAYLAND
-+#include <gdk/gdkwayland.h>
-+#endif
-
- #include "mozilla/widget/WindowSurface.h"
- #include "mozilla/widget/WindowSurfaceProvider.h"
-@@ -172,11 +176,7 @@ public:
- GdkRectangle DevicePixelsToGdkRectRoundOut(LayoutDeviceIntRect aRect);
-
- // event callbacks
--#if (MOZ_WIDGET_GTK == 2)
-- gboolean OnExposeEvent(GdkEventExpose *aEvent);
--#else
- gboolean OnExposeEvent(cairo_t *cr);
--#endif
- gboolean OnConfigureEvent(GtkWidget *aWidget,
- GdkEventConfigure *aEvent);
- void OnContainerUnrealize();
-@@ -315,10 +315,6 @@ public:
- nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
- uint8_t* aAlphas, int32_t aStride);
-
--#if (MOZ_WIDGET_GTK == 2)
-- static already_AddRefed<DrawTarget> GetDrawTargetForGdkDrawable(GdkDrawable* aDrawable,
-- const mozilla::gfx::IntSize& aSize);
--#endif
- virtual void ReparentNativeWidget(nsIWidget* aNewParent) override;
-
- virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
-@@ -348,9 +344,14 @@ public:
- nsIObserver* aObserver) override;
- #endif
-
-+
- #ifdef MOZ_X11
- Display* XDisplay() { return mXDisplay; }
- #endif
-+#ifdef MOZ_WAYLAND
-+ wl_display* GetWaylandDisplay();
-+ wl_surface* GetWaylandSurface();
-+#endif
- virtual void GetCompositorWidgetInitData(mozilla::widget::CompositorWidgetInitData* aInitData) override;
-
- virtual nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
-@@ -374,6 +375,18 @@ public:
- virtual bool WidgetTypeSupportsAcceleration() override;
-
- bool DoDrawTitlebar() const;
-+
-+ typedef enum { CSD_SUPPORT_FULL, // CSD including shadows
-+ CSD_SUPPORT_FLAT, // CSD without shadows
-+ CSD_SUPPORT_NONE, // WM does not support CSD at all
-+ CSD_SUPPORT_UNKNOWN
-+ } CSDSupportLevel;
-+ /**
-+ * Get the support of Client Side Decoration by checking
-+ * the XDG_CURRENT_DESKTOP environment variable.
-+ */
-+ static CSDSupportLevel GetCSDSupportLevel();
-+
- protected:
- virtual ~nsWindow();
-
-@@ -423,6 +436,7 @@ private:
- nsWindow *GetContainerWindow();
- void SetUrgencyHint(GtkWidget *top_window, bool state);
- void SetDefaultIcon(void);
-+ void SetWindowDecoration(nsBorderStyle aStyle);
- void InitButtonEvent(mozilla::WidgetMouseEvent& aEvent,
- GdkEventButton* aGdkEvent);
- bool DispatchCommandEvent(nsAtom* aCommand);
-@@ -441,7 +455,6 @@ private:
- nsIWidgetListener* GetListener();
- bool IsComposited() const;
-
--
- GtkWidget *mShell;
- MozContainer *mContainer;
- GdkWindow *mGdkWindow;
-@@ -578,16 +591,6 @@ private:
- RefPtr<mozilla::widget::IMContextWrapper> mIMContext;
-
- mozilla::UniquePtr<mozilla::CurrentX11TimeGetter> mCurrentTimeGetter;
-- typedef enum { CSD_SUPPORT_FULL, // CSD including shadows
-- CSD_SUPPORT_FLAT, // CSD without shadows
-- CSD_SUPPORT_NONE, // WM does not support CSD at all
-- CSD_SUPPORT_UNKNOWN
-- } CSDSupportLevel;
-- /**
-- * Get the support of Client Side Decoration by checking
-- * the XDG_CURRENT_DESKTOP environment variable.
-- */
-- static CSDSupportLevel GetCSDSupportLevel();
- static CSDSupportLevel sCSDSupportLevel;
- };
-
diff --git a/mozilla-1416170.patch b/mozilla-1416170.patch
deleted file mode 100644
index 6f86f8e..0000000
--- a/mozilla-1416170.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-diff --git a/memory/build/Utils.h b/memory/build/Utils.h
---- a/memory/build/Utils.h
-+++ b/memory/build/Utils.h
-@@ -67,19 +67,19 @@ constexpr size_t operator"" _MiB(unsigne
- return size_t(aNum) * 1024_KiB;
- }
-
- constexpr size_t operator"" _MiB(long double aNum)
- {
- return size_t(aNum * 1024_KiB);
- }
-
--constexpr long double operator""_percent(long double aPercent)
-+constexpr double operator""_percent(long double aPercent)
- {
-- return aPercent / 100;
-+ return double(aPercent) / 100;
- }
-
- // Helper for (fast) comparison of fractions without involving divisions or
- // floats.
- class Fraction
- {
- public:
- explicit constexpr Fraction(size_t aNumerator, size_t aDenominator)
-diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp
---- a/memory/build/mozjemalloc.cpp
-+++ b/memory/build/mozjemalloc.cpp
-@@ -908,18 +908,18 @@ struct arena_bin_t
-
- // Offset of first region in a run for this bin's size class.
- uint32_t mRunFirstRegionOffset;
-
- // Current number of runs in this bin, full or otherwise.
- unsigned long mNumRuns;
-
- // Amount of overhead runs are allowed to have.
-- static constexpr long double kRunOverhead = 1.6_percent;
-- static constexpr long double kRunRelaxedOverhead = 2.4_percent;
-+ static constexpr double kRunOverhead = 1.6_percent;
-+ static constexpr double kRunRelaxedOverhead = 2.4_percent;
-
- // Initialize a bin for the given size class.
- // The generated run sizes, for a page size of 4 KiB, are:
- // size|run size|run size|run size|run
- // class|size class|size class|size class|size
- // 4 4 KiB 8 4 KiB 16 4 KiB 32 4 KiB
- // 48 4 KiB 64 4 KiB 80 4 KiB 96 4 KiB
- // 112 4 KiB 128 8 KiB 144 4 KiB 160 8 KiB
-
diff --git a/mozilla-1431052.patch b/mozilla-1431052.patch
new file mode 100644
index 0000000..59376bd
--- /dev/null
+++ b/mozilla-1431052.patch
@@ -0,0 +1,21 @@
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -6948,11 +6948,15 @@ nsWindow::GetWaylandDisplay()
+ GdkDisplay* gdkDisplay = gdk_display_get_default();
+ return mIsX11Display ? nullptr :
+ sGdkWaylandDisplayGetWlDisplay(gdkDisplay);
+ }
+
+ wl_surface*
+ nsWindow::GetWaylandSurface()
+ {
+- return moz_container_get_wl_surface(MOZ_CONTAINER(mContainer));
++ if (mContainer)
++ return moz_container_get_wl_surface(MOZ_CONTAINER(mContainer));
++
++ NS_WARNING("nsWindow::GetWaylandSurfaces(): We don't have any mContainer for drawing!");
++ return nullptr;
+ }
+ #endif
+
diff --git a/mozilla-1432414.patch b/mozilla-1432414.patch
new file mode 100644
index 0000000..818dbbd
--- /dev/null
+++ b/mozilla-1432414.patch
@@ -0,0 +1,58 @@
+diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
+--- a/widget/gtk/mozgtk/mozgtk.c
++++ b/widget/gtk/mozgtk/mozgtk.c
+@@ -224,16 +224,17 @@ STUB(gtk_file_chooser_set_preview_widget
+ STUB(gtk_file_chooser_set_preview_widget_active)
+ STUB(gtk_file_chooser_set_select_multiple)
+ STUB(gtk_file_chooser_widget_get_type)
+ STUB(gtk_file_filter_add_pattern)
+ STUB(gtk_file_filter_new)
+ STUB(gtk_file_filter_set_name)
+ STUB(gtk_fixed_new)
+ STUB(gtk_frame_new)
++STUB(gtk_get_current_event_time)
+ STUB(gtk_grab_add)
+ STUB(gtk_grab_remove)
+ STUB(gtk_handle_box_new)
+ STUB(gtk_hbox_new)
+ STUB(gtk_icon_info_free)
+ STUB(gtk_icon_info_load_icon)
+ STUB(gtk_icon_set_add_source)
+ STUB(gtk_icon_set_new)
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -1358,23 +1358,27 @@ SetUserTimeAndStartupIDForActivatedWindo
+ // we don't want to reuse the timestamp next time we raise the window
+ GTKToolkit->SetFocusTimestamp(0);
+ GTKToolkit->SetDesktopStartupID(EmptyCString());
+ }
+
+ /* static */ guint32
+ nsWindow::GetLastUserInputTime()
+ {
+- // gdk_x11_display_get_user_time tracks button and key presses,
+- // DESKTOP_STARTUP_ID used to start the app, drop events from external
+- // drags, WM_DELETE_WINDOW delete events, but not usually mouse motion nor
++ // gdk_x11_display_get_user_time/gtk_get_current_event_time tracks
++ // button and key presses, DESKTOP_STARTUP_ID used to start the app,
++ // drop events from external drags,
++ // WM_DELETE_WINDOW delete events, but not usually mouse motion nor
+ // button and key releases. Therefore use the most recent of
+ // gdk_x11_display_get_user_time and the last time that we have seen.
+- guint32 timestamp =
+- gdk_x11_display_get_user_time(gdk_display_get_default());
++ GdkDisplay* gdkDisplay = gdk_display_get_default();
++ guint32 timestamp = GDK_IS_X11_DISPLAY(gdkDisplay) ?
++ gdk_x11_display_get_user_time(gdkDisplay) :
++ gtk_get_current_event_time();
++
+ if (sLastUserInputTime != GDK_CURRENT_TIME &&
+ TimestampIsNewerThan(sLastUserInputTime, timestamp)) {
+ return sLastUserInputTime;
+ }
+
+ return timestamp;
+ }
+
+
diff --git a/mozilla-1433081.patch b/mozilla-1433081.patch
new file mode 100644
index 0000000..6677ff0
--- /dev/null
+++ b/mozilla-1433081.patch
@@ -0,0 +1,51 @@
+diff --git a/gfx/gl/GLContextProvider.h b/gfx/gl/GLContextProvider.h
+--- a/gfx/gl/GLContextProvider.h
++++ b/gfx/gl/GLContextProvider.h
+@@ -21,16 +21,18 @@ namespace gl {
+
+ #define IN_GL_CONTEXT_PROVIDER_H
+
+ // Null is always there
+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderNull
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+
++#if !defined(MOZ_GL_PROVIDER)
++
+ #ifdef XP_WIN
+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderWGL
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWGL
+ #define DEFAULT_IMPL WGL
+ #endif
+
+@@ -59,23 +61,27 @@ namespace gl {
+ #define GL_CONTEXT_PROVIDER_NAME GLContextProviderEAGL
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+ #ifndef GL_CONTEXT_PROVIDER_DEFAULT
+ #define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEAGL
+ #endif
+ #endif
+
++#else //defined(MOZ_GL_PROVIDER)
++
+ #ifdef MOZ_GL_PROVIDER
+ #define GL_CONTEXT_PROVIDER_NAME MOZ_GL_PROVIDER
+ #include "GLContextProviderImpl.h"
+ #undef GL_CONTEXT_PROVIDER_NAME
+ #define GL_CONTEXT_PROVIDER_DEFAULT MOZ_GL_PROVIDER
+ #endif
+
++#endif
++
+ #ifdef GL_CONTEXT_PROVIDER_DEFAULT
+ typedef GL_CONTEXT_PROVIDER_DEFAULT GLContextProvider;
+ #else
+ typedef GLContextProviderNull GLContextProvider;
+ #endif
+
+ #undef IN_GL_CONTEXT_PROVIDER_H
+
+
diff --git a/mozilla-1434202.patch b/mozilla-1434202.patch
new file mode 100644
index 0000000..d91f55e
--- /dev/null
+++ b/mozilla-1434202.patch
@@ -0,0 +1,25 @@
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -3785,16 +3785,20 @@ nsWindow::Create(nsIWidget* aParent,
+ SetCursor(eCursor_standard);
+
+ if (aInitData->mNoAutoHide) {
+ gint wmd = ConvertBorderStyles(mBorderStyle);
+ if (wmd != -1)
+ gdk_window_set_decorations(mGdkWindow, (GdkWMDecoration) wmd);
+ }
+
++ if (!mIsX11Display) {
++ gtk_widget_set_app_paintable(mShell, TRUE);
++ }
++
+ // If the popup ignores mouse events, set an empty input shape.
+ if (aInitData->mMouseTransparent) {
+ cairo_rectangle_int_t rect = { 0, 0, 0, 0 };
+ cairo_region_t *region = cairo_region_create_rectangle(&rect);
+
+ gdk_window_input_shape_combine_region(mGdkWindow, region, 0, 0);
+ cairo_region_destroy(region);
+ }
+
diff --git a/mozilla-1434565.patch b/mozilla-1434565.patch
new file mode 100644
index 0000000..bb42348
--- /dev/null
+++ b/mozilla-1434565.patch
@@ -0,0 +1,16 @@
+diff -up mozilla-beta-64737c752ac4af4766ad6f82720818521f3aca24/toolkit/components/remote/nsDBusRemoteService.cpp.1434565 mozilla-beta-64737c752ac4af4766ad6f82720818521f3aca24/toolkit/components/remote/nsDBusRemoteService.cpp
+--- mozilla-beta-64737c752ac4af4766ad6f82720818521f3aca24/toolkit/components/remote/nsDBusRemoteService.cpp.1434565 2018-02-01 14:14:38.902873024 +0100
++++ mozilla-beta-64737c752ac4af4766ad6f82720818521f3aca24/toolkit/components/remote/nsDBusRemoteService.cpp 2018-02-01 14:18:02.906281711 +0100
+@@ -89,7 +89,11 @@ nsDBusRemoteService::OpenURL(DBusMessage
+ errorMsg = nsPrintfCString("org.mozilla.%s.Error", mAppName.get());
+ reply = dbus_message_new_error(msg, errorMsg.get(), "Wrong argument");
+ } else {
+- nsRemoteService::HandleCommandLine(commandLine, nullptr, 0);
++ guint32 timestamp = gtk_get_current_event_time();
++ if (timestamp == GDK_CURRENT_TIME) {
++ timestamp = guint32(g_get_monotonic_time() / 1000);
++ }
++ nsRemoteService::HandleCommandLine(commandLine, nullptr, timestamp);
+ reply = dbus_message_new_method_return(msg);
+ }
+
diff --git a/mozilla-1434572.patch b/mozilla-1434572.patch
new file mode 100644
index 0000000..835c76f
--- /dev/null
+++ b/mozilla-1434572.patch
@@ -0,0 +1,93 @@
+diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
+--- a/widget/gtk/mozgtk/mozgtk.c
++++ b/widget/gtk/mozgtk/mozgtk.c
+@@ -66,16 +66,17 @@ STUB(gdk_screen_get_number)
+ STUB(gdk_screen_get_resolution)
+ STUB(gdk_screen_get_rgba_visual)
+ STUB(gdk_screen_get_root_window)
+ STUB(gdk_screen_get_system_visual)
+ STUB(gdk_screen_get_width)
+ STUB(gdk_screen_height)
+ STUB(gdk_screen_is_composited)
+ STUB(gdk_screen_width)
++STUB(gdk_selection_owner_get)
+ STUB(gdk_set_program_class)
+ STUB(gdk_unicode_to_keyval)
+ STUB(gdk_visual_get_depth)
+ STUB(gdk_visual_get_system)
+ STUB(gdk_window_add_filter)
+ STUB(gdk_window_begin_move_drag)
+ STUB(gdk_window_begin_resize_drag)
+ STUB(gdk_window_destroy)
+diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp
+--- a/widget/gtk/nsClipboardWayland.cpp
++++ b/widget/gtk/nsClipboardWayland.cpp
+@@ -337,21 +346,68 @@ nsRetrievalContextWayland::GetTargets(in
+ for (int32_t j = 0; j < length; j++) {
+ targetList[j] = mTargetMIMETypes[j];
+ }
+
+ *aTargetNum = length;
+ return targetList;
+ }
+
++struct fastTrackClipboardData
++{
++ char* data;
++ int dataLength;
++};
++
++static void
++wayland_clipboard_contents_received(GtkClipboard *clipboard,
++ GtkSelectionData *selection_data,
++ gpointer data)
++{
++ fastTrackClipboardData* clipboardData =
++ static_cast<fastTrackClipboardData*>(data);
++
++ int contentLength = gtk_selection_data_get_length(selection_data);
++ if (contentLength > 0) {
++ clipboardData->data = reinterpret_cast<char*>(
++ g_malloc(sizeof(char)*contentLength));
++ memcpy(clipboardData->data,
++ gtk_selection_data_get_data(selection_data),
++ sizeof(char)*contentLength);
++ }
++
++ clipboardData->dataLength = contentLength;
++}
++
+ const char*
+ nsRetrievalContextWayland::GetClipboardData(const char* aMimeType,
+ int32_t aWhichClipboard,
+ uint32_t* aContentLength)
+ {
++ /* If actual clipboard data is owned by us we don't need to go
++ * through Wayland but we ask Gtk+ to directly call data
++ * getter callback nsClipboard::SelectionGetEvent().
++ */
++ GdkAtom selection = GetSelectionAtom(aWhichClipboard);
++ if (gdk_selection_owner_get(selection)) {
++ fastTrackClipboardData clipboardData = { nullptr, 0 };
++ gtk_clipboard_request_contents(gtk_clipboard_get(selection),
++ gdk_atom_intern(aMimeType, FALSE),
++ wayland_clipboard_contents_received,
++ &clipboardData);
++ *aContentLength = clipboardData.dataLength;
++ return static_cast<const char*>(clipboardData.data);
++ }
++
++ /* TODO: We need to implement GDK_SELECTION_PRIMARY (X11 text selection)
++ * for Wayland backend.
++ */
++ if (selection == GDK_SELECTION_PRIMARY)
++ return nullptr;
++
+ NS_ASSERTION(mDataOffer, "Requested data without valid data offer!");
+
+ if (!mDataOffer) {
+ // TODO
+ // Something went wrong. We're requested to provide clipboard data
+ // but we haven't got any from wayland. Looks like rhbz#1455915.
+ return nullptr;
+ }
diff --git a/queue-crash.patch b/queue-crash.patch
new file mode 100644
index 0000000..962fce9
--- /dev/null
+++ b/queue-crash.patch
@@ -0,0 +1,26 @@
+diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp
+--- a/widget/gtk/WindowSurfaceWayland.cpp
++++ b/widget/gtk/WindowSurfaceWayland.cpp
+@@ -268,17 +268,21 @@ nsWaylandDisplay::GetShm()
+
+ if (!mShm) {
+ // wl_shm is not provided by Gtk so we need to query wayland directly
+ // See weston/simple-shm.c and create_display() for reference.
+ wl_registry* registry = wl_display_get_registry(mDisplay);
+ wl_registry_add_listener(registry, &registry_listener, this);
+
+ wl_proxy_set_queue((struct wl_proxy *)registry, mEventQueue);
+- wl_display_roundtrip_queue(mDisplay, mEventQueue);
++ if (mEventQueue) {
++ wl_display_roundtrip_queue(mDisplay, mEventQueue);
++ } else {
++ wl_display_roundtrip(mDisplay);
++ }
+
+ MOZ_RELEASE_ASSERT(mShm, "Wayland registry query failed!");
+ }
+
+ return(mShm);
+ }
+
+ bool
diff --git a/remote-profile.patch b/remote-profile.patch
new file mode 100644
index 0000000..919f735
--- /dev/null
+++ b/remote-profile.patch
@@ -0,0 +1,19 @@
+diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
+index 386213efebb4..990ba32acbd4 100644
+--- a/toolkit/xre/nsAppRunner.cpp
++++ b/toolkit/xre/nsAppRunner.cpp
+@@ -3995,6 +3995,14 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
+ }
+ }
+
++ if (!profile) {
++#ifdef MOZ_DEV_EDITION
++ profile = "dev-edition-default";
++#else
++ profile = "default";
++#endif
++ }
++
+ nsCOMPtr<nsIFile> mutexDir;
+ rv = GetSpecialSystemDirectory(OS_TemporaryDirectory, getter_AddRefs(mutexDir));
+ if (NS_SUCCEEDED(rv)) {
diff --git a/sources b/sources
index 645390a..fdcd654 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (firefox-58.0.2.source.tar.xz) = ff748780492fc66b3e44c7e7641f16206e4c09514224c62d37efac2c59877bdf428a3670bfb50407166d7b505d4e2ea020626fd776b87f6abb6bc5d2e54c773f
-SHA512 (firefox-langpacks-58.0.2-20180214.tar.xz) = 9c972daaab84915dce22257b99ba1210e97862f6ba7cc71a30de837e6701b2039022e98e3c9d452d16003986066d62ad2ce3392e33554dc85c195dccbe471ad0
+SHA512 (2f6a4d2cf42c9d59626061d45c043817cb220814.tar.bz2) = 78d7e6da9062cdf0883097fa5bbad7c7db3f9b28dae9413e1ed880f34bb9fbfd9b2524b2c25fbca55bcf796b5023c42131758bf5bdee6c404e572bc751287215
+SHA512 (firefox-langpacks-59.0-20180306.tar.xz) = 7eda70eca83679581ef3e015e066f9d1a338bf7aab54f3f851a04d68d3155190d5e03cafca1f9716ff33648d78fec74ec07c2041a9a81c7aed5f8649ca367712
bgstack15