--- a/MozillaFirefox/MozillaFirefox.changes Thu Dec 10 14:36:59 2020 +0100
+++ b/MozillaFirefox/MozillaFirefox.changes Sun Dec 27 10:49:49 2020 +0100
@@ -1,4 +1,55 @@
-------------------------------------------------------------------
+Sun Dec 13 18:18:58 UTC 2020 - Wolfgang Rosenauer <wr@rosenauer.org>
+
+- Mozilla Firefox 84.0
+ * Firefox 84 is the final release to support Adobe Flash
+ * WebRender is enabled by default when run on GNOME-based X11
+ Linux desktops
+ MFSA 2020-54 (bsc#1180039))
+ * CVE-2020-16042 (bmo#1679003)
+ Operations on a BigInt could have caused uninitialized memory
+ to be exposed
+ * CVE-2020-26971 (bmo#1663466)
+ Heap buffer overflow in WebGL
+ * CVE-2020-26972 (bmo#1671382)
+ Use-After-Free in WebGL
+ * CVE-2020-26973 (bmo#1680084)
+ CSS Sanitizer performed incorrect sanitization
+ * CVE-2020-26974 (bmo#1681022)
+ Incorrect cast of StyleGenericFlexBasis resulted in a heap
+ use-after-free
+ * CVE-2020-26975 (bmo#1661071)
+ Malicious applications on Android could have induced Firefox
+ for Android into sending arbitrary attacker-specified headers
+ * CVE-2020-26976 (bmo#1674343)
+ HTTPS pages could have been intercepted by a registered
+ service worker when they should not have been
+ * CVE-2020-26977 (bmo#1676311)
+ URL spoofing via unresponsive port in Firefox for Android
+ * CVE-2020-26978 (bmo#1677047)
+ Internal network hosts could have been probed by a malicious
+ webpage
+ * CVE-2020-26979 (bmo#1641287, bmo#1673299)
+ When entering an address in the address or search bars, a
+ website could have redirected the user before they were
+ navigated to the intended url
+ * CVE-2020-35111 (bmo#1657916)
+ The proxy.onRequest API did not catch view-source URLs
+ * CVE-2020-35112 (bmo#1661365)
+ Opening an extension-less download may have inadvertently
+ launched an executable instead
+ * CVE-2020-35113 (bmo#1664831, bmo#1673589)
+ Memory safety bugs fixed in Firefox 84 and Firefox ESR 78.6
+ * CVE-2020-35114 (bmo#1607449, bmo#1640416, bmo#1656459,
+ bmo#1669914, bmo#1673567)
+ Memory safety bugs fixed in Firefox 84
+- requires
+ NSS >= 3.59
+ rust >= 1.44
+ rust-cbindgen >= 0.15.0
+- remove revert-795c8762b16b.patch and replace with mozilla-pgo.patch
+
+-------------------------------------------------------------------
Sat Nov 21 08:12:17 UTC 2020 - Kirill Kirillov <kkirill@opensuse.org>
- Add/Enable GNOME search provider
--- a/MozillaFirefox/MozillaFirefox.spec Thu Dec 10 14:36:59 2020 +0100
+++ b/MozillaFirefox/MozillaFirefox.spec Sun Dec 27 10:49:49 2020 +0100
@@ -29,9 +29,9 @@
# orig_suffix b3
# major 69
# mainver %major.99
-%define major 83
+%define major 84
%define mainver %major.0
-%define orig_version 83.0
+%define orig_version 84.0
%define orig_suffix %{nil}
%define update_channel release
%define branding 1
@@ -92,7 +92,7 @@
%else
BuildRequires: gcc-c++
%endif
-BuildRequires: cargo >= 1.43
+BuildRequires: cargo >= 1.44
BuildRequires: ccache
BuildRequires: libXcomposite-devel
BuildRequires: libcurl-devel
@@ -101,7 +101,7 @@
BuildRequires: libproxy-devel
BuildRequires: makeinfo
BuildRequires: mozilla-nspr-devel >= 4.29
-BuildRequires: mozilla-nss-devel >= 3.58
+BuildRequires: mozilla-nss-devel >= 3.59
BuildRequires: nasm >= 2.14
BuildRequires: nodejs10 >= 10.22.1
%if 0%{?sle_version} >= 120000 && 0%{?sle_version} < 150000
@@ -111,8 +111,8 @@
BuildRequires: python3 >= 3.5
BuildRequires: python3-devel
%endif
-BuildRequires: rust >= 1.43
-BuildRequires: rust-cbindgen >= 0.14.3
+BuildRequires: rust >= 1.44
+BuildRequires: rust-cbindgen >= 0.15.0
BuildRequires: unzip
BuildRequires: update-desktop-files
BuildRequires: xorg-x11-libXt-devel
@@ -195,6 +195,7 @@
Patch7: mozilla-fix-aarch64-libopus.patch
Patch8: mozilla-disable-wasm-emulate-arm-unaligned-fp-access.patch
Patch9: mozilla-s390-context.patch
+Patch10: mozilla-pgo.patch
Patch11: mozilla-reduce-rust-debuginfo.patch
Patch13: mozilla-bmo1005535.patch
Patch14: mozilla-bmo1568145.patch
@@ -212,7 +213,6 @@
Patch26: mozilla-bmo1626236.patch
Patch27: mozilla-s390x-skia-gradient.patch
Patch28: mozilla-libavcodec58_91.patch
-Patch29: revert-795c8762b16b.patch
# Firefox/browser
Patch101: firefox-kde.patch
Patch102: firefox-branded-icons.patch
@@ -335,6 +335,7 @@
%patch7 -p1
%patch8 -p1
%patch9 -p1
+%patch10 -p1
%patch11 -p1
%patch13 -p1
%patch14 -p1
@@ -354,7 +355,6 @@
%patch26 -p1
%patch27 -p1
%patch28 -p1
-%patch29 -p1 -R
# Firefox
%patch101 -p1
%patch102 -p1
@@ -536,7 +536,6 @@
# build additional locales
%if %localize
-mkdir -p %{buildroot}%{progdir}/browser/extensions
truncate -s 0 %{_tmppath}/translations.{common,other}
# langpack-build can not be done in parallel easily (see https://bugzilla.mozilla.org/show_bug.cgi?id=1660943)
# Therefore, we have to have a separate obj-dir for each language
@@ -562,6 +561,7 @@
%else
%define njobs 0%{?jobs:%jobs}
%endif
+mkdir -p $RPM_BUILD_DIR/langpacks_artifacts/
sed -r '/^(ja-JP-mac|ga-IE|en-US|)$/d;s/ .*$//' $RPM_BUILD_DIR/%{srcname}-%{orig_version}/browser/locales/shipped-locales \
| xargs -n 1 %{?njobs:-P %njobs} -I {} /bin/sh -c '
locale=$1
@@ -571,10 +571,7 @@
# nsinstall is needed for langpack-build. It is already built by `./mach build`, but building it again is very fast
./mach build config/nsinstall langpack-$locale
cp -L ../obj_$locale/dist/linux-*/xpi/firefox-%{orig_version}.$locale.langpack.xpi \
- %{buildroot}%{progdir}/browser/extensions/langpack-$locale@firefox.mozilla.org.xpi
- # remove prefs, profile defaults, and hyphenation from langpack
- #rm -rf %{buildroot}%{progdir}/browser/extensions/langpack-$locale@firefox.mozilla.org/defaults
- #rm -rf %{buildroot}%{progdir}/browser/extensions/langpack-$locale@firefox.mozilla.org/hyphenation
+ $RPM_BUILD_DIR/langpacks_artifacts/langpack-$locale@firefox.mozilla.org.xpi
# check against the fixed common list and sort into the right filelist
_matched=0
for _match in ar ca cs da de el en-GB es-AR es-CL es-ES fi fr hu it ja ko nb-NO nl pl pt-BR pt-PT ru sv-SE zh-CN zh-TW; do
@@ -604,6 +601,8 @@
# copy tree into RPM_BUILD_ROOT
mkdir -p %{buildroot}%{progdir}
cp -rf $RPM_BUILD_DIR/obj/dist/%{srcname}/* %{buildroot}%{progdir}
+mkdir -p %{buildroot}%{progdir}/browser/extensions
+cp -rf $RPM_BUILD_DIR/langpacks_artifacts/* %{buildroot}%{progdir}/browser/extensions/
mkdir -p %{buildroot}%{progdir}/distribution/extensions
mkdir -p %{buildroot}%{progdir}/browser/defaults/preferences/
# renaming executables (for regular vs. ESR)
--- a/MozillaFirefox/mozilla-fix-top-level-asm.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/MozillaFirefox/mozilla-fix-top-level-asm.patch Sun Dec 27 10:49:49 2020 +0100
@@ -1,42 +1,1 @@
-From 91bb79836ee274855393bdf6ab10e24899b1b349 Mon Sep 17 00:00:00 2001
-From: Martin Liska <mliska@suse.cz>
-Date: Fri, 17 May 2019 14:41:35 +0200
-Subject: [PATCH] Fix top-level asm issue.
-
----
- security/sandbox/linux/moz.build | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build
-index aae85843e9f6..208368dfd189 100644
---- a/security/sandbox/linux/moz.build
-+++ b/security/sandbox/linux/moz.build
-@@ -61,7 +61,6 @@ UNIFIED_SOURCES += [
- '../chromium/sandbox/linux/bpf_dsl/policy_compiler.cc',
- '../chromium/sandbox/linux/bpf_dsl/syscall_set.cc',
- '../chromium/sandbox/linux/seccomp-bpf/die.cc',
-- '../chromium/sandbox/linux/seccomp-bpf/syscall.cc',
- 'broker/SandboxBrokerCommon.cpp',
- 'Sandbox.cpp',
- 'SandboxBrokerClient.cpp',
-@@ -77,6 +76,7 @@ UNIFIED_SOURCES += [
- SOURCES += [
- '../chromium/base/strings/safe_sprintf.cc',
- '../chromium/base/third_party/icu/icu_utf.cc',
-+ '../chromium/sandbox/linux/seccomp-bpf/syscall.cc',
- '../chromium/sandbox/linux/seccomp-bpf/trap.cc',
- '../chromium/sandbox/linux/services/syscall_wrappers.cc',
- ]
-@@ -96,6 +96,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
- SOURCES['../chromium/sandbox/linux/services/syscall_wrappers.cc'].flags += [
- '-Wno-empty-body',
- ]
-+ SOURCES['../chromium/sandbox/linux/seccomp-bpf/syscall.cc'].flags += [
-+ '-fno-lto'
-+ ]
-
- # gcc lto likes to put the top level asm in syscall.cc in a different partition
- # from the function using it which breaks the build. Work around that by
---
-2.23.0
-
+../mozilla-fix-top-level-asm.patch
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-pgo.patch Sun Dec 27 10:49:49 2020 +0100
@@ -0,0 +1,1 @@
+../mozilla-pgo.patch
\ No newline at end of file
--- a/MozillaFirefox/revert-795c8762b16b.patch Thu Dec 10 14:36:59 2020 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-../revert-795c8762b16b.patch
\ No newline at end of file
--- a/MozillaFirefox/tar_stamps Thu Dec 10 14:36:59 2020 +0100
+++ b/MozillaFirefox/tar_stamps Sun Dec 27 10:49:49 2020 +0100
@@ -1,11 +1,11 @@
PRODUCT="firefox"
CHANNEL="release"
-VERSION="83.0"
+VERSION="84.0"
VERSION_SUFFIX=""
-PREV_VERSION="82.0.3"
+PREV_VERSION="83.0"
PREV_VERSION_SUFFIX=""
#SKIP_LOCALES="" # Uncomment to skip l10n and compare-locales-generation
RELEASE_REPO="https://hg.mozilla.org/releases/mozilla-release"
-RELEASE_TAG="55359edc5d1cb8addecf9d2e7151782da543f67b"
-RELEASE_TIMESTAMP="20201112153044"
+RELEASE_TAG="98507f230e7442065b287ced065ac77d4d8ea35d"
+RELEASE_TIMESTAMP="20201211215739"
--- a/firefox-kde.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/firefox-kde.patch Sun Dec 27 10:49:49 2020 +0100
@@ -3,7 +3,7 @@
# Date 1559300151 -7200
# Fri May 31 12:55:51 2019 +0200
# Node ID 54d41b0033b8d649d842a1f862c6fed8b9874dec
-# Parent 3804871eac4171b99e9049dbc881b5304b5ac207
+# Parent 8310cc1a162e9dd066a20f6a3bbd271993b67fc6
How to apply this patch:
1. Import and apply it
2. cp browser/base/content/browser.xul browser/base/content/browser-kde.xul
@@ -14,7 +14,7 @@
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
-@@ -335,16 +335,23 @@ var gMainPane = {
+@@ -347,16 +347,23 @@ var gMainPane = {
}, backoffTimes[this._backoffIndex + 1 < backoffTimes.length ? this._backoffIndex++ : backoffTimes.length - 1]);
};
@@ -38,7 +38,7 @@
);
let performanceSettingsUrl =
Services.urlFormatter.formatURLPref("app.support.baseURL") +
-@@ -1291,16 +1298,27 @@ var gMainPane = {
+@@ -1326,16 +1333,27 @@ var gMainPane = {
this._backoffIndex = 0;
let shellSvc = getShellService();
@@ -69,24 +69,24 @@
diff --git a/browser/components/shell/moz.build b/browser/components/shell/moz.build
--- a/browser/components/shell/moz.build
+++ b/browser/components/shell/moz.build
-@@ -34,16 +34,18 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
+@@ -32,16 +32,18 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "coco
]
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
XPIDL_SOURCES += [
- 'nsIGNOMEShellService.idl',
+ "nsIGNOMEShellService.idl",
]
SOURCES += [
- 'nsGNOMEShellService.cpp',
-+ 'nsKDEShellService.cpp',
-+ 'nsUnixShellService.cpp',
+ "nsGNOMEShellService.cpp",
++ "nsKDEShellService.cpp",
++ "nsUnixShellService.cpp",
]
- if CONFIG['MOZ_ENABLE_DBUS']:
+ if CONFIG["MOZ_ENABLE_DBUS"]:
SOURCES += [
- 'nsGNOMEShellDBusHelper.cpp',
- 'nsGNOMEShellSearchProvider.cpp',
+ "nsGNOMEShellDBusHelper.cpp",
+ "nsGNOMEShellSearchProvider.cpp",
]
- include('/ipc/chromium/chromium-config.mozbuild')
+ include("/ipc/chromium/chromium-config.mozbuild")
diff --git a/browser/components/shell/nsKDEShellService.cpp b/browser/components/shell/nsKDEShellService.cpp
new file mode 100644
--- a/mozilla-bmo1512162.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/mozilla-bmo1512162.patch Sun Dec 27 10:49:49 2020 +0100
@@ -1,12 +1,12 @@
# HG changeset patch
-# Parent e42a036a5533ea6a60ebc22fd2a150c384d42fda
+# Parent f9f5af4c88f2f3172a4f30d7e42bd2131bf24146
This fixes a broken build for gcc < 9 on ppc64le.
This patch can be removed for newer gcc-versions.
diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
-@@ -1080,17 +1080,21 @@ class MOZ_STACK_CLASS CallMethodHelper f
+@@ -1072,17 +1072,21 @@ class MOZ_STACK_CLASS CallMethodHelper f
uint32_t* result);
MOZ_ALWAYS_INLINE bool GetInterfaceTypeFromParam(const nsXPTType& type,
@@ -29,7 +29,7 @@
paramIndex += 1;
}
if (paramIndex >= mOptArgcIndex) {
-@@ -1127,17 +1131,21 @@ class MOZ_STACK_CLASS CallMethodHelper f
+@@ -1119,17 +1123,21 @@ class MOZ_STACK_CLASS CallMethodHelper f
{
// Success checked later.
--- a/mozilla-bmo1568145.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/mozilla-bmo1568145.patch Sun Dec 27 10:49:49 2020 +0100
@@ -28,12 +28,12 @@
ManifestLocale,
parse_manifest,
)
-@@ -94,17 +95,17 @@ def get_dt_from_hg(path):
+@@ -100,17 +101,17 @@ def get_dt_from_hg(path):
# ts == "20170914215617"
###
def get_timestamp_for_locale(path):
dt = None
- if os.path.isdir(os.path.join(path, '.hg')):
+ if os.path.isdir(os.path.join(path, ".hg")):
dt = get_dt_from_hg(path)
if dt is None:
--- a/mozilla-fix-top-level-asm.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/mozilla-fix-top-level-asm.patch Sun Dec 27 10:49:49 2020 +0100
@@ -10,48 +10,48 @@
diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build
--- a/security/sandbox/linux/moz.build
+++ b/security/sandbox/linux/moz.build
-@@ -56,32 +56,32 @@ UNIFIED_SOURCES += [
- '../chromium/base/time/time_now_posix.cc',
- '../chromium/sandbox/linux/bpf_dsl/bpf_dsl.cc',
- '../chromium/sandbox/linux/bpf_dsl/codegen.cc',
- '../chromium/sandbox/linux/bpf_dsl/dump_bpf.cc',
- '../chromium/sandbox/linux/bpf_dsl/policy.cc',
- '../chromium/sandbox/linux/bpf_dsl/policy_compiler.cc',
- '../chromium/sandbox/linux/bpf_dsl/syscall_set.cc',
- '../chromium/sandbox/linux/seccomp-bpf/die.cc',
-- '../chromium/sandbox/linux/seccomp-bpf/syscall.cc',
- 'broker/SandboxBrokerCommon.cpp',
- 'Sandbox.cpp',
- 'SandboxBrokerClient.cpp',
- 'SandboxFilter.cpp',
- 'SandboxFilterUtil.cpp',
- 'SandboxHooks.cpp',
- 'SandboxInfo.cpp',
- 'SandboxLogging.cpp',
- 'SandboxOpenedFiles.cpp',
- 'SandboxReporterClient.cpp',
+@@ -66,32 +66,32 @@ UNIFIED_SOURCES += [
+ "../chromium/base/time/time_now_posix.cc",
+ "../chromium/sandbox/linux/bpf_dsl/bpf_dsl.cc",
+ "../chromium/sandbox/linux/bpf_dsl/codegen.cc",
+ "../chromium/sandbox/linux/bpf_dsl/dump_bpf.cc",
+ "../chromium/sandbox/linux/bpf_dsl/policy.cc",
+ "../chromium/sandbox/linux/bpf_dsl/policy_compiler.cc",
+ "../chromium/sandbox/linux/bpf_dsl/syscall_set.cc",
+ "../chromium/sandbox/linux/seccomp-bpf/die.cc",
+- "../chromium/sandbox/linux/seccomp-bpf/syscall.cc",
+ "broker/SandboxBrokerCommon.cpp",
+ "Sandbox.cpp",
+ "SandboxBrokerClient.cpp",
+ "SandboxFilter.cpp",
+ "SandboxFilterUtil.cpp",
+ "SandboxHooks.cpp",
+ "SandboxInfo.cpp",
+ "SandboxLogging.cpp",
+ "SandboxOpenedFiles.cpp",
+ "SandboxReporterClient.cpp",
]
SOURCES += [
- '../chromium/base/strings/safe_sprintf.cc',
- '../chromium/base/third_party/icu/icu_utf.cc',
-+ '../chromium/sandbox/linux/seccomp-bpf/syscall.cc',
- '../chromium/sandbox/linux/seccomp-bpf/trap.cc',
- '../chromium/sandbox/linux/services/syscall_wrappers.cc',
+ "../chromium/base/strings/safe_sprintf.cc",
+ "../chromium/base/third_party/icu/icu_utf.cc",
++ "../chromium/sandbox/linux/seccomp-bpf/syscall.cc",
+ "../chromium/sandbox/linux/seccomp-bpf/trap.cc",
+ "../chromium/sandbox/linux/services/syscall_wrappers.cc",
]
# This copy of SafeSPrintf doesn't need to avoid the Chromium logging
# dependency like the one in libxul does, but this way the behavior is
# consistent. See also the comment in SandboxLogging.h.
- SOURCES['../chromium/base/strings/safe_sprintf.cc'].flags += ['-DNDEBUG']
-@@ -91,16 +91,19 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
- SOURCES['../chromium/base/third_party/icu/icu_utf.cc'].flags += ['-Wno-implicit-fallthrough']
- SOURCES['../chromium/sandbox/linux/seccomp-bpf/trap.cc'].flags += ['-Wno-unreachable-code-return']
+ SOURCES["../chromium/base/strings/safe_sprintf.cc"].flags += ["-DNDEBUG"]
+@@ -105,16 +105,19 @@ if CONFIG["CC_TYPE"] in ("clang", "gcc")
+ "-Wno-unreachable-code-return"
+ ]
- if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
- CXXFLAGS += ['-Wno-shadow']
- SOURCES['../chromium/sandbox/linux/services/syscall_wrappers.cc'].flags += [
- '-Wno-empty-body',
+ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
+ CXXFLAGS += ["-Wno-shadow"]
+ SOURCES["../chromium/sandbox/linux/services/syscall_wrappers.cc"].flags += [
+ "-Wno-empty-body",
]
+ SOURCES['../chromium/sandbox/linux/seccomp-bpf/syscall.cc'].flags += [
+ '-fno-lto'
@@ -60,7 +60,7 @@
# gcc lto likes to put the top level asm in syscall.cc in a different partition
# from the function using it which breaks the build. Work around that by
# forcing there to be only one partition.
- for f in CONFIG['OS_CXXFLAGS']:
- if f.startswith('-flto') and CONFIG['CC_TYPE'] != 'clang':
- LDFLAGS += ['--param lto-partitions=1']
+ for f in CONFIG["OS_CXXFLAGS"]:
+ if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
+ LDFLAGS += ["--param lto-partitions=1"]
--- a/mozilla-kde.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/mozilla-kde.patch Sun Dec 27 10:49:49 2020 +0100
@@ -3,7 +3,7 @@
# Date 1559294891 -7200
# Fri May 31 11:28:11 2019 +0200
# Node ID c2aa7198fb925e7fde96abf65b6f68b9b755f112
-# Parent e89d21ead66fbb34b6349edda42748a3ad9e6136
+# Parent 4b9aa59b15c3247d263cc32804786b3a6bff7912
Description: Add KDE integration to Firefox (toolkit parts)
Author: Wolfgang Rosenauer <wolfgang@rosenauer.org>
Author: Lubos Lunak <lunak@suse.com>
@@ -13,7 +13,7 @@
diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
-@@ -83,16 +83,17 @@
+@@ -82,16 +82,17 @@
#include "nsXPCOM.h"
#include "nsXULAppAPI.h"
#include "nsZipArchive.h"
@@ -31,7 +31,7 @@
#ifdef MOZ_MEMORY
# include "mozmemory.h"
#endif
-@@ -4536,25 +4537,37 @@ nsresult Preferences::InitInitialObjects
+@@ -4459,25 +4460,37 @@ nsresult Preferences::InitInitialObjects
// application pref files for backwards compatibility.
static const char* specialFiles[] = {
#if defined(XP_MACOSX)
@@ -69,7 +69,7 @@
// Load jar:$app/omni.jar!/defaults/preferences/*.js
// or jar:$gre/omni.jar!/defaults/preferences/*.js.
-@@ -4600,17 +4613,17 @@ nsresult Preferences::InitInitialObjects
+@@ -4523,17 +4536,17 @@ nsresult Preferences::InitInitialObjects
}
nsCOMPtr<nsIFile> path = do_QueryInterface(elem);
@@ -91,13 +91,13 @@
diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build
--- a/modules/libpref/moz.build
+++ b/modules/libpref/moz.build
-@@ -118,16 +118,20 @@ EXPORTS.mozilla += [
+@@ -116,16 +116,20 @@ EXPORTS.mozilla += [
]
- EXPORTS.mozilla += sorted(['!' + g for g in gen_h])
+ EXPORTS.mozilla += sorted(["!" + g for g in gen_h])
UNIFIED_SOURCES += [
- 'Preferences.cpp',
- 'SharedPrefMap.cpp',
+ "Preferences.cpp",
+ "SharedPrefMap.cpp",
]
+LOCAL_INCLUDES += [
@@ -106,52 +106,52 @@
+
gen_all_tuple = tuple(gen_h + gen_cpp + gen_rs)
- GeneratedFile(*gen_all_tuple, script='init/generate_static_pref_list.py',
- entry_point='emit_code', inputs=['init/StaticPrefList.yaml'])
-
- PYTHON_UNITTEST_MANIFESTS += [
- 'test/python.ini',
- ]
+ GeneratedFile(
+ *gen_all_tuple,
+ script="init/generate_static_pref_list.py",
+ entry_point="emit_code",
+ inputs=["init/StaticPrefList.yaml"]
+ )
diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py
--- a/python/mozbuild/mozpack/chrome/flags.py
+++ b/python/mozbuild/mozpack/chrome/flags.py
-@@ -227,16 +227,17 @@ class Flags(OrderedDict):
- 'contentaccessible': Flag,
- 'os': StringFlag,
- 'osversion': VersionFlag,
- 'abi': StringFlag,
- 'platform': Flag,
- 'xpcnativewrappers': Flag,
- 'tablet': Flag,
- 'process': StringFlag,
-+ 'desktop': StringFlag,
+@@ -228,16 +228,17 @@ class Flags(OrderedDict):
+ "contentaccessible": Flag,
+ "os": StringFlag,
+ "osversion": VersionFlag,
+ "abi": StringFlag,
+ "platform": Flag,
+ "xpcnativewrappers": Flag,
+ "tablet": Flag,
+ "process": StringFlag,
++ "desktop": StringFlag,
}
- RE = re.compile(r'([!<>=]+)')
+ RE = re.compile(r"([!<>=]+)")
def __init__(self, *flags):
- '''
+ """
Initialize a set of flags given in string form.
flags = Flags('contentaccessible=yes', 'appversion>=3.5')
- '''
+ """
diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
--- a/python/mozbuild/mozpack/chrome/manifest.py
+++ b/python/mozbuild/mozpack/chrome/manifest.py
-@@ -37,16 +37,17 @@ class ManifestEntry(object):
- 'platformversion',
- 'os',
- 'osversion',
- 'abi',
- 'xpcnativewrappers',
- 'tablet',
- 'process',
- 'contentaccessible',
-+ 'desktop',
+@@ -38,16 +38,17 @@ class ManifestEntry(object):
+ "platformversion",
+ "os",
+ "osversion",
+ "abi",
+ "xpcnativewrappers",
+ "tablet",
+ "process",
+ "contentaccessible",
++ "desktop",
]
def __init__(self, base, *flags):
- '''
+ """
Initialize a manifest entry with the given base path and flags.
- '''
+ """
self.base = base
self.flags = Flags(*flags)
diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
@@ -159,23 +159,23 @@
+++ b/toolkit/components/downloads/moz.build
@@ -45,10 +45,14 @@ XPCOM_MANIFESTS += [
- if CONFIG['MOZ_PLACES']:
+ if CONFIG["MOZ_PLACES"]:
EXTRA_JS_MODULES += [
- 'DownloadHistory.jsm',
+ "DownloadHistory.jsm",
]
- FINAL_LIBRARY = 'xul'
+ FINAL_LIBRARY = "xul"
+LOCAL_INCLUDES += [
+ '/toolkit/xre'
+]
+
- with Files('**'):
- BUG_COMPONENT = ('Toolkit', 'Downloads API')
+ with Files("**"):
+ BUG_COMPONENT = ("Toolkit", "Downloads API")
diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm
--- a/toolkit/mozapps/downloads/HelperAppDlg.jsm
+++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm
-@@ -1239,36 +1239,66 @@ nsUnknownContentTypeDialog.prototype = {
+@@ -1243,36 +1243,66 @@ nsUnknownContentTypeDialog.prototype = {
params.handlerApp &&
params.handlerApp.executable &&
params.handlerApp.executable.isFile()
@@ -356,26 +356,26 @@
diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
--- a/toolkit/xre/moz.build
+++ b/toolkit/xre/moz.build
-@@ -90,17 +90,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
- '../components/printingui',
+@@ -91,17 +91,19 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "co
+ "../components/printingui",
]
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
UNIFIED_SOURCES += [
- 'nsNativeAppSupportDefault.cpp',
- 'UIKitDirProvider.mm',
+ "nsNativeAppSupportDefault.cpp",
+ "UIKitDirProvider.mm",
]
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ EXPORTS += ['nsKDEUtils.h']
UNIFIED_SOURCES += [
-+ 'nsKDEUtils.cpp',
- 'nsNativeAppSupportUnix.cpp',
++ "nsKDEUtils.cpp",
+ "nsNativeAppSupportUnix.cpp",
]
else:
UNIFIED_SOURCES += [
- 'nsNativeAppSupportDefault.cpp',
+ "nsNativeAppSupportDefault.cpp",
]
- if CONFIG['MOZ_HAS_REMOTE']:
+ if CONFIG["MOZ_HAS_REMOTE"]:
diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp
new file mode 100644
--- /dev/null
@@ -841,44 +841,44 @@
diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build
--- a/uriloader/exthandler/moz.build
+++ b/uriloader/exthandler/moz.build
-@@ -85,17 +85,19 @@ else:
+@@ -86,17 +86,19 @@ else:
SOURCES += [
- osdir + '/nsOSHelperAppService.cpp',
+ osdir + "/nsOSHelperAppService.cpp",
]
- if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
- CXXFLAGS += ['-Wno-error=shadow']
+ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
+ CXXFLAGS += ["-Wno-error=shadow"]
- if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
+ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
UNIFIED_SOURCES += [
-+ 'unix/nsCommonRegistry.cpp',
- 'unix/nsGNOMERegistry.cpp',
-+ 'unix/nsKDERegistry.cpp',
- 'unix/nsMIMEInfoUnix.cpp',
++ "unix/nsCommonRegistry.cpp",
+ "unix/nsGNOMERegistry.cpp",
++ "unix/nsKDERegistry.cpp",
+ "unix/nsMIMEInfoUnix.cpp",
]
- elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
UNIFIED_SOURCES += [
- 'android/nsAndroidHandlerApp.cpp',
- 'android/nsExternalURLHandlerService.cpp',
- 'android/nsMIMEInfoAndroid.cpp',
+ "android/nsAndroidHandlerApp.cpp",
+ "android/nsExternalURLHandlerService.cpp",
+ "android/nsMIMEInfoAndroid.cpp",
]
-@@ -135,16 +137,17 @@ include('/ipc/chromium/chromium-config.m
- FINAL_LIBRARY = 'xul'
+@@ -136,16 +138,17 @@ include("/ipc/chromium/chromium-config.m
+ FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [
- '/docshell/base',
- '/dom/base',
- '/dom/ipc',
- '/netwerk/base',
- '/netwerk/protocol/http',
-+ '/toolkit/xre',
+ "/docshell/base",
+ "/dom/base",
+ "/dom/ipc",
+ "/netwerk/base",
+ "/netwerk/protocol/http",
++ "/toolkit/xre",
]
- if CONFIG['MOZ_ENABLE_DBUS']:
- CXXFLAGS += CONFIG['TK_CFLAGS']
- CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
+ if CONFIG["MOZ_ENABLE_DBUS"]:
+ CXXFLAGS += CONFIG["TK_CFLAGS"]
+ CXXFLAGS += CONFIG["MOZ_DBUS_CFLAGS"]
- if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
- CXXFLAGS += CONFIG['TK_CFLAGS']
+ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ CXXFLAGS += CONFIG["TK_CFLAGS"]
diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp
new file mode 100644
--- /dev/null
@@ -1293,23 +1293,23 @@
diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
-@@ -134,16 +134,17 @@ FINAL_LIBRARY = 'xul'
+@@ -138,16 +138,17 @@ FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [
- '/layout/base',
- '/layout/forms',
- '/layout/generic',
- '/layout/xul',
- '/other-licenses/atk-1.0',
- '/third_party/cups/include',
-+ '/toolkit/xre',
- '/widget',
- '/widget/headless',
+ "/layout/base",
+ "/layout/forms",
+ "/layout/generic",
+ "/layout/xul",
+ "/other-licenses/atk-1.0",
+ "/third_party/cups/include",
++ "/toolkit/xre",
+ "/widget",
+ "/widget/headless",
]
- if CONFIG['MOZ_X11']:
+ if CONFIG["MOZ_X11"]:
LOCAL_INCLUDES += [
- '/widget/x11',
+ "/widget/x11",
]
diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp
--- a/widget/gtk/nsFilePicker.cpp
@@ -1816,28 +1816,28 @@
diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build
--- a/xpcom/components/moz.build
+++ b/xpcom/components/moz.build
-@@ -62,16 +62,17 @@ LOCAL_INCLUDES += [
- '!..',
- '../base',
- '../build',
- '../ds',
- '/chrome',
- '/js/xpconnect/loader',
- '/layout/build',
- '/modules/libjar',
-+ '/toolkit/xre',
+@@ -66,16 +66,17 @@ LOCAL_INCLUDES += [
+ "!..",
+ "../base",
+ "../build",
+ "../ds",
+ "/chrome",
+ "/js/xpconnect/loader",
+ "/layout/build",
+ "/modules/libjar",
++ "/toolkit/xre",
]
- if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
- CXXFLAGS += CONFIG['TK_CFLAGS']
- if CONFIG['MOZ_ENABLE_DBUS']:
- CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
+ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ CXXFLAGS += CONFIG["TK_CFLAGS"]
+ if CONFIG["MOZ_ENABLE_DBUS"]:
+ CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
- include('/ipc/chromium/chromium-config.mozbuild')
+ include("/ipc/chromium/chromium-config.mozbuild")
diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
-@@ -46,16 +46,17 @@
+@@ -49,16 +49,17 @@
#include "prproces.h"
#include "nsIDirectoryEnumerator.h"
#include "nsSimpleEnumerator.h"
@@ -1855,7 +1855,7 @@
# include "prmem.h"
# include "plbase64.h"
-@@ -1898,62 +1899,77 @@ nsLocalFile::SetPersistentDescriptor(con
+@@ -1968,62 +1969,77 @@ nsLocalFile::SetPersistentDescriptor(con
NS_IMETHODIMP
nsLocalFile::Reveal() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-pgo.patch Sun Dec 27 10:49:49 2020 +0100
@@ -0,0 +1,225 @@
+# HG changeset patch
+# User Wolfgang Rosenauer <wr@rosenauer.org>
+# Parent 431962e810598b34327620fb99e06768e9a29c38
+
+diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure
+--- a/build/moz.configure/lto-pgo.configure
++++ b/build/moz.configure/lto-pgo.configure
+@@ -223,23 +223,23 @@ def lto(value, c_compiler, ld64_known_go
+ "configure."
+ )
+
+ if c_compiler.type == "clang":
+ if len(value) and value[0].lower() == "full":
+ cflags.append("-flto")
+ ldflags.append("-flto")
+ else:
+- cflags.append("-flto=thin")
+- ldflags.append("-flto=thin")
++ cflags.append("-flto")
++ ldflags.append("-flto")
+ elif c_compiler.type == "clang-cl":
+ if len(value) and value[0].lower() == "full":
+ cflags.append("-flto")
+ else:
+- cflags.append("-flto=thin")
++ cflags.append("-flto")
+ # With clang-cl, -flto can only be used with -c or -fuse-ld=lld.
+ # AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld.
+ cflags.append("-fuse-ld=lld")
+
+ # Explicitly set the CPU to optimize for so the linker doesn't
+ # choose a poor default. Rust compilation by default uses the
+ # pentium4 CPU on x86:
+ #
+@@ -263,17 +263,17 @@ def lto(value, c_compiler, ld64_known_go
+ ldflags.append("-mllvm:-mcpu=x86-64")
+ # We do not need special flags for arm64. Hooray for fixed-length
+ # instruction sets.
+ else:
+ num_cores = multiprocessing.cpu_count()
+ if len(value) and value[0].lower() == "full":
+ cflags.append("-flto")
+ else:
+- cflags.append("-flto=thin")
++ cflags.append("-flto")
+ cflags.append("-flifetime-dse=1")
+
+ ldflags.append("-flto=%s" % num_cores)
+ ldflags.append("-flifetime-dse=1")
+
+ # Tell LTO not to inline functions above a certain size, to mitigate
+ # binary size growth while still getting good performance.
+ # (For hot functions, PGO will put a multiplier on this limit.)
+diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py
+--- a/build/pgo/profileserver.py
++++ b/build/pgo/profileserver.py
+@@ -6,17 +6,17 @@
+
+ import json
+ import os
+ import sys
+ import glob
+ import subprocess
+
+ import mozcrash
+-from mozbuild.base import MozbuildObject, BinaryNotFoundException
++from mozbuild.base import MozbuildObject, BinaryNotFoundException, BuildEnvironmentNotFoundException
+ from mozfile import TemporaryDirectory
+ from mozhttpd import MozHttpd
+ from mozprofile import FirefoxProfile, Preferences
+ from mozprofile.permissions import ServerLocations
+ from mozrunner import FirefoxRunner, CLI
+ from six import string_types
+
+ PORT = 8888
+@@ -82,19 +82,32 @@ if __name__ == "__main__":
+ docroot=os.path.join(build.topsrcdir, "build", "pgo"),
+ path_mappings=path_mappings,
+ )
+ httpd.start(block=False)
+
+ locations = ServerLocations()
+ locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged")
+
+- old_profraw_files = glob.glob("*.profraw")
+- for f in old_profraw_files:
+- os.remove(f)
++ using_gcc = False
++ try:
++ if build.config_environment.substs.get('CC_TYPE') == 'gcc':
++ using_gcc = True
++ except BuildEnvironmentNotFoundException:
++ pass
++
++ if using_gcc:
++ for dirpath, _, filenames in os.walk('.'):
++ for f in filenames:
++ if f.endswith('.gcda'):
++ os.remove(os.path.join(dirpath, f))
++ else:
++ old_profraw_files = glob.glob('*.profraw')
++ for f in old_profraw_files:
++ os.remove(f)
+
+ with TemporaryDirectory() as profilePath:
+ # TODO: refactor this into mozprofile
+ profile_data_dir = os.path.join(build.topsrcdir, "testing", "profiles")
+ with open(os.path.join(profile_data_dir, "profiles.json"), "r") as fh:
+ base_profiles = json.load(fh)["profileserver"]
+
+ prefpaths = [
+@@ -207,16 +220,20 @@ if __name__ == "__main__":
+
+ # Try to move the crash reports to the artifacts even if Firefox appears
+ # to exit successfully, in case there's a crash that doesn't set the
+ # return code to non-zero for some reason.
+ if get_crashreports(profilePath, name="Firefox exited successfully?") != 0:
+ print("Firefox exited successfully, but produced a crashreport")
+ sys.exit(1)
+
++ print('Copying profile data....')
++ os.system('pwd');
++ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;');
++
+ llvm_profdata = env.get("LLVM_PROFDATA")
+ if llvm_profdata:
+ profraw_files = glob.glob("*.profraw")
+ if not profraw_files:
+ print(
+ "Could not find profraw files in the current directory: %s"
+ % os.getcwd()
+ )
+diff --git a/build/unix/mozconfig.unix b/build/unix/mozconfig.unix
+--- a/build/unix/mozconfig.unix
++++ b/build/unix/mozconfig.unix
+@@ -1,16 +1,25 @@
+ . "$topsrcdir/build/mozconfig.common"
+
+ TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
+
+ if [ -n "$FORCE_GCC" ]; then
+ CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
+ CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
+
++ if [ -n "$MOZ_PGO" ]; then
++ if [ -z "$USE_ARTIFACT" ]; then
++ ac_add_options --enable-lto
++ fi
++ export AR="$topsrcdir/gcc/bin/gcc-ar"
++ export NM="$topsrcdir/gcc/bin/gcc-nm"
++ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib"
++ fi
++
+ # We want to make sure we use binutils and other binaries in the tooltool
+ # package.
+ mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH"
+ ac_add_options --with-clang-path=$MOZ_FETCHES_DIR/clang/bin/clang
+ else
+ CC="$MOZ_FETCHES_DIR/clang/bin/clang"
+ CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
+
+diff --git a/extensions/spellcheck/src/moz.build b/extensions/spellcheck/src/moz.build
+--- a/extensions/spellcheck/src/moz.build
++++ b/extensions/spellcheck/src/moz.build
+@@ -26,8 +26,10 @@ LOCAL_INCLUDES += [
+ ]
+ EXPORTS.mozilla += [
+ "mozInlineSpellChecker.h",
+ "mozSpellChecker.h",
+ ]
+
+ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
+ CXXFLAGS += ["-Wno-error=shadow"]
++
++CXXFLAGS += ['-fno-devirtualize']
+diff --git a/python/mozbuild/mozbuild/build_commands.py b/python/mozbuild/mozbuild/build_commands.py
+--- a/python/mozbuild/mozbuild/build_commands.py
++++ b/python/mozbuild/mozbuild/build_commands.py
+@@ -121,19 +121,18 @@ class Build(MachCommandBase):
+ silent=not verbose,
+ ensure_exit_code=False,
+ append_env=append_env,
+ )
+ if status != 0:
+ return status
+
+ pgo_env = os.environ.copy()
+- pgo_env["LLVM_PROFDATA"] = instr.config_environment.substs.get(
+- "LLVM_PROFDATA"
+- )
++ if instr.config_environment.substs.get('CC_TYPE') != 'gcc':
++ pgo_env["LLVM_PROFDATA"] = instr.config_environment.substs.get("LLVM_PROFDATA")
+ pgo_env["JARLOG_FILE"] = mozpath.join(orig_topobjdir, "jarlog/en-US.log")
+ pgo_cmd = [
+ instr.virtualenv_manager.python_path,
+ mozpath.join(self.topsrcdir, "build/pgo/profileserver.py"),
+ ]
+ subprocess.check_call(
+ pgo_cmd, cwd=instr.topobjdir, env=ensure_subprocess_env(pgo_env)
+ )
+diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp
+--- a/toolkit/components/terminator/nsTerminator.cpp
++++ b/toolkit/components/terminator/nsTerminator.cpp
+@@ -413,16 +413,21 @@ void nsTerminator::StartWatchdog() {
+ // Defend against overflow
+ crashAfterMS = INT32_MAX;
+ } else {
+ crashAfterMS *= scaleUp;
+ }
+ }
+ #endif
+
++ // Disable watchdog for PGO train builds - writting profile information at
++ // exit may take time and it is better to make build hang rather than
++ // silently produce poorly performing binary.
++ crashAfterMS = INT32_MAX;
++
+ UniquePtr<Options> options(new Options());
+ const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);
+ options->crashAfterTicks = crashAfterMS / ticksDuration;
+ // Handle systems where ticksDuration is greater than crashAfterMS.
+ if (options->crashAfterTicks == 0) {
+ options->crashAfterTicks = crashAfterMS / 1000;
+ }
+
--- a/mozilla-pipewire-0-3.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/mozilla-pipewire-0-3.patch Sun Dec 27 10:49:49 2020 +0100
@@ -1,1009 +1,163 @@
-# HG changeset patch
-# Parent 5bd7b491505076dc38ba1efc7c406b9c53ba8389
-
-diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
---- a/config/system-headers.mozbuild
-+++ b/config/system-headers.mozbuild
-@@ -309,16 +309,17 @@ system_headers = [
- 'gdk/gdkkeysyms.h',
- 'gdk/gdkprivate.h',
- 'gdk/gdkwayland.h',
- 'gdk/gdkx.h',
- 'gdk-pixbuf/gdk-pixbuf.h',
- 'Gestalt.h',
- 'getopt.h',
- 'gio/gio.h',
-+ 'gio/gunixfdlist.h',
- 'glibconfig.h',
- 'glib.h',
- 'glib-object.h',
- 'glob.h',
- 'gmodule.h',
- 'gnome.h',
- 'gnu/libc-version.h',
- 'gps.h',
-@@ -602,16 +603,17 @@ system_headers = [
- 'pango/pangoxft.h',
- 'pascal.h',
- 'Patches.h',
- 'Path.h',
- 'pcfs/pc_dir.h',
- 'Pgenerr.h',
- 'PGenErr.h',
- 'Ph.h',
-+ 'pipewire/pipewire.h',
- 'pixman.h',
- 'pk11func.h',
- 'pk11pqg.h',
- 'pk11priv.h',
- 'pk11pub.h',
- 'pk11sdr.h',
- 'pkcs11f.h',
- 'pkcs11.h',
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/BUILD.gn b/third_party/libwebrtc/webrtc/modules/desktop_capture/BUILD.gn
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/BUILD.gn
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/BUILD.gn
-@@ -153,17 +153,17 @@ if (rtc_include_tests) {
- "../../test:test_support",
- ]
- }
- }
+diff -up firefox-83.0/browser/actors/WebRTCParent.jsm.pw6 firefox-83.0/browser/actors/WebRTCParent.jsm
+--- firefox-83.0/browser/actors/WebRTCParent.jsm.pw6 2020-11-12 19:04:30.000000000 +0100
++++ firefox-83.0/browser/actors/WebRTCParent.jsm 2020-11-25 10:28:32.492865982 +0100
+@@ -45,6 +45,9 @@ XPCOMUtils.defineLazyServiceGetter(
+ "nsIOSPermissionRequest"
+ );
- if (is_linux) {
- if (rtc_use_pipewire) {
- pkg_config("pipewire") {
-- packages = [ "libpipewire-0.2" ]
-+ packages = [ "libpipewire-0.3" ]
-
- defines = [ "WEBRTC_USE_PIPEWIRE" ]
- }
-
- pkg_config("gio") {
- packages = [
- "gio-2.0",
- "gio-unix-2.0",
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build b/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
-@@ -112,16 +112,39 @@ if CONFIG["OS_TARGET"] == "DragonFly":
- "/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/x_atom_cache.cc",
- "/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/x_error_trap.cc",
- "/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/x_server_pixel_buffer.cc",
- "/third_party/libwebrtc/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc",
- "/third_party/libwebrtc/webrtc/modules/desktop_capture/screen_capturer_linux.cc",
- "/third_party/libwebrtc/webrtc/modules/desktop_capture/window_capturer_linux.cc"
- ]
-
-+# PipeWire specific files
-+if CONFIG["OS_TARGET"] == "Linux":
-+
-+ DEFINES["WEBRTC_USE_PIPEWIRE"] = "1"
++const PIPEWIRE_PORTAL_NAME = "####_PIPEWIRE_PORTAL_####";
++const PIPEWIRE_ID = 0xaffffff;
+
-+ 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 += [
-+ "/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc",
-+ "/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc",
-+ "/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc"
-+ ]
-+
- if CONFIG["OS_TARGET"] == "FreeBSD":
-
- DEFINES["USE_X11"] = "1"
- DEFINES["WEBRTC_BSD"] = True
- DEFINES["WEBRTC_POSIX"] = True
- DEFINES["_FILE_OFFSET_BITS"] = "64"
-
- OS_LIBS += [
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_options.h b/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_options.h
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_options.h
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/desktop_capture_options.h
-@@ -136,15 +136,15 @@ class DesktopCaptureOptions {
- #if defined(USE_X11)
- bool use_update_notifications_ = false;
- #else
- bool use_update_notifications_ = true;
- #endif
- bool disable_effects_ = true;
- bool detect_updated_region_ = false;
- #if defined(WEBRTC_USE_PIPEWIRE)
-- bool allow_pipewire_ = false;
-+ bool allow_pipewire_ = true;
- #endif
- };
-
- } // namespace webrtc
-
- #endif // MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
-@@ -10,18 +10,21 @@
-
- #include "modules/desktop_capture/linux/base_capturer_pipewire.h"
-
- #include <gio/gunixfdlist.h>
- #include <glib-object.h>
-
- #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>
-
- #include "modules/desktop_capture/desktop_capture_options.h"
- #include "modules/desktop_capture/desktop_capturer.h"
- #include "rtc_base/checks.h"
- #include "rtc_base/logging.h"
-@@ -31,181 +34,158 @@ namespace webrtc {
- const char kDesktopBusName[] = "org.freedesktop.portal.Desktop";
- const char kDesktopObjectPath[] = "/org/freedesktop/portal/desktop";
- const char kDesktopRequestObjectPath[] =
- "/org/freedesktop/portal/desktop/request";
- 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);
-+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;
+ class WebRTCParent extends JSWindowActorParent {
+ didDestroy() {
+ webrtcUI.forgetStreamsFromBrowserContext(this.browsingContext);
+@@ -753,6 +756,8 @@ function prompt(aActor, aBrowser, aReque
+ );
+ menupopup.appendChild(doc.createXULElement("menuseparator"));
-- switch (state) {
-- case PW_REMOTE_STATE_ERROR:
-- RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message;
-+ 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_CONNECTED:
-- RTC_LOG(LS_INFO) << "PipeWire remote state: connected.";
-- that->CreateReceivingStream();
-+ } else {
- break;
-- case PW_REMOTE_STATE_CONNECTING:
-- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting.";
-- break;
-- case PW_REMOTE_STATE_UNCONNECTED:
-- RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected.";
-- 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,
- pw_stream_state state,
- const char* error_message) {
- BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
- RTC_DCHECK(that);
-
- switch (state) {
- 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_PAUSED:
-+ case PW_STREAM_STATE_STREAMING:
- 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:
- 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);
++ let isPipeWire = false;
+
- 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
- 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)
- : capture_source_type_(source_type) {}
-
- BaseCapturerPipeWire::~BaseCapturerPipeWire() {
- if (pw_main_loop_) {
- 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_);
- }
+ // Build the list of 'devices'.
+ let monitorIndex = 1;
+ for (let i = 0; i < devices.length; ++i) {
+@@ -774,6 +779,29 @@ function prompt(aActor, aBrowser, aReque
+ }
+ } else {
+ name = device.name;
++ // When we share content by PipeWire add only one item to the device
++ // list. When it's selected PipeWire portal dialog is opened and
++ // user confirms actual window/screen sharing there.
++ // Don't mark it as scary as there's an extra confirmation step by
++ // PipeWire portal dialog.
++ if (name == PIPEWIRE_PORTAL_NAME && device.id == PIPEWIRE_ID) {
++ isPipeWire = true;
++ let name;
++ try {
++ name = stringBundle.getString("getUserMedia.sharePipeWirePortal.label");
++ } catch (err) {
++ name = "Use operating system settings"
++ }
++ let item = addDeviceToList(
++ menupopup,
++ name,
++ i,
++ type
++ );
++ item.deviceId = device.id;
++ item.mediaSource = type;
++ break;
++ }
+ if (type == "application") {
+ // The application names returned by the platform are of the form:
+ // <window count>\x1e<application name>
+@@ -888,39 +916,41 @@ function prompt(aActor, aBrowser, aReque
+ perms.EXPIRE_SESSION
+ );
-- 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_);
- }
- if (sources_request_signal_id_) {
- g_dbus_connection_signal_unsubscribe(connection_,
- sources_request_signal_id_);
- }
- if (session_request_signal_id_) {
-@@ -245,142 +225,220 @@ void BaseCapturerPipeWire::InitPortal()
- kDesktopBusName, kDesktopObjectPath, kScreenCastInterfaceName,
- /*cancellable=*/nullptr,
- reinterpret_cast<GAsyncReadyCallback>(OnProxyRequested), this);
- }
-
- 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_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;
-+ }
-
-- 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);
--
-- 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";
- portal_init_failed_ = true;
- }
- }
-
--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);
--}
-+pw_stream* BaseCapturerPipeWire::CreateReceivingStream() {
-+ spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
-+ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX};
-
--void 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())};
-+ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr);
-
-- spa_fraction pwFrameRateMin = spa_fraction{0, 1};
-- spa_fraction pwFrameRateMax = spa_fraction{60, 1};
--
-- 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));
-+ const spa_pod* params[2];
-+ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer));
-
-- pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_,
-- this);
-+ 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));
-+
-+ if (map == MAP_FAILED) {
-+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
-+ return;
-+ }
-
-- if (!(src = spaBuffer->datas[0].data)) {
-+ 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));
-+
-+ if (map == MAP_FAILED) {
-+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
-+ return;
-+ }
-+
-+ 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;
- }
-
-- uint32_t maxSize = spaBuffer->datas[0].maxsize;
-- int32_t srcStride = spaBuffer->datas[0].chunk->stride;
-+ if (!src) {
-+ return;
-+ }
-+
-+ 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
- << " != " << (desktop_size_.width() * kBytesPerPixel);
- portal_init_failed_ = true;
- return;
- }
-
-- if (!current_frame_) {
-- current_frame_ = static_cast<uint8_t*>(malloc(maxSize));
-- }
-- RTC_DCHECK(current_frame_ != nullptr);
-+ dst = current_frame_.get();
-
-- // 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);
-+ // 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;
-+ }
-+
-+ 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);
- }
- }
-
- void BaseCapturerPipeWire::ConvertRGBxToBGRx(uint8_t* frame, uint32_t size) {
- // Change color format for KDE KWin which uses RGBx and not BGRx
- for (uint32_t i = 0; i < size; i += 4) {
- uint8_t tempR = frame[i];
- uint8_t tempB = frame[i + 2];
-@@ -720,20 +778,17 @@ void BaseCapturerPipeWire::OnStartReques
- guint32 stream_id;
- gint32 width;
- gint32 height;
- GVariant* options;
-
- 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);
- }
- }
- g_variant_iter_free(iter);
- g_variant_unref(response_data);
-
- that->OpenPipeWireRemote();
-@@ -808,20 +863,25 @@ void BaseCapturerPipeWire::CaptureFrame(
- return;
- }
-
- if (!current_frame_) {
- callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
- 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;
- }
+- video.deviceId = deviceId;
+- let constraints = {
+- video: { mediaSource: type, deviceId: { exact: deviceId } },
+- };
+- chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(
+- stream => {
+- if (video.deviceId != deviceId) {
+- // The user has selected a different device or closed the panel
+- // before getUserMedia finished.
+- stream.getTracks().forEach(t => t.stop());
+- return;
+- }
+- video.srcObject = stream;
+- video.stream = stream;
+- doc.getElementById("webRTC-preview").hidden = false;
+- video.onloadedmetadata = function(e) {
+- video.play();
+- };
+- },
+- err => {
+- if (
+- err.name == "OverconstrainedError" &&
+- err.constraint == "deviceId"
+- ) {
+- // Window has disappeared since enumeration, which can happen.
+- // No preview for you.
+- return;
++ if (!isPipeWire) {
++ video.deviceId = deviceId;
++ let constraints = {
++ video: { mediaSource: type, deviceId: { exact: deviceId } },
++ };
++ chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(
++ stream => {
++ if (video.deviceId != deviceId) {
++ // The user has selected a different device or closed the panel
++ // before getUserMedia finished.
++ stream.getTracks().forEach(t => t.stop());
++ return;
++ }
++ video.srcObject = stream;
++ video.stream = stream;
++ doc.getElementById("webRTC-preview").hidden = false;
++ video.onloadedmetadata = function(e) {
++ video.play();
++ };
++ },
++ err => {
++ if (
++ err.name == "OverconstrainedError" &&
++ err.constraint == "deviceId"
++ ) {
++ // Window has disappeared since enumeration, which can happen.
++ // No preview for you.
++ return;
++ }
++ Cu.reportError(
++ `error in preview: ${err.message} ${err.constraint}`
++ );
+ }
+- Cu.reportError(
+- `error in preview: ${err.message} ${err.constraint}`
+- );
+- }
+- );
++ );
++ }
+ };
+ menupopup.addEventListener("command", menupopup._commandEventListener);
+ }
+diff -up firefox-83.0/browser/locales/en-US/chrome/browser/browser.properties.pw6 firefox-83.0/browser/locales/en-US/chrome/browser/browser.properties
+--- firefox-83.0/browser/locales/en-US/chrome/browser/browser.properties.pw6 2020-11-12 19:04:30.000000000 +0100
++++ firefox-83.0/browser/locales/en-US/chrome/browser/browser.properties 2020-11-25 09:24:26.378857626 +0100
+@@ -764,6 +764,7 @@ getUserMedia.selectWindowOrScreen.label=
+ getUserMedia.selectWindowOrScreen.accesskey=W
+ getUserMedia.pickWindowOrScreen.label = Select Window or Screen
+ getUserMedia.shareEntireScreen.label = Entire screen
++getUserMedia.sharePipeWirePortal.label = Use operating system settings
+ # LOCALIZATION NOTE (getUserMedia.shareMonitor.label):
+ # %S is screen number (digits 1, 2, etc)
+ # Example: Screen 1, Screen 2,..
+diff -up firefox-83.0/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.pw6 firefox-83.0/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
+--- firefox-83.0/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.pw6 2020-11-25 09:24:26.358857788 +0100
++++ firefox-83.0/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc 2020-11-25 09:24:26.378857626 +0100
+@@ -879,17 +879,17 @@ void BaseCapturerPipeWire::CaptureFrame(
callback_->OnCaptureResult(Result::SUCCESS, std::move(result));
}
++#define PIPEWIRE_ID 0xaffffff
++#define PIPEWIRE_NAME "####_PIPEWIRE_PORTAL_####"
++
bool BaseCapturerPipeWire::GetSourceList(SourceList* sources) {
-@@ -832,9 +892,27 @@ bool BaseCapturerPipeWire::GetSourceList
+- RTC_DCHECK(sources->size() == 0);
+- // List of available screens is already presented by the xdg-desktop-portal.
+- // But we have to add an empty source as the code expects it.
+- sources->push_back({0});
++ sources->push_back({PIPEWIRE_ID, 0, PIPEWIRE_NAME});
return true;
}
bool BaseCapturerPipeWire::SelectSource(SourceId id) {
// Screen selection is handled by the xdg-desktop-portal.
- return true;
+- return true;
++ return id == PIPEWIRE_ID;
}
-+// 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/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
-@@ -17,99 +17,103 @@
- #include <spa/param/video/format-utils.h>
-
- #include "modules/desktop_capture/desktop_capture_options.h"
- #include "modules/desktop_capture/desktop_capturer.h"
- #include "rtc_base/constructormagic.h"
-
- 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;
-
- // DesktopCapturer interface.
- void Start(Callback* delegate) override;
- void CaptureFrame() override;
- 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
-
- GDBusConnection* connection_ = nullptr;
- GDBusProxy* proxy_ = nullptr;
- gchar* portal_handle_ = nullptr;
- gchar* session_handle_ = nullptr;
- gchar* sources_handle_ = nullptr;
- gchar* start_handle_ = nullptr;
- guint session_request_signal_id_ = 0;
- 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);
-
- guint SetupRequestResponseSignal(const gchar* object_path,
- GDBusSignalCallback callback);
-
- static void OnProxyRequested(GObject* object,
- GAsyncResult* result,
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
-@@ -10,17 +10,17 @@
-
- #include "modules/desktop_capture/linux/screen_capturer_pipewire.h"
-
- #include <memory>
-
- namespace webrtc {
-
- ScreenCapturerPipeWire::ScreenCapturerPipeWire()
-- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {}
-+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {}
- ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {}
-
// static
- std::unique_ptr<DesktopCapturer>
- ScreenCapturerPipeWire::CreateRawScreenCapturer(
- const DesktopCaptureOptions& options) {
- return std::make_unique<ScreenCapturerPipeWire>();
- }
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
-@@ -10,17 +10,17 @@
-
- #include "modules/desktop_capture/linux/window_capturer_pipewire.h"
-
- #include <memory>
-
- namespace webrtc {
-
- WindowCapturerPipeWire::WindowCapturerPipeWire()
-- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {}
-+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {}
- WindowCapturerPipeWire::~WindowCapturerPipeWire() {}
-
- // static
- std::unique_ptr<DesktopCapturer>
- WindowCapturerPipeWire::CreateRawWindowCapturer(
- const DesktopCaptureOptions& options) {
- return std::make_unique<WindowCapturerPipeWire>();
- }
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/screen_capturer_linux.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/screen_capturer_linux.cc
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/screen_capturer_linux.cc
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/screen_capturer_linux.cc
-@@ -21,17 +21,17 @@
-
- namespace webrtc {
-
- // static
- 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)
-
- #if defined(USE_X11)
- return ScreenCapturerX11::CreateRawScreenCapturer(options);
- #endif // defined(USE_X11)
-
- return nullptr;
-diff --git a/third_party/libwebrtc/webrtc/modules/desktop_capture/window_capturer_linux.cc b/third_party/libwebrtc/webrtc/modules/desktop_capture/window_capturer_linux.cc
---- a/third_party/libwebrtc/webrtc/modules/desktop_capture/window_capturer_linux.cc
-+++ b/third_party/libwebrtc/webrtc/modules/desktop_capture/window_capturer_linux.cc
-@@ -21,17 +21,17 @@
-
- namespace webrtc {
-
- // static
- 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)
-
- #if defined(USE_X11)
- return WindowCapturerX11::CreateRawWindowCapturer(options);
- #endif // defined(USE_X11)
-
- return nullptr;
--- a/mozilla-reduce-rust-debuginfo.patch Thu Dec 10 14:36:59 2020 +0100
+++ b/mozilla-reduce-rust-debuginfo.patch Sun Dec 27 10:49:49 2020 +0100
@@ -3,7 +3,7 @@
# Date 1560754926 -7200
# Mon Jun 17 09:02:06 2019 +0200
# Node ID 428161c3b9599083e1b8710eda1760f1f707ab11
-# Parent 83625bab561d09fb68aa2c71cea7cbafd9ec09b4
+# Parent f5e9431a99bb1d122ccd76411f08ac6f3236c19f
#Description: reduce the rust debuginfo level on selected architectures where
# compiling with debuginfo=2 causes the OOM killer to interrupt the build on
# launchpad builders. Initially this was only on 32 bit architectures, but with
@@ -12,18 +12,19 @@
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
-@@ -1823,18 +1823,18 @@ imply_option('RUSTC_OPT_LEVEL', '2', whe
- @depends('RUSTC_OPT_LEVEL', moz_optimize)
+@@ -2138,19 +2138,19 @@ imply_option("RUSTC_OPT_LEVEL", "2", whe
def rustc_opt_level(opt_level_option, moz_optimize):
if opt_level_option:
return opt_level_option[0]
else:
- return '1' if moz_optimize.optimize else '0'
+ return "1" if moz_optimize.optimize else "0"
--@depends(rustc_opt_level, debug_rust, '--enable-debug-symbols', '--enable-frame-pointers')
+ @depends(
+- rustc_opt_level, debug_rust, "--enable-debug-symbols", "--enable-frame-pointers"
++ rustc_opt_level, debug_rust, "--enable-debug-symbols", "--enable-frame-pointers", host
+ )
-def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers):
-+@depends(rustc_opt_level, debug_rust, '--enable-debug-symbols', '--enable-frame-pointers', host)
+def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers, host):
# Cargo currently supports only two interesting profiles for building:
# development and release. Those map (roughly) to --enable-debug and
@@ -33,22 +34,22 @@
# optimization level. Since Cargo only supports 2 profiles, we're in
# a bit of a bind.
#
-@@ -1847,16 +1847,18 @@ def rust_compile_flags(opt_level, debug_
+@@ -2163,16 +2163,18 @@ def rust_compile_flags(opt_level, debug_
# opt-level=0 implies -C debug-assertions, which may not be desired
# unless Rust debugging is enabled.
- if opt_level == '0' and not debug_rust:
+ if opt_level == "0" and not debug_rust:
debug_assertions = False
if debug_symbols:
- debug_info = '2'
+ debug_info = "2"
+ if host.bitness == 32 or host.cpu == 'aarch64' or host.cpu == 'ppc64':
+ debug_info = '1'
opts = []
if opt_level is not None:
- opts.append('opt-level=%s' % opt_level)
+ opts.append("opt-level=%s" % opt_level)
if debug_assertions is not None:
- opts.append('debug-assertions=%s' %
- ('yes' if debug_assertions else 'no'))
+ opts.append("debug-assertions=%s" % ("yes" if debug_assertions else "no"))
+ if debug_info is not None:
--- a/revert-795c8762b16b.patch Thu Dec 10 14:36:59 2020 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure
---- a/build/moz.configure/lto-pgo.configure
-+++ b/build/moz.configure/lto-pgo.configure
-@@ -224,17 +224,20 @@ def lto(value, c_compiler, ld64_known_go
- #
- # https://github.com/llvm/llvm-project/blob/e7694f34ab6a12b8bb480cbfcb396d0a64fe965f/llvm/lib/Target/X86/X86.td#L1165-L1187
- if target.cpu == 'x86_64':
- ldflags.append('-mllvm:-mcpu=x86-64')
- # We do not need special flags for arm64. Hooray for fixed-length
- # instruction sets.
- else:
- num_cores = multiprocessing.cpu_count()
-- cflags.append("-flto")
-+ if len(value) and value[0].lower() == 'full':
-+ cflags.append("-flto")
-+ else:
-+ cflags.append("-flto=thin")
- cflags.append("-flifetime-dse=1")
-
- ldflags.append("-flto=%s" % num_cores)
- ldflags.append("-flifetime-dse=1")
-
- # Tell LTO not to inline functions above a certain size, to mitigate
- # binary size growth while still getting good performance.
- # (For hot functions, PGO will put a multiplier on this limit.)
--- a/series Thu Dec 10 14:36:59 2020 +0100
+++ b/series Sun Dec 27 10:49:49 2020 +0100
@@ -7,6 +7,7 @@
mozilla-fix-aarch64-libopus.patch
mozilla-disable-wasm-emulate-arm-unaligned-fp-access.patch
mozilla-s390-context.patch
+mozilla-pgo.patch
mozilla-reduce-rust-debuginfo.patch
mozilla-bmo1005535.patch
mozilla-bmo1568145.patch
@@ -24,7 +25,6 @@
mozilla-bmo1626236.patch
mozilla-s390x-skia-gradient.patch
mozilla-libavcodec58_91.patch
-#revert-795c8762b16b.patch
# Firefox patches
firefox-kde.patch