diff --git a/.firefox.metadata b/.firefox.metadata
index 0fab77b..386e8c1 100644
--- a/.firefox.metadata
+++ b/.firefox.metadata
@@ -1,7 +1,7 @@
 18a8f30a0356c751b8d0ea6f76e764cab13ee046 SOURCES/Python-2.7.13.tar.xz
 e86c38c48960b95353503b78e1de9ddca1ed34d7 SOURCES/cbindgen-vendor.tar.xz
-220c262c5cb2ee81d29c58a5afe4522c9880cf2b SOURCES/firefox-68.3.0esr.source.tar.xz
-e4958412ffa347f9de0315e54d6596461169f029 SOURCES/firefox-langpacks-68.3.0esr-20191127.tar.xz
+ee6406ec1280afc24d4a90c392ff09ff5060686e SOURCES/firefox-68.9.0esr.source.tar.xz
+cbb1c23ae26fc81578036403dbceef7cd10fc98b SOURCES/firefox-langpacks-68.9.0esr-20200529.tar.xz
 6724218efbb1f3fa14541cb2f255970b98446a45 SOURCES/firefox-symbolic.svg
 0de63f863b158454b9429234b52ed28a397ec45c SOURCES/gtk3-private-3.22.26-1.el6.src.rpm
 e188ab1a444697bc649e223c28389d82ca94c472 SOURCES/libffi-3.0.13-18.el7_3.src.rpm
diff --git a/.gitignore b/.gitignore
index bc20190..32b932d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
 SOURCES/Python-2.7.13.tar.xz
 SOURCES/cbindgen-vendor.tar.xz
-SOURCES/firefox-68.3.0esr.source.tar.xz
-SOURCES/firefox-langpacks-68.3.0esr-20191127.tar.xz
+SOURCES/firefox-68.9.0esr.source.tar.xz
+SOURCES/firefox-langpacks-68.9.0esr-20200529.tar.xz
 SOURCES/firefox-symbolic.svg
 SOURCES/gtk3-private-3.22.26-1.el6.src.rpm
 SOURCES/libffi-3.0.13-18.el7_3.src.rpm
diff --git a/README.debrand b/README.debrand
deleted file mode 100644
index 01c46d2..0000000
--- a/README.debrand
+++ /dev/null
@@ -1,2 +0,0 @@
-Warning: This package was configured for automatic debranding, but the changes
-failed to apply.
diff --git a/SOURCES/build-aarch64-skia.patch b/SOURCES/build-aarch64-skia.patch
deleted file mode 100644
index 1ecad24..0000000
--- a/SOURCES/build-aarch64-skia.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp.aarch64-skia firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp
---- firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp.aarch64-skia	2018-06-20 09:19:11.411939714 +0200
-+++ firefox-61.0/gfx/skia/skia/src/jumper/SkJumper_stages.cpp	2018-06-20 09:23:36.831919894 +0200
-@@ -686,7 +686,7 @@ SI F from_half(U16 h) {
- }
- 
- SI U16 to_half(F f) {
--#if defined(JUMPER_IS_NEON) && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3)  // Temporary workaround for some Google3 builds.
-+#if 0 && defined(__aarch64__) && !defined(SK_BUILD_FOR_GOOGLE3)  // Temporary workaround for some Google3 builds.
-     return vcvt_f16_f32(f);
- 
- #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
diff --git a/SOURCES/build-big-endian.patch b/SOURCES/build-big-endian.patch
deleted file mode 100644
index e8ec439..0000000
--- a/SOURCES/build-big-endian.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-diff -up firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h.big-endian firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h
---- firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h.big-endian	2018-04-09 22:50:48.000000000 +0200
-+++ firefox-60.0/gfx/skia/skia/include/core/SkColorPriv.h	2018-04-18 11:51:38.748680174 +0200
-@@ -54,18 +54,19 @@ static inline U8CPU SkUnitScalarClampToB
-  *
-  *  Here we enforce this constraint.
-  */
--
-+/*
- #ifdef SK_CPU_BENDIAN
-     #define SK_RGBA_R32_SHIFT   24
-     #define SK_RGBA_G32_SHIFT   16
-     #define SK_RGBA_B32_SHIFT   8
-     #define SK_RGBA_A32_SHIFT   0
- #else
-+*/
-     #define SK_RGBA_R32_SHIFT   0
-     #define SK_RGBA_G32_SHIFT   8
-     #define SK_RGBA_B32_SHIFT   16
-     #define SK_RGBA_A32_SHIFT   24
--#endif
-+/*#endif*/
- 
- #define SkGetPackedA32(packed)      ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24)
- #define SkGetPackedR32(packed)      ((uint32_t)((packed) << (24 - SK_R32_SHIFT)) >> 24)
-diff -up firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h.big-endian firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h
---- firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h.big-endian	2018-04-09 22:50:48.000000000 +0200
-+++ firefox-60.0/gfx/skia/skia/include/core/SkImageInfo.h	2018-04-18 11:51:38.748680174 +0200
-@@ -84,7 +84,8 @@ enum SkColorType {
- #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
-     kN32_SkColorType = kRGBA_8888_SkColorType,
- #else
--    #error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order"
-+    //#error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order"
-+    kN32_SkColorType = kBGRA_8888_SkColorType
- #endif
- };
- 
-diff -up firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h.big-endian firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h
---- firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h.big-endian	2018-04-09 22:50:48.000000000 +0200
-+++ firefox-60.0/gfx/skia/skia/include/gpu/GrTypes.h	2018-04-18 11:51:38.748680174 +0200
-@@ -344,15 +344,13 @@ enum GrPixelConfig {
- static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
- 
- // Aliases for pixel configs that match skia's byte order.
--#ifndef SK_CPU_LENDIAN
--    #error "Skia gpu currently assumes little endian"
--#endif
- #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
-     static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
- #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
-     static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig;
- #else
--    #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
-+    static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
-+    static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSBGRA_8888_GrPixelConfig;
- #endif
- 
- /**
-diff -up firefox-60.0/gfx/skia/skia/src/core/SkColorData.h.big-endian firefox-60.0/gfx/skia/skia/src/core/SkColorData.h
---- firefox-60.0/gfx/skia/skia/src/core/SkColorData.h.big-endian	2018-04-18 13:42:06.980476156 +0200
-+++ firefox-60.0/gfx/skia/skia/src/core/SkColorData.h	2018-04-18 13:42:50.493520552 +0200
-@@ -31,18 +31,19 @@
-  *
-  *  Here we enforce this constraint.
-  */
--
-+/*
- #ifdef SK_CPU_BENDIAN
-     #define SK_BGRA_B32_SHIFT   24
-     #define SK_BGRA_G32_SHIFT   16
-     #define SK_BGRA_R32_SHIFT   8
-     #define SK_BGRA_A32_SHIFT   0
- #else
-+*/
-     #define SK_BGRA_B32_SHIFT   0
-     #define SK_BGRA_G32_SHIFT   8
-     #define SK_BGRA_R32_SHIFT   16
-     #define SK_BGRA_A32_SHIFT   24
--#endif
-+//#endif
- 
- #if defined(SK_PMCOLOR_IS_RGBA) && defined(SK_PMCOLOR_IS_BGRA)
-     #error "can't define PMCOLOR to be RGBA and BGRA"
diff --git a/SOURCES/build-disable-elfhack.patch b/SOURCES/build-disable-elfhack.patch
deleted file mode 100644
index 1db9bdf..0000000
--- a/SOURCES/build-disable-elfhack.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-60.4.0/toolkit/moz.configure.disable-elfhack firefox-60.4.0/toolkit/moz.configure
---- firefox-60.4.0/toolkit/moz.configure.disable-elfhack	2019-01-03 14:47:00.566556623 +0100
-+++ firefox-60.4.0/toolkit/moz.configure	2019-01-03 14:49:14.243887620 +0100
-@@ -1192,7 +1192,7 @@ with only_when(has_elfhack):
-     option('--disable-elf-hack', help='Disable elf hacks')
- 
-     set_config('USE_ELF_HACK',
--               depends_if('--enable-elf-hack')(lambda _: True))
-+               depends_if('--enable-elf-hack')(lambda _: False))
- 
- 
- @depends(check_build_environment)
diff --git a/SOURCES/build-gdk-version.patch b/SOURCES/build-gdk-version.patch
deleted file mode 100644
index a25b255..0000000
--- a/SOURCES/build-gdk-version.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -up mozilla-release-c61f5f5ead48c78a80c80db5c489bdc7cfaf8175/old-configure.in.gdk-version mozilla-release-c61f5f5ead48c78a80c80db5c489bdc7cfaf8175/old-configure.in
---- mozilla-release-c61f5f5ead48c78a80c80db5c489bdc7cfaf8175/old-configure.in.gdk-version	2018-03-10 03:54:17.000000000 +0100
-+++ mozilla-release-c61f5f5ead48c78a80c80db5c489bdc7cfaf8175/old-configure.in	2018-03-28 13:11:06.294873487 +0200
-@@ -61,6 +61,7 @@ CAIRO_VERSION=1.10
- GTK2_VERSION=2.18.0
- GTK3_VERSION=3.4.0
- GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
-+GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4
- WINDRES_VERSION=2.14.90
- W32API_VERSION=3.14
- GCONF_VERSION=1.2.1
-@@ -2173,6 +2174,7 @@ if test "$COMPILE_ENVIRONMENT"; then
-     dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
-     dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
-     AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
-+    AC_DEFINE_UNQUOTED(GDK_VERSION_MIN_REQUIRED,$GDK_VERSION_MIN_REQUIRED)
-     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
-   fi
-   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
diff --git a/SOURCES/build-icu-make.patch b/SOURCES/build-icu-make.patch
new file mode 100644
index 0000000..6a04091
--- /dev/null
+++ b/SOURCES/build-icu-make.patch
@@ -0,0 +1,13 @@
+diff -up firefox-68.8.0/intl/icu_sources_data.py.icu-makefile firefox-68.8.0/intl/icu_sources_data.py
+--- firefox-68.8.0/intl/icu_sources_data.py.icu-makefile	2020-05-11 17:00:03.642605718 +0200
++++ firefox-68.8.0/intl/icu_sources_data.py	2020-05-11 17:00:37.774642749 +0200
+@@ -246,8 +246,7 @@ def update_data_file(topsrcdir):
+     if not try_run(
+             'icu-make',
+             ['make',
+-             '--jobs=%d' % multiprocessing.cpu_count(),
+-             '--output-sync'],
++             '--jobs=1'],
+             cwd=objdir):
+         return False
+     print('Copying ICU data file...')
diff --git a/SOURCES/build-jit-atomic-always-lucky.patch b/SOURCES/build-jit-atomic-always-lucky.patch
deleted file mode 100644
index ab99524..0000000
--- a/SOURCES/build-jit-atomic-always-lucky.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky firefox-60.5.0/js/src/jit/AtomicOperations.h
---- firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky	2019-01-22 10:20:27.993697161 +0100
-+++ firefox-60.5.0/js/src/jit/AtomicOperations.h	2019-01-22 10:23:15.337873762 +0100
-@@ -394,7 +394,7 @@ inline bool AtomicOperations::isLockfree
- #elif defined(__s390__) || defined(__s390x__)
- #include "jit/none/AtomicOperations-feeling-lucky.h"
- #else
--#error "No AtomicOperations support provided for this platform"
-+#include "jit/none/AtomicOperations-feeling-lucky.h"
- #endif
- 
- #endif  // jit_AtomicOperations_h
diff --git a/SOURCES/build-nss-version.patch b/SOURCES/build-nss-version.patch
index 680961d..7847090 100644
--- a/SOURCES/build-nss-version.patch
+++ b/SOURCES/build-nss-version.patch
@@ -5,7 +5,7 @@ diff -up firefox-68.3.0/old-configure.in.nss-version firefox-68.3.0/old-configur
      _USE_SYSTEM_NSS=1 )
  
  if test -n "$_USE_SYSTEM_NSS"; then
