# HG changeset patch
# Parent  a51bd264ec563271db93a126e23b3df4f4a8d7ee

diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1015,18 +1015,16 @@ system_headers = [
     'wx/log.h',
     'wx/toolbar.h',
     'wx/wx.h',
     'wx/xrc/xmlres.h',
     'X11/cursorfont.h',
     '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/Xrender.h',
     'X11/extensions/XShm.h',
     'X11/ImUtil.h',
     'X11/Intrinsic.h',
     'X11/keysymdef.h',
     'X11/keysym.h',
     'X11/Shell.h',
diff --git a/js/src/threading/posix/Thread.cpp b/js/src/threading/posix/Thread.cpp
--- a/js/src/threading/posix/Thread.cpp
+++ b/js/src/threading/posix/Thread.cpp
@@ -156,17 +156,18 @@ void js::ThisThread::SetName(const char*
 #ifdef XP_DARWIN
   rv = pthread_setname_np(name);
 #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
   pthread_set_name_np(pthread_self(), name);
   rv = 0;
 #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);
 }
 
 void js::ThisThread::GetName(char* nameBuffer, size_t len) {
   MOZ_RELEASE_ASSERT(len >= 16);
 
   int rv = -1;
diff --git a/media/webrtc/gn-configs/x64_True_x64_linux.json b/media/webrtc/gn-configs/x64_True_x64_linux.json
--- a/media/webrtc/gn-configs/x64_True_x64_linux.json
+++ b/media/webrtc/gn-configs/x64_True_x64_linux.json
@@ -5746,19 +5746,17 @@
                 "/media/libyuv/libyuv/include/",
                 "//",
                 "/home/dminor/src/firefox-signaling/obj-x86_64-pc-linux-gnu/media/webrtc/trunk/gn-output/gen/"
             ],
             "libs": [
                 "X11",
                 "X11-xcb",
                 "xcb",
-                "Xcomposite",
                 "Xcursor",
-                "Xdamage",
                 "Xext",
                 "Xfixes",
                 "Xi",
                 "Xrender",
                 "rt"
             ],
             "sources": [
                 "//webrtc/modules/desktop_capture/cropped_desktop_frame.cc",
@@ -8844,19 +8842,17 @@
                 "//webrtc/modules/audio_device/dummy/"
             ],
             "libs": [
                 "rt",
                 "m",
                 "X11",
                 "X11-xcb",
                 "xcb",
-                "Xcomposite",
                 "Xcursor",
-                "Xdamage",
                 "Xext",
                 "Xfixes",
                 "Xi",
                 "Xrender"
             ],
             "sources": [
                 "//webrtc/build/no_op_function.cc",
                 "//webrtc/call.h",
@@ -8937,9 +8933,9 @@
                 "//webrtc/common_types.h",
                 "//webrtc/config.cc",
                 "//webrtc/config.h",
                 "//webrtc/typedefs.h"
             ],
             "type": "static_library"
         }
     }
