# HG changeset patch
# Parent  b46973c75f6ab044c438cbd68de452675560cfe4

Index: firefox-102.1.0/config/system-headers.mozbuild
===================================================================
--- firefox-102.1.0.orig/config/system-headers.mozbuild
+++ firefox-102.1.0/config/system-headers.mozbuild
@@ -1024,8 +1024,6 @@ if CONFIG['MOZ_X11']:
         'X11/extensions/Print.h',
         'X11/extensions/scrnsaver.h',
         'X11/extensions/shape.h',
-        'X11/extensions/Xcomposite.h',
-        'X11/extensions/Xdamage.h',
         'X11/extensions/Xfixes.h',
         'X11/extensions/Xrandr.h',
         'X11/extensions/XShm.h',
Index: firefox-102.1.0/js/src/threading/posix/PosixThread.cpp
===================================================================
--- firefox-102.1.0.orig/js/src/threading/posix/PosixThread.cpp
+++ firefox-102.1.0/js/src/threading/posix/PosixThread.cpp
@@ -116,7 +116,8 @@ void ThisThread::SetName(const char* nam
 #elif defined(__NetBSD__)
   rv = pthread_setname_np(pthread_self(), "%s", (void*)name);
 #else
-  rv = pthread_setname_np(pthread_self(), name);
+//  rv = pthread_setname_np(pthread_self(), name);
+    rv = 0;
 #endif
   MOZ_RELEASE_ASSERT(!rv);
 }
