summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO43
-rw-r--r--0001-Bug-1803016-Wayland-Don-t-commit-wl_buffer-if-buffer.patch81
-rw-r--r--0001-Use-remoting-name-for-GDK-application-names.patch56
-rw-r--r--PKGBUILD142
-rw-r--r--firefox.desktop2
-rw-r--r--fix-wayland-build.patch19
-rw-r--r--fix_csd_window_buttons.patch12
-rw-r--r--identity-icons-brand.svg3
-rw-r--r--no-relinking.patch41
-rw-r--r--unity-menubar.patch695
-rwxr-xr-xupload-symbol-archive25
11 files changed, 587 insertions, 532 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 090254edd03f..88ac036dc25a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = firefox-appmenu
pkgdesc = Firefox from extra with appmenu patch
- pkgver = 70.0.1
- pkgrel = 1
+ pkgver = 112.0.2
+ pkgrel = 2
url = https://www.mozilla.org/firefox/
arch = x86_64
license = MPL
@@ -10,54 +10,57 @@ pkgbase = firefox-appmenu
makedepends = unzip
makedepends = zip
makedepends = diffutils
- makedepends = python2-setuptools
makedepends = yasm
makedepends = mesa
makedepends = imake
makedepends = inetutils
makedepends = xorg-server-xvfb
- makedepends = autoconf2.13
makedepends = rust
makedepends = clang
makedepends = llvm
makedepends = jack
- makedepends = gtk2
- makedepends = python
makedepends = nodejs
- makedepends = python2-psutil
makedepends = cbindgen
makedepends = nasm
+ makedepends = python
+ makedepends = lld
+ makedepends = dump_syms
+ makedepends = wasi-compiler-rt
+ makedepends = wasi-libc
+ makedepends = wasi-libc++
+ makedepends = wasi-libc++abi
depends = gtk3
depends = libxt
- depends = startup-notification
depends = mime-types
depends = dbus-glib
depends = ffmpeg
depends = nss
depends = ttf-font
depends = libpulse
+ depends = libdbusmenu-gtk3
optdepends = networkmanager: Location detection via available WiFi networks
optdepends = libnotify: Notification integration
optdepends = pulseaudio: Audio support
optdepends = speech-dispatcher: Text-to-Speech
optdepends = hunspell-en_US: Spell checking, American English
- provides = firefox=70.0.1
+ optdepends = xdg-desktop-portal: Screensharing with Wayland
+ provides = firefox=112.0.2
+ conflicts = firefox
options = !emptydirs
options = !makeflags
options = !strip
- source = https://archive.mozilla.org/pub/firefox/releases/70.0.1/source/firefox-70.0.1.source.tar.xz
- source = https://archive.mozilla.org/pub/firefox/releases/70.0.1/source/firefox-70.0.1.source.tar.xz.asc
- source = no-relinking.patch
- source = 0001-Use-remoting-name-for-GDK-application-names.patch
+ options = !lto
+ options = !debug
+ source = https://archive.mozilla.org/pub/firefox/releases/112.0.2/source/firefox-112.0.2.source.tar.xz
+ source = https://archive.mozilla.org/pub/firefox/releases/112.0.2/source/firefox-112.0.2.source.tar.xz.asc
source = firefox.desktop
- source = unity-menubar.patch
+ source = identity-icons-brand.svg
+ source = 0001-Bug-1803016-Wayland-Don-t-commit-wl_buffer-if-buffer.patch
validpgpkeys = 14F26682D0916CDD81E37B6D61B7B526D98F0353
- sha256sums = f2e9bb26af7682b31e82fdfc3a4b3e04fd1caa8b004469ea608185d33e35691b
+ sha256sums = e6a4819a3b82b1ca6c45296e50e6c9ab653306eeb540e50ba8683e339565992e
sha256sums = SKIP
- sha256sums = 2dc9d1aa5eb7798c89f46478f254ae61e4122b4d1956d6044426288627d8a014
- sha256sums = ab07ab26617ff76fce68e07c66b8aa9b96c2d3e5b5517e51a3c3eac2edd88894
- sha256sums = e466789015e15be9409b7a7044353674ca6aa0f392e882217f90c79821fe2630
- sha256sums = 73b9804393381f2c278eff63fecbd05035264dbb2aa68dd263a14db9f981a668
+ sha256sums = 34514a657d6907a159594c51e674eeb81297c431ec26a736417c2fdb995c2c0c
+ sha256sums = a9b8b4a0a1f4a7b4af77d5fc70c2686d624038909263c795ecc81e0aec7711e9
+ sha256sums = bfe15651a99ac6d0037867c9db00a0d4340353cdc0ac4a39e43ad61cc2589ed6
pkgname = firefox-appmenu
-
diff --git a/0001-Bug-1803016-Wayland-Don-t-commit-wl_buffer-if-buffer.patch b/0001-Bug-1803016-Wayland-Don-t-commit-wl_buffer-if-buffer.patch
new file mode 100644
index 000000000000..37333e253618
--- /dev/null
+++ b/0001-Bug-1803016-Wayland-Don-t-commit-wl_buffer-if-buffer.patch
@@ -0,0 +1,81 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: stransky <stransky@redhat.com>
+Date: Thu, 30 Mar 2023 11:49:53 +0000
+Subject: [PATCH] Bug 1803016 [Wayland] Don't commit wl_buffer if buffer scale
+ doesn't match its size r=emilio
+
+Differential Revision: https://phabricator.services.mozilla.com/D173814
+---
+ widget/gtk/MozContainerWayland.cpp | 7 +++++++
+ widget/gtk/MozContainerWayland.h | 3 +++
+ widget/gtk/WindowSurfaceWaylandMultiBuffer.cpp | 17 ++++++++++++++---
+ 3 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/widget/gtk/MozContainerWayland.cpp b/widget/gtk/MozContainerWayland.cpp
+index 2a4a492077c3..0d9aacc954b7 100644
+--- a/widget/gtk/MozContainerWayland.cpp
++++ b/widget/gtk/MozContainerWayland.cpp
+@@ -597,6 +597,13 @@ void moz_container_wayland_set_scale_factor(MozContainer* container) {
+ }
+ }
+
++bool moz_container_wayland_size_matches_scale_factor_locked(
++ const MutexAutoLock& aProofOfLock, MozContainer* container, int aWidth,
++ int aHeight) {
++ return aWidth % container->wl_container.buffer_scale == 0 &&
++ aHeight % container->wl_container.buffer_scale == 0;
++}
++
+ static bool moz_container_wayland_surface_create_locked(
+ const MutexAutoLock& aProofOfLock, MozContainer* container) {
+ MozContainerWayland* wl_container = &container->wl_container;
+diff --git a/widget/gtk/MozContainerWayland.h b/widget/gtk/MozContainerWayland.h
+index d3c49baae8ac..369d40a55250 100644
+--- a/widget/gtk/MozContainerWayland.h
++++ b/widget/gtk/MozContainerWayland.h
+@@ -85,6 +85,9 @@ bool moz_container_wayland_egl_window_needs_size_update(MozContainer* container,
+ void moz_container_wayland_set_scale_factor(MozContainer* container);
+ void moz_container_wayland_set_scale_factor_locked(
+ const mozilla::MutexAutoLock& aProofOfLock, MozContainer* container);
++bool moz_container_wayland_size_matches_scale_factor_locked(
++ const mozilla::MutexAutoLock& aProofOfLock, MozContainer* container,
++ int aWidth, int aHeight);
+
+ void moz_container_wayland_add_initial_draw_callback_locked(
+ MozContainer* container, const std::function<void(void)>& initial_draw_cb);
+diff --git a/widget/gtk/WindowSurfaceWaylandMultiBuffer.cpp b/widget/gtk/WindowSurfaceWaylandMultiBuffer.cpp
+index 85ab1942d9e6..31091f4b9848 100644
+--- a/widget/gtk/WindowSurfaceWaylandMultiBuffer.cpp
++++ b/widget/gtk/WindowSurfaceWaylandMultiBuffer.cpp
+@@ -285,8 +285,8 @@ void WindowSurfaceWaylandMB::Commit(
+ mFrameInProcess = false;
+
+ MozContainer* container = mWindow->GetMozContainer();
+- MozContainerSurfaceLock lock(container);
+- struct wl_surface* waylandSurface = lock.GetSurface();
++ MozContainerSurfaceLock MozContainerLock(container);
++ struct wl_surface* waylandSurface = MozContainerLock.GetSurface();
+ if (!waylandSurface) {
+ LOGWAYLAND(
+ "WindowSurfaceWaylandMB::Commit [%p] frame queued: can't lock "
+@@ -319,8 +319,19 @@ void WindowSurfaceWaylandMB::Commit(
+ }
+ }
+
++ // aProofOfLock is a kind of substitution of MozContainerSurfaceLock.
++ // MozContainer is locked but MozContainerSurfaceLock doen't convert to
++ // MutexAutoLock& so we use aProofOfLock here.
+ moz_container_wayland_set_scale_factor_locked(aProofOfLock, container);
+- mInProgressBuffer->AttachAndCommit(waylandSurface);
++
++ // It's possible that scale factor changed between Lock() and Commit()
++ // but window size is the same.
++ // Don't attach such buffer as it may have incorrect size,
++ // we'll paint new content soon.
++ if (moz_container_wayland_size_matches_scale_factor_locked(
++ aProofOfLock, container, mWindowSize.width, mWindowSize.height)) {
++ mInProgressBuffer->AttachAndCommit(waylandSurface);
++ }
+
+ mInProgressBuffer->ResetBufferAge();
+ mFrontBuffer = mInProgressBuffer;
diff --git a/0001-Use-remoting-name-for-GDK-application-names.patch b/0001-Use-remoting-name-for-GDK-application-names.patch
deleted file mode 100644
index 8cc378636c19..000000000000
--- a/0001-Use-remoting-name-for-GDK-application-names.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 1cab10b39cfda068100cab8c598f1ca0f50e4131 Mon Sep 17 00:00:00 2001
-Message-Id: <1cab10b39cfda068100cab8c598f1ca0f50e4131.1553597287.git.jan.steffens@gmail.com>
-From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
-Date: Mon, 25 Mar 2019 20:30:11 +0100
-Subject: [PATCH] Use remoting name for GDK application names
-
----
- toolkit/xre/nsAppRunner.cpp | 6 +-----
- widget/gtk/nsAppShell.cpp | 7 +++----
- 2 files changed, 4 insertions(+), 9 deletions(-)
-
-diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
-index 0b808ef215f06..28911c0ffeaec 100644
---- a/toolkit/xre/nsAppRunner.cpp
-+++ b/toolkit/xre/nsAppRunner.cpp
-@@ -3728,11 +3728,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
- // consistently.
-
- // Set program name to the one defined in application.ini.
-- {
-- nsAutoCString program(gAppData->name);
-- ToLowerCase(program);
-- g_set_prgname(program.get());
-- }
-+ g_set_prgname(gAppData->remotingName);
-
- // Initialize GTK here for splash.
-
-diff --git a/widget/gtk/nsAppShell.cpp b/widget/gtk/nsAppShell.cpp
-index 0686ff814916b..ae4a4ea55f420 100644
---- a/widget/gtk/nsAppShell.cpp
-+++ b/widget/gtk/nsAppShell.cpp
-@@ -24,6 +24,7 @@
- # include "WakeLockListener.h"
- #endif
- #include "gfxPlatform.h"
-+#include "nsAppRunner.h"
- #include "ScreenHelperGTK.h"
- #include "HeadlessScreenHelper.h"
- #include "mozilla/widget/ScreenManager.h"
-@@ -171,10 +172,8 @@ nsresult nsAppShell::Init() {
- // option when program uses gdk_set_program_class().
- //
- // See https://bugzilla.gnome.org/show_bug.cgi?id=747634
-- nsAutoString brandName;
-- mozilla::widget::WidgetUtils::GetBrandShortName(brandName);
-- if (!brandName.IsEmpty()) {
-- gdk_set_program_class(NS_ConvertUTF16toUTF8(brandName).get());
-+ if (gAppData) {
-+ gdk_set_program_class(gAppData->remotingName);
- }
- }
-
---
-2.21.0
-
diff --git a/PKGBUILD b/PKGBUILD
index 6164b3b14fe8..aaa49ea8a33b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,40 +1,47 @@
-# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
+# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Jakub Schmidtke <sjakub@gmail.com>
-# Additional patching: Nikita Tarasov <nikatar@disroot.org>
+
+### Appmenu patching ###
+# PKGBUILD: Nikita Tarasov <nikatar@disroot.org>
pkgname=firefox-appmenu
_pkgname=firefox
-pkgver=70.0.1
-pkgrel=1
+pkgver=112.0.2
+pkgrel=2
pkgdesc="Firefox from extra with appmenu patch"
arch=(x86_64)
license=(MPL GPL LGPL)
url="https://www.mozilla.org/firefox/"
-depends=(gtk3 libxt startup-notification mime-types dbus-glib ffmpeg nss
- ttf-font libpulse)
-makedepends=(unzip zip diffutils python2-setuptools yasm mesa imake inetutils
- xorg-server-xvfb autoconf2.13 rust clang llvm jack gtk2
- python nodejs python2-psutil cbindgen nasm)
+depends=(gtk3 libxt mime-types dbus-glib ffmpeg nss ttf-font libpulse libdbusmenu-gtk3)
+makedepends=(unzip zip diffutils yasm mesa imake inetutils xorg-server-xvfb
+ rust clang llvm jack nodejs cbindgen nasm python
+ lld dump_syms wasi-compiler-rt wasi-libc wasi-libc++ wasi-libc++abi
+ )
optdepends=('networkmanager: Location detection via available WiFi networks'
'libnotify: Notification integration'
'pulseaudio: Audio support'
'speech-dispatcher: Text-to-Speech'
- 'hunspell-en_US: Spell checking, American English')
+ 'hunspell-en_US: Spell checking, American English'
+ 'xdg-desktop-portal: Screensharing with Wayland')
provides=("firefox=$pkgver")
-conflict=("firefox")
-options=(!emptydirs !makeflags !strip)
+conflicts=("firefox")
+options=(!emptydirs !makeflags !strip !lto !debug)
source=(https://archive.mozilla.org/pub/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz{,.asc}
- no-relinking.patch
- 0001-Use-remoting-name-for-GDK-application-names.patch
$_pkgname.desktop
- unity-menubar.patch)
-sha256sums=('f2e9bb26af7682b31e82fdfc3a4b3e04fd1caa8b004469ea608185d33e35691b'
+ identity-icons-brand.svg
+ 0001-Bug-1803016-Wayland-Don-t-commit-wl_buffer-if-buffer.patch
+ fix-wayland-build.patch
+ unity-menubar.patch
+ fix_csd_window_buttons.patch)
+sha256sums=('e6a4819a3b82b1ca6c45296e50e6c9ab653306eeb540e50ba8683e339565992e'
'SKIP'
- '2dc9d1aa5eb7798c89f46478f254ae61e4122b4d1956d6044426288627d8a014'
- 'ab07ab26617ff76fce68e07c66b8aa9b96c2d3e5b5517e51a3c3eac2edd88894'
- 'e466789015e15be9409b7a7044353674ca6aa0f392e882217f90c79821fe2630'
- '73b9804393381f2c278eff63fecbd05035264dbb2aa68dd263a14db9f981a668')
+ '34514a657d6907a159594c51e674eeb81297c431ec26a736417c2fdb995c2c0c'
+ 'a9b8b4a0a1f4a7b4af77d5fc70c2686d624038909263c795ecc81e0aec7711e9'
+ 'bfe15651a99ac6d0037867c9db00a0d4340353cdc0ac4a39e43ad61cc2589ed6'
+ '46724a625f51c358abaee488a7ce75673078e96ba009459339120b8dd11dec25'
+ '74440d292e76426ac5cba9058a6f86763c37a9aa61b7afc47771140f1f53870b'
+ 'e08d0bc5b7e562f5de6998060e993eddada96d93105384960207f7bdf2e1ed6e')
validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <release@mozilla.com>
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
@@ -53,41 +60,44 @@ prepare() {
mkdir mozbuild
cd firefox-$pkgver
- # Avoid relinking during buildsymbols
- patch -Np1 -i ../no-relinking.patch
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1803016
+ patch -Np1 -i ../0001-Bug-1803016-Wayland-Don-t-commit-wl_buffer-if-buffer.patch
- # https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
- patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch
+ #https://aur.archlinux.org/packages/firefox-appmenu nicman32 comment 2021-08-16
+ patch -Np1 -i ../fix-wayland-build.patch
# actual appmenu patch from ubuntu repos
+ # http://archive.ubuntu.com/ubuntu/pool/main/f/firefox/firefox_80.0+build2-0ubuntu0.16.04.1.debian.tar.xz
patch -Np1 -i ../unity-menubar.patch
+ #fix csd window buttons patch
+ patch -Np1 -i ../fix_csd_window_buttons.patch
+
echo -n "$_google_api_key" >google-api-key
echo -n "$_mozilla_api_key" >mozilla-api-key
cat >../mozconfig <<END
ac_add_options --enable-application=browser
+mk_add_options MOZ_OBJDIR=${PWD@Q}/obj
ac_add_options --prefix=/usr
ac_add_options --enable-release
ac_add_options --enable-hardening
ac_add_options --enable-optimize
ac_add_options --enable-rust-simd
-export CC='clang --target=x86_64-unknown-linux-gnu'
-export CXX='clang++ --target=x86_64-unknown-linux-gnu'
-export AR=llvm-ar
-export NM=llvm-nm
-export RANLIB=llvm-ranlib
+ac_add_options --enable-linker=lld
+ac_add_options --disable-elf-hack
+ac_add_options --disable-bootstrap
+ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
# Branding
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=release
ac_add_options --with-distribution-id=org.archlinux
ac_add_options --with-unsigned-addon-scopes=app,system
+ac_add_options --allow-addon-sideload
export MOZILLA_OFFICIAL=1
export MOZ_APP_REMOTINGNAME=${_pkgname//-/}
-export MOZ_TELEMETRY_REPORTING=1
-export MOZ_REQUIRE_SIGNING=1
# Keys
ac_add_options --with-google-location-service-api-keyfile=${PWD@Q}/google-api-key
@@ -101,9 +111,7 @@ ac_add_options --with-system-nss
# Features
ac_add_options --enable-alsa
ac_add_options --enable-jack
-ac_add_options --enable-startup-notification
ac_add_options --enable-crashreporter
-ac_add_options --disable-gconf
ac_add_options --disable-updater
ac_add_options --disable-tests
END
@@ -114,61 +122,53 @@ build() {
export MOZ_NOSPAM=1
export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
+ export MOZ_ENABLE_FULL_SYMBOLS=1
+ export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=pip
# LTO needs more open files
ulimit -n 4096
- # -fno-plt with cross-LTO causes obscure LLVM errors
- # LLVM ERROR: Function Import: link error
- CFLAGS="${CFLAGS/-fno-plt/}"
- CXXFLAGS="${CXXFLAGS/-fno-plt/}"
-
# Do 3-tier PGO
- msg2 "Building instrumented browser..."
+ echo "Building instrumented browser..."
cat >.mozconfig ../mozconfig - <<END
ac_add_options --enable-profile-generate=cross
END
./mach build
- msg2 "Profiling instrumented browser..."
+ echo "Profiling instrumented browser..."
./mach package
LLVM_PROFDATA=llvm-profdata \
JARLOG_FILE="$PWD/jarlog" \
- xvfb-run -a -n 92 -s "-screen 0 1600x1200x24" \
+ xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
./mach python build/pgo/profileserver.py
- if ! compgen -G '*.profraw' >&2; then
- error "No profile data produced."
- return 1
- fi
+ stat -c "Profile data found (%s bytes)" merged.profdata
+ test -s merged.profdata
- if [[ ! -s jarlog ]]; then
- error "No jar log produced."
- return 1
- fi
+ stat -c "Jar log found (%s bytes)" jarlog
+ test -s jarlog
- msg2 "Removing instrumented browser..."
+ echo "Removing instrumented browser..."
./mach clobber
- msg2 "Building optimized browser..."
+ echo "Building optimized browser..."
cat >.mozconfig ../mozconfig - <<END
ac_add_options --enable-lto=cross
ac_add_options --enable-profile-use=cross
-ac_add_options --with-pgo-profile-path=${PWD@Q}
+ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
END
./mach build
- msg2 "Building symbol archive..."
+ echo "Building symbol archive..."
./mach buildsymbols
}
-
package() {
cd firefox-$pkgver
DESTDIR="$pkgdir" ./mach install
- local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
+ local vendorjs="$pkgdir/usr/lib/$_pkgname/browser/defaults/preferences/vendor.js"
install -Dvm644 /dev/stdin "$vendorjs" <<END
// Use LANG environment variable to choose locale
pref("intl.locale.requested", "");
@@ -179,12 +179,11 @@ pref("spellchecker.dictionary_path", "/usr/share/hunspell");
// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);
-// Don't disable our bundled extensions in the application directory
+// Don't disable extensions in the application directory
pref("extensions.autoDisableScopes", 11);
-pref("extensions.shownSelectionUI", true);
END
- local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
+ local distini="$pkgdir/usr/lib/$_pkgname/distribution/distribution.ini"
install -Dvm644 /dev/stdin "$distini" <<END
[Global]
id=archlinux
@@ -197,17 +196,19 @@ app.distributor.channel=$_pkgname
app.partner.archlinux=archlinux
END
- local i
+ local i theme=official
for i in 16 22 24 32 48 64 128 256; do
- install -Dvm644 browser/branding/official/default$i.png \
+ install -Dvm644 browser/branding/$theme/default$i.png \
"$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$_pkgname.png"
done
- install -Dvm644 browser/branding/official/content/about-logo.png \
+ install -Dvm644 browser/branding/$theme/content/about-logo.png \
"$pkgdir/usr/share/icons/hicolor/192x192/apps/$_pkgname.png"
- install -Dvm644 browser/branding/official/content/about-logo@2x.png \
+ install -Dvm644 browser/branding/$theme/content/about-logo@2x.png \
"$pkgdir/usr/share/icons/hicolor/384x384/apps/$_pkgname.png"
- install -Dvm644 ../firefox-symbolic.svg \
- "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$_pkgname-symbolic.svg"
+ install -Dvm644 browser/branding/$theme/content/about-logo.svg \
+ "$pkgdir/usr/share/icons/hicolor/scalable/apps/$_pkgname.svg"
+ install -Dvm644 ../identity-icons-brand.svg \
+ "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.svg"
install -Dvm644 ../$_pkgname.desktop \
"$pkgdir/usr/share/applications/$_pkgname.desktop"
@@ -220,20 +221,19 @@ END
# Replace duplicate binary with wrapper
# https://bugzilla.mozilla.org/show_bug.cgi?id=658850
- ln -srfv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/lib/$pkgname/firefox-bin"
+ ln -srfv "$pkgdir/usr/bin/$_pkgname" "$pkgdir/usr/lib/$_pkgname/firefox-bin"
# Use system certificates
- local nssckbi="$pkgdir/usr/lib/$pkgname/libnssckbi.so"
+ local nssckbi="$pkgdir/usr/lib/$_pkgname/libnssckbi.so"
if [[ -e $nssckbi ]]; then
ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
fi
- if [[ -f "$startdir/.crash-stats-api.token" ]]; then
- find . -name '*crashreporter-symbols-full.zip' -exec \
- "$startdir/upload-symbol-archive" "$startdir/.crash-stats-api.token" {} +
+ export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE="$startdir/.crash-stats-api.token"
+ if [[ -f $SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE ]]; then
+ make -C obj uploadsymbols
else
- find . -name '*crashreporter-symbols-full.zip' -exec \
- cp -fvt "$startdir" {} +
+ cp -fvt "$startdir" obj/dist/*crashreporter-symbols-full.tar.zst
fi
}
diff --git a/firefox.desktop b/firefox.desktop
index ba8d6d21399a..08ddb1b2e127 100644
--- a/firefox.desktop
+++ b/firefox.desktop
@@ -117,7 +117,7 @@ Icon=firefox
Terminal=false
X-MultipleArgs=false
Type=Application
-MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;
+MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupNotify=true
StartupWMClass=firefox
Categories=Network;WebBrowser;
diff --git a/fix-wayland-build.patch b/fix-wayland-build.patch
new file mode 100644
index 000000000000..703b1a8c1faf
--- /dev/null
+++ b/fix-wayland-build.patch
@@ -0,0 +1,19 @@
+Description: Fix FTBFS on bionic. Compiler errors:
+ In file included from Unified_cpp_widget_gtk1.cpp:2:
+ /<<BUILDDIR>>/firefox-92.0~b2+build1/widget/gtk/WaylandBuffer.cpp:261:39: error: unknown type name 'GLContext'; did you mean 'EGLContext'?
+ const LayoutDeviceIntSize& aSize, GLContext* aGL) {
+ ^~~~~~~~~
+
+Author: Rico Tzschichholz <ricotz@ubuntu.com>
+
+--- a/widget/gtk/WaylandBuffer.cpp
++++ b/widget/gtk/WaylandBuffer.cpp
+@@ -258,7 +258,7 @@
+
+ /* static */
+ RefPtr<WaylandBufferDMABUF> WaylandBufferDMABUF::Create(
+- const LayoutDeviceIntSize& aSize, GLContext* aGL) {
++ const LayoutDeviceIntSize& aSize, gl::GLContext* aGL) {
+ RefPtr<WaylandBufferDMABUF> buffer = new WaylandBufferDMABUF(aSize);
+
+ const auto flags =
diff --git a/fix_csd_window_buttons.patch b/fix_csd_window_buttons.patch
new file mode 100644
index 000000000000..1fe384e083a4
--- /dev/null
+++ b/fix_csd_window_buttons.patch
@@ -0,0 +1,12 @@
+Fix window buttons in case CSD when globalmenu is active
+
+
+--- a/browser/base/content/browser.css
++++ b/browser/base/content/browser.css
+@@ -334,5 +334,5 @@ toolbar[customizing] #whats-new-menu-button {
+ %ifdef MENUBAR_CAN_AUTOHIDE
+ #toolbar-menubar[autohide=true]:not([inactive]) + #TabsToolbar > .titlebar-buttonbox-container {
+- visibility: hidden;
++ visibility: visible;
+ }
+ %endif
diff --git a/identity-icons-brand.svg b/identity-icons-brand.svg
new file mode 100644
index 000000000000..fc8b1a356768
--- /dev/null
+++ b/identity-icons-brand.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+ <path fill="context-fill" fill-opacity="context-fill-opacity" d="M15.424 5.366A4.384 4.384 0 0 0 13.817 3.4a7.893 7.893 0 0 1 .811 2.353v.017c-.9-2.185-2.441-3.066-3.7-4.984l-.189-.3c-.035-.059-.063-.112-.088-.161a1.341 1.341 0 0 1-.119-.306.022.022 0 0 0-.013-.019.026.026 0 0 0-.019 0h-.006a5.629 5.629 0 0 0-2.755 4.308c.094-.006.187-.014.282-.014a4.069 4.069 0 0 1 3.51 1.983A2.838 2.838 0 0 0 9.6 5.824a3.2 3.2 0 0 1-1.885 6.013 3.651 3.651 0 0 1-1.042-.2c-.078-.028-.157-.059-.235-.093-.046-.02-.091-.04-.135-.062A3.282 3.282 0 0 1 4.415 8.95s.369-1.334 2.647-1.334a1.91 1.91 0 0 0 .964-.857 12.756 12.756 0 0 1-1.941-1.118c-.29-.277-.428-.411-.551-.511-.066-.054-.128-.1-.207-.152a3.481 3.481 0 0 1-.022-1.894 5.915 5.915 0 0 0-1.929 1.442A4.108 4.108 0 0 1 3.1 2.584a1.561 1.561 0 0 0-.267.138 5.767 5.767 0 0 0-.783.649 6.9 6.9 0 0 0-.748.868 6.446 6.446 0 0 0-1.08 2.348c0 .009-.076.325-.131.715l-.025.182c-.019.117-.033.245-.048.444v.023c-.005.076-.011.16-.016.258v.04A7.884 7.884 0 0 0 8.011 16a7.941 7.941 0 0 0 7.9-6.44l.036-.3a7.724 7.724 0 0 0-.523-3.894z" />
+</svg>
diff --git a/no-relinking.patch b/no-relinking.patch
deleted file mode 100644
index 6dd988402d9c..000000000000
--- a/no-relinking.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-
-# HG changeset patch
-# User Mike Shal <mshal@mozilla.com>
-# Date 1570127498 25200
-# Node ID b8bc2504f108d8a2216ee11405cbbe4cf7a0eaec
-# Parent 9a4d6aacc48080f019024c02ac7da1fd576b39fe
-Bug XYZ - Only force re-linking on 1-tier PGO builds; r?#firefox-build-system-reviewers
-
-
-diff --git a/config/rules.mk b/config/rules.mk
---- a/config/rules.mk
-+++ b/config/rules.mk
-@@ -465,25 +465,27 @@ ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
- $(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);)
- else
- ifdef GNU_CC
- -$(RM) *.gcda
- endif
- endif
- endif
-
-+ifdef MOZ_1TIER_PGO
- ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
- ifneq (,$(filter target,$(MAKECMDGOALS)))
- ifdef GNU_CC
- # Force rebuilding libraries and programs in both passes because each
- # pass uses different object files.
- $(PROGRAM) $(SHARED_LIBRARY) $(LIBRARY): FORCE
- endif
- endif
- endif
-+endif
-
- endif # NO_PROFILE_GUIDED_OPTIMIZE
-
- ##############################################
-
- clean clobber realclean clobber_all::
- -$(RM) $(ALL_TRASH)
- -$(RM) -r $(ALL_TRASH_DIRS)
-
diff --git a/unity-menubar.patch b/unity-menubar.patch
index e43298b7e5d4..531c28f1017b 100644
--- a/unity-menubar.patch
+++ b/unity-menubar.patch
@@ -1,23 +1,26 @@
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
-@@ -5,7 +5,11 @@
-
- <menubar id="main-menubar"
- onpopupshowing="if (event.target.parentNode.parentNode == this &amp;&amp;
+@@ -7,7 +7,12 @@
+ # On macOS, we don't track whether activation of the native menubar happened
+ # with the keyboard.
+ #ifndef XP_MACOSX
+- onpopupshowing="if (event.target.parentNode.parentNode == this)
++ onpopupshowing="if (event.target.parentNode.parentNode == this &amp;&amp;
+#ifdef MOZ_WIDGET_GTK
+ document.documentElement.getAttribute('shellshowingmenubar') != 'true')
+#else
- !('@mozilla.org/widget/nativemenuservice;1' in Cc))
++ true)
+#endif
this.setAttribute('openedwithkey',
- event.target.parentNode.openedWithKey);">
- <menu id="file-menu" data-l10n-id="menu-file">
+ event.target.parentNode.openedWithKey);"
+ #endif
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
-@@ -6801,11 +6801,17 @@ function onViewToolbarsPopupShowing(aEve
-
+@@ -6466,11 +6466,18 @@ function onViewToolbarsPopupShowing(aEve
+ MozXULElement.insertFTLIfNeeded("browser/toolbarContextMenu.ftl");
+ let firstMenuItem = aInsertPoint || popup.firstElementChild;
let toolbarNodes = gNavToolbox.querySelectorAll("toolbar");
-
++
+ let shellShowingMenubar = document.documentElement.getAttribute("shellshowingmenubar") == "true";
+
for (let toolbar of toolbarNodes) {
@@ -29,23 +32,22 @@
+ continue;
+ }
+
- let menuItem = document.createXULElement("menuitem");
- let hidingAttribute =
- toolbar.getAttribute("type") == "menubar" ? "autohide" : "collapsed";
---- a/browser/components/places/content/places.xul
-+++ b/browser/components/places/content/places.xul
-@@ -166,7 +166,7 @@
- <toolbarbutton type="menu" class="tabbable"
- onpopupshowing="document.getElementById('placeContent').focus()"
+ if (toolbar.id == "PersonalToolbar") {
+ let menu = BookmarkingUI.buildBookmarksToolbarSubmenu(toolbar);
+ popup.insertBefore(menu, firstMenuItem);
+--- a/browser/components/places/content/places.xhtml
++++ b/browser/components/places/content/places.xhtml
+@@ -165,6 +165,7 @@
#else
-- <menubar id="placesMenu">
-+ <menubar id="placesMenu" _moz-menubarkeeplocal="true">
- <menu accesskey="&organize.accesskey;" class="menu-iconic"
+ <menubar id="placesMenu">
+ <menu class="menu-iconic" data-l10n-id="places-organize-button"
++ _moz-menubarkeeplocal="true"
#endif
- id="organizeButton" label="&organize.label;"
+ id="organizeButton">
+ <menupopup id="organizeButtonPopup">
--- a/dom/xul/XULPopupElement.cpp
+++ b/dom/xul/XULPopupElement.cpp
-@@ -156,6 +156,10 @@ void XULPopupElement::GetState(nsString&
+@@ -208,6 +208,10 @@ void XULPopupElement::GetState(nsString&
// set this here in case there's no frame for the popup
aState.AssignLiteral("closed");
@@ -53,10 +55,10 @@
+ nsAutoString nativeState;
+#endif
+
- nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetPrimaryFrame());
- if (menuPopupFrame) {
- switch (menuPopupFrame->PopupState()) {
-@@ -179,6 +183,11 @@ void XULPopupElement::GetState(nsString&
+ if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
+ switch (pm->GetPopupState(this)) {
+ case ePopupShown:
+@@ -230,6 +234,11 @@ void XULPopupElement::GetState(nsString&
break;
}
}
@@ -70,90 +72,83 @@
nsINode* XULPopupElement::GetTriggerNode() const {
--- a/dom/xul/moz.build
+++ b/dom/xul/moz.build
-@@ -77,6 +77,11 @@ LOCAL_INCLUDES += [
+@@ -82,4 +82,9 @@ LOCAL_INCLUDES += [
- include('/ipc/chromium/chromium-config.mozbuild')
+ include("/ipc/chromium/chromium-config.mozbuild")
-+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
++if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ LOCAL_INCLUDES += [
-+ '/widget/gtk',
++ "/widget/gtk",
+ ]
+
- FINAL_LIBRARY = 'xul'
-
- if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
+ FINAL_LIBRARY = "xul"
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
-@@ -70,6 +70,10 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'an
- '/dom/system',
- '/dom/system/android',
+@@ -70,6 +70,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "an
+ "/dom/system",
+ "/dom/system/android",
]
-+elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
++elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ LOCAL_INCLUDES += [
-+ '/widget/gtk',
++ "/widget/gtk",
+ ]
XPCOM_MANIFESTS += [
- 'components.conf',
+ "components.conf",
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
-@@ -327,6 +327,9 @@ pref("dom.inputevent.datatransfer.enable
+@@ -311,6 +311,9 @@ pref("dom.mouseevent.click.hack.use_lega
+ // Fastback caching - if this pref is negative, then we calculate the number
// of content viewers to cache based on the amount of available memory.
pref("browser.sessionhistory.max_total_viewers", -1);
-
+#ifdef MOZ_WIDGET_GTK
+pref("ui.use_unity_menubar", true);
+#endif
- pref("ui.click_hold_context_menus", false);
- // 0 = false, 1 = true, 2 = autodetect.
- pref("ui.android.mouse_as_touch", 1);
+
+ // min font device pixel size at which to turn on high quality
+ pref("browser.display.auto_quality_min_font_size", 20);
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
-@@ -212,6 +212,18 @@ toolbar[type="menubar"] {
+@@ -229,6 +229,13 @@ toolbox {
+ }
}
- %endif
-+%ifdef MOZ_WIDGET_GTK
-+window[shellshowingmenubar="true"] menubar {
++@media (-moz-platform: linux) {
++*|*:root[shellshowingmenubar="true"]
++toolbar[type="menubar"]:not([customizing="true"]) {
+ display: none !important;
+}
-+
-+window[shellshowingmenubar="true"]
-+toolbar[type="menubar"]:not([customizing="true"]) {
-+ min-height: 0 !important;
-+ border: 0 !important;
+}
-+%endif
+
toolbarspring {
-moz-box-flex: 1000;
}
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
-@@ -53,6 +53,15 @@ UNIFIED_SOURCES += [
- ]
+@@ -77,6 +77,15 @@ UNIFIED_SOURCES += [
SOURCES += [
-+ 'nsDbusmenu.cpp',
-+ 'nsMenu.cpp', # conflicts with X11 headers
-+ 'nsMenuBar.cpp',
-+ 'nsMenuContainer.cpp',
-+ 'nsMenuItem.cpp',
-+ 'nsMenuObject.cpp',
-+ 'nsMenuSeparator.cpp',
-+ 'nsNativeMenuDocListener.cpp',
-+ 'nsNativeMenuService.cpp',
- 'nsWindow.cpp', # conflicts with X11 headers
- ]
-
-@@ -129,6 +138,7 @@ FINAL_LIBRARY = 'xul'
- LOCAL_INCLUDES += [
- '/layout/base',
- '/layout/generic',
-+ '/layout/style',
- '/layout/xul',
- '/other-licenses/atk-1.0',
- '/widget',
+ "MediaKeysEventSourceFactory.cpp",
++ "nsDbusmenu.cpp",
++ "nsMenu.cpp", # conflicts with X11 headers
++ "nsMenuBar.cpp",
++ "nsMenuContainer.cpp",
++ "nsMenuItem.cpp",
++ "nsMenuObject.cpp",
++ "nsMenuSeparator.cpp",
++ "nsNativeMenuDocListener.cpp",
++ "nsNativeMenuService.cpp",
+ "nsNativeThemeGTK.cpp", # conflicts with X11 headers
+ "nsWindow.cpp", # conflicts with X11 headers
+ "WaylandVsyncSource.cpp", # conflicts with X11 headers
+@@ -152,6 +161,7 @@ LOCAL_INCLUDES += [
+ "/layout/base",
+ "/layout/forms",
+ "/layout/generic",
++ "/layout/style",
+ "/layout/xul",
+ "/other-licenses/atk-1.0",
+ "/third_party/cups/include",
--- /dev/null
+++ b/widget/gtk/nsDbusmenu.cpp
@@ -0,0 +1,61 @@
@@ -324,7 +319,7 @@
+#endif /* __nsDbusmenu_h__ */
--- /dev/null
+++ b/widget/gtk/nsMenu.cpp
-@@ -0,0 +1,844 @@
+@@ -0,0 +1,795 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -339,13 +334,9 @@
+#include "mozilla/Assertions.h"
+#include "mozilla/ComputedStyleInlines.h"
+#include "mozilla/EventDispatcher.h"
-+#include "mozilla/GuardObjects.h"
+#include "mozilla/MouseEvents.h"
-+#include "mozilla/Move.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/PresShellInlines.h"
-+#include "nsAutoPtr.h"
-+#include "nsBindingManager.h"
+#include "nsComponentManagerUtils.h"
+#include "nsContentUtils.h"
+#include "nsCSSValue.h"
@@ -358,8 +349,6 @@
+#include "nsString.h"
+#include "nsStyleStruct.h"
+#include "nsThreadUtils.h"
-+#include "nsXBLBinding.h"
-+#include "nsXBLService.h"
+
+#include "nsNativeMenuDocListener.h"
+
@@ -442,45 +431,6 @@
+ EventDispatcher::Dispatch(aTarget, nullptr, &event);
+}
+
-+static void
-+AttachXBLBindings(nsIContent *aContent)
-+{
-+ dom::Document *doc = aContent->OwnerDoc();
-+ PresShell *shell = doc->GetPresShell();
-+ if (!shell) {
-+ return;
-+ }
-+
-+ RefPtr<ComputedStyle> style =
-+ shell->StyleSet()->ResolveStyleLazily(*aContent->AsElement());
-+
-+ if (!style) {
-+ return;
-+ }
-+
-+ const auto& binding = style->StyleDisplay()->mBinding;
-+ if (binding.IsNone()) {
-+ return;
-+ }
-+
-+ nsXBLService* xbl = nsXBLService::GetInstance();
-+ if (!xbl) {
-+ return;
-+ }
-+
-+ RefPtr<nsXBLBinding> pendingBinding;
-+ const auto& url = binding.AsUrl();
-+ nsresult rv = xbl->LoadBindings(aContent->AsElement(),
-+ url.GetURI(),
-+ url.ExtraData().Principal(),
-+ getter_AddRefs(pendingBinding));
-+ if ((NS_FAILED(rv) && rv != NS_ERROR_XBL_BLOCKED) || !pendingBinding) {
-+ return;
-+ }
-+
-+ doc->BindingManager()->AddToAttachedQueue(pendingBinding);
-+}
-+
+void
+nsMenu::SetPopupState(EPopupState aState)
+{
@@ -493,13 +443,13 @@
+ nsAutoString state;
+ switch (aState) {
+ case ePopupState_Showing:
-+ state.Assign(NS_LITERAL_STRING("showing"));
++ state.Assign(u"showing"_ns);
+ break;
+ case ePopupState_Open:
-+ state.Assign(NS_LITERAL_STRING("open"));
++ state.Assign(u"open"_ns);
+ break;
+ case ePopupState_Hiding:
-+ state.Assign(NS_LITERAL_STRING("hiding"));
++ state.Assign(u"hiding"_ns);
+ break;
+ default:
+ break;
@@ -537,12 +487,12 @@
+
+ nsAutoCString event(name);
+
-+ if (event.Equals(NS_LITERAL_CSTRING("closed"))) {
++ if (event.Equals("closed"_ns)) {
+ self->OnClose();
+ return;
+ }
+
-+ if (event.Equals(NS_LITERAL_CSTRING("opened"))) {
++ if (event.Equals("opened"_ns)) {
+ self->OnOpen();
+ return;
+ }
@@ -606,7 +556,7 @@
+ DispatchMouseEvent(mPopupContent, eXULPopupShowing);
+
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::open,
-+ NS_LITERAL_STRING("true"), true);
++ u"true"_ns, true);
+ }
+
+ if (!self) {
@@ -690,8 +640,6 @@
+ return;
+ }
+
-+ AttachXBLBindings(mPopupContent);
-+
+ DocListener()->RegisterForContentChanges(mPopupContent, this);
+}
+
@@ -816,12 +764,10 @@
+ mNeedsUpdate = true;
+
+ MaybeAddPlaceholderItem();
-+
-+ AttachXBLBindings(ContentNode());
+}
+
+void
-+nsMenu::Update(ComputedStyle *aComputedStyle)
++nsMenu::Update(const ComputedStyle *aComputedStyle)
+{
+ if (mNeedsUpdate) {
+ mNeedsUpdate = false;
@@ -873,10 +819,10 @@
+ UpdateLabel();
+ } else if (aAttribute == nsGkAtoms::hidden ||
+ aAttribute == nsGkAtoms::collapsed) {
-+ RefPtr<ComputedStyle> style = GetComputedStyle();
++ RefPtr<const ComputedStyle> style = GetComputedStyle();
+ UpdateVisibility(style);
+ } else if (aAttribute == nsGkAtoms::image) {
-+ RefPtr<ComputedStyle> style = GetComputedStyle();
++ RefPtr<const ComputedStyle> style = GetComputedStyle();
+ UpdateIcon(style);
+ }
+}
@@ -1122,7 +1068,7 @@
+
+ OnOpen();
+
-+ mOpenDelayTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
++ mOpenDelayTimer = NS_NewTimer();
+ if (!mOpenDelayTimer) {
+ return;
+ }
@@ -1264,7 +1210,7 @@
+ nsIContent *aChild);
+
+ void InitializeNativeData() override;
-+ void Update(mozilla::ComputedStyle *aComputedStyle) override;
++ void Update(const mozilla::ComputedStyle *aComputedStyle) override;
+ nsMenuObject::PropertyFlags SupportedProperties() const override;
+
+ void OnAttributeChanged(nsIContent *aContent, nsAtom *aAttribute) override;
@@ -1297,7 +1243,7 @@
+#endif /* __nsMenu_h__ */
--- /dev/null
+++ b/widget/gtk/nsMenuBar.cpp
-@@ -0,0 +1,550 @@
+@@ -0,0 +1,548 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -1312,9 +1258,7 @@
+#include "mozilla/dom/Event.h"
+#include "mozilla/dom/KeyboardEvent.h"
+#include "mozilla/dom/KeyboardEventBinding.h"
-+#include "mozilla/Move.h"
+#include "mozilla/Preferences.h"
-+#include "nsAutoPtr.h"
+#include "nsContentUtils.h"
+#include "nsIDOMEventListener.h"
+#include "nsIRunnable.h"
@@ -1416,9 +1360,9 @@
+ nsAutoString type;
+ aEvent->GetType(type);
+
-+ if (type.Equals(NS_LITERAL_STRING("focus"))) {
++ if (type.Equals(u"focus"_ns)) {
+ mOwner->Focus();
-+ } else if (type.Equals(NS_LITERAL_STRING("blur"))) {
++ } else if (type.Equals(u"blur"_ns)) {
+ mOwner->Blur();
+ }
+
@@ -1427,11 +1371,11 @@
+ return NS_OK;
+ }
+
-+ if (type.Equals(NS_LITERAL_STRING("keypress"))) {
++ if (type.Equals(u"keypress"_ns)) {
+ return mOwner->Keypress(keyEvent);
-+ } else if (type.Equals(NS_LITERAL_STRING("keydown"))) {
++ } else if (type.Equals(u"keydown"_ns)) {
+ return mOwner->KeyDown(keyEvent);
-+ } else if (type.Equals(NS_LITERAL_STRING("keyup"))) {
++ } else if (type.Equals(u"keyup"_ns)) {
+ return mOwner->KeyUp(keyEvent);
+ }
+
@@ -1472,7 +1416,7 @@
+ g_object_ref(mTopLevel);
+
+ nsAutoCString path;
-+ path.Append(NS_LITERAL_CSTRING("/com/canonical/menu/"));
++ path.Append("/com/canonical/menu/"_ns);
+ char xid[10];
+ sprintf(xid, "%X", static_cast<uint32_t>(
+ GDK_WINDOW_XID(gtk_widget_get_window(mTopLevel))));
@@ -1530,19 +1474,19 @@
+void
+nsMenuBar::DisconnectDocumentEventListeners()
+{
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("focus"),
++ mDocument->RemoveEventListener(u"focus"_ns,
+ mEventListener,
+ true);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("blur"),
++ mDocument->RemoveEventListener(u"blur"_ns,
+ mEventListener,
+ true);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("keypress"),
++ mDocument->RemoveEventListener(u"keypress"_ns,
+ mEventListener,
+ false);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("keydown"),
++ mDocument->RemoveEventListener(u"keydown"_ns,
+ mEventListener,
+ false);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("keyup"),
++ mDocument->RemoveEventListener(u"keyup"_ns,
+ mEventListener,
+ false);
+}
@@ -1552,7 +1496,7 @@
+{
+ ContentNode()->OwnerDoc()->GetRootElement()->SetAttr(
+ kNameSpaceID_None, nsGkAtoms::shellshowingmenubar,
-+ aShowing ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"),
++ aShowing ? u"true"_ns : u"false"_ns,
+ true);
+}
+
@@ -1561,7 +1505,7 @@
+{
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::openedwithkey,
-+ NS_LITERAL_STRING("false"), true);
++ u"false"_ns, true);
+}
+
+void
@@ -1639,7 +1583,7 @@
+
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::openedwithkey,
-+ NS_LITERAL_STRING("true"), true);
++ u"true"_ns, true);
+ static_cast<nsMenu *>(found)->OpenMenu();
+
+ aEvent->StopPropagation();
@@ -1806,26 +1750,26 @@
+
+ mIsActive = true;
+
-+ mDocument->AddEventListener(NS_LITERAL_STRING("focus"),
++ mDocument->AddEventListener(u"focus"_ns,
+ mEventListener,
+ true);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("blur"),
++ mDocument->AddEventListener(u"blur"_ns,
+ mEventListener,
+ true);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("keypress"),
++ mDocument->AddEventListener(u"keypress"_ns,
+ mEventListener,
+ false);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("keydown"),
++ mDocument->AddEventListener(u"keydown"_ns,
+ mEventListener,
+ false);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("keyup"),
++ mDocument->AddEventListener(u"keyup"_ns,
+ mEventListener,
+ false);
+
+ // Clear this. Not sure if we really need to though
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::openedwithkey,
-+ NS_LITERAL_STRING("false"), true);
++ u"false"_ns, true);
+
+ DocListener()->Start();
+ Build();
@@ -1964,7 +1908,7 @@
+#endif /* __nsMenuBar_h__ */
--- /dev/null
+++ b/widget/gtk/nsMenuContainer.cpp
-@@ -0,0 +1,171 @@
+@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -1973,7 +1917,6 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/DebugOnly.h"
-+#include "mozilla/Move.h"
+#include "nsGkAtoms.h"
+#include "nsIContent.h"
+
@@ -2104,7 +2047,7 @@
+ index));
+ }
+
-+ MOZ_ALWAYS_TRUE(mChildren.InsertElementAt(index, std::move(aChild)));
++ mChildren.InsertElementAt(index, std::move(aChild));
+}
+
+void
@@ -2118,7 +2061,7 @@
+ aChild->GetNativeData()));
+ }
+
-+ MOZ_ALWAYS_TRUE(mChildren.AppendElement(std::move(aChild)));
++ mChildren.AppendElement(std::move(aChild));
+}
+
+bool
@@ -2211,7 +2154,7 @@
+#endif /* __nsMenuContainer_h__ */
--- /dev/null
+++ b/widget/gtk/nsMenuItem.cpp
-@@ -0,0 +1,764 @@
+@@ -0,0 +1,766 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -2225,10 +2168,8 @@
+#include "mozilla/dom/Element.h"
+#include "mozilla/dom/KeyboardEventBinding.h"
+#include "mozilla/dom/XULCommandEvent.h"
-+#include "mozilla/Move.h"
+#include "mozilla/Preferences.h"
+#include "mozilla/TextEvents.h"
-+#include "nsAutoPtr.h"
+#include "nsContentUtils.h"
+#include "nsCRT.h"
+#include "nsGkAtoms.h"
@@ -2560,22 +2501,22 @@
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::checked,
+ mIsChecked ?
-+ NS_LITERAL_STRING("false")
-+ : NS_LITERAL_STRING("true"),
++ u"false"_ns
++ : u"true"_ns,
+ true);
+ }
+
+ dom::Document *doc = ContentNode()->OwnerDoc();
+ ErrorResult rv;
+ RefPtr<dom::Event> event =
-+ doc->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
++ doc->CreateEvent(u"xulcommandevent"_ns,
+ dom::CallerType::System, rv);
+ if (!rv.Failed()) {
+ RefPtr<dom::XULCommandEvent> command = event->AsXULCommandEvent();
+ if (command) {
-+ command->InitCommandEvent(NS_LITERAL_STRING("command"), true, true,
++ command->InitCommandEvent(u"command"_ns, true, true,
+ nsGlobalWindowInner::Cast(doc->GetInnerWindow()),
-+ 0, false, false, false, false, nullptr, 0, rv);
++ 0, false, false, false, false, 0, nullptr, 0, rv);
+ if (!rv.Failed()) {
+ event->SetTrusted(true);
+ ContentNode()->DispatchEvent(*event, rv);
@@ -2795,6 +2736,10 @@
+ for (uint32_t i = 0; i < count; ++i) {
+ nsIContent *sibling = parent->GetChildAt_Deprecated(i);
+
++ if (sibling->IsComment()) {
++ continue;
++ }
++
+ nsAutoString otherName;
+ sibling->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name,
+ otherName);
@@ -2845,7 +2790,7 @@
+ eCaseMatters)) {
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::disabled,
-+ NS_LITERAL_STRING("true"), true);
++ u"true"_ns, true);
+ } else {
+ ContentNode()->AsElement()->UnsetAttr(kNameSpaceID_None,
+ nsGkAtoms::disabled, true);
@@ -2858,7 +2803,7 @@
+}
+
+void
-+nsMenuItem::Update(ComputedStyle *aComputedStyle)
++nsMenuItem::Update(const ComputedStyle *aComputedStyle)
+{
+ if (mNeedsUpdate) {
+ mNeedsUpdate = false;
@@ -2933,10 +2878,10 @@
+ UpdateState();
+ } else if (aAttribute == nsGkAtoms::hidden ||
+ aAttribute == nsGkAtoms::collapsed) {
-+ RefPtr<ComputedStyle> style = GetComputedStyle();
++ RefPtr<const ComputedStyle> style = GetComputedStyle();
+ UpdateVisibility(style);
+ } else if (aAttribute == nsGkAtoms::image) {
-+ RefPtr<ComputedStyle> style = GetComputedStyle();
++ RefPtr<const ComputedStyle> style = GetComputedStyle();
+ UpdateIcon(style);
+ }
+ } else if (aContent == mKeyContent &&
@@ -3043,7 +2988,7 @@
+
+ void InitializeNativeData() override;
+ void UpdateContentAttributes() override;
-+ void Update(mozilla::ComputedStyle *aComputedStyle) override;
++ void Update(const mozilla::ComputedStyle *aComputedStyle) override;
+ bool IsCompatibleWithNativeData(DbusmenuMenuitem *aNativeData) const override;
+ nsMenuObject::PropertyFlags SupportedProperties() const override;
+
@@ -3061,7 +3006,7 @@
+#endif /* __nsMenuItem_h__ */
--- /dev/null
+++ b/widget/gtk/nsMenuObject.cpp
-@@ -0,0 +1,664 @@
+@@ -0,0 +1,653 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -3081,6 +3026,7 @@
+#include "mozilla/Preferences.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/PresShellInlines.h"
++#include "mozilla/GRefPtr.h"
+#include "nsAttrValue.h"
+#include "nsComputedDOMStyle.h"
+#include "nsContentUtils.h"
@@ -3136,7 +3082,7 @@
+
+ nsMenuObjectIconLoader(nsMenuObject *aOwner) : mOwner(aOwner) { };
+
-+ void LoadIcon(ComputedStyle *aComputedStyle);
++ void LoadIcon(const ComputedStyle *aComputedStyle);
+ void Destroy();
+
+private:
@@ -3145,21 +3091,20 @@
+ nsMenuObject *mOwner;
+ RefPtr<imgRequestProxy> mImageRequest;
+ nsCOMPtr<nsIURI> mURI;
-+ nsIntRect mImageRect;
+};
+
+NS_IMPL_ISUPPORTS(nsMenuObjectIconLoader, imgINotificationObserver)
+
-+NS_IMETHODIMP
++void
+nsMenuObjectIconLoader::Notify(imgIRequest *aProxy,
+ int32_t aType, const nsIntRect *aRect)
+{
+ if (!mOwner) {
-+ return NS_OK;
++ return;
+ }
+
+ if (aProxy != mImageRequest) {
-+ return NS_ERROR_FAILURE;
++ return;
+ }
+
+ if (aType == imgINotificationObserver::LOAD_COMPLETE) {
@@ -3168,7 +3113,7 @@
+ (status & imgIRequest::STATUS_ERROR)) {
+ mImageRequest->Cancel(NS_BINDING_ABORTED);
+ mImageRequest = nullptr;
-+ return NS_ERROR_FAILURE;
++ return;
+ }
+
+ nsCOMPtr<imgIContainer> image;
@@ -3180,27 +3125,23 @@
+ image->GetWidth(&width);
+ image->GetHeight(&height);
+ image->RequestDecodeForSize(nsIntSize(width, height), imgIContainer::FLAG_NONE);
-+ return NS_OK;
++ return;
+ }
+
+ if (aType == imgINotificationObserver::DECODE_COMPLETE) {
+ mImageRequest->Cancel(NS_BINDING_ABORTED);
+ mImageRequest = nullptr;
-+ return NS_OK;
++ return;
+ }
+
+ if (aType != imgINotificationObserver::FRAME_COMPLETE) {
-+ return NS_OK;
++ return;
+ }
+
+ nsCOMPtr<imgIContainer> img;
+ mImageRequest->GetImage(getter_AddRefs(img));
+ if (!img) {
-+ return NS_ERROR_FAILURE;
-+ }
-+
-+ if (!mImageRect.IsEmpty()) {
-+ img = ImageOps::Clip(img, mImageRect);
++ return;
+ }
+
+ int32_t width, height;
@@ -3209,7 +3150,7 @@
+
+ if (width <= 0 || height <= 0) {
+ mOwner->ClearIcon();
-+ return NS_OK;
++ return;
+ }
+
+ if (width > 100 || height > 100) {
@@ -3218,27 +3159,25 @@
+ // GDbus helpfully aborts the application. Thank you :)
+ NS_WARNING("Icon data too large");
+ mOwner->ClearIcon();
-+ return NS_OK;
++ return;
+ }
+
-+ GdkPixbuf *pixbuf = nsImageToPixbuf::ImageToPixbuf(img);
++ RefPtr<GdkPixbuf> pixbuf = nsImageToPixbuf::ImageToPixbuf(img);
+ if (pixbuf) {
+ dbusmenu_menuitem_property_set_image(mOwner->GetNativeData(),
+ DBUSMENU_MENUITEM_PROP_ICON_DATA,
+ pixbuf);
-+ g_object_unref(pixbuf);
+ }
+
-+ return NS_OK;
++ return;
+}
+
+void
-+nsMenuObjectIconLoader::LoadIcon(ComputedStyle *aComputedStyle)
++nsMenuObjectIconLoader::LoadIcon(const ComputedStyle *aComputedStyle)
+{
+ dom::Document *doc = mOwner->ContentNode()->OwnerDoc();
+
+ nsCOMPtr<nsIURI> uri;
-+ nsIntRect imageRect;
+ imgRequestProxy *imageRequest = nullptr;
+
+ nsAutoString uriString;
@@ -3258,12 +3197,9 @@
+ }
+
+ const nsStyleList *list = aComputedStyle->StyleList();
-+ imageRequest = list->GetListStyleImage();
++ imageRequest = list->mListStyleImage.GetImageRequest();
+ if (imageRequest) {
+ imageRequest->GetURI(getter_AddRefs(uri));
-+ auto& rect = list->mImageRegion.AsRect();
-+ imageRect = rect.ToLayoutRect().ToNearestPixels(
-+ pc->AppUnitsPerDevPixel());
+ }
+ }
+
@@ -3281,7 +3217,7 @@
+
+ bool same;
+ if (mURI && NS_SUCCEEDED(mURI->Equals(uri, &same)) && same &&
-+ (!imageRequest || imageRect == mImageRect)) {
++ !imageRequest) {
+ return;
+ }
+
@@ -3293,10 +3229,8 @@
+ mURI = uri;
+
+ if (imageRequest) {
-+ mImageRect = imageRect;
+ imageRequest->Clone(this, nullptr, getter_AddRefs(mImageRequest));
+ } else {
-+ mImageRect.SetEmpty();
+ nsCOMPtr<nsILoadGroup> loadGroup = doc->GetDocumentLoadGroup();
+ RefPtr<imgLoader> loader =
+ nsContentUtils::GetImgLoaderForDocument(doc);
@@ -3309,7 +3243,7 @@
+ nullptr, 0, loadGroup, this, nullptr, nullptr,
+ nsIRequest::LOAD_NORMAL, nullptr,
+ nsIContentPolicy::TYPE_IMAGE, EmptyString(),
-+ false, getter_AddRefs(mImageRequest));
++ false, false, 0, getter_AddRefs(mImageRequest));
+ }
+}
+
@@ -3499,14 +3433,14 @@
+}
+
+void
-+nsMenuObject::UpdateVisibility(ComputedStyle *aComputedStyle)
++nsMenuObject::UpdateVisibility(const ComputedStyle *aComputedStyle)
+{
+ bool vis = true;
+
+ if (aComputedStyle &&
+ (aComputedStyle->StyleDisplay()->mDisplay == StyleDisplay::None ||
+ aComputedStyle->StyleVisibility()->mVisible ==
-+ NS_STYLE_VISIBILITY_COLLAPSE)) {
++ StyleVisibility::Collapse)) {
+ vis = false;
+ }
+
@@ -3530,7 +3464,7 @@
+}
+
+void
-+nsMenuObject::UpdateIcon(ComputedStyle *aComputedStyle)
++nsMenuObject::UpdateIcon(const ComputedStyle *aComputedStyle)
+{
+ if (ShouldShowIcon()) {
+ if (!mIconLoader) {
@@ -3548,12 +3482,12 @@
+ }
+}
+
-+already_AddRefed<ComputedStyle>
++already_AddRefed<const ComputedStyle>
+nsMenuObject::GetComputedStyle()
+{
-+ RefPtr<ComputedStyle> style =
++ RefPtr<const ComputedStyle> style =
+ nsComputedDOMStyle::GetComputedStyleNoFlush(
-+ mContent->AsElement(), nullptr);
++ mContent->AsElement());
+
+ return style.forget();
+}
@@ -3581,7 +3515,7 @@
+}
+
+void
-+nsMenuObject::Update(ComputedStyle *aComputedStyle)
++nsMenuObject::Update(const ComputedStyle *aComputedStyle)
+{
+}
+
@@ -3685,7 +3619,7 @@
+
+ UpdateContentAttributes();
+
-+ RefPtr<ComputedStyle> style = GetComputedStyle();
++ RefPtr<const ComputedStyle> style = GetComputedStyle();
+ Update(style);
+}
+
@@ -3817,11 +3751,11 @@
+ };
+
+ void UpdateLabel();
-+ void UpdateVisibility(mozilla::ComputedStyle *aComputedStyle);
++ void UpdateVisibility(const mozilla::ComputedStyle *aComputedStyle);
+ void UpdateSensitivity();
-+ void UpdateIcon(mozilla::ComputedStyle *aComputedStyle);
++ void UpdateIcon(const mozilla::ComputedStyle *aComputedStyle);
+
-+ already_AddRefed<mozilla::ComputedStyle> GetComputedStyle();
++ already_AddRefed<const mozilla::ComputedStyle> GetComputedStyle();
+
+private:
+ friend class nsMenuObjectIconLoader;
@@ -3848,7 +3782,7 @@
+ // Update properties that should be refreshed when the container opens.
+ // This should be implemented by subclasses that have properties which
+ // need refreshing
-+ virtual void Update(mozilla::ComputedStyle *aComputedStyle);
++ virtual void Update(const mozilla::ComputedStyle *aComputedStyle);
+
+ bool ShouldShowIcon() const;
+ void ClearIcon();
@@ -3900,7 +3834,7 @@
+#endif /* __nsMenuObject_h__ */
--- /dev/null
+++ b/widget/gtk/nsMenuSeparator.cpp
-@@ -0,0 +1,84 @@
+@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -3909,8 +3843,6 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/Assertions.h"
-+#include "mozilla/Move.h"
-+#include "nsAutoPtr.h"
+#include "nsCRT.h"
+#include "nsGkAtoms.h"
+
@@ -3930,7 +3862,7 @@
+}
+
+void
-+nsMenuSeparator::Update(ComputedStyle *aComputedStyle)
++nsMenuSeparator::Update(const ComputedStyle *aComputedStyle)
+{
+ UpdateVisibility(aComputedStyle);
+}
@@ -3963,7 +3895,7 @@
+
+ if (aAttribute == nsGkAtoms::hidden ||
+ aAttribute == nsGkAtoms::collapsed) {
-+ RefPtr<ComputedStyle> style = GetComputedStyle();
++ RefPtr<const ComputedStyle> style = GetComputedStyle();
+ UpdateVisibility(style);
+ }
+}
@@ -4017,7 +3949,7 @@
+
+private:
+ void InitializeNativeData() override;
-+ void Update(mozilla::ComputedStyle *aComputedStyle) override;
++ void Update(const mozilla::ComputedStyle *aComputedStyle) override;
+ bool IsCompatibleWithNativeData(DbusmenuMenuitem *aNativeData) const override;
+ nsMenuObject::PropertyFlags SupportedProperties() const override;
+
@@ -4027,7 +3959,7 @@
+#endif /* __nsMenuSeparator_h__ */
--- /dev/null
+++ b/widget/gtk/nsNativeMenuDocListener.cpp
-@@ -0,0 +1,350 @@
+@@ -0,0 +1,347 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -4061,11 +3993,9 @@
+{
+public:
+ DispatchHelper(nsNativeMenuDocListener *aListener,
-+ nsIContent *aContent
-+ MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
++ nsIContent *aContent) :
+ mObserver(nullptr)
+ {
-+ MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+ if (aContent == aListener->mLastSource) {
+ mObserver = aListener->mLastTarget;
+ } else {
@@ -4085,7 +4015,6 @@
+
+private:
+ nsNativeMenuChangeObserver *mObserver;
-+ MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+};
+
+NS_IMPL_ISUPPORTS(nsNativeMenuDocListener, nsIMutationObserver)
@@ -4109,7 +4038,7 @@
+ return;
+ }
+
-+ MutationRecord *m = *mPendingMutations.AppendElement(new MutationRecord);
++ MutationRecord *m = mPendingMutations.AppendElement(MakeUnique<MutationRecord>())->get();
+ m->mType = MutationRecord::eAttributeChanged;
+ m->mTarget = aElement;
+ m->mAttribute = aAttribute;
@@ -4140,7 +4069,7 @@
+ return;
+ }
+
-+ MutationRecord *m = *mPendingMutations.AppendElement(new MutationRecord);
++ MutationRecord *m = mPendingMutations.AppendElement(MakeUnique<MutationRecord>())->get();
+ m->mType = MutationRecord::eContentInserted;
+ m->mTarget = container;
+ m->mChild = aChild;
@@ -4163,7 +4092,7 @@
+ return;
+ }
+
-+ MutationRecord *m = *mPendingMutations.AppendElement(new MutationRecord);
++ MutationRecord *m = mPendingMutations.AppendElement(MakeUnique<MutationRecord>())->get();
+ m->mType = MutationRecord::eContentRemoved;
+ m->mTarget = container;
+ m->mChild = aChild;
@@ -4172,7 +4101,7 @@
+}
+
+void
-+nsNativeMenuDocListener::NodeWillBeDestroyed(const nsINode *aNode)
++nsNativeMenuDocListener::NodeWillBeDestroyed(nsINode *aNode)
+{
+ mDocument = nullptr;
+}
@@ -4233,7 +4162,7 @@
+ bool inUpdateSequence = false;
+
+ while (mPendingMutations.Length() > 0) {
-+ MutationRecord *m = mPendingMutations[0];
++ MutationRecord *m = mPendingMutations[0].get();
+
+ if (m->mTarget != currentTarget) {
+ if (inUpdateSequence) {
@@ -4334,7 +4263,7 @@
+ MOZ_ASSERT(!mContentToObserverTable.Get(aContent, &old) || old == aObserver,
+ "Multiple observers for the same content node are not supported");
+
-+ mContentToObserverTable.Put(aContent, aObserver);
++ mContentToObserverTable.InsertOrUpdate(aContent, aObserver);
+}
+
+void
@@ -4380,7 +4309,7 @@
+}
--- /dev/null
+++ b/widget/gtk/nsNativeMenuDocListener.h
-@@ -0,0 +1,157 @@
+@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -4392,10 +4321,9 @@
+#define __nsNativeMenuDocListener_h__
+
+#include "mozilla/Attributes.h"
-+#include "mozilla/GuardObjects.h"
+#include "mozilla/RefPtr.h"
-+#include "nsAutoPtr.h"
-+#include "nsDataHashtable.h"
++#include "mozilla/UniquePtr.h"
++#include "nsTHashMap.h"
+#include "nsStubMutationObserver.h"
+#include "nsTArray.h"
+
@@ -4447,9 +4375,8 @@
+ class MOZ_STACK_CLASS BlockUpdatesScope
+ {
+ public:
-+ BlockUpdatesScope(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
++ BlockUpdatesScope()
+ {
-+ MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+ nsNativeMenuDocListener::AddUpdateBlocker();
+ }
+
@@ -4457,9 +4384,6 @@
+ {
+ nsNativeMenuDocListener::RemoveUpdateBlocker();
+ }
-+
-+ private:
-+ MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+ };
+
+private:
@@ -4505,8 +4429,8 @@
+ mozilla::dom::Document *mDocument;
+ nsIContent *mLastSource;
+ nsNativeMenuChangeObserver *mLastTarget;
-+ nsTArray<nsAutoPtr<MutationRecord> > mPendingMutations;
-+ nsDataHashtable<nsPtrHashKey<nsIContent>, nsNativeMenuChangeObserver *> mContentToObserverTable;
++ nsTArray<mozilla::UniquePtr<MutationRecord> > mPendingMutations;
++ nsTHashMap<nsPtrHashKey<nsIContent>, nsNativeMenuChangeObserver *> mContentToObserverTable;
+
+ static uint32_t sUpdateBlockersCount;
+};
@@ -4540,7 +4464,7 @@
+#endif /* __nsNativeMenuDocListener_h__ */
--- /dev/null
+++ b/widget/gtk/nsNativeMenuService.cpp
-@@ -0,0 +1,505 @@
+@@ -0,0 +1,478 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -4548,11 +4472,10 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
++#include "mozilla/dom/Element.h"
+#include "mozilla/Assertions.h"
-+#include "mozilla/Move.h"
+#include "mozilla/Preferences.h"
+#include "mozilla/UniquePtr.h"
-+#include "nsAutoPtr.h"
+#include "nsCOMPtr.h"
+#include "nsCRT.h"
+#include "nsGtkUtils.h"
@@ -4579,32 +4502,6 @@
+extern PangoLayout* gPangoLayout;
+extern nsNativeMenuDocListenerTArray* gPendingListeners;
+
-+#if not GLIB_CHECK_VERSION(2,26,0)
-+enum GBusType {
-+ G_BUS_TYPE_STARTER = -1,
-+ G_BUS_TYPE_NONE = 0,
-+ G_BUS_TYPE_SYSTEM = 1,
-+ G_BUS_TYPE_SESSION = 2
-+};
-+
-+enum GDBusProxyFlags {
-+ G_DBUS_PROXY_FLAGS_NONE = 0,
-+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES = 1 << 0,
-+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS = 1 << 1,
-+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START = 1 << 2,
-+ G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES = 1 << 3
-+};
-+
-+enum GDBusCallFlags {
-+ G_DBUS_CALL_FLAGS_NONE = 0,
-+ G_DBUS_CALL_FLAGS_NO_AUTO_START = 1 << 0
-+};
-+
-+typedef _GDBusInterfaceInfo GDBusInterfaceInfo;
-+typedef _GDBusProxy GDBusProxy;
-+typedef _GVariant GVariant;
-+#endif
-+
+#undef g_dbus_proxy_new_for_bus
+#undef g_dbus_proxy_new_for_bus_finish
+#undef g_dbus_proxy_call
@@ -4811,7 +4708,7 @@
+ }
+
+ GCancellable *cancellable = g_cancellable_new();
-+ mMenuBarRegistrationCancellables.Put(aMenuBar, cancellable);
++ mMenuBarRegistrationCancellables.InsertOrUpdate(aMenuBar, cancellable);
+
+ // We keep a weak ref because we can't assume that GDBus cancellation
+ // is reliable (see https://launchpad.net/bugs/953562)
@@ -5048,7 +4945,7 @@
+}
--- /dev/null
+++ b/widget/gtk/nsNativeMenuService.h
-@@ -0,0 +1,84 @@
+@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -5061,7 +4958,7 @@
+
+#include "mozilla/Attributes.h"
+#include "nsCOMPtr.h"
-+#include "nsDataHashtable.h"
++#include "nsTHashMap.h"
+#include "nsINativeMenuService.h"
+#include "nsTArray.h"
+
@@ -5072,8 +4969,9 @@
+class nsMenuBar;
+
+/*
-+ * The main native menu service singleton. nsWebShellWindow calls in to this when
-+ * a new top level window is created.
++ * The main native menu service singleton.
++ * NativeMenuSupport::CreateNativeMenuBar calls in to this when a new top level
++ * window is created.
+ *
+ * Menubars are owned by their nsWindow. This service holds a weak reference to
+ * each menubar for the purpose of re-registering them with the shell if it
@@ -5126,7 +5024,7 @@
+ GDBusProxy *mDbusProxy;
+ bool mOnline;
+ nsTArray<nsMenuBar *> mMenuBars;
-+ nsDataHashtable<nsPtrHashKey<nsMenuBar>, GCancellable*> mMenuBarRegistrationCancellables;
++ nsTHashMap<nsPtrHashKey<nsMenuBar>, GCancellable*> mMenuBarRegistrationCancellables;
+
+ static bool sShutdown;
+ static nsNativeMenuService *sService;
@@ -5135,16 +5033,8 @@
+#endif /* __nsNativeMenuService_h__ */
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
-@@ -73,6 +73,7 @@
-
- #include "mozilla/Assertions.h"
- #include "mozilla/Likely.h"
-+#include "mozilla/Move.h"
- #include "mozilla/Preferences.h"
- #include "nsIPrefService.h"
- #include "nsIServiceManager.h"
-@@ -5192,6 +5193,10 @@ void nsWindow::HideWindowChrome(bool aSh
- SetWindowDecoration(aShouldHide ? eBorderStyle_none : mBorderStyle);
+@@ -7060,6 +7060,10 @@ void nsWindow::HideWindowChrome(bool aSh
+ SetWindowDecoration(aShouldHide ? BorderStyle::None : mBorderStyle);
}
+void nsWindow::SetMenuBar(UniquePtr<nsMenuBar> aMenuBar) {
@@ -5153,62 +5043,36 @@
+
bool nsWindow::CheckForRollup(gdouble aMouseX, gdouble aMouseY, bool aIsWheel,
bool aAlwaysRollup) {
- nsIRollupListener* rollupListener = GetActiveRollupListener();
+ LOG("nsWindow::CheckForRollup() aAlwaysRollup %d", aAlwaysRollup);
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
-@@ -38,6 +38,8 @@
-
+@@ -26,6 +26,8 @@
+ #include "nsRefPtrHashtable.h"
#include "IMContextWrapper.h"
+#include "nsMenuBar.h"
+
- #undef LOG
- #ifdef MOZ_LOGGING
-
-@@ -171,6 +173,8 @@ class nsWindow final : public nsBaseWidg
- nsIScreen* aTargetScreen = nullptr) override;
- virtual void HideWindowChrome(bool aShouldHide) override;
+ #ifdef ACCESSIBILITY
+ # include "mozilla/a11y/LocalAccessible.h"
+ #endif
+@@ -172,6 +174,8 @@ class nsWindow final : public nsBaseWidg
+ nsresult MakeFullScreen(bool aFullScreen) override;
+ void HideWindowChrome(bool aShouldHide) override;
+ void SetMenuBar(mozilla::UniquePtr<nsMenuBar> aMenuBar);
+
/**
* GetLastUserInputTime returns a timestamp for the most recent user input
* event. This is intended for pointer grab requests (including drags).
-@@ -638,6 +642,8 @@ class nsWindow final : public nsBaseWidg
+@@ -824,6 +828,8 @@ class nsWindow final : public nsBaseWidg
- mozilla::UniquePtr<mozilla::CurrentX11TimeGetter> mCurrentTimeGetter;
- static CSDSupportLevel sCSDSupportLevel;
-+
-+ mozilla::UniquePtr<nsMenuBar> mMenuBar;
- };
+ static bool sTransparentMainWindow;
- #endif /* __nsWindow_h__ */
---- a/widget/moz.build
-+++ b/widget/moz.build
-@@ -69,9 +69,9 @@ elif toolkit == 'cocoa':
- 'nsITouchBarInput.idl',
- 'nsITouchBarUpdater.idl',
- ]
-- EXPORTS += [
-- 'nsINativeMenuService.h',
-- ]
++ mozilla::UniquePtr<nsMenuBar> mMenuBar;
+
-+if toolkit in ('cocoa', 'gtk'):
-+ EXPORTS += ['nsINativeMenuService.h']
-
- TEST_DIRS += ['tests']
-
---- a/xpfe/appshell/nsWebShellWindow.cpp
-+++ b/xpfe/appshell/nsWebShellWindow.cpp
-@@ -70,7 +70,7 @@
+ #ifdef ACCESSIBILITY
+ RefPtr<mozilla::a11y::LocalAccessible> mRootAccessible;
- #include "gfxPlatform.h"
-
--#ifdef XP_MACOSX
-+#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
- # include "nsINativeMenuService.h"
- # define USE_NATIVE_MENUS
- #endif
--- /dev/null
+++ b/xpcom/ds/NativeMenuAtoms.py
@@ -0,0 +1,9 @@
@@ -5224,30 +5088,30 @@
--- a/xpcom/ds/StaticAtoms.py
+++ b/xpcom/ds/StaticAtoms.py
@@ -7,6 +7,7 @@
- from Atom import Atom, InheritingAnonBoxAtom, NonInheritingAnonBoxAtom
- from Atom import PseudoElementAtom
+ PseudoElementAtom,
+ )
from HTMLAtoms import HTML_PARSER_ATOMS
+from NativeMenuAtoms import NATIVE_MENU_ATOMS
- import sys
# Static atom definitions, used to generate nsGkAtomList.h.
-@@ -2481,7 +2482,7 @@ STATIC_ATOMS = [
+ #
+@@ -2529,7 +2530,7 @@ STATIC_ATOMS = [
InheritingAnonBoxAtom("AnonBox_mozSVGForeignContent", ":-moz-svg-foreign-content"),
InheritingAnonBoxAtom("AnonBox_mozSVGText", ":-moz-svg-text"),
# END ATOMS
-] + HTML_PARSER_ATOMS
+] + HTML_PARSER_ATOMS + NATIVE_MENU_ATOMS
+ # fmt: on
- def verify():
--- a/widget/gtk/components.conf
+++ b/widget/gtk/components.conf
-@@ -82,6 +82,14 @@ Classes = [
- 'headers': ['/widget/gtk/nsApplicationChooser.h'],
- 'processes': ProcessSelector.MAIN_PROCESS_ONLY,
+@@ -76,6 +76,14 @@ Classes = [
+ 'headers': ['/widget/gtk/nsUserIdleServiceGTK.h'],
+ 'constructor': 'nsUserIdleServiceGTK::GetInstance',
},
+ {
-+ 'cid': '{0B3FE5AA-BC72-4303-85AE-76365DF1251D}',
++ 'cid': '{0b3fe5aa-bc72-4303-85ae-76365df1251d}',
+ 'contract_ids': ['@mozilla.org/widget/nativemenuservice;1'],
+ 'singleton': True,
+ 'type': 'nsNativeMenuService',
@@ -5256,4 +5120,149 @@
+ },
]
- if defined('MOZ_X11'):
+ if defined('NS_PRINTING'):
+--- a/xpfe/appshell/AppWindow.cpp
++++ b/xpfe/appshell/AppWindow.cpp
+@@ -80,7 +80,7 @@
+
+ #include "mozilla/dom/DocumentL10n.h"
+
+-#ifdef XP_MACOSX
++#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
+ # include "mozilla/widget/NativeMenuSupport.h"
+ # define USE_NATIVE_MENUS
+ #endif
+--- a/widget/gtk/NativeMenuSupport.cpp
++++ b/widget/gtk/NativeMenuSupport.cpp
+@@ -7,6 +7,8 @@
+
+ #include "MainThreadUtils.h"
+ #include "NativeMenuGtk.h"
++#include "nsINativeMenuService.h"
++#include "nsServiceManagerUtils.h"
+
+ namespace mozilla::widget {
+
+@@ -14,7 +16,14 @@ void NativeMenuSupport::CreateNativeMenu
+ dom::Element* aMenuBarElement) {
+ MOZ_RELEASE_ASSERT(NS_IsMainThread(),
+ "Attempting to create native menu bar on wrong thread!");
+- // TODO
++
++ nsCOMPtr<nsINativeMenuService> nms =
++ do_GetService("@mozilla.org/widget/nativemenuservice;1");
++ if (!nms) {
++ return;
++ }
++
++ nms->CreateNativeMenuBar(aParent, aMenuBarElement);
+ }
+
+ already_AddRefed<NativeMenu> NativeMenuSupport::CreateNativeContextMenu(
+--- /dev/null
++++ b/widget/gtk/NativeMenuSupport.h
+@@ -0,0 +1,31 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_widget_NativeMenuSupport_h
++#define mozilla_widget_NativeMenuSupport_h
++
++class nsIWidget;
++
++namespace mozilla {
++
++namespace dom {
++class Element;
++}
++
++namespace widget {
++
++class NativeMenuSupport final {
++public:
++ // Given a top-level window widget and a menu bar DOM node, sets up native
++ // menus. Once created, native menus are controlled via the DOM, including
++ // destruction.
++ static void CreateNativeMenuBar(nsIWidget* aParent,
++ dom::Element* aMenuBarElement);
++};
++
++} // namespace widget
++} // namespace mozilla
++
++#endif // mozilla_widget_NativeMenuSupport_h
+--- a/widget/moz.build
++++ b/widget/moz.build
+@@ -157,6 +157,11 @@ EXPORTS += [
+ "PuppetWidget.h",
+ ]
+
++if toolkit == "gtk":
++ EXPORTS += [
++ "nsINativeMenuService.h",
++ ]
++
+ EXPORTS.mozilla += [
+ "BasicEvents.h",
+ "ColorScheme.h",
+--- /dev/null
++++ b/widget/nsINativeMenuService.h
+@@ -0,0 +1,39 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef nsINativeMenuService_h_
++#define nsINativeMenuService_h_
++
++#include "nsISupports.h"
++
++class nsIWidget;
++class nsIContent;
++namespace mozilla {
++namespace dom {
++class Element;
++}
++} // namespace mozilla
++
++// {90DF88F9-F084-4EF3-829A-49496E636DED}
++#define NS_INATIVEMENUSERVICE_IID \
++ { \
++ 0x90DF88F9, 0xF084, 0x4EF3, { \
++ 0x82, 0x9A, 0x49, 0x49, 0x6E, 0x63, 0x6D, 0xED \
++ } \
++ }
++
++class nsINativeMenuService : public nsISupports {
++ public:
++ NS_DECLARE_STATIC_IID_ACCESSOR(NS_INATIVEMENUSERVICE_IID)
++ // Given a top-level window widget and a menu bar DOM node, sets up native
++ // menus. Once created, native menus are controlled via the DOM, including
++ // destruction.
++ NS_IMETHOD CreateNativeMenuBar(nsIWidget* aParent,
++ mozilla::dom::Element* aMenuBarNode) = 0;
++};
++
++NS_DEFINE_STATIC_IID_ACCESSOR(nsINativeMenuService, NS_INATIVEMENUSERVICE_IID)
++
++#endif // nsINativeMenuService_h_
+--- a/widget/nsWidgetsCID.h
++++ b/widget/nsWidgetsCID.h
+@@ -66,6 +66,14 @@
+ // Menus
+ //-----------------------------------------------------------
+
++// {0B3FE5AA-BC72-4303-85AE-76365DF1251D}
++#define NS_NATIVEMENUSERVICE_CID \
++ { \
++ 0x0B3FE5AA, 0xBC72, 0x4303, { \
++ 0x85, 0xAE, 0x76, 0x36, 0x5D, 0xF1, 0x25, 0x1D \
++ } \
++ }
++
+ // {F6CD4F21-53AF-11d2-8DC4-00609703C14E}
+ #define NS_POPUPMENU_CID \
+ { \
diff --git a/upload-symbol-archive b/upload-symbol-archive
new file mode 100755
index 000000000000..059a399c429f
--- /dev/null
+++ b/upload-symbol-archive
@@ -0,0 +1,25 @@
+#!/bin/bash -e
+
+die() {
+ echo >&2 "$@"
+ exit 1
+}
+
+(( $# >= 2 )) || die "Usage: $0 TOKEN-FILE SYMBOL-ARCHIVE..."
+token="$1"
+shift
+
+[[ -f $token && -s $token ]] || die "Invalid TOKEN-FILE ${token@Q}"
+
+for zip; do
+ [[ $(file -SEbi "$zip") == application/zip* ]] || die "Invalid SYMBOL-ARCHIVE ${zip@Q}"
+done
+
+for zip; do
+ echo >&2 "Uploading ${zip@Q} ..."
+ curl -X POST -H "Auth-Token: $(<"$token")" -F "${zip##*/}=@$zip" \
+ --retry 4 --retry-connrefused --connect-timeout 120 \
+ https://symbols.mozilla.org/upload/
+ echo
+ mv -v "$zip" "$zip.uploaded"
+done