-}
\ No newline at end of file
+}
diff --git a/media/webrtc/gn-configs/x86_False_x86_linux.json b/media/webrtc/gn-configs/x86_False_x86_linux.json
--- a/media/webrtc/gn-configs/x86_False_x86_linux.json
+++ b/media/webrtc/gn-configs/x86_False_x86_linux.json
@@ -5905,19 +5905,17 @@
                 "/media/libyuv/libyuv/include/",
                 "//",
                 "/home/dminor/src/firefox-signaling/obj-x86_64-pc-linux-gnu/media/webrtc/trunk/gn-output/gen/"
             ],
             "libs": [
                 "X11",
                 "X11-xcb",
                 "xcb",
-                "Xcomposite",
                 "Xcursor",
-                "Xdamage",
                 "Xext",
                 "Xfixes",
                 "Xi",
                 "Xrender",
                 "rt"
             ],
             "sources": [
                 "//webrtc/modules/desktop_capture/cropped_desktop_frame.cc",
@@ -9090,19 +9088,17 @@
                 "//webrtc/modules/audio_device/dummy/"
             ],
             "libs": [
                 "rt",
                 "m",
                 "X11",
                 "X11-xcb",
                 "xcb",
-                "Xcomposite",
                 "Xcursor",
-                "Xdamage",
                 "Xext",
                 "Xfixes",
                 "Xi",
                 "Xrender"
             ],
             "sources": [
                 "//webrtc/build/no_op_function.cc",
                 "//webrtc/call.h",
diff --git a/media/webrtc/gn-configs/x86_True_x86_linux.json b/media/webrtc/gn-configs/x86_True_x86_linux.json
--- a/media/webrtc/gn-configs/x86_True_x86_linux.json
+++ b/media/webrtc/gn-configs/x86_True_x86_linux.json
@@ -5746,19 +5746,17 @@
                 "/media/libyuv/libyuv/include/",
                 "//",
                 "/home/dminor/src/firefox-signaling/obj-x86_64-pc-linux-gnu/media/webrtc/trunk/gn-output/gen/"
             ],
             "libs": [
                 "X11",
                 "X11-xcb",
                 "xcb",
-                "Xcomposite",
                 "Xcursor",
-                "Xdamage",
                 "Xext",
                 "Xfixes",
                 "Xi",
                 "Xrender",
                 "rt"
             ],
             "sources": [
                 "//webrtc/modules/desktop_capture/cropped_desktop_frame.cc",
@@ -8844,19 +8842,17 @@
                 "//webrtc/modules/audio_device/dummy/"
             ],
             "libs": [
                 "rt",
                 "m",
                 "X11",
                 "X11-xcb",
                 "xcb",
-                "Xcomposite",
                 "Xcursor",
-                "Xdamage",
                 "Xext",
                 "Xfixes",
                 "Xi",
                 "Xrender"
             ],
             "sources": [
                 "//webrtc/build/no_op_function.cc",
                 "//webrtc/call.h",
diff --git a/media/webrtc/trunk/build/config/linux/BUILD.gn b/media/webrtc/trunk/build/config/linux/BUILD.gn
--- a/media/webrtc/trunk/build/config/linux/BUILD.gn
+++ b/media/webrtc/trunk/build/config/linux/BUILD.gn
@@ -27,36 +27,30 @@ config("runtime_library") {
   }
 }
 
 config("x11") {
   libs = [
     "X11",
     "X11-xcb",
     "xcb",
-    "Xcomposite",
     "Xcursor",
-    "Xdamage",
     "Xext",
     "Xfixes",
     "Xi",
     "Xrender",
   ]
 
   if (!build_with_mozilla) {
     libs += [
       "Xtst",
     ]
   }
 }
 
-config("xcomposite") {
-  libs = [ "Xcomposite" ]
-}
-
 config("xext") {
   libs = [ "Xext" ]
 }
 
 config("xrandr") {
   libs = [ "Xrandr" ]
 }
 