--    AM_PATH_NSS(3.44.3, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
+-    AM_PATH_NSS(3.44.4, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
 +    AM_PATH_NSS(3.44.0, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
  fi
  
diff --git a/SOURCES/firefox-pipewire-0-3.patch b/SOURCES/firefox-pipewire-0-3.patch
new file mode 100644
index 0000000..7aa06b9
--- /dev/null
+++ b/SOURCES/firefox-pipewire-0-3.patch
@@ -0,0 +1,821 @@
+diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
+index 2081d0c683a4..641133bf1ea4 100644
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -314,6 +314,7 @@ system_headers = [
+     'Gestalt.h',
+     'getopt.h',
+     'gio/gio.h',
++    'gio/gunixfdlist.h',
+     'glibconfig.h',
+     'glib.h',
+     'glib-object.h',
+@@ -607,6 +608,7 @@ system_headers = [
+     'Pgenerr.h',
+     'PGenErr.h',
+     'Ph.h',
++    'pipewire/pipewire.h',
+     'pixman.h',
+     'pk11func.h',
+     'pk11pqg.h',
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
+index 90b40431c7e4..d844aa79d591 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
+@@ -194,6 +194,30 @@ if CONFIG["OS_TARGET"] == "Linux":
+         "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc"
+     ]
+ 
++# PipeWire specific files
++if CONFIG["OS_TARGET"] == "Linux":
++
++    DEFINES["WEBRTC_USE_PIPEWIRE"] = "1"
++
++    OS_LIBS += [
++        "rt",
++        "pipewire-0.3",
++        "glib-2.0",
++        "gio-2.0",
++        "gobject-2.0"
++    ]
++
++    CXXFLAGS += CONFIG['TK_CFLAGS']
++    CXXFLAGS += [ "-I/usr/include/pipewire-0.3" ]
++    CXXFLAGS += [ "-I/usr/include/spa-0.2" ]
++
++    UNIFIED_SOURCES += [
++        "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc",
++        "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc",
++        "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc"
++    ]
++
++
+ if CONFIG["OS_TARGET"] == "NetBSD":
+ 
+     DEFINES["USE_X11"] = "1"
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
+index 1eb8ead26efa..316468eed1fc 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
+@@ -141,7 +141,7 @@ class DesktopCaptureOptions {
+   bool disable_effects_ = true;
+   bool detect_updated_region_ = false;
+ #if defined(WEBRTC_USE_PIPEWIRE)
+-  bool allow_pipewire_ = false;
++  bool allow_pipewire_ = true;
+ #endif
+ };
+ 
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
+index 379341c833de..53e2683df2e8 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
+@@ -15,8 +15,11 @@
+ 
+ #include <spa/param/format-utils.h>
+ #include <spa/param/props.h>
+-#include <spa/param/video/raw-utils.h>
+-#include <spa/support/type-map.h>
++
++#include <linux/dma-buf.h>
++#include <sys/mman.h>
++#include <sys/ioctl.h>
++#include <sys/syscall.h>
+ 
+ #include <memory>
+ #include <utility>
+@@ -36,31 +39,36 @@ const char kSessionInterfaceName[] = "org.freedesktop.portal.Session";
+ const char kRequestInterfaceName[] = "org.freedesktop.portal.Request";
+ const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast";
+ 
+-// static
+-void BaseCapturerPipeWire::OnStateChanged(void* data,
+-                                          pw_remote_state old_state,
+-                                          pw_remote_state state,
+-                                          const char* error_message) {
+-  BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
+-  RTC_DCHECK(that);
+ 
+-  switch (state) {
+-    case PW_REMOTE_STATE_ERROR:
+-      RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message;
+-      break;
+-    case PW_REMOTE_STATE_CONNECTED:
+-      RTC_LOG(LS_INFO) << "PipeWire remote state: connected.";
+-      that->CreateReceivingStream();
+-      break;
+-    case PW_REMOTE_STATE_CONNECTING:
+-      RTC_LOG(LS_INFO) << "PipeWire remote state: connecting.";
++// static
++void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) {
++  struct dma_buf_sync sync = { 0 };
++
++  sync.flags = start_or_end | DMA_BUF_SYNC_READ;
++
++  while(true) {
++    int ret;
++    ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync);
++    if (ret == -1 && errno == EINTR) {
++      continue;
++    } else if (ret == -1) {
++      RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno);
+       break;
+-    case PW_REMOTE_STATE_UNCONNECTED:
+-      RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected.";
++    } else {
+       break;
++    }
+   }
+ }
+ 
++// static
++void BaseCapturerPipeWire::OnCoreError(void *data,
++                                       uint32_t id,
++                                       int seq,
++                                       int res,
++                                       const char *message) {
++  RTC_LOG(LS_ERROR) << "core error: " << message;
++}
++
+ // static
+ void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
+                                                 pw_stream_state old_state,
+@@ -73,76 +81,54 @@ void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
+     case PW_STREAM_STATE_ERROR:
+       RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
+       break;
+-    case PW_STREAM_STATE_CONFIGURE:
+-      pw_stream_set_active(that->pw_stream_, true);
+-      break;
+-    case PW_STREAM_STATE_UNCONNECTED:
+-    case PW_STREAM_STATE_CONNECTING:
+-    case PW_STREAM_STATE_READY:
+     case PW_STREAM_STATE_PAUSED:
+     case PW_STREAM_STATE_STREAMING:
++    case PW_STREAM_STATE_UNCONNECTED:
++    case PW_STREAM_STATE_CONNECTING:
+       break;
+   }
+ }
+ 
+ // static
+-void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
+-                                                 const struct spa_pod* format) {
++void BaseCapturerPipeWire::OnStreamParamChanged(void *data, uint32_t id,
++                                                const struct spa_pod *format) {
+   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
+   RTC_DCHECK(that);
+ 
+-  RTC_LOG(LS_INFO) << "PipeWire stream format changed.";
++  RTC_LOG(LS_INFO) << "PipeWire stream param changed.";
+ 
+-  if (!format) {
+-    pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr,
+-                            /*n_params=*/0);
++  if (!format || id != SPA_PARAM_Format) {
+     return;
+   }
+ 
+-  that->spa_video_format_ = new spa_video_info_raw();
+-  spa_format_video_raw_parse(format, that->spa_video_format_,
+-                             &that->pw_type_->format_video);
++  spa_format_video_raw_parse(format, &that->spa_video_format_);
+ 
+-  auto width = that->spa_video_format_->size.width;
+-  auto height = that->spa_video_format_->size.height;
++  auto width = that->spa_video_format_.size.width;
++  auto height = that->spa_video_format_.size.height;
+   auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4);
+   auto size = height * stride;
+ 
++  that->desktop_size_ = DesktopSize(width, height);
++
+   uint8_t buffer[1024] = {};
+   auto builder = spa_pod_builder{buffer, sizeof(buffer)};
+ 
+   // Setup buffers and meta header for new format.
+-  const struct spa_pod* params[2];
+-  params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
+-      &builder,
+-      // id to enumerate buffer requirements
+-      that->pw_core_type_->param.idBuffers,
+-      that->pw_core_type_->param_buffers.Buffers,
+-      // Size: specified as integer (i) and set to specified size
+-      ":", that->pw_core_type_->param_buffers.size, "i", size,
+-      // Stride: specified as integer (i) and set to specified stride
+-      ":", that->pw_core_type_->param_buffers.stride, "i", stride,
+-      // Buffers: specifies how many buffers we want to deal with, set as
+-      // integer (i) where preferred number is 8, then allowed number is defined
+-      // as range (r) from min and max values and it is undecided (u) to allow
+-      // negotiation
+-      ":", that->pw_core_type_->param_buffers.buffers, "iru", 8,
+-      SPA_POD_PROP_MIN_MAX(1, 32),
+-      // Align: memory alignment of the buffer, set as integer (i) to specified
+-      // value
+-      ":", that->pw_core_type_->param_buffers.align, "i", 16));
+-  params[1] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
+-      &builder,
+-      // id to enumerate supported metadata
+-      that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta,
+-      // Type: specified as id or enum (I)
+-      ":", that->pw_core_type_->param_meta.type, "I",
+-      that->pw_core_type_->meta.Header,
+-      // Size: size of the metadata, specified as integer (i)
+-      ":", that->pw_core_type_->param_meta.size, "i",
+-      sizeof(struct spa_meta_header)));
+-
+-  pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2);
++  const struct spa_pod* params[3];
++  params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
++              SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
++              SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
++              SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
++              SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32)));
++  params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
++              SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
++              SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
++              SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))));
++  params[2] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
++              SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
++              SPA_PARAM_META_type, SPA_POD_Id (SPA_META_VideoCrop),
++              SPA_PARAM_META_size, SPA_POD_Int (sizeof(struct spa_meta_region))));
++  pw_stream_update_params(that->pw_stream_, params, 3);
+ }
+ 
+ // static
+@@ -150,15 +136,25 @@ void BaseCapturerPipeWire::OnStreamProcess(void* data) {
+   BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
+   RTC_DCHECK(that);
+ 
+-  pw_buffer* buf = nullptr;
++  struct pw_buffer *next_buffer;
++  struct pw_buffer *buffer = nullptr;
+ 
+-  if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) {
++  next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
++  while (next_buffer) {
++    buffer = next_buffer;
++    next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
++
++    if (next_buffer)
++      pw_stream_queue_buffer (that->pw_stream_, buffer);
++  }
++
++  if (!buffer) {
+     return;
+   }
+ 
+-  that->HandleBuffer(buf);
++  that->HandleBuffer(buffer);
+ 
+-  pw_stream_queue_buffer(that->pw_stream_, buf);
++  pw_stream_queue_buffer(that->pw_stream_, buffer);
+ }
+ 
+ BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type)
+@@ -169,38 +165,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeWire() {
+     pw_thread_loop_stop(pw_main_loop_);
+   }
+ 
+-  if (pw_type_) {
+-    delete pw_type_;
+-  }
+-
+-  if (spa_video_format_) {
+-    delete spa_video_format_;
+-  }
+-
+   if (pw_stream_) {
+     pw_stream_destroy(pw_stream_);
+   }
+ 
+-  if (pw_remote_) {
+-    pw_remote_destroy(pw_remote_);
++  if (pw_core_) {
++    pw_core_disconnect(pw_core_);
+   }
+ 
+-  if (pw_core_) {
+-    pw_core_destroy(pw_core_);
++  if (pw_context_) {
++    pw_context_destroy(pw_context_);
+   }
+ 
+   if (pw_main_loop_) {
+     pw_thread_loop_destroy(pw_main_loop_);
+   }
+ 
+-  if (pw_loop_) {
+-    pw_loop_destroy(pw_loop_);
+-  }
+-
+-  if (current_frame_) {
+-    free(current_frame_);
+-  }
+-
+   if (start_request_signal_id_) {
+     g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_);
+   }
+@@ -250,27 +230,35 @@ void BaseCapturerPipeWire::InitPortal() {
+ void BaseCapturerPipeWire::InitPipeWire() {
+   pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
+ 
+-  pw_loop_ = pw_loop_new(/*properties=*/nullptr);
+-  pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop");
+-
+-  pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr);
+-  pw_core_type_ = pw_core_get_type(pw_core_);
+-  pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0);
++  pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
++  pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0);
++  if (!pw_context_) {
++    RTC_LOG(LS_ERROR) << "Failed to create PipeWire context";
++    return;
++  }
+ 
+-  InitPipeWireTypes();
++  pw_core_ = pw_context_connect(pw_context_, nullptr, 0);
++  if (!pw_core_) {
++    RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context";
++    return;
++  }
+ 
+   // Initialize event handlers, remote end and stream-related.
+-  pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS;
+-  pw_remote_events_.state_changed = &OnStateChanged;
++  pw_core_events_.version = PW_VERSION_CORE_EVENTS;
++  pw_core_events_.error = &OnCoreError;
+ 
+   pw_stream_events_.version = PW_VERSION_STREAM_EVENTS;
+   pw_stream_events_.state_changed = &OnStreamStateChanged;
+-  pw_stream_events_.format_changed = &OnStreamFormatChanged;
++  pw_stream_events_.param_changed = &OnStreamParamChanged;
+   pw_stream_events_.process = &OnStreamProcess;
+ 
+-  pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_,
+-                         this);
+-  pw_remote_connect_fd(pw_remote_, pw_fd_);
++  pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this);
++
++  pw_stream_ = CreateReceivingStream();
++  if (!pw_stream_) {
++    RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream";
++    return;
++  }
+ 
+   if (pw_thread_loop_start(pw_main_loop_) < 0) {
+     RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop";
+@@ -278,81 +266,120 @@ void BaseCapturerPipeWire::InitPipeWire() {
+   }
+ }
+ 
+-void BaseCapturerPipeWire::InitPipeWireTypes() {
+-  spa_type_map* map = pw_core_type_->map;
+-  pw_type_ = new PipeWireType();
+-
+-  spa_type_media_type_map(map, &pw_type_->media_type);
+-  spa_type_media_subtype_map(map, &pw_type_->media_subtype);
+-  spa_type_format_video_map(map, &pw_type_->format_video);
+-  spa_type_video_format_map(map, &pw_type_->video_format);
+-}
+-
+-void BaseCapturerPipeWire::CreateReceivingStream() {
++pw_stream* BaseCapturerPipeWire::CreateReceivingStream() {
+   spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
+-  spa_rectangle pwScreenBounds =
+-      spa_rectangle{static_cast<uint32_t>(desktop_size_.width()),
+-                    static_cast<uint32_t>(desktop_size_.height())};
++  spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX};
+ 
+-  spa_fraction pwFrameRateMin = spa_fraction{0, 1};
+-  spa_fraction pwFrameRateMax = spa_fraction{60, 1};
++  auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr);
+ 
+-  pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1",
+-                                                /*end of varargs*/ nullptr);
+-  pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps);
++  if (!stream) {
++    RTC_LOG(LS_ERROR) << "Could not create receiving stream.";
++    return nullptr;
++  }
+ 
+   uint8_t buffer[1024] = {};
+-  const spa_pod* params[1];
+-  spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)};
+-  params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
+-      &builder,
+-      // id to enumerate formats
+-      pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I",
+-      pw_type_->media_type.video, "I", pw_type_->media_subtype.raw,
+-      // Video format: specified as id or enum (I), preferred format is BGRx,
+-      // then allowed formats are enumerated (e) and the format is undecided (u)
+-      // to allow negotiation
+-      ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx,
+-      SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx,
+-                        pw_type_->video_format.BGRx),
+-      // Video size: specified as rectangle (R), preferred size is specified as
+-      // first parameter, then allowed size is defined as range (r) from min and
+-      // max values and the format is undecided (u) to allow negotiation
+-      ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2,
+-      &pwMinScreenBounds, &pwScreenBounds,
+-      // Frame rate: specified as fraction (F) and set to minimum frame rate
+-      // value
+-      ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin,
+-      // Max frame rate: specified as fraction (F), preferred frame rate is set
+-      // to maximum value, then allowed frame rate is defined as range (r) from
+-      // min and max values and it is undecided (u) to allow negotiation
+-      ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2,
+-      &pwFrameRateMin, &pwFrameRateMax));
+-
+-  pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_,
+-                         this);
++  const spa_pod* params[2];
++  spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer));
++
++  params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
++              SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
++              SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
++              SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
++              SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA,
++                                                                 SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA),
++              SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds,
++                                                                    &pwMinScreenBounds,
++                                                                    &pwMaxScreenBounds),
++              0));
++  pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_, this);
++
+   pw_stream_flags flags = static_cast<pw_stream_flags>(
+-      PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE |
+-      PW_STREAM_FLAG_MAP_BUFFERS);
+-  if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
+-                        flags, params,
+-                        /*n_params=*/1) != 0) {
++      PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE);
++
++  if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) {
+     RTC_LOG(LS_ERROR) << "Could not connect receiving stream.";
+     portal_init_failed_ = true;
+-    return;
+   }
++
++  return stream;
+ }
+ 
+ void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
++  struct spa_meta_region* video_crop;
+   spa_buffer* spaBuffer = buffer->buffer;
+-  void* src = nullptr;
++  uint8_t *map = nullptr;
++  uint8_t* src = nullptr;
++  uint8_t* dst = nullptr;
++
++  if (spaBuffer->datas[0].chunk->size == 0) {
++    map = nullptr;
++    src = nullptr;
++  } else if (spaBuffer->datas[0].type == SPA_DATA_MemFd) {
++    map = static_cast<uint8_t*>(mmap(
++        nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
++        PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0));
++    src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
++  } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
++    int fd;
++    fd = spaBuffer->datas[0].fd;
++
++    map = static_cast<uint8_t*>(mmap(
++        nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
++        PROT_READ, MAP_PRIVATE, fd, 0));
++    SyncDmaBuf(fd, DMA_BUF_SYNC_START);
++
++    src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
++  } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) {
++    map = nullptr;
++    src = static_cast<uint8_t*>(spaBuffer->datas[0].data);
++  } else {
++    return;
++  }
+ 
+-  if (!(src = spaBuffer->datas[0].data)) {
++  if (!src) {
+     return;
+   }
+ 
+-  uint32_t maxSize = spaBuffer->datas[0].maxsize;
+-  int32_t srcStride = spaBuffer->datas[0].chunk->stride;
++  DesktopSize prev_crop_size = DesktopSize(0, 0);
++  if (video_crop_size_initialized_) {
++    prev_crop_size = video_crop_size_;
++  }  
++
++  if ((video_crop = static_cast<struct spa_meta_region*>(
++           spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(*video_crop))))) {
++    RTC_DCHECK(video_crop->region.size.width <= desktop_size_.width() &&
++               video_crop->region.size.height <= desktop_size_.height());
++    if ((video_crop->region.size.width != desktop_size_.width() ||
++        video_crop->region.size.height != desktop_size_.height()) && video_crop->region.size.width && video_crop->region.size.height) {
++      video_crop_size_ = DesktopSize(video_crop->region.size.width, video_crop->region.size.height);
++      video_crop_size_initialized_ = true;
++    } else {
++      video_crop_size_initialized_ = false;
++    }
++  } else {
++    video_crop_size_initialized_ = false;
++  }
++
++  size_t frame_size;
++  if (video_crop_size_initialized_) {
++    frame_size =
++        video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel;
++  } else {
++    frame_size =
++        desktop_size_.width() * desktop_size_.height() * kBytesPerPixel;
++  }
++
++  if (!current_frame_ ||
++      (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) {
++    current_frame_ = std::make_unique<uint8_t[]>(frame_size);
++  }
++  RTC_DCHECK(current_frame_ != nullptr);
++
++  const int32_t dstStride = video_crop_size_initialized_
++                                ? video_crop_size_.width() * kBytesPerPixel
++                                : desktop_size_.width() * kBytesPerPixel;
++  const int32_t srcStride = spaBuffer->datas[0].chunk->stride;
++
+   if (srcStride != (desktop_size_.width() * kBytesPerPixel)) {
+     RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
+                       << srcStride
+@@ -361,21 +388,40 @@ void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
+     return;
+   }
+ 
+-  if (!current_frame_) {
+-    current_frame_ = static_cast<uint8_t*>(malloc(maxSize));
++  dst = current_frame_.get();
++
++  // Adjust source content based on crop video position
++  if (video_crop_size_initialized_ &&
++      (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) {
++    for (int i = 0; i < video_crop->region.position.y; ++i) {
++      src += srcStride;
++    }
++  }
++  const int xOffset =
++      video_crop_size_initialized_ && (video_crop->region.position.x + video_crop_size_.width() <=
++                           desktop_size_.width())
++          ? video_crop->region.position.x * kBytesPerPixel
++          : 0;
++  const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height();
++  for (int i = 0; i < height; ++i) {
++    // Adjust source content based on crop video position if needed
++    src += xOffset;
++    std::memcpy(dst, src, dstStride);
++    // If both sides decided to go with the RGBx format we need to convert it to
++    // BGRx to match color format expected by WebRTC.
++    if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx ||
++        spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) {
++      ConvertRGBxToBGRx(dst, dstStride);
++    }
++    src += srcStride - xOffset;
++    dst += dstStride;
+   }
+-  RTC_DCHECK(current_frame_ != nullptr);
+ 
+-  // If both sides decided to go with the RGBx format we need to convert it to
+-  // BGRx to match color format expected by WebRTC.
+-  if (spa_video_format_->format == pw_type_->video_format.RGBx) {
+-    uint8_t* tempFrame = static_cast<uint8_t*>(malloc(maxSize));
+-    std::memcpy(tempFrame, src, maxSize);
+-    ConvertRGBxToBGRx(tempFrame, maxSize);
+-    std::memcpy(current_frame_, tempFrame, maxSize);
+-    free(tempFrame);
+-  } else {
+-    std::memcpy(current_frame_, src, maxSize);
++  if (map) {
++    if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
++      SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END);
++    }
++    munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset);
+   }
+ }
+ 
+@@ -725,10 +771,7 @@ void BaseCapturerPipeWire::OnStartRequestResponseSignal(
+       g_variant_get(variant, "(u@a{sv})", &stream_id, &options);
+       RTC_DCHECK(options != nullptr);
+ 
+-      g_variant_lookup(options, "size", "(ii)", &width, &height);
+-
+-      that->desktop_size_.set(width, height);
+-
++      that->pw_stream_node_id_ = stream_id;
+       g_variant_unref(options);
+       g_variant_unref(variant);
+     }
+@@ -813,10 +856,15 @@ void BaseCapturerPipeWire::CaptureFrame() {
+     return;
+   }
+ 
+-  std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(desktop_size_));
++  DesktopSize frame_size = desktop_size_;
++  if (video_crop_size_initialized_) {
++    frame_size = video_crop_size_;
++  }
++  
++  std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(frame_size));
+   result->CopyPixelsFrom(
+-      current_frame_, (desktop_size_.width() * kBytesPerPixel),
+-      DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height()));
++      current_frame_.get(), (frame_size.width() * kBytesPerPixel),
++      DesktopRect::MakeWH(frame_size.width(), frame_size.height()));
+   if (!result) {
+     callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
+     return;
+@@ -837,4 +885,22 @@ bool BaseCapturerPipeWire::SelectSource(SourceId id) {
+   return true;
+ }
+ 
++// static
++std::unique_ptr<DesktopCapturer>
++BaseCapturerPipeWire::CreateRawScreenCapturer(
++    const DesktopCaptureOptions& options) {
++  std::unique_ptr<BaseCapturerPipeWire> capturer =
++      std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
++  return std::move(capturer);}
++
++// static
++std::unique_ptr<DesktopCapturer>
++BaseCapturerPipeWire::CreateRawWindowCapturer(
++    const DesktopCaptureOptions& options) {
++
++  std::unique_ptr<BaseCapturerPipeWire> capturer =
++      std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
++  return std::move(capturer);
++}
++
+ }  // namespace webrtc
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
+index 56b101acbaa6..de54157d1a2a 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
+@@ -22,17 +22,13 @@
+ 
+ namespace webrtc {
+ 
+-class PipeWireType {
+- public:
+-  spa_type_media_type media_type;
+-  spa_type_media_subtype media_subtype;
+-  spa_type_format_video format_video;
+-  spa_type_video_format video_format;
+-};
+-
+ class BaseCapturerPipeWire : public DesktopCapturer {
+  public:
+-  enum CaptureSourceType { Screen = 1, Window };
++  enum CaptureSourceType : uint32_t {
++    kScreen = 0b01,
++    kWindow = 0b10,
++    kAny = 0b11
++  };
+ 
+   explicit BaseCapturerPipeWire(CaptureSourceType source_type);
+   ~BaseCapturerPipeWire() override;
+@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public DesktopCapturer {
+   bool GetSourceList(SourceList* sources) override;
+   bool SelectSource(SourceId id) override;
+ 
++  static std::unique_ptr<DesktopCapturer> CreateRawScreenCapturer(
++      const DesktopCaptureOptions& options);
++
++  static std::unique_ptr<DesktopCapturer> CreateRawWindowCapturer(
++      const DesktopCaptureOptions& options);
++
+  private:
+   // PipeWire types -->
++  pw_context* pw_context_ = nullptr;
+   pw_core* pw_core_ = nullptr;
+-  pw_type* pw_core_type_ = nullptr;
+   pw_stream* pw_stream_ = nullptr;
+-  pw_remote* pw_remote_ = nullptr;
+-  pw_loop* pw_loop_ = nullptr;
+   pw_thread_loop* pw_main_loop_ = nullptr;
+-  PipeWireType* pw_type_ = nullptr;
+ 
++  spa_hook spa_core_listener_ = {};
+   spa_hook spa_stream_listener_ = {};
+-  spa_hook spa_remote_listener_ = {};
+ 
++  pw_core_events pw_core_events_ = {};
+   pw_stream_events pw_stream_events_ = {};
+-  pw_remote_events pw_remote_events_ = {};
+ 
+-  spa_video_info_raw* spa_video_format_ = nullptr;
++  struct spa_video_info_raw spa_video_format_;
+ 
++  guint32 pw_stream_node_id_ = 0;
+   gint32 pw_fd_ = -1;
+ 
+   CaptureSourceType capture_source_type_ =
+-      BaseCapturerPipeWire::CaptureSourceType::Screen;
++      BaseCapturerPipeWire::CaptureSourceType::kAny;
+ 
+   // <-- end of PipeWire types
+ 
+@@ -78,33 +78,37 @@ class BaseCapturerPipeWire : public DesktopCapturer {
+   guint sources_request_signal_id_ = 0;
+   guint start_request_signal_id_ = 0;
+ 
++  bool video_crop_size_initialized_ = false;
++  DesktopSize video_crop_size_;;
+   DesktopSize desktop_size_ = {};
+   DesktopCaptureOptions options_ = {};
+ 
+-  uint8_t* current_frame_ = nullptr;
++  std::unique_ptr<uint8_t[]> current_frame_;
+   Callback* callback_ = nullptr;
+ 
+   bool portal_init_failed_ = false;
+ 
+   void InitPortal();
+   void InitPipeWire();
+-  void InitPipeWireTypes();
+ 
+-  void CreateReceivingStream();
++  pw_stream* CreateReceivingStream();
+   void HandleBuffer(pw_buffer* buffer);
+ 
+   void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
+ 
+-  static void OnStateChanged(void* data,
+-                             pw_remote_state old_state,
+-                             pw_remote_state state,
+-                             const char* error);
++  static void SyncDmaBuf(int fd, uint64_t start_or_end);
++  static void OnCoreError(void *data,
++                          uint32_t id,
++                          int seq,
++                          int res,
++                          const char *message);
++  static void OnStreamParamChanged(void *data,
++                                   uint32_t id,
++                                   const struct spa_pod *format);
+   static void OnStreamStateChanged(void* data,
+                                    pw_stream_state old_state,
+                                    pw_stream_state state,
+                                    const char* error_message);
+-
+-  static void OnStreamFormatChanged(void* data, const struct spa_pod* format);
+   static void OnStreamProcess(void* data);
+   static void OnNewBuffer(void* data, uint32_t id);
+ 
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
+index 26956fc67dc8..3813d697bb38 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
+@@ -15,7 +15,7 @@
+ namespace webrtc {
+ 
+ ScreenCapturerPipeWire::ScreenCapturerPipeWire()
+-    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {}
++    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {}
+ ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {}
+ 
+ // static
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
+index 35436475cb4d..c43a1f1a0c4e 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
+@@ -15,7 +15,7 @@
+ namespace webrtc {
+ 
+ WindowCapturerPipeWire::WindowCapturerPipeWire()
+-    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {}
++    : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {}
+ WindowCapturerPipeWire::~WindowCapturerPipeWire() {}
+ 
+ // static
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
+index cf8a9dd0e0db..d27fab8d28d9 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
+@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
+     const DesktopCaptureOptions& options) {
+ #if defined(WEBRTC_USE_PIPEWIRE)
+   if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
+-    return ScreenCapturerPipeWire::CreateRawScreenCapturer(options);
++    return BaseCapturerPipeWire::CreateRawScreenCapturer(options);
+   }
+ #endif  // defined(WEBRTC_USE_PIPEWIRE)
+ 
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
+index 82359e50c2db..bb9724cf7cc2 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
+@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
+     const DesktopCaptureOptions& options) {
+ #if defined(WEBRTC_USE_PIPEWIRE)
+   if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
+-    return WindowCapturerPipeWire::CreateRawWindowCapturer(options);
++    return BaseCapturerPipeWire::CreateRawWindowCapturer(options);
+   }
+ #endif  // defined(WEBRTC_USE_PIPEWIRE)
+ 
diff --git a/SOURCES/firefox.sh.in b/SOURCES/firefox.sh.in
index 0e5214e..a33e812 100644
--- a/SOURCES/firefox.sh.in
+++ b/SOURCES/firefox.sh.in
@@ -250,6 +250,9 @@ done
 # Linux version specific environment variables
 %RHEL_ENV_VARS%
 
+# Don't throw "old profile" dialog box.
+export MOZ_ALLOW_DOWNGRADE=1
+
 # Make sure at-spi-bus is running
 if ! dbus-send --session            \
      --dest=org.freedesktop.DBus    \
diff --git a/SOURCES/mozilla-1005640-accept-lang.patch b/SOURCES/mozilla-1005640-accept-lang.patch
deleted file mode 100644
index 29d3833..0000000
--- a/SOURCES/mozilla-1005640-accept-lang.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff -up firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm.1005640-accept-lang firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm
---- firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm.1005640-accept-lang	2017-01-16 17:16:52.000000000 +0100
-+++ firefox-51.0/toolkit/mozapps/extensions/internal/XPIProvider.jsm	2017-01-18 12:35:29.380394216 +0100
-@@ -2852,6 +2852,11 @@ this.XPIProvider = {
-         this.addAddonsToCrashReporter();
-       }
- 
-+      // Save locale settings to compare it later to check whenever some addon
-+      // changed it.
-+      var previousLocale = Cc["@mozilla.org/chrome/chrome-registry;1"]
-+                          .getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
-+
-       try {
-         AddonManagerPrivate.recordTimestamp("XPI_bootstrap_addons_begin");
- 
-@@ -2880,6 +2885,14 @@ this.XPIProvider = {
-         AddonManagerPrivate.recordException("XPI-BOOTSTRAP", "startup failed", e);
-       }
- 
-+      var currentLocale = Cc["@mozilla.org/chrome/chrome-registry;1"]
-+                         .getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
-+      if (currentLocale != previousLocale) {
-+        // We have to flush string cache if the locale was changed during loading
-+        // of addons
-+        Services.obs.notifyObservers(null, "chrome-flush-caches", null);
-+      }
-+
-       // Let these shutdown a little earlier when they still have access to most
-       // of XPCOM
-       Services.obs.addObserver({
diff --git a/SOURCES/mozilla-1170092.patch b/SOURCES/mozilla-1170092.patch
index b182d64..5aebd73 100644
--- a/SOURCES/mozilla-1170092.patch
+++ b/SOURCES/mozilla-1170092.patch
@@ -1,7 +1,7 @@
-diff -up firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
---- firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092	2019-01-22 10:48:38.187383614 +0100
-+++ firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp	2019-01-22 11:26:11.027108692 +0100
-@@ -225,8 +225,20 @@ nsresult nsReadConfig::openAndEvaluateJS
+diff -up firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
+--- firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092	2020-02-07 01:27:03.000000000 +0100
++++ firefox-68.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp	2020-02-24 11:30:32.058044651 +0100
+@@ -246,8 +246,20 @@ nsresult nsReadConfig::openAndEvaluateJS
      if (NS_FAILED(rv)) return rv;
  
      rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
@@ -23,30 +23,30 @@ diff -up firefox-60.5.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 
    } else {
      nsAutoCString location("resource://gre/defaults/autoconfig/");
      location += aFileName;
-diff -up firefox-60.5.0/modules/libpref/Preferences.cpp.1170092 firefox-60.5.0/modules/libpref/Preferences.cpp
---- firefox-60.5.0/modules/libpref/Preferences.cpp.1170092	2019-01-21 17:38:16.000000000 +0100
-+++ firefox-60.5.0/modules/libpref/Preferences.cpp	2019-01-22 10:48:38.187383614 +0100
-@@ -3459,6 +3459,8 @@ static nsresult pref_ReadPrefFromJar(nsZ
+diff -up firefox-68.5.0/modules/libpref/Preferences.cpp.1170092 firefox-68.5.0/modules/libpref/Preferences.cpp
+--- firefox-68.5.0/modules/libpref/Preferences.cpp.1170092	2020-02-24 11:30:32.059044645 +0100
++++ firefox-68.5.0/modules/libpref/Preferences.cpp	2020-02-24 11:35:14.613443673 +0100
+@@ -4436,6 +4436,8 @@ static nsresult pref_ReadDefaultPrefs(co
    //
    // Thus, in the omni.jar case, we always load app-specific default
    // preferences from omni.jar, whether or not `$app == $gre`.
 +  // At very end load configuration from system config location:
 +  // - /etc/firefox/pref/*.js
  
-   nsresult rv;
+   nsresult rv = NS_ERROR_FAILURE;
    nsZipFind* findPtr;
-diff -up firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp
---- firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092	2019-01-21 17:38:51.000000000 +0100
-+++ firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp	2019-01-22 11:37:01.868896974 +0100
-@@ -58,6 +58,7 @@
+diff -up firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp
+--- firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092	2020-02-07 01:28:06.000000000 +0100
++++ firefox-68.5.0/toolkit/xre/nsXREDirProvider.cpp	2020-02-24 11:34:27.284704700 +0100
+@@ -61,6 +61,7 @@
  #endif
  #ifdef XP_UNIX
- #include <ctype.h>
-+#include "nsIXULAppInfo.h"
+ #  include <ctype.h>
++#  include "nsIXULAppInfo.h"
  #endif
  #ifdef XP_IOS
- #include "UIKitDirProvider.h"
-@@ -491,6 +492,21 @@ nsXREDirProvider::GetFile(const char* aP
+ #  include "UIKitDirProvider.h"
+@@ -524,6 +525,21 @@ nsXREDirProvider::GetFile(const char* aP
        }
      }
    }
@@ -68,7 +68,7 @@ diff -up firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-60.5.0/
    if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
  
    if (ensureFilePermissions) {
-@@ -796,6 +812,16 @@ nsresult nsXREDirProvider::GetFilesInter
+@@ -880,6 +896,17 @@ nsresult nsXREDirProvider::GetFilesInter
      LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
      LoadDirsIntoArray(mAppBundleDirectories, kAppendPrefDir, directories);
  
@@ -78,16 +78,17 @@ diff -up firefox-60.5.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-60.5.0/
 +                                getter_AddRefs(systemPrefDir));
 +    if (NS_SUCCEEDED(rv)) {
 +      rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
-+      if (NS_SUCCEEDED(rv))
++      if (NS_SUCCEEDED(rv)) {
 +        directories.AppendObject(systemPrefDir);
++      }
 +    }
 +
-     rv = NS_NewArrayEnumerator(aResult, directories);
+     rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
    } else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
      // NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
-diff -up firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h
---- firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092	2019-01-22 10:48:38.188383609 +0100
-+++ firefox-60.5.0/xpcom/io/nsAppDirectoryServiceDefs.h	2019-01-22 11:08:12.068459480 +0100
+diff -up firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h
+--- firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092	2020-02-07 01:27:52.000000000 +0100
++++ firefox-68.5.0/xpcom/io/nsAppDirectoryServiceDefs.h	2020-02-24 11:30:32.059044645 +0100
 @@ -62,6 +62,7 @@
  #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
  #define NS_APP_PREFS_OVERRIDE_DIR \
diff --git a/SOURCES/mozilla-1436242.patch b/SOURCES/mozilla-1436242.patch
deleted file mode 100644
index 570b7c5..0000000
--- a/SOURCES/mozilla-1436242.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-
-# HG changeset patch
-# User Jed Davis <jld@mozilla.com>
-# Date 1526943705 21600
-# Node ID 6bb3adfa15c6877f7874429462dad88f8c978c4f
-# Parent  4c71c8454879c841871ecf3afb7dbdc96bad97fc
-Bug 1436242 - Avoid undefined behavior in IPC fd-passing code.  r=froydnj
-
-MozReview-Commit-ID: 3szIPUssgF5
-
-diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
---- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-+++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-@@ -418,20 +418,37 @@ bool Channel::ChannelImpl::ProcessIncomi
-     const int* fds;
-     unsigned num_fds;
-     unsigned fds_i = 0;  // the index of the first unused descriptor
- 
-     if (input_overflow_fds_.empty()) {
-       fds = wire_fds;
-       num_fds = num_wire_fds;
-     } else {
--      const size_t prev_size = input_overflow_fds_.size();
--      input_overflow_fds_.resize(prev_size + num_wire_fds);
--      memcpy(&input_overflow_fds_[prev_size], wire_fds,
--             num_wire_fds * sizeof(int));
-+      // This code may look like a no-op in the case where
-+      // num_wire_fds == 0, but in fact:
-+      //
-+      // 1. wire_fds will be nullptr, so passing it to memcpy is
-+      // undefined behavior according to the C standard, even though
-+      // the memcpy length is 0.
-+      //
-+      // 2. prev_size will be an out-of-bounds index for
-+      // input_overflow_fds_; this is undefined behavior according to
-+      // the C++ standard, even though the element only has its
-+      // pointer taken and isn't accessed (and the corresponding
-+      // operation on a C array would be defined).
-+      //
-+      // UBSan makes #1 a fatal error, and assertions in libstdc++ do
-+      // the same for #2 if enabled.
-+      if (num_wire_fds > 0) {
-+        const size_t prev_size = input_overflow_fds_.size();
-+        input_overflow_fds_.resize(prev_size + num_wire_fds);
-+        memcpy(&input_overflow_fds_[prev_size], wire_fds,
-+               num_wire_fds * sizeof(int));
-+      }
-       fds = &input_overflow_fds_[0];
-       num_fds = input_overflow_fds_.size();
-     }
- 
-     // The data for the message we're currently reading consists of any data
-     // stored in incoming_message_ followed by data in input_buf_ (followed by
-     // other messages).
- 
-
diff --git a/SOURCES/mozilla-1603112-accept-lang.patch b/SOURCES/mozilla-1603112-accept-lang.patch
new file mode 100644
index 0000000..b67b232
--- /dev/null
+++ b/SOURCES/mozilla-1603112-accept-lang.patch
@@ -0,0 +1,12 @@
+diff --git a/intl/strres/nsStringBundle.cpp b/intl/strres/nsStringBundle.cpp
+--- a/intl/strres/nsStringBundle.cpp
++++ b/intl/strres/nsStringBundle.cpp
+@@ -66,7 +66,6 @@
+     "chrome://global/locale/commonDialogs.properties",
+     "chrome://global/locale/css.properties",
+     "chrome://global/locale/dom/dom.properties",
+-    "chrome://global/locale/intl.properties",
+     "chrome://global/locale/layout/HtmlForm.properties",
+     "chrome://global/locale/layout/htmlparser.properties",
+     "chrome://global/locale/layout_errors.properties",
+
diff --git a/SOURCES/mozilla-256180.patch b/SOURCES/mozilla-256180.patch
deleted file mode 100644
index 4b61b5f..0000000
--- a/SOURCES/mozilla-256180.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-60.5.0/layout/generic/nsIFrame.h.256180 firefox-60.5.0/layout/generic/nsIFrame.h
---- firefox-60.5.0/layout/generic/nsIFrame.h.256180	2019-01-22 11:44:10.849848268 +0100
-+++ firefox-60.5.0/layout/generic/nsIFrame.h	2019-01-22 11:44:53.918645941 +0100
-@@ -13,7 +13,7 @@
- #error This header/class should only be used within Mozilla code. It should not be used by extensions.
- #endif
- 
--#define MAX_REFLOW_DEPTH 200
-+#define MAX_REFLOW_DEPTH 1000
- 
- /* nsIFrame is in the process of being deCOMtaminated, i.e., this file is
-    eventually going to be eliminated, and all callers will use nsFrame instead.
diff --git a/SOURCES/mozilla-bmo1005535.patch b/SOURCES/mozilla-bmo1005535.patch
new file mode 100644
index 0000000..96f6e1a
--- /dev/null
+++ b/SOURCES/mozilla-bmo1005535.patch
@@ -0,0 +1,20 @@
+# HG changeset patch
+# User Steve Singer <steve@ssinger.info>
+# Date 1558451540 -7200
+#      Tue May 21 17:12:20 2019 +0200
+# Node ID 433beec63e6b5f409683af20a0c1ab137cc7bfad
+# Parent  42c99b59a87b904063bad3193f10c51d068d2eac
+Bug 1005535 - Get skia GPU building on big endian.
+
+diff -r 42c99b59a87b -r 433beec63e6b gfx/skia/skia/include/private/GrColor.h
+--- a/gfx/skia/skia/include/private/GrColor.h	Wed Jun 05 08:48:08 2019 +0200
++++ b/gfx/skia/skia/include/private/GrColor.h	Tue May 21 17:12:20 2019 +0200
+@@ -63,7 +63,7 @@
+  *  Since premultiplied means that alpha >= color, we construct a color with
+  *  each component==255 and alpha == 0 to be "illegal"
+  */
+-#define GrColor_ILLEGAL     (~(0xFF << GrColor_SHIFT_A))
++#define GrColor_ILLEGAL     ((uint32_t)(~(0xFF << GrColor_SHIFT_A)))
+ 
+ /** Normalizes and coverts an uint8_t to a float. [0, 255] -> [0.0, 1.0] */
+ static inline float GrNormalizeByteToFloat(uint8_t value) {
diff --git a/SOURCES/mozilla-bmo1504834-part1.patch b/SOURCES/mozilla-bmo1504834-part1.patch
new file mode 100644
index 0000000..cb985bb
--- /dev/null
+++ b/SOURCES/mozilla-bmo1504834-part1.patch
@@ -0,0 +1,81 @@
+# HG changeset patch
+# Parent  051b75a600dfbf7503c3485cebfd34d4eb29be96
+Taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1504834
+
+diff -r 051b75a600df gfx/2d/DrawTargetSkia.cpp
+--- a/gfx/2d/DrawTargetSkia.cpp	Fri Jul 05 12:42:44 2019 +0200
++++ b/gfx/2d/DrawTargetSkia.cpp	Mon Jul 08 10:59:30 2019 +0200
+@@ -138,8 +138,7 @@
+   return surfaceBounds.Intersect(bounds);
+ }
+ 
+-static const int kARGBAlphaOffset =
+-    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
++static const int kARGBAlphaOffset = 0;  // Skia is always BGRA SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
+ 
+ static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
+                              const int32_t aStride, SurfaceFormat aFormat) {
+diff -r 051b75a600df gfx/2d/Types.h
+--- a/gfx/2d/Types.h	Fri Jul 05 12:42:44 2019 +0200
++++ b/gfx/2d/Types.h	Mon Jul 08 10:59:30 2019 +0200
+@@ -85,15 +85,8 @@
+ // The following values are endian-independent synonyms. The _UINT32 suffix
+ // indicates that the name reflects the layout when viewed as a uint32_t
+ // value.
+-#if MOZ_LITTLE_ENDIAN
+   A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
+   X8R8G8B8_UINT32 = B8G8R8X8   // 0x00RRGGBB
+-#elif MOZ_BIG_ENDIAN
+-  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
+-  X8R8G8B8_UINT32 = X8R8G8B8   // 0x00RRGGBB
+-#else
+-#  error "bad endianness"
+-#endif
+ };
+ 
+ static inline int BytesPerPixel(SurfaceFormat aFormat) {
+diff -r 051b75a600df gfx/skia/skia/third_party/skcms/skcms.cc
+--- a/gfx/skia/skia/third_party/skcms/skcms.cc	Fri Jul 05 12:42:44 2019 +0200
++++ b/gfx/skia/skia/third_party/skcms/skcms.cc	Mon Jul 08 10:59:30 2019 +0200
+@@ -17,6 +17,8 @@
+     #include <arm_neon.h>
+ #elif defined(__SSE__)
+     #include <immintrin.h>
++#else
++    #define SKCMS_PORTABLE
+ #endif
+ 
+ // sizeof(x) will return size_t, which is 32-bit on some machines and 64-bit on others.
+@@ -124,20 +126,28 @@
+ static uint16_t read_big_u16(const uint8_t* ptr) {
+     uint16_t be;
+     memcpy(&be, ptr, sizeof(be));
+-#if defined(_MSC_VER)
++#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
++    return be;
++#else
++    #if defined(_MSC_VER)
+     return _byteswap_ushort(be);
+-#else
++    #else
+     return __builtin_bswap16(be);
++    #endif
+ #endif
+ }
+ 
+ static uint32_t read_big_u32(const uint8_t* ptr) {
+     uint32_t be;
+     memcpy(&be, ptr, sizeof(be));
+-#if defined(_MSC_VER)
++#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
++    return be;
++#else
++    #if defined(_MSC_VER)
+     return _byteswap_ulong(be);
+-#else
++    #else
+     return __builtin_bswap32(be);
++    #endif
+ #endif
+ }
+ 
diff --git a/SOURCES/mozilla-bmo1504834-part2.patch b/SOURCES/mozilla-bmo1504834-part2.patch
new file mode 100644
index 0000000..e6e6aa5
--- /dev/null
+++ b/SOURCES/mozilla-bmo1504834-part2.patch
@@ -0,0 +1,88 @@
+# HG changeset patch
+# Parent  36563351309ddbc6c29559ba50a41d005f925abb
+Skia does not support big endian. The places to fix are too numerous and upstream (skia, not Mozilla)
+has no interest in maintaining big endian.
+So here we try to swizzle the input for skia, so that skia always works on LE, and when it comes
+out again, we transform back to BE.
+
+diff -r 36563351309d gfx/2d/ConvolutionFilter.cpp
+--- a/gfx/2d/ConvolutionFilter.cpp	Mon Sep 09 17:59:28 2019 +0200
++++ b/gfx/2d/ConvolutionFilter.cpp	Tue Sep 10 08:25:13 2019 +0200
+@@ -35,9 +35,38 @@
+   return true;
+ }
+ 
++static void ByteSwapArray(uint8_t *u8Array, int32_t size) {
++    uint32_t *array = reinterpret_cast<uint32_t*>(u8Array);
++    for (int pxl = 0; pxl < size; ++pxl) {
++        // Use an endian swap to move the bytes, i.e. BGRA -> ARGB.
++        uint32_t rgba = array[pxl];
++        array[pxl] = NativeEndian::swapToLittleEndian(rgba);
++    }
++}
++
+ void ConvolutionFilter::ConvolveHorizontally(const uint8_t* aSrc, uint8_t* aDst,
+                                              bool aHasAlpha) {
++#if MOZ_BIG_ENDIAN
++    int outputSize = mFilter->numValues();
++
++    // Input size isn't handed in, so we have to calculate it quickly
++    int inputSize = 0;
++    for (int xx = 0; xx < outputSize; ++xx) {
++        // Get the filter that determines the current output pixel.
++        int filterOffset, filterLength;
++        mFilter->FilterForValue(xx, &filterOffset, &filterLength);
++        inputSize = std::max(inputSize, filterOffset + filterLength);
++    }
++
++    ByteSwapArray((uint8_t*)aSrc, inputSize);
++#endif
++
+   SkOpts::convolve_horizontally(aSrc, *mFilter, aDst, aHasAlpha);
++
++#if MOZ_BIG_ENDIAN
++    ByteSwapArray((uint8_t*)aSrc, inputSize);
++    ByteSwapArray(aDst, outputSize);
++#endif
+ }
+ 
+ void ConvolutionFilter::ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst,
+@@ -49,8 +78,26 @@
+   int32_t filterLength;
+   auto filterValues =
+       mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength);
++
++#if MOZ_BIG_ENDIAN
++  for (int filterY = 0; filterY < filterLength; filterY++) {
++      // Skia only knows LE, so we have to swizzle the input
++    ByteSwapArray(aSrc[filterY], aRowSize);
++  }
++#endif
++
+   SkOpts::convolve_vertically(filterValues, filterLength, aSrc, aRowSize, aDst,
+                               aHasAlpha);
++
++#if MOZ_BIG_ENDIAN
++  // After skia is finished, we swizzle back to BE, in case
++  // the input is used again somewhere else
++  for (int filterY = 0; filterY < filterLength; filterY++) {
++    ByteSwapArray(aSrc[filterY], aRowSize);
++  }
++  // The destination array as well
++  ByteSwapArray(aDst, aRowSize);
++#endif
+ }
+ 
+ /* ConvolutionFilter::ComputeResizeFactor is derived from Skia's
+diff -r 36563351309d gfx/skia/skia/include/core/SkPreConfig.h
+--- a/gfx/skia/skia/include/core/SkPreConfig.h	Mon Sep 09 17:59:28 2019 +0200
++++ b/gfx/skia/skia/include/core/SkPreConfig.h	Tue Sep 10 08:25:13 2019 +0200
+@@ -73,7 +73,7 @@
+       defined(__ppc__) || defined(__hppa) || \
+       defined(__PPC__) || defined(__PPC64__) || \
+       defined(_MIPSEB) || defined(__ARMEB__) || \
+-      defined(__s390__) || \
++      defined(__s390__) || defined(__s390x__) || \
+       (defined(__sh__) && defined(__BIG_ENDIAN__)) || \
+       (defined(__ia64) && defined(__BIG_ENDIAN__))
+          #define SK_CPU_BENDIAN
diff --git a/SOURCES/mozilla-bmo1504834-part3.patch b/SOURCES/mozilla-bmo1504834-part3.patch
new file mode 100644
index 0000000..1a498f8
--- /dev/null
+++ b/SOURCES/mozilla-bmo1504834-part3.patch
@@ -0,0 +1,44 @@
+# HG changeset patch
+# Parent  aecb4600e5da17443b224c79eee178c1d8e155e3
+For FF68, AntiAliasing of XULTexts seem to be broken on big endian (s390x). Text and icons of the sandwich-menu to the
+right of the address bar, as well as plugin-windows appears transparant, which usually means unreadable (white on white).
+
+diff -r aecb4600e5da gfx/skia/skia/include/private/SkNx.h
+--- a/gfx/skia/skia/include/private/SkNx.h	Tue Aug 20 09:46:55 2019 +0200
++++ b/gfx/skia/skia/include/private/SkNx.h	Mon Sep 09 10:04:06 2019 +0200
+@@ -238,7 +238,18 @@
+     AI SkNx operator*(const SkNx& y) const { return fVal * y.fVal; }
+     AI SkNx operator/(const SkNx& y) const { return fVal / y.fVal; }
+ 
++    // On Big endian the commented out variant doesn't work,
++    // and honestly, I have no idea why it exists in the first place.
++    // The reason its broken is, I think, that it defaults to the double-variant of ToBits()
++    // which gets a 64-bit integer, and FromBits returns 32-bit,
++    // cutting off the wrong half again.
++    // Overall, I see no reason to have ToBits and FromBits at all (even for floats/doubles).
++    // Still we are only "fixing" this for big endian and leave little endian alone (never touch a running system)
++#ifdef SK_CPU_BENDIAN
++    AI SkNx operator&(const SkNx& y) const { return fVal & y.fVal; }
++#else
+     AI SkNx operator&(const SkNx& y) const { return FromBits(ToBits(fVal) & ToBits(y.fVal)); }
++#endif
+     AI SkNx operator|(const SkNx& y) const { return FromBits(ToBits(fVal) | ToBits(y.fVal)); }
+     AI SkNx operator^(const SkNx& y) const { return FromBits(ToBits(fVal) ^ ToBits(y.fVal)); }
+ 
+diff -r aecb4600e5da gfx/skia/skia/src/opts/SkBlitMask_opts.h
+--- a/gfx/skia/skia/src/opts/SkBlitMask_opts.h	Tue Aug 20 09:46:55 2019 +0200
++++ b/gfx/skia/skia/src/opts/SkBlitMask_opts.h	Mon Sep 09 10:04:06 2019 +0200
+@@ -203,7 +203,13 @@
+             //   ~~~>
+             // a = 1*aa + d(1-1*aa) = aa + d(1-aa)
+             // c = 0*aa + d(1-1*aa) =      d(1-aa)
++
++            // For big endian we have to swap the alpha-mask from 0,0,0,255 to 255,0,0,0
++#ifdef SK_CPU_BENDIAN
++            return Sk4px(Sk16b(aa) & Sk16b(255,0,0,0, 255,0,0,0, 255,0,0,0, 255,0,0,0))
++#else
+             return Sk4px(Sk16b(aa) & Sk16b(0,0,0,255, 0,0,0,255, 0,0,0,255, 0,0,0,255))
++#endif
+                  + d.approxMulDiv255(aa.inv());
+         };
+         while (h --> 0) {
diff --git a/SOURCES/mozilla-bmo1504834-part4.patch b/SOURCES/mozilla-bmo1504834-part4.patch
new file mode 100644
index 0000000..9d2ffc4
--- /dev/null
+++ b/SOURCES/mozilla-bmo1504834-part4.patch
@@ -0,0 +1,30 @@
+# HG changeset patch
+# Parent  46ea866ca3acb8bb5e1709ceb799b9c94f591dec
+Problem description: Tab-titles that are too long to fit into a tab get faded out.
+                     On big endian this is broken and instead of fading out, the 
+                     tab gets white and the font transparent, leading to an unreadable
+                     tab-title
+Solution: This is not a real solution, but a hack. The real solution would have been
+          to byte-swap the correct buffer, but I could not find it.
+          So the next best thing is to deactivate the fading-effect. Now all tab-titles
+          are readable, albeit not as pretty to look at as they could be. 
+Side-effects: I have not yet found an unwanted side-effect.
+
+diff -r 46ea866ca3ac -r 6ef20eee3f8f gfx/2d/DrawTargetSkia.cpp
+--- a/gfx/2d/DrawTargetSkia.cpp	Tue Oct 22 12:27:22 2019 +0200
++++ b/gfx/2d/DrawTargetSkia.cpp	Thu Oct 31 09:11:56 2019 +0100
+@@ -1861,6 +1861,14 @@
+       SkCanvas::kPreserveLCDText_SaveLayerFlag |
+           (aCopyBackground ? SkCanvas::kInitWithPrevious_SaveLayerFlag : 0));
+ 
++#if MOZ_BIG_ENDIAN
++  // Pushing a layer where an aMask is defined produces wrong output.
++  // We _should_ endian swap the data, but I couldn't find a workable way to do so
++  // Therefore I deactivate those layers in the meantime.
++  // The result is: Tab-titles that are longer than the available space should be faded out.
++  //                The fading doesn't work, so we deactivate the fading-effect here.
++  if (!aMask)
++#endif
+   mCanvas->saveLayer(saveRec);
+ 
+   SetPermitSubpixelAA(aOpaque);
diff --git a/SOURCES/mozilla-bmo1554971.patch b/SOURCES/mozilla-bmo1554971.patch
new file mode 100644
index 0000000..ab25c2d
--- /dev/null
+++ b/SOURCES/mozilla-bmo1554971.patch
@@ -0,0 +1,22 @@
+# HG changeset patch
+# Parent  a25cebecb02d5460b8ad757fe9cb4a9c8d1d7658
+Eliminate startup error message:
+JavaScript error: , line 0: Error: Type error for platformInfo value (Error processing arch: Invalid enumeration value "s390x") for runtime.getPlatformInfo.
+
+Reported here: https://bugzilla.mozilla.org/show_bug.cgi?id=1554971
+
+Uncertain if this is causing real problems or not. Also uncertain if the fix actually fixes anything.
+No response from upstream yet.
+
+diff -r a25cebecb02d -r 378b81b00e73 toolkit/components/extensions/schemas/runtime.json
+--- a/toolkit/components/extensions/schemas/runtime.json	Fri Jul 05 12:42:44 2019 +0200
++++ b/toolkit/components/extensions/schemas/runtime.json	Fri Jul 19 13:19:30 2019 +0200
+@@ -64,7 +64,7 @@
+       {
+         "id": "PlatformArch",
+         "type": "string",
+-        "enum": ["arm", "x86-32", "x86-64"],
++        "enum": ["arm", "x86-32", "x86-64", "s390x", "aarch64", "ppc64le"],
+         "allowedContexts": ["content", "devtools"],
+         "description": "The machine's processor architecture."
+       },
diff --git a/SOURCES/mozilla-bmo1602730.patch b/SOURCES/mozilla-bmo1602730.patch
new file mode 100644
index 0000000..c11f958
--- /dev/null
+++ b/SOURCES/mozilla-bmo1602730.patch
@@ -0,0 +1,28 @@
+diff -r 6ef20eee3f8f gfx/layers/basic/BasicCompositor.cpp
+--- a/gfx/layers/basic/BasicCompositor.cpp	Thu Oct 31 09:11:56 2019 +0100
++++ b/gfx/layers/basic/BasicCompositor.cpp	Wed Dec 11 16:16:09 2019 +0100
+@@ -693,9 +693,13 @@
+ 
+   RefPtr<SourceSurface> sourceMask;
+   Matrix maskTransform;
++  // Setting an alpha-mask here breaks the URL-bar on big endian (s390x)
++  // if the typed URL is too long for the textbox (automatic scrolling needed)
++#if MOZ_LITTLE_ENDIAN
+   if (aTransform.Is2D()) {
+     SetupMask(aEffectChain, dest, offset, sourceMask, maskTransform);
+   }
++#endif
+ 
+   CompositionOp blendMode = CompositionOp::OP_OVER;
+   if (Effect* effect =
+diff -r 6ef20eee3f8f gfx/layers/composite/CompositableHost.cpp
+--- a/gfx/layers/composite/CompositableHost.cpp	Thu Oct 31 09:11:56 2019 +0100
++++ b/gfx/layers/composite/CompositableHost.cpp	Wed Dec 11 16:16:09 2019 +0100
+@@ -91,6 +91,7 @@
+   }
+   MOZ_ASSERT(source);
+ 
++  // Alternatively: Comment out these lines where the alpha-mask is set
+   RefPtr<EffectMask> effect =
+       new EffectMask(source, source->GetSize(), aTransform);
+   aEffects.mSecondaryEffects[EffectTypes::MASK] = effect;
diff --git a/SOURCES/mozilla-bmo849632.patch b/SOURCES/mozilla-bmo849632.patch
new file mode 100644
index 0000000..177fdc3
--- /dev/null
+++ b/SOURCES/mozilla-bmo849632.patch
@@ -0,0 +1,23 @@
+Problem:  webGL sites are displayed in the wrong color (usually blue-ish)
+Solution: Problem is with skia once again. Output of webgl seems endian-correct, but skia only
+          knows how to deal with little endian.
+          So we swizzle the output of webgl after reading it from readpixels()
+Note:     This does not fix all webGL sites, but is a step in the right direction
+diff -r 6b017d3e9733 gfx/gl/GLContext.h
+--- a/gfx/gl/GLContext.h    Mon Sep 09 10:04:05 2019 +0200
++++ b/gfx/gl/GLContext.h    Wed Nov 13 17:13:04 2019 +0100
+@@ -1551,6 +1551,13 @@
+     BEFORE_GL_CALL;
+     mSymbols.fReadPixels(x, y, width, height, format, type, pixels);
+     OnSyncCall();
++#if MOZ_BIG_ENDIAN
++    uint8_t* itr = (uint8_t*)pixels;
++    for (GLsizei i = 0; i < width * height; i++) {
++      NativeEndian::swapToLittleEndianInPlace((uint32_t*)itr, 1);
++      itr += 4;
++    }
++#endif
+     AFTER_GL_CALL;
+     mHeavyGLCallsSinceLastFlush = true;
+   }
+
diff --git a/SOURCES/mozilla-build-arm.patch b/SOURCES/mozilla-build-arm.patch
deleted file mode 100644
index e390a28..0000000
--- a/SOURCES/mozilla-build-arm.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -up firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h.arm firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h
---- firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h.arm	2017-03-03 13:53:52.480754536 +0100
-+++ firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h	2017-03-03 13:56:01.476018102 +0100
-@@ -203,6 +203,10 @@
-     #define SK_ARM_HAS_CRC32
- #endif
- 
-+#if defined(__aarch64__)
-+    #undef SK_ARM_HAS_NEON
-+#endif
-+
- //////////////////////////////////////////////////////////////////////
- 
- #if !defined(SKIA_IMPLEMENTATION)
diff --git a/SOURCES/mozilla-nestegg-big-endian.patch b/SOURCES/mozilla-nestegg-big-endian.patch
new file mode 100644
index 0000000..de9adbf
--- /dev/null
+++ b/SOURCES/mozilla-nestegg-big-endian.patch
@@ -0,0 +1,38 @@
+# HG changeset patch
+# Parent  381102061fccdec40efda75c7423a766f68201ba
+Bug-behavior: Youtube-videos using VP9 and opus as audio-codec started loading but did not play
+Reason: While parsing the audio-stream, the sampling frequency (short rate) was wrongly parsed by
+        nestegg, returning 0 all the time. This led to the audio-track reporting that it neither had 
+        valid video nor audio. Which led to an endless-loop in the video state machine.
+Solution: Correct parsing of rate in nestegg, which is a float and cuts of bytes.
+Link: https://github.com/kinetiknz/nestegg/issues/64
+
+diff -r 381102061fcc -r 8da4be020b1e media/libnestegg/src/nestegg.c
+--- a/media/libnestegg/src/nestegg.c	Tue Aug 13 07:51:27 2019 +0200
++++ b/media/libnestegg/src/nestegg.c	Tue Aug 20 07:59:54 2019 +0200
+@@ -768,7 +768,15 @@
+ {
+   union {
+     uint64_t u;
+-    float f;
++    struct {
++#if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
++      uint32_t _pad;
++      float f;
++#else
++      float f;
++      uint32_t _pad;
++#endif
++    } f;
+     double d;
+   } value;
+   int r;
+@@ -780,7 +788,7 @@
+   if (r != 1)
+     return r;
+   if (length == 4)
+-    *val = value.f;
++    *val = value.f.f;
+   else
+     *val = value.d;
+   return 1;
diff --git a/SOURCES/mozilla-s390-context.patch b/SOURCES/mozilla-s390-context.patch
new file mode 100644
index 0000000..55bd7a8
--- /dev/null
+++ b/SOURCES/mozilla-s390-context.patch
@@ -0,0 +1,36 @@
+# HG changeset patch
+# User msirringhaus@suse.de
+# Date 1558452408 -7200
+#      Tue May 21 17:26:48 2019 +0200
+# Node ID 602e92722e765a3c238d3b96b26c0c8063b5eeb4
+# Parent  a3cc550d25e3a04d906f516928cbcbe50efd585e
+[mq]: mozilla-s390-context.patch
+
+diff -r a3cc550d25e3 -r 602e92722e76 js/src/wasm/WasmSignalHandlers.cpp
+--- a/js/src/wasm/WasmSignalHandlers.cpp	Tue May 21 17:22:06 2019 +0200
++++ b/js/src/wasm/WasmSignalHandlers.cpp	Tue May 21 17:26:48 2019 +0200
+@@ -154,6 +154,10 @@
+ #    define R01_sig(p) ((p)->uc_mcontext.gp_regs[1])
+ #    define R32_sig(p) ((p)->uc_mcontext.gp_regs[32])
+ #  endif
++#  if defined(__linux__) && defined(__s390x__)
++#    define GR_sig(p,x) ((p)->uc_mcontext.gregs[x])
++#    define PSWa_sig(p) ((p)->uc_mcontext.psw.addr)
++#  endif
+ #elif defined(__NetBSD__)
+ #  define EIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EIP])
+ #  define EBP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EBP])
+@@ -385,8 +389,13 @@
+ #  define PC_sig(p) R32_sig(p)
+ #  define SP_sig(p) R01_sig(p)
+ #  define FP_sig(p) R01_sig(p)
++#elif defined(__s390x__)
++# define PC_sig(p) PSWa_sig(p)
++# define SP_sig(p) GR_sig(p, 15)
++# define FP_sig(p) GR_sig(p, 11)
+ #endif
+ 
++
+ static void SetContextPC(CONTEXT* context, uint8_t* pc) {
+ #ifdef PC_sig
+   *reinterpret_cast<uint8_t**>(&PC_sig(context)) = pc;
diff --git a/SOURCES/rhbz-1503632-nss.patch b/SOURCES/rhbz-1503632-nss.patch
deleted file mode 100644
index f7a26d3..0000000
--- a/SOURCES/rhbz-1503632-nss.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -up firefox-60.5.0/security/certverifier/NSSCertDBTrustDomain.cpp.1503632-nss firefox-60.5.0/security/certverifier/NSSCertDBTrustDomain.cpp
---- firefox-60.5.0/security/certverifier/NSSCertDBTrustDomain.cpp.1503632-nss	2019-01-22 11:38:49.484365928 +0100
-+++ firefox-60.5.0/security/certverifier/NSSCertDBTrustDomain.cpp	2019-01-22 11:40:52.694779150 +0100
-@@ -1077,13 +1077,11 @@ SECStatus InitializeNSS(const nsACString
-   if (!loadPKCS11Modules) {
-     flags |= NSS_INIT_NOMODDB;
-   }
--  nsAutoCString dbTypeAndDirectory("sql:");
--  dbTypeAndDirectory.Append(dir);
-   MOZ_LOG(gCertVerifierLog, LogLevel::Debug,
--          ("InitializeNSS(%s, %d, %d)", dbTypeAndDirectory.get(), readOnly,
-+          ("InitializeNSS(%s, %d, %d)", PromiseFlatCString(dir).get(), readOnly,
-            loadPKCS11Modules));
-   SECStatus srv =
--      NSS_Initialize(dbTypeAndDirectory.get(), "", "", SECMOD_DB, flags);
-+      NSS_Initialize(PromiseFlatCString(dir).get(), "", "", SECMOD_DB, flags);
-   if (srv != SECSuccess) {
-     return srv;
-   }
diff --git a/SOURCES/rhbz-1821418.patch b/SOURCES/rhbz-1821418.patch
new file mode 100644
index 0000000..588084c
--- /dev/null
+++ b/SOURCES/rhbz-1821418.patch
@@ -0,0 +1,37 @@
+diff -up firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418 firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp
+--- firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp.rhbz-1821418	2020-04-03 21:30:08.000000000 +0200
++++ firefox-68.7.0/xpcom/base/AvailableMemoryTracker.cpp	2020-04-23 21:15:56.015491502 +0200
+@@ -147,8 +147,12 @@ bool nsAvailableMemoryWatcher::IsVirtual
+ 
+ /* static */
+ bool nsAvailableMemoryWatcher::IsCommitSpaceLow(const MEMORYSTATUSEX& aStat) {
+-  if ((kLowCommitSpaceThreshold != 0) &&
+-      (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) {
++  const char* threshold = getenv("MOZ_GC_THRESHOLD");
++  if (threshold) {
++    kLowCommitSpaceThreshold = atoi(threshold);
++  }
++
++  if ((kLowCommitSpaceThreshold == 0) || (aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) {
+     sNumLowCommitSpaceEvents++;
+     CrashReporter::AnnotateCrashReport(
+         CrashReporter::Annotation::LowCommitSpaceEvents,
+@@ -206,13 +210,16 @@ void nsAvailableMemoryWatcher::AdjustPol
+ // polling interval accordingly.
+ NS_IMETHODIMP
+ nsAvailableMemoryWatcher::Notify(nsITimer* aTimer) {
++  const char* threshold = getenv("MOZ_GC_THRESHOLD");
++  bool forceLowMem = (threshold && atoi(threshold) == 0);
++
+   MEMORYSTATUSEX stat;
+   stat.dwLength = sizeof(stat);
+   bool success = GlobalMemoryStatusEx(&stat);
+ 
+-  if (success) {
++  if (success || forceLowMem) {
+     bool lowMemory = IsVirtualMemoryLow(stat) || IsCommitSpaceLow(stat) ||
+-                     IsPhysicalMemoryLow(stat);
++                     IsPhysicalMemoryLow(stat) || forceLowMem;
+ 
+     if (lowMemory) {
+       SendMemoryPressureEvent();
diff --git a/SOURCES/xulrunner-24.0-jemalloc-ppc.patch b/SOURCES/xulrunner-24.0-jemalloc-ppc.patch
deleted file mode 100644
index c8fe421..0000000
--- a/SOURCES/xulrunner-24.0-jemalloc-ppc.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up firefox-60.5.0/memory/build/mozjemalloc.cpp.jemalloc-ppc firefox-60.5.0/memory/build/mozjemalloc.cpp
---- firefox-60.5.0/memory/build/mozjemalloc.cpp.jemalloc-ppc	2019-01-22 10:25:30.764207480 +0100
-+++ firefox-60.5.0/memory/build/mozjemalloc.cpp	2019-01-22 10:28:48.352235343 +0100
-@@ -180,7 +180,7 @@ using namespace mozilla;
- // Debug builds are opted out too, for test coverage.
- #ifndef MOZ_DEBUG
- #if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__) && \
--    !defined(__aarch64__)
-+    !defined(__aarch64__) && !defined(__powerpc__)
- #define MALLOC_STATIC_PAGESIZE 1
- #endif
- #endif
diff --git a/SPECS/firefox.spec b/SPECS/firefox.spec
index 0f8a222..6ab0762 100644
--- a/SPECS/firefox.spec
+++ b/SPECS/firefox.spec
@@ -96,7 +96,22 @@
 %global libvpx_version 1.4.0
 %endif
 
-%if %{?system_nss}
+%global rhel_minor_version -1
+%if "%{?dist}" == "el8"
+%global rhel_minor_version 3
+%endif
+%if "%{?dist}" == ".el8_2"
+%global rhel_minor_version 2
+%endif
+%if "%{?dist}" == ".el8_1"
+%global rhel_minor_version 1
+%endif
+%if "%{?dist}" == ".el8_0"
+%global rhel_minor_version 0
+%endif
+
+
+%if 0%{?system_nss}
 %global nspr_version 4.21
 # NSS/NSPR quite often ends in build override, so as requirement the version
 # we're building against could bring us some broken dependencies from time to time.
@@ -165,8 +180,8 @@
 
 Summary:        Mozilla Firefox Web browser
 Name:           firefox
-Version:        68.3.0
-Release:        1%{?pre_tag}%{?dist}
+Version:        68.9.0
+Release:        1%{?dist}
 URL:            https://www.mozilla.org/firefox/
 License:        MPLv1.1 or GPLv2+ or LGPLv2+
 %if 0%{?rhel} == 7
@@ -178,11 +193,15 @@ ExclusiveArch:  i686 x86_64 ppc64 s390x
 
 Source0:        https://hg.mozilla.org/releases/mozilla-release/archive/firefox-%{version}%{?pre_version}.source.tar.xz
 %if %{build_langpacks}
-Source1:        firefox-langpacks-%{version}%{?pre_version}-20191127.tar.xz
+Source1:        firefox-langpacks-%{version}%{?pre_version}-20200529.tar.xz
 %endif
 Source2:        cbindgen-vendor.tar.xz
 Source10:       firefox-mozconfig
+%if 0%{?centos}
+Source12:       firefox-centos-default-prefs.js
+%else
 Source12:       firefox-redhat-default-prefs.js
+%endif
 Source20:       firefox.desktop
 Source21:       firefox.sh.in
 Source23:       firefox.1
@@ -216,49 +235,52 @@ Patch1000:      python-2.7.patch
 Patch1001:      build-ppc64le-inline.patch
 Patch1002:      python-2.7-gcc8-fix.patch
 Patch1003:      python-missing-utimensat.patch
+Patch1004:      build-icu-make.patch
 # workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1699374
 Patch1:         no-rust-lto.patch
 Patch2:         rust-network-check.patch
-Patch3:         mozilla-build-arm.patch
 Patch4:         build-mozconfig-fix.patch
-Patch5:         build-gdk-version.patch
 Patch6:         build-nss-version.patch
 Patch7:         firefox-debugedits-error.patch
 Patch8:         firefox-dont-check-binary.patch
 Patch9:         nss-build-mozilla-1564499.patch
 Patch26:        build-icu-big-endian.patch
-# Also fixes s390x: https://bugzilla.mozilla.org/show_bug.cgi?id=1376268
-Patch29:        build-big-endian.patch
-# Always feel lucky for unsupported platforms:
-# https://bugzilla.mozilla.org/show_bug.cgi?id=1347128
-Patch37:        build-jit-atomic-always-lucky.patch
-Patch40:        build-aarch64-skia.patch
 Patch41:        build-debug-qcms.patch
-Patch43:        xulrunner-24.0-jemalloc-ppc.patch
-Patch45:        build-disable-elfhack.patch
 
 # Fedora/RHEL specific patches
 Patch215:        firefox-enable-addons.patch
 Patch219:        rhbz-1173156.patch
 Patch224:        mozilla-1170092.patch
-Patch225:        mozilla-1005640-accept-lang.patch
 #ARM run-time patch
 #Patch226:        rhbz-1354671.patch
-Patch230:        rhbz-1503632-nss.patch
 Patch231:        firefox-pipewire.patch
 Patch232:        firefox-rhel6-hugepage.patch
 Patch233:        firefox-rhel6-nss-tls1.3.patch
+Patch234:        rhbz-1821418.patch
+Patch235:        firefox-pipewire-0-3.patch
 
 # Upstream patches
 Patch402:        mozilla-1196777.patch
-Patch406:        mozilla-256180.patch
-#Patch413:        mozilla-1353817.patch
-Patch415:        mozilla-1436242.patch
 
 #Patch500:        debug.patch
 Patch501:        python-encode.patch
-
-# Debian patches
+Patch502:        mozilla-1603112-accept-lang.patch
+Patch503:        mozilla-s390-context.patch
+Patch504:        mozilla-nestegg-big-endian.patch
+Patch505:        mozilla-bmo1005535.patch
+Patch506:        mozilla-bmo1504834-part1.patch
+Patch507:        mozilla-bmo1504834-part2.patch
+Patch508:        mozilla-bmo1504834-part3.patch
+Patch509:        mozilla-bmo1504834-part4.patch
+Patch510:        mozilla-bmo1554971.patch
+Patch511:        mozilla-bmo1602730.patch
+Patch512:        mozilla-bmo849632.patch
+
+# CentOS patches
+%if 0%{?centos}
+Patch10000:      Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
+Patch10001:      Bug-1526653---fix_user_vfp_armv7.patch
+%endif
 
 %if %{?system_nss}
 BuildRequires:  pkgconfig(nspr) >= %{nspr_version}
@@ -315,6 +337,7 @@ BuildRequires:  llvm-toolset-%{llvm_version}-llvm-devel
 
 BuildRequires:  scl-utils
 
+
 %if 0%{?rhel} == 8
 BuildRequires:  cargo
 BuildRequires:  rust >= %{rust_version}
@@ -336,10 +359,8 @@ BuildRequires:  llvm-toolset-%{llvm_version}-llvm-devel
 %endif
 
 %if 0%{?use_bundled_python_2}
-#%if 0%{?rhel} == 6
 # Needed for Python in RHEL6
 BuildRequires:  openssl-devel
-#%endif
 %endif
 
 %if 0%{?rhel} == 8
@@ -476,7 +497,7 @@ https://extensions.gnome.org.
 
 %files -n firefox-gnome-shell-extension
 %{mozappdir}/distribution/extensions/chrome-gnome-shell@gnome.org.xpi
-%endif # bundle_gnome_extension
+%endif
 
 %prep
 %if 0%{?use_bundled_python_2}
@@ -503,40 +524,31 @@ https://extensions.gnome.org.
 %endif
 %patch9 -p1 -b .nss-build-mozilla-1564499
 
-#%patch29 -p1 -b .big-endian
-#%patch37 -p1 -b .jit-atomic-lucky
-#%patch40 -p1 -b .aarch64-skia
 %if %{?debug_build}
 %patch41 -p1 -b .build-debug-qcms
 %endif
-#%patch43 -p1 -b .jemalloc-ppc
 #%if 0%{?rhel} == 8
-#%patch45 -p1 -b .disable-elfhack
 #%endif
 
-#%patch3  -p1 -b .arm
 %patch4  -p1 -b .build-mozconfig-fix
-#%patch5  -p1 -b .gdk-version
 %patch6  -p1 -b .nss-version
 
 # Fedora patches
 %patch215 -p1 -b .addons
 %patch219 -p1 -b .rhbz-1173156
-#%patch224 -p1 -b .1170092
-#%patch225 -p1 -b .1005640-accept-lang
+%patch224 -p1 -b .1170092
 %if 0%{?rhel} == 8
+  %if 0%{?rhel_minor_version} >= 3
+%patch235 -p1 -b .pipewire-0-3
+  %else
 %patch231 -p1 -b .pipewire
+  %endif
 %endif
 %if 0%{?rhel} == 6
 %patch232 -p1 -b .hugepage
 %patch233 -p1 -b .rhel6-nss-tls1.3
 %endif
-
-# This ensures no migration of certdb to sqlite on the RHEL6 and RHEL7.
-# This needs to stay for the future releases
-%if 0%{?rhel} < 8
-#%patch230 -p1 -b .1503632-nss
-%endif
+%patch234 -p1 -b .rhbz-1821418
 
 #ARM run-time patch
 #%ifarch aarch64
@@ -544,10 +556,6 @@ https://extensions.gnome.org.
 #%endif
 
 %patch402 -p1 -b .1196777
-#%patch406 -p1 -b .256180
-#%patch413 -p1 -b .1353817
-#%patch415 -p1 -b .1436242
-
 
 # Patch for big endian platforms only
 %if 0%{?big_endian}
@@ -556,7 +564,25 @@ https://extensions.gnome.org.
 
 #%patch500 -p1 -b .debug
 %patch501 -p1 -b .python-encode
+%patch502 -p1 -b .1603112-accept-lang
+%patch503 -p1 -b .mozilla-s390-context
+%patch504 -p1 -b .mozilla-nestegg-big-endian
+%patch505 -p1 -b .mozilla-bmo1005535
+%patch506 -p1 -b .mozilla-bmo1504834-part1
+%patch507 -p1 -b .mozilla-bmo1504834-part2
+%patch508 -p1 -b .mozilla-bmo1504834-part3
+%patch509 -p1 -b .mozilla-bmo1504834-part4
+%patch510 -p1 -b .mozilla-bmo1554971
+%patch511 -p1 -b .mozilla-bmo1602730
+%patch512 -p1 -b .mozilla-bmo849632
 %patch1001 -p1 -b .ppc64le-inline
+%patch1004 -p1 -b .icu-make
+
+# CentOS patches
+%if 0%{?centos}
+%patch10000 -p1 -b .mozilla-1238661
+%patch10001 -p1 -b .mozilla-1526653
+%endif
 
 %{__rm} -f .mozconfig
 %{__cp} %{SOURCE10} .mozconfig
@@ -608,9 +634,9 @@ echo "ac_add_options --enable-system-hunspell" >> .mozconfig
 echo "ac_add_options --enable-debug" >> .mozconfig
 echo "ac_add_options --disable-optimize" >> .mozconfig
 %else
-%global optimize_flags "none"
-%ifnarch s390 s390x
 %global optimize_flags "-g -O2"
+%ifarch s390 s390x
+%global optimize_flags "-g -O1"
 %endif
 %ifarch armv7hl
 # ARMv7 need that (rhbz#1426850)
@@ -886,10 +912,11 @@ esac
 
 %if 0%{?big_endian}
 echo "Generate big endian version of config/external/icu/data/icud64l.dat"
-# ./mach python intl/icu_sources_data.py .
-# rm -f config/external/icu/data/icudt*l.dat
- mv config/external/icu/data/icudt64l.dat config/external/icu/data/icudt64b.dat
+ ./mach python intl/icu_sources_data.py .
+ rm -f config/external/icu/data/icudt*l.dat
+# mv config/external/icu/data/icudt64l.dat config/external/icu/data/icudt64b.dat
  ls -l config/external/icu/data
+ cat /tmp/icu-make*
 %endif
 
 mkdir %{_buildrootdir}/bin || :
@@ -1176,7 +1203,7 @@ create_default_langpack "pa-IN" "pa"
 create_default_langpack "pt-PT" "pt"
 create_default_langpack "sv-SE" "sv"
 create_default_langpack "zh-TW" "zh"
-%endif # build_langpacks
+%endif
 
 # Keep compatibility with the old preference location.
 %{__mkdir_p} %{buildroot}%{mozappdir}/defaults/preferences
@@ -1221,6 +1248,10 @@ sed -i -e "s/\[Crash Reporter\]/[Crash Reporter]\nEnabled=1/" %{buildroot}/%{moz
 %{__mkdir_p} %{buildroot}%{mozappdir}/distribution
 %{__cp} %{SOURCE26} %{buildroot}%{mozappdir}/distribution
 
+%if 0%{?centos}
+sed -i -e 's|Red Hat Enterprise|CentOS|' %{buildroot}%{mozappdir}/distribution/distribution.ini
+%endif
+
 # Remove copied libraries to speed up build
 rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libmozjs.so
 rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libmozalloc.so
@@ -1234,8 +1265,6 @@ chmod 644 %{buildroot}%{mozappdir}/distribution/extensions/chrome-gnome-shell@gn
 %endif
 #---------------------------------------------------------------------
 
-
-
 %preun
 # is it a final removal?
 if [ $1 -eq 0 ]; then
@@ -1298,11 +1327,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %{mozappdir}/browser/defaults/preferences
 %{mozappdir}/browser/features/*.xpi
 %{mozappdir}/distribution/distribution.ini
-# That's Windows only
-#%exclude %{mozappdir}/browser/features/aushelper@mozilla.org.xpi
 %attr(644, root, root) %{mozappdir}/browser/blocklist.xml
-#%dir %{mozappdir}/browser/extensions
-#%{mozappdir}/browser/extensions/*
 %if %{build_langpacks}
 %dir %{langpackdir}
 %endif
@@ -1359,6 +1384,47 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 #---------------------------------------------------------------------
 
 %changelog
+* Fri May 29 2020 Jan Horak <jhorak@redhat.com>
+- Update to 68.9.0 build1
+- Added patch for pipewire 0.3
+
+* Mon May 11 2020 Jan Horak <jhorak@redhat.com>
+- Added s390x specific patches
+
+* Wed Apr 29 2020 Jan Horak <jhorak@redhat.com>
+- Update to 68.8.0 build1
+
+* Thu Apr 23 2020 Martin Stransky <stransky@redhat.com> - 68.7.0-3
+- Added fix for rhbz#1821418
+
+* Tue Apr 07 2020 Jan Horak <jhorak@redhat.com> - 68.7.0-2
+- Update to 68.7.0 build3
+
+* Mon Apr  6 2020 Jan Horak <jhorak@redhat.com> - 68.6.1-1
+- Update to 68.6.1 ESR
+
+* Wed Mar 04 2020 Jan Horak <jhorak@redhat.com>
+- Update to 68.6.0 build1
+
+* Mon Feb 24 2020 Martin Stransky <stransky@redhat.com> - 68.5.0-3
+- Added fix for rhbz#1805667
+- Enabled mzbz@1170092 - Firefox prefs at /etc
+
+* Fri Feb 07 2020 Jan Horak <jhorak@redhat.com>
+- Update to 68.5.0 build2
+
+* Wed Feb 05 2020 Jan Horak <jhorak@redhat.com>
+- Update to 68.5.0 build1
+
+* Wed Jan 08 2020 Jan Horak <jhorak@redhat.com>
+- Update to 68.4.1esr build1
+
+* Fri Jan 03 2020 Jan Horak <jhorak@redhat.com>
+- Update to 68.4.0esr build1
+
+* Wed Dec 18 2019 Jan Horak <jhorak@redhat.com>
+- Fix for wrong intl.accept_lang when using non en-us langpack
+
 * Wed Nov 27 2019 Martin Stransky <stransky@redhat.com> - 68.3.0-1
 - Update to 68.3.0 ESR