Index: firefox-102.1.0/security/sandbox/linux/SandboxFilter.cpp
===================================================================
--- firefox-102.1.0.orig/security/sandbox/linux/SandboxFilter.cpp
+++ firefox-102.1.0/security/sandbox/linux/SandboxFilter.cpp
@@ -1264,9 +1264,10 @@ class ContentSandboxPolicy : public Sand
   Maybe<ResultExpr> EvaluateSocketCall(int aCall,
                                        bool aHasArgs) const override {
     switch (aCall) {
+#if defined(SYS_SENDMMSG)
       case SYS_SENDMMSG:  // libresolv via libasyncns; see bug 1355274
         return Some(Allow());
-
+#endif
 #ifdef ANDROID
       case SYS_SOCKET:
         return Some(Error(EACCES));
@@ -1929,10 +1930,11 @@ class SocketProcessSandboxPolicy final :
       case SYS_BIND:
         return Some(Allow());
 
+#if defined(SYS_SENDMMSG)
         // FIXME(bug 1641401) do we really need this?
       case SYS_SENDMMSG:
         return Some(Allow());
-
+#endif
       case SYS_GETSOCKOPT:
       case SYS_SETSOCKOPT:
       case SYS_GETSOCKNAME:
Index: firefox-102.1.0/security/sandbox/linux/SandboxReporterClient.cpp
===================================================================
--- firefox-102.1.0.orig/security/sandbox/linux/SandboxReporterClient.cpp
+++ firefox-102.1.0/security/sandbox/linux/SandboxReporterClient.cpp
@@ -49,7 +49,7 @@ SandboxReport SandboxReporterClient::Mak
   // sending uninitialized alignment padding to another process.
   PodZero(&report);
 
-  clock_gettime(CLOCK_MONOTONIC_COARSE, &report.mTime);
+  clock_gettime(CLOCK_MONOTONIC, &report.mTime);
   report.mPid = getpid();
   report.mTid = syscall(__NR_gettid);
   report.mProcType = mProcType;
Index: firefox-102.1.0/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
===================================================================
--- firefox-102.1.0.orig/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
+++ firefox-102.1.0/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
@@ -38,7 +38,7 @@ NS_IMPL_ISUPPORTS(SandboxReportWrapper,
 /* readonly attribute uint64_t msecAgo; */
 NS_IMETHODIMP SandboxReportWrapper::GetMsecAgo(uint64_t* aMsec) {
   struct timespec then = mReport.mTime, now = {0, 0};
-  clock_gettime(CLOCK_MONOTONIC_COARSE, &now);
+  clock_gettime(CLOCK_MONOTONIC, &now);
 
   const uint64_t now_msec = uint64_t(now.tv_sec) * 1000 + now.tv_nsec / 1000000;
   const uint64_t then_msec =
Index: firefox-102.1.0/third_party/libwebrtc/build/install-build-deps.sh
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/build/install-build-deps.sh
+++ firefox-102.1.0/third_party/libwebrtc/build/install-build-deps.sh
@@ -270,9 +270,7 @@ common_lib_list="\
   libx11-xcb1
   libxau6
   libxcb1
-  libxcomposite1
   libxcursor1
-  libxdamage1
   libxdmcp6
   libxext6
   libxfixes3
@@ -280,7 +278,6 @@ common_lib_list="\
   libxinerama1
   libxrandr2
   libxrender1
-  libxtst6
   zlib1g
 "
 
@@ -451,13 +448,10 @@ nacl_list="\
   libtinfo-dev:i386
   libtool
   libuuid1:i386
-  libxcomposite1:i386
   libxcursor1:i386
-  libxdamage1:i386
   libxi6:i386
   libxrandr2:i386
   libxss1:i386
-  libxtst6:i386
   texinfo
   xvfb
   ${naclports_list}
Index: firefox-102.1.0/third_party/libwebrtc/build/linux/sysroot_scripts/sysroot-creator-sid.sh
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/build/linux/sysroot_scripts/sysroot-creator-sid.sh
+++ firefox-102.1.0/third_party/libwebrtc/build/linux/sysroot_scripts/sysroot-creator-sid.sh
@@ -322,12 +322,8 @@ DEBIAN_PACKAGES="\
   libxcb-xfixes0
   libxcb1
   libxcb1-dev
-  libxcomposite-dev
-  libxcomposite1
   libxcursor-dev
   libxcursor1
-  libxdamage-dev
-  libxdamage1
   libxdmcp-dev
   libxdmcp6
   libxext-dev
@@ -354,8 +350,6 @@ DEBIAN_PACKAGES="\
   libxss1
   libxt-dev
   libxt6
-  libxtst-dev
-  libxtst6
   libxxf86vm-dev
   libxxf86vm1
   libzstd1
Index: firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/BUILD.gn
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/modules/desktop_capture/BUILD.gn
+++ firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/BUILD.gn
@@ -380,13 +380,10 @@ rtc_library("desktop_capture_generic") {
     ]
     libs = [
       "X11",
-      "Xcomposite",
-      "Xdamage",
       "Xext",
       "Xfixes",
       "Xrender",
       "Xrandr",
-      "Xtst",
     ]
   }
 
Index: firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
+++ firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
@@ -123,13 +123,10 @@ if CONFIG["OS_TARGET"] == "OpenBSD":
 
     OS_LIBS += [
         "X11",
-        "Xcomposite",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xrandr",
         "Xrender",
-        "Xtst"
     ]
 
     SOURCES += [
@@ -256,13 +253,10 @@ if CONFIG["CPU_ARCH"] == "ppc64":
 
     OS_LIBS += [
         "X11",
-        "Xcomposite",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xrandr",
         "Xrender",
-        "Xtst"
     ]
 
     UNIFIED_SOURCES += [
Index: firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
+++ firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
@@ -81,13 +81,10 @@ if CONFIG["OS_TARGET"] == "OpenBSD":
 
     OS_LIBS += [
         "X11",
-        "Xcomposite",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xrandr",
         "Xrender",
-        "Xtst"
     ]
 
 if CONFIG["OS_TARGET"] == "WINNT":
@@ -236,13 +233,10 @@ if CONFIG["CPU_ARCH"] == "x86_64" and CO
 
     OS_LIBS += [
         "X11",
-        "Xcomposite",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xrandr",
         "Xrender",
-        "Xtst"
     ]
 
 Library("desktop_capture_gn")
Index: firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/linux/screen_capturer_x11.cc
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/modules/desktop_capture/linux/screen_capturer_x11.cc
+++ firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/linux/screen_capturer_x11.cc
@@ -11,7 +11,6 @@
 #include "modules/desktop_capture/linux/screen_capturer_x11.h"
 
 #include <X11/Xlib.h>
-#include <X11/extensions/Xdamage.h>
 #include <X11/extensions/Xfixes.h>
 #include <X11/extensions/damagewire.h>
 #include <dlfcn.h>
@@ -43,10 +42,6 @@ ScreenCapturerX11::ScreenCapturerX11() {
 
 ScreenCapturerX11::~ScreenCapturerX11() {
   options_.x_display()->RemoveEventHandler(ConfigureNotify, this);
-  if (use_damage_) {
-    options_.x_display()->RemoveEventHandler(damage_event_base_ + XDamageNotify,
-                                             this);
-  }
   if (use_randr_) {
     options_.x_display()->RemoveEventHandler(
         randr_event_base_ + RRScreenChangeNotify, this);
@@ -112,39 +107,7 @@ void ScreenCapturerX11::InitXDamage() {
     return;
   }
 
-  // Check for XDamage extension.
-  if (!XDamageQueryExtension(display(), &damage_event_base_,
-                             &damage_error_base_)) {
-    RTC_LOG(LS_INFO) << "X server does not support XDamage.";
-    return;
-  }
-
-  // TODO(lambroslambrou): Disable DAMAGE in situations where it is known
-  // to fail, such as when Desktop Effects are enabled, with graphics
-  // drivers (nVidia, ATI) that fail to report DAMAGE notifications
-  // properly.
-
-  // Request notifications every time the screen becomes damaged.
-  damage_handle_ =
-      XDamageCreate(display(), root_window_, XDamageReportNonEmpty);
-  if (!damage_handle_) {
-    RTC_LOG(LS_ERROR) << "Unable to initialize XDamage.";
-    return;
-  }
-
-  // Create an XFixes server-side region to collate damage into.
-  damage_region_ = XFixesCreateRegion(display(), 0, 0);
-  if (!damage_region_) {
-    XDamageDestroy(display(), damage_handle_);
-    RTC_LOG(LS_ERROR) << "Unable to create XFixes region.";
-    return;
-  }
-
-  options_.x_display()->AddEventHandler(damage_event_base_ + XDamageNotify,
-                                        this);
-
-  use_damage_ = true;
-  RTC_LOG(LS_INFO) << "Using XDamage extension.";
+  RTC_LOG(LS_INFO) << "X server does not support XDamage extension.";
 }
 
 RTC_NO_SANITIZE("cfi-icall")
@@ -320,14 +283,7 @@ bool ScreenCapturerX11::SelectSource(Sou
 }
 
 bool ScreenCapturerX11::HandleXEvent(const XEvent& event) {
-  if (use_damage_ && (event.type == damage_event_base_ + XDamageNotify)) {
-    const XDamageNotifyEvent* damage_event =
-        reinterpret_cast<const XDamageNotifyEvent*>(&event);
-    if (damage_event->damage != damage_handle_)
-      return false;
-    RTC_DCHECK(damage_event->level == XDamageReportNonEmpty);
-    return true;
-  } else if (use_randr_ &&
+  if (use_randr_ &&
              event.type == randr_event_base_ + RRScreenChangeNotify) {
     XRRUpdateConfiguration(const_cast<XEvent*>(&event));
     UpdateMonitors();
@@ -352,36 +308,11 @@ std::unique_ptr<DesktopFrame> ScreenCapt
   // if any.  If there isn't a previous frame, that means a screen-resolution
   // change occurred, and |invalid_rects| will be updated to include the whole
   // screen.
-  if (use_damage_ && queue_.previous_frame())
-    SynchronizeFrame();
 
   DesktopRegion* updated_region = frame->mutable_updated_region();
 
   x_server_pixel_buffer_.Synchronize();
-  if (use_damage_ && queue_.previous_frame()) {
-    // Atomically fetch and clear the damage region.
-    XDamageSubtract(display(), damage_handle_, None, damage_region_);
-    int rects_num = 0;
-    XRectangle bounds;
-    XRectangle* rects = XFixesFetchRegionAndBounds(display(), damage_region_,
-                                                   &rects_num, &bounds);
-    for (int i = 0; i < rects_num; ++i) {
-      updated_region->AddRect(DesktopRect::MakeXYWH(
-          rects[i].x, rects[i].y, rects[i].width, rects[i].height));
-    }
-    XFree(rects);
-    helper_.InvalidateRegion(*updated_region);
-
-    // Capture the damaged portions of the desktop.
-    helper_.TakeInvalidRegion(updated_region);
-    updated_region->IntersectWith(selected_monitor_rect_);
-
-    for (DesktopRegion::Iterator it(*updated_region); !it.IsAtEnd();
-         it.Advance()) {
-      if (!x_server_pixel_buffer_.CaptureRect(it.rect(), frame.get()))
-        return nullptr;
-    }
-  } else {
+  {
     // Doing full-screen polling, or this is the first capture after a
     // screen-resolution change.  In either case, need a full-screen capture.
     if (!x_server_pixel_buffer_.CaptureRect(selected_monitor_rect_,
@@ -451,11 +382,6 @@ void ScreenCapturerX11::DeinitXlib() {
   x_server_pixel_buffer_.Release();
 
   if (display()) {
-    if (damage_handle_) {
-      XDamageDestroy(display(), damage_handle_);
-      damage_handle_ = 0;
-    }
-
     if (damage_region_) {
       XFixesDestroyRegion(display(), damage_region_);
       damage_region_ = 0;
Index: firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/linux/window_capturer_x11.cc
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/modules/desktop_capture/linux/window_capturer_x11.cc
+++ firefox-102.1.0/third_party/libwebrtc/modules/desktop_capture/linux/window_capturer_x11.cc
@@ -11,7 +11,6 @@
 #include "modules/desktop_capture/linux/window_capturer_x11.h"
 
 #include <X11/Xutil.h>
-#include <X11/extensions/Xcomposite.h>
 #include <X11/extensions/composite.h>
 #include <string.h>
 
@@ -36,16 +35,7 @@ WindowCapturerX11::WindowCapturerX11(con
     : x_display_(options.x_display()),
       atom_cache_(display()),
       window_finder_(&atom_cache_) {
-  int event_base, error_base, major_version, minor_version;
-  if (XCompositeQueryExtension(display(), &event_base, &error_base) &&
-      XCompositeQueryVersion(display(), &major_version, &minor_version) &&
-      // XCompositeNameWindowPixmap() requires version 0.2
-      (major_version > 0 || minor_version >= 2)) {
-    has_composite_extension_ = true;
-  } else {
-    RTC_LOG(LS_INFO) << "Xcomposite extension not available or too old.";
-  }
-
+  RTC_LOG(LS_INFO) << "Xcomposite extension not available or too old.";
   x_display_->AddEventHandler(ConfigureNotify, this);
 }
 
@@ -81,7 +71,7 @@ bool WindowCapturerX11::SelectSource(Sou
 
   // Redirect drawing to an offscreen buffer (ie, turn on compositing). X11
   // remembers who has requested this and will turn it off for us when we exit.
-  XCompositeRedirectWindow(display(), id, CompositeRedirectAutomatic);
+  // XCompositeRedirectWindow(display(), id, CompositeRedirectAutomatic);
 
   return true;
 }
Index: firefox-102.1.0/third_party/libwebrtc/peerconnection_client.target.mk
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/peerconnection_client.target.mk
+++ firefox-102.1.0/third_party/libwebrtc/peerconnection_client.target.mk
@@ -257,7 +257,6 @@ LIBS := \
 	-lrt \
 	-lglib-2.0 \
 	-lX11 \
-	-lXcomposite \
 	-lXext \
 	-lXrender \
 	-lexpat \
Index: firefox-102.1.0/third_party/libwebrtc/webrtc_gn/moz.build
===================================================================
--- firefox-102.1.0.orig/third_party/libwebrtc/webrtc_gn/moz.build
+++ firefox-102.1.0/third_party/libwebrtc/webrtc_gn/moz.build
@@ -98,13 +98,10 @@ if CONFIG["OS_TARGET"] == "OpenBSD":
 
     OS_LIBS += [
         "X11",
-        "Xcomposite",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xrandr",
         "Xrender",
-        "Xtst"
     ]
 
 if CONFIG["OS_TARGET"] == "WINNT":
@@ -189,13 +186,10 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["
 
     OS_LIBS += [
         "X11",
-        "Xcomposite",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xrandr",
         "Xrender",
-        "Xtst"
     ]
 
 if CONFIG["CPU_ARCH"] == "arm" and CONFIG["OS_TARGET"] == "Android":
Index: firefox-102.1.0/widget/gtk/nsShmImage.h
===================================================================
--- firefox-102.1.0.orig/widget/gtk/nsShmImage.h
+++ firefox-102.1.0/widget/gtk/nsShmImage.h
@@ -17,8 +17,10 @@
 #  include "nsIWidget.h"
 #  include "Units.h"
 
+extern "C" {
 #  include <X11/Xlib-xcb.h>
 #  include <xcb/shm.h>
+}
 
 class nsShmImage {
   // bug 1168843, compositor thread may create shared memory instances that are
Index: firefox-102.1.0/widget/nsXPLookAndFeel.cpp
===================================================================
--- firefox-102.1.0.orig/widget/nsXPLookAndFeel.cpp
+++ firefox-102.1.0/widget/nsXPLookAndFeel.cpp
@@ -425,7 +425,9 @@ void nsXPLookAndFeel::OnPrefChanged(cons
   }
 }
 
-static constexpr struct {
+// SLE-11: Our gcc8 chokes on this and we don't really need it to be a constexpr
+// static constexpr struct {
+static struct {
   nsLiteralCString mName;
   widget::ThemeChangeKind mChangeKind =
       widget::ThemeChangeKind::MediaQueriesOnly;