diff --git a/media/webrtc/trunk/build/experimental/install-build-deps.py b/media/webrtc/trunk/build/experimental/install-build-deps.py
--- a/media/webrtc/trunk/build/experimental/install-build-deps.py
+++ b/media/webrtc/trunk/build/experimental/install-build-deps.py
@@ -135,19 +135,17 @@ SUPPORTED_UBUNTU_VERSIONS = (
   'libpng12-0',
   'libspeechd2',
   'libsqlite3-0',
   'libstdc++6',
   'libx11-6',
   'libx11-xcb1',
   'libxau6',
   'libxcb1',
-  'libxcomposite1',
   'libxcursor1',
-  'libxdamage1',
   'libxdmcp6',
   'libxext6',
   'libxfixes3',
   'libxi6',
   'libxinerama1',
   'libxrandr2',
   'libxrender1',
   'libxtst6',
@@ -166,19 +164,17 @@ SUPPORTED_UBUNTU_VERSIONS = (
   'libpango1.0-0-dbg',
   'libpcre3-dbg',
   'libpixman-1-0-dbg',
   'libsqlite3-0-dbg',
   'libx11-6-dbg',
   'libx11-xcb1-dbg',
   'libxau6-dbg',
   'libxcb1-dbg',
-  'libxcomposite1-dbg',
   'libxcursor1-dbg',
-  'libxdamage1-dbg',
   'libxdmcp6-dbg',
   'libxext6-dbg',
   'libxfixes3-dbg',
   'libxi6-dbg',
   'libxinerama1-dbg',
   'libxrandr2-dbg',
   'libxrender1-dbg',
   'libxtst6-dbg',
@@ -225,19 +221,17 @@ SUPPORTED_UBUNTU_VERSIONS = (
   'libgtk2.0-0:i386',
   'libncurses5:i386',
   'libnss3:i386',
   'libpango1.0-0:i386',
   'libssl1.0.0:i386',
   'libtinfo-dev',
   'libtinfo-dev:i386',
   'libtool',
-  'libxcomposite1:i386',
   'libxcursor1:i386',
-  'libxdamage1:i386',
   'libxi6:i386',
   'libxrandr2:i386',
   'libxss1:i386',
   'libxtst6:i386',
   'texinfo',
   'xvfb',
 )
 
diff --git a/media/webrtc/trunk/build/install-build-deps.sh b/media/webrtc/trunk/build/install-build-deps.sh
--- a/media/webrtc/trunk/build/install-build-deps.sh
+++ b/media/webrtc/trunk/build/install-build-deps.sh
@@ -244,19 +244,17 @@ lib_list="\
   libpixman-1-0
   libspeechd2
   libstdc++6
   libsqlite3-0
   libx11-6
   libx11-xcb1
   libxau6
   libxcb1
-  libxcomposite1
   libxcursor1
-  libxdamage1
   libxdmcp6
   libxext6
   libxfixes3
   libxi6
   libxinerama1
   libxrandr2
   libxrender1
   libxtst6
@@ -277,19 +275,17 @@ dbg_list="\
   libpango1.0-0-dbg
   libpcre3-dbg
   libpixman-1-0-dbg
   libsqlite3-0-dbg
   libx11-6-dbg
   libx11-xcb1-dbg
   libxau6-dbg
   libxcb1-dbg
-  libxcomposite1-dbg
   libxcursor1-dbg
-  libxdamage1-dbg
   libxdmcp6-dbg
   libxext6-dbg
   libxi6-dbg
   libxinerama1-dbg
   libxrandr2-dbg
   libxrender1-dbg
   libxtst6-dbg
   zlib1g-dbg
@@ -383,19 +379,17 @@ nacl_list="\
   libncurses5:i386
   lib32ncurses5-dev
   libnss3:i386
   libpango1.0-0:i386
   libssl-dev:i386
   libtinfo-dev
   libtinfo-dev:i386
   libtool
-  libxcomposite1:i386
   libxcursor1:i386
-  libxdamage1:i386
   libxi6:i386
   libxrandr2:i386
   libxss1:i386
   libxtst6:i386
   texinfo
   xvfb
   ${naclports_list}
 "
diff --git a/media/webrtc/trunk/gtest/moz.build b/media/webrtc/trunk/gtest/moz.build
--- a/media/webrtc/trunk/gtest/moz.build
+++ b/media/webrtc/trunk/gtest/moz.build
@@ -69,18 +69,16 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Li
         else:
             USE_LIBS += [
                 'libevent',
             ]
 
         OS_LIBS += [
             'rt',
             'X11',
-            'Xcomposite',
-            'Xdamage',
             'Xext',
             'Xfixes',
             'Xrandr',
             'Xrender',
         ]
     elif CONFIG['OS_TARGET'] == 'Darwin':
 
         LOCAL_INCLUDES += [
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build
@@ -86,19 +86,17 @@ if CONFIG["OS_TARGET"] == "DragonFly":
     DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
 
     OS_LIBS += [
         "X11",
         "X11-xcb",
         "xcb",
-        "Xcomposite",
         "Xcursor",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xi",
         "Xrender"
     ]
 
     UNIFIED_SOURCES += [
         "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc",
@@ -118,19 +116,17 @@ if CONFIG["OS_TARGET"] == "FreeBSD":
     DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
 
     OS_LIBS += [
         "X11",
         "X11-xcb",
         "xcb",
-        "Xcomposite",
         "Xcursor",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xi",
         "Xrender"
     ]
 
     UNIFIED_SOURCES += [
         "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc",
@@ -152,19 +148,17 @@ if CONFIG["OS_TARGET"] == "Linux":
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
 
     OS_LIBS += [
         "rt",
         "X11",
         "X11-xcb",
         "xcb",
-        "Xcomposite",
         "Xcursor",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xi",
         "Xrender"
     ]
 
     UNIFIED_SOURCES += [
         "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc",
@@ -184,19 +178,17 @@ if CONFIG["OS_TARGET"] == "NetBSD":
     DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
 
     OS_LIBS += [
         "X11",
         "X11-xcb",
         "xcb",
-        "Xcomposite",
         "Xcursor",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xi",
         "Xrender"
     ]
 
     UNIFIED_SOURCES += [
         "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc",
@@ -216,19 +208,17 @@ if CONFIG["OS_TARGET"] == "OpenBSD":
     DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
 
     OS_LIBS += [
         "X11",
         "X11-xcb",
         "xcb",
-        "Xcomposite",
         "Xcursor",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xi",
         "Xrender"
     ]
 
     UNIFIED_SOURCES += [
         "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc",
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
@@ -9,17 +9,16 @@
  */
 
 #include <string.h>
 
 #include <memory>
 #include <set>
 #include <utility>
 
-#include <X11/extensions/Xdamage.h>
 #include <X11/extensions/Xfixes.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
 #include "webrtc/base/checks.h"
 #include "webrtc/base/constructormagic.h"
 #include "webrtc/base/timeutils.h"
 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
@@ -94,17 +93,17 @@ class ScreenCapturerLinux : public Deskt
 
   // XFixes.
   bool has_xfixes_ = false;
   int xfixes_event_base_ = -1;
   int xfixes_error_base_ = -1;
 
   // XDamage information.
   bool use_damage_ = false;
-  Damage damage_handle_ = 0;
+  int damage_handle_ = 0;
   int damage_event_base_ = -1;
   int damage_error_base_ = -1;
   XserverRegion damage_region_ = 0;
 
   // Access to the X Server's pixel buffer.
   XServerPixelBuffer x_server_pixel_buffer_;
 
   // A thread-safe list of invalid rectangles, and the size of the most
@@ -122,20 +121,16 @@ class ScreenCapturerLinux : public Deskt
 };
 
 ScreenCapturerLinux::ScreenCapturerLinux() {
   helper_.SetLogGridSize(4);
 }
 
 ScreenCapturerLinux::~ScreenCapturerLinux() {
   options_.x_display()->RemoveEventHandler(ConfigureNotify, this);
-  if (use_damage_) {
-    options_.x_display()->RemoveEventHandler(
-        damage_event_base_ + XDamageNotify, this);
-  }
   DeinitXlib();
 }
 
 bool ScreenCapturerLinux::Init(const DesktopCaptureOptions& options) {
   options_ = options;
 
   root_window_ = RootWindow(display(), DefaultScreen(display()));
   if (root_window_ == BadValue) {
@@ -178,49 +173,17 @@ bool ScreenCapturerLinux::Init(const Des
 }
 
 void ScreenCapturerLinux::InitXDamage() {
   // Our use of XDamage requires XFixes.
   if (!has_xfixes_) {
     return;
   }
 
-  // Check for XDamage extension.
-  if (!XDamageQueryExtension(display(), &damage_event_base_,
-                             &damage_error_base_)) {
-    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_) {
-    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_);
-    LOG(LS_ERROR) << "Unable to create XFixes region.";
-    return;
-  }
-
-  options_.x_display()->AddEventHandler(
-      damage_event_base_ + XDamageNotify, this);
-
-  use_damage_ = true;
-  LOG(LS_INFO) << "Using XDamage extension.";
+  LOG(LS_INFO) << "X server does not support XDamage extension.";
 }
 
 void ScreenCapturerLinux::Start(Callback* callback) {
   RTC_DCHECK(!callback_);
   RTC_DCHECK(callback);
 
   callback_ = callback;
 }
@@ -276,24 +239,17 @@ bool ScreenCapturerLinux::GetSourceList(
 }
 
 bool ScreenCapturerLinux::SelectSource(SourceId id) {
   // TODO(jiayl): implement screen selection.
   return true;
 }
 
 bool ScreenCapturerLinux::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 (event.type == ConfigureNotify) {
+  if (event.type == ConfigureNotify) {
     ScreenConfigurationChanged();
     return true;
   }
   return false;
 }
 
 std::unique_ptr<DesktopFrame> ScreenCapturerLinux::CaptureScreen() {
   std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
@@ -302,51 +258,21 @@ std::unique_ptr<DesktopFrame> ScreenCapt
   // Pass the screen size to the helper, so it can clip the invalid region if it
   // expands that region to a grid.
   helper_.set_size_most_recent(frame->size());
 
   // In the DAMAGE case, ensure the frame is up-to-date with the previous frame
   // 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);
-
-    // Clip the damaged portions to the current screen size, just in case some
-    // spurious XDamage notifications were received for a previous (larger)
-    // screen size.
-    updated_region->IntersectWith(
-        DesktopRect::MakeSize(x_server_pixel_buffer_.window_size()));
-
-    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.
     DesktopRect screen_rect = DesktopRect::MakeSize(frame->size());
     x_server_pixel_buffer_.CaptureRect(screen_rect, frame.get());
     updated_region->SetRect(screen_rect);
   }
 
   return std::move(frame);
@@ -387,21 +313,16 @@ void ScreenCapturerLinux::DeinitXlib() {
   if (gc_) {
     XFreeGC(display(), gc_);
     gc_ = nullptr;
   }
 
   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;
     }
   }
 }
 
 }  // namespace
diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
@@ -6,17 +6,16 @@
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 #include <assert.h>
 #include <string.h>
 #include <X11/Xatom.h>
-#include <X11/extensions/Xcomposite.h>
 #include <X11/extensions/Xrender.h>
 #include <X11/Xutil.h>
 
 #include <algorithm>
 
 #include "webrtc/base/constructormagic.h"
 #include "webrtc/base/scoped_ref_ptr.h"
 #include "webrtc/modules/desktop_capture/desktop_capturer.h"
@@ -84,25 +83,17 @@ class WindowCapturerLinux : public Deskt
 WindowCapturerLinux::WindowCapturerLinux(const DesktopCaptureOptions& options)
     : x_display_(options.x_display()) {
   // Create Atoms so we don't need to do it every time they are used.
   wm_state_atom_ = XInternAtom(display(), "WM_STATE", True);
   window_type_atom_ = XInternAtom(display(), "_NET_WM_WINDOW_TYPE", True);
   normal_window_type_atom_ = XInternAtom(
       display(), "_NET_WM_WINDOW_TYPE_NORMAL", True);
 
-  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 {
-    LOG(LS_INFO) << "Xcomposite extension not available or too old.";
-  }
+  LOG(LS_INFO) << "Xcomposite extension not available or too old.";
 
   x_display_->AddEventHandler(ConfigureNotify, this);
 }
 
 WindowCapturerLinux::~WindowCapturerLinux() {
   x_display_->RemoveEventHandler(ConfigureNotify, this);
 }
 
@@ -170,17 +161,17 @@ bool WindowCapturerLinux::SelectSource(S
 
   // In addition to needing X11 server-side support for Xcomposite, it actually
   // needs to be turned on for the window. If the user has modern
   // hardware/drivers but isn't using a compositing window manager, that won't
   // be the case. Here we automatically turn it on.
 
   // 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;
 }
 
 bool WindowCapturerLinux::FocusOnSelectedSource() {
   if (!selected_window_)
     return false;
 
diff --git a/media/webrtc/trunk/webrtc/webrtc_gn/moz.build b/media/webrtc/trunk/webrtc/webrtc_gn/moz.build
--- a/media/webrtc/trunk/webrtc/webrtc_gn/moz.build
+++ b/media/webrtc/trunk/webrtc/webrtc_gn/moz.build
@@ -142,19 +142,17 @@ if CONFIG["OS_TARGET"] == "Linux":
     DEFINES["_FILE_OFFSET_BITS"] = "64"
 
     OS_LIBS += [
         "m",
         "rt",
         "X11",
         "X11-xcb",
         "xcb",
-        "Xcomposite",
         "Xcursor",
-        "Xdamage",
         "Xext",
         "Xfixes",
         "Xi",
         "Xrender"
     ]
 
 if CONFIG["OS_TARGET"] == "NetBSD":
 
diff --git a/old-configure.in b/old-configure.in
--- a/old-configure.in
+++ b/old-configure.in
@@ -2349,17 +2349,17 @@ AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_H
 
 if test -n "$MOZ_WEBRTC"; then
     MOZ_RAW=1
     MOZ_SCTP=1
     MOZ_SRTP=1
     AC_DEFINE(MOZ_SCTP)
     AC_DEFINE(MOZ_SRTP)
     if test -n "$MOZ_X11"; then
-      MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
+      MOZ_WEBRTC_X11_LIBS="-lXext -lXfixes"
     fi
 fi
 
 dnl ========================================================
 dnl = Force hardware AEC, disable webrtc.org AEC
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
 [  --enable-hardware-aec-ns   Enable support for hardware AEC and noise suppression],
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
--- a/security/sandbox/linux/SandboxFilter.cpp
+++ b/security/sandbox/linux/SandboxFilter.cpp
@@ -741,17 +741,17 @@ class ContentSandboxPolicy : public Sand
 
   ~ContentSandboxPolicy() override = default;
 
   Maybe<ResultExpr> EvaluateSocketCall(int aCall,
                                        bool aHasArgs) const override {
     switch (aCall) {
       case SYS_RECVFROM:
       case SYS_SENDTO:
-      case SYS_SENDMMSG:  // libresolv via libasyncns; see bug 1355274
+      //case SYS_SENDMMSG:  // libresolv via libasyncns; see bug 1355274
         return Some(Allow());
 
       case SYS_SOCKETPAIR: {
         // See bug 1066750.
         if (!aHasArgs) {
           // If this is a socketcall(2) platform, but the kernel also
           // supports separate syscalls (>= 4.2.0), we can unpack the
           // arguments and filter them.
diff --git a/security/sandbox/linux/SandboxReporterClient.cpp b/security/sandbox/linux/SandboxReporterClient.cpp
--- a/security/sandbox/linux/SandboxReporterClient.cpp
+++ b/security/sandbox/linux/SandboxReporterClient.cpp
@@ -44,17 +44,17 @@ SandboxReporterClient::SandboxReporterCl
 SandboxReport SandboxReporterClient::MakeReport(const void* aContext) {
   SandboxReport report;
   const auto ctx = static_cast<const ucontext_t*>(aContext);
 
   // Zero the entire struct; some memory safety analyses care about
   // 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;
   report.mSyscall = SECCOMP_SYSCALL(ctx);
   report.mArgs[0] = SECCOMP_PARM1(ctx);
   report.mArgs[1] = SECCOMP_PARM2(ctx);
   report.mArgs[2] = SECCOMP_PARM3(ctx);
   report.mArgs[3] = SECCOMP_PARM4(ctx);
diff --git a/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp b/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
--- a/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
+++ b/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
@@ -31,17 +31,17 @@ class SandboxReportWrapper final : publi
   SandboxReport mReport;
 };
 
 NS_IMPL_ISUPPORTS(SandboxReportWrapper, mozISandboxReport)
 
 /* 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 =
       uint64_t(then.tv_sec) * 1000 + then.tv_nsec / 1000000;
   MOZ_DIAGNOSTIC_ASSERT(now_msec >= then_msec);
   if (now_msec >= then_msec) {
     *aMsec = now_msec - then_msec;
   } else {
diff --git a/widget/nsShmImage.h b/widget/nsShmImage.h
--- a/widget/nsShmImage.h
+++ b/widget/nsShmImage.h
@@ -12,18 +12,20 @@
 #endif
 
 #ifdef MOZ_HAVE_SHMIMAGE
 
 #include "mozilla/gfx/2D.h"
 #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
   // destroyed by main thread on shutdown, so this must use thread-safe RC to
   // avoid hitting assertion
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsShmImage)
 
  public:
