From bec5fd344331f29af6f28517c779b52844984f41 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 22 Dec 2020 11:19:48 +0100 Subject: [PATCH] Added fix for mozbz#1631061, temporary build with build with nss 3.59.0 --- firefox-nss-version.patch | 20 ++--- firefox.spec | 4 +- mozilla-1631061.patch | 158 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 11 deletions(-) create mode 100644 mozilla-1631061.patch diff --git a/firefox-nss-version.patch b/firefox-nss-version.patch index fee93bb..21985d1 100644 --- a/firefox-nss-version.patch +++ b/firefox-nss-version.patch @@ -1,12 +1,12 @@ -diff -up firefox-78.0/toolkit/moz.configure.nss-version firefox-78.0/toolkit/moz.configure ---- firefox-78.0/toolkit/moz.configure.nss-version 2020-06-30 08:47:09.657501414 +0200 -+++ firefox-78.0/toolkit/moz.configure 2020-06-30 08:47:12.652510169 +0200 -@@ -2089,7 +2089,7 @@ option('--with-system-nss', help='Use sy +diff -up firefox-84.0.1/build/moz.configure/nss.configure.nss-version firefox-84.0.1/build/moz.configure/nss.configure +--- firefox-84.0.1/build/moz.configure/nss.configure.nss-version 2020-12-21 20:07:33.000000000 +0100 ++++ firefox-84.0.1/build/moz.configure/nss.configure 2020-12-22 10:23:02.156625919 +0100 +@@ -9,7 +9,7 @@ option("--with-system-nss", help="Use sy + imply_option("--with-system-nspr", True, when="--with-system-nss") - imply_option('--with-system-nspr', True, when='--with-system-nss') - --nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.1', when='--with-system-nss', config=False) -+nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.0', when='--with-system-nss', config=False) - - set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss') + nss_pkg = pkg_check_modules( +- "NSS", "nss >= 3.59.1", when="--with-system-nss", config=False ++ "NSS", "nss >= 3.59", when="--with-system-nss", config=False + ) + set_config("MOZ_SYSTEM_NSS", True, when="--with-system-nss") diff --git a/firefox.spec b/firefox.spec index 86cb1e2..4df041a 100644 --- a/firefox.spec +++ b/firefox.spec @@ -207,6 +207,7 @@ Patch415: mozilla-1670333.patch Patch418: mozilla-1556931-s390x-hidden-syms.patch Patch420: mozilla-1678680.patch Patch421: mozilla-1680505.patch +Patch422: mozilla-1631061.patch # Upstream patches from mozbz#1672944 Patch450: pw1.patch @@ -394,7 +395,7 @@ This package contains results of tests executed during build. %endif %patch3 -p1 -b .arm %patch44 -p1 -b .build-arm-libopus -#%patch46 -p1 -b .nss-version +%patch46 -p1 -b .nss-version %patch47 -p1 -b .fedora-shebang %patch48 -p1 -b .build-arm-wasm %patch49 -p1 -b .build-arm-libaom @@ -428,6 +429,7 @@ This package contains results of tests executed during build. %patch455 -p1 -b .pw6 %patch420 -p1 -b .1678680 %patch421 -p1 -b .1680505 +%patch422 -p1 -b .1631061 %patch500 -p1 -b .ffvpx diff --git a/mozilla-1631061.patch b/mozilla-1631061.patch new file mode 100644 index 0000000..acd1c5a --- /dev/null +++ b/mozilla-1631061.patch @@ -0,0 +1,158 @@ +changeset: 563258:ed4b271af277 +tag: tip +parent: 563255:2c9db4cd3d89 +user: stransky +date: Tue Dec 22 11:03:28 2020 +0100 +files: widget/gtk/nsClipboardWayland.cpp widget/gtk/nsClipboardWayland.h +description: +Bug 1631061 [Wayland] Remove fast track clipboard and always ask compositor for clipboard data, r?rmader + +Differential Revision: https://phabricator.services.mozilla.com/D100317 + + +diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp +--- a/widget/gtk/nsClipboardWayland.cpp ++++ b/widget/gtk/nsClipboardWayland.cpp +@@ -749,7 +749,6 @@ nsRetrievalContextWayland::nsRetrievalCo + mClipboardOffer(nullptr), + mPrimaryOffer(nullptr), + mDragContext(nullptr), +- mClipboardRequestNumber(0), + mClipboardData(nullptr), + mClipboardDataLength(0) { + wl_data_device* dataDevice = wl_data_device_manager_get_data_device( +@@ -807,42 +806,6 @@ GdkAtom* nsRetrievalContextWayland::GetT + return nullptr; + } + +-struct FastTrackClipboard { +- FastTrackClipboard(int aClipboardRequestNumber, +- nsRetrievalContextWayland* aRetrievalContex) +- : mClipboardRequestNumber(aClipboardRequestNumber), +- mRetrievalContex(aRetrievalContex) {} +- +- int mClipboardRequestNumber; +- nsRetrievalContextWayland* mRetrievalContex; +-}; +- +-static void wayland_clipboard_contents_received( +- GtkClipboard* clipboard, GtkSelectionData* selection_data, gpointer data) { +- LOGCLIP(("wayland_clipboard_contents_received() callback\n")); +- FastTrackClipboard* fastTrack = static_cast(data); +- fastTrack->mRetrievalContex->TransferFastTrackClipboard( +- fastTrack->mClipboardRequestNumber, selection_data); +- delete fastTrack; +-} +- +-void nsRetrievalContextWayland::TransferFastTrackClipboard( +- int aClipboardRequestNumber, GtkSelectionData* aSelectionData) { +- if (mClipboardRequestNumber == aClipboardRequestNumber) { +- int dataLength = gtk_selection_data_get_length(aSelectionData); +- if (dataLength > 0) { +- mClipboardDataLength = dataLength; +- mClipboardData = reinterpret_cast( +- g_malloc(sizeof(char) * (mClipboardDataLength + 1))); +- memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData), +- sizeof(char) * mClipboardDataLength); +- mClipboardData[mClipboardDataLength] = '\0'; +- } +- } else { +- NS_WARNING("Received obsoleted clipboard data!"); +- } +-} +- + const char* nsRetrievalContextWayland::GetClipboardData( + const char* aMimeType, int32_t aWhichClipboard, uint32_t* aContentLength) { + NS_ASSERTION(mClipboardData == nullptr && mClipboardDataLength == 0, +@@ -851,33 +814,20 @@ const char* nsRetrievalContextWayland::G + LOGCLIP(("nsRetrievalContextWayland::GetClipboardData [%p] mime %s\n", this, + aMimeType)); + +- /* If actual clipboard data is owned by us we don't need to go +- * through Wayland but we ask Gtk+ to directly call data +- * getter callback nsClipboard::SelectionGetEvent(). +- * see gtk_selection_convert() at gtk+/gtkselection.c. +- */ +- GdkAtom selection = GetSelectionAtom(aWhichClipboard); +- if (gdk_selection_owner_get(selection)) { +- LOGCLIP((" Internal clipboard content\n")); +- mClipboardRequestNumber++; +- gtk_clipboard_request_contents( +- gtk_clipboard_get(selection), gdk_atom_intern(aMimeType, FALSE), +- wayland_clipboard_contents_received, +- new FastTrackClipboard(mClipboardRequestNumber, this)); ++ const auto& dataOffer = ++ (GetSelectionAtom(aWhichClipboard) == GDK_SELECTION_PRIMARY) ++ ? mPrimaryOffer ++ : mClipboardOffer; ++ if (!dataOffer) { ++ // Something went wrong. We're requested to provide clipboard data ++ // but we haven't got any from wayland. ++ NS_WARNING("Requested data without valid DataOffer!"); ++ if (mClipboardData) { ++ ReleaseClipboardData(mClipboardData); ++ } + } else { +- LOGCLIP((" Remote clipboard content\n")); +- const auto& dataOffer = +- (selection == GDK_SELECTION_PRIMARY) ? mPrimaryOffer : mClipboardOffer; +- if (!dataOffer) { +- // Something went wrong. We're requested to provide clipboard data +- // but we haven't got any from wayland. +- NS_WARNING("Requested data without valid DataOffer!"); +- mClipboardData = nullptr; +- mClipboardDataLength = 0; +- } else { +- mClipboardData = dataOffer->GetData(mDisplay->GetDisplay(), aMimeType, +- &mClipboardDataLength); +- } ++ mClipboardData = dataOffer->GetData(mDisplay->GetDisplay(), aMimeType, ++ &mClipboardDataLength); + } + + *aContentLength = mClipboardDataLength; +@@ -908,8 +858,10 @@ void nsRetrievalContextWayland::ReleaseC + + NS_ASSERTION(aClipboardData == mClipboardData, + "Releasing unknown clipboard data!"); +- g_free((void*)aClipboardData); + +- mClipboardData = nullptr; +- mClipboardDataLength = 0; ++ if (mClipboardData) { ++ g_free((void*)aClipboardData); ++ mClipboardData = nullptr; ++ mClipboardDataLength = 0; ++ } + } +diff --git a/widget/gtk/nsClipboardWayland.h b/widget/gtk/nsClipboardWayland.h +--- a/widget/gtk/nsClipboardWayland.h ++++ b/widget/gtk/nsClipboardWayland.h +@@ -16,8 +16,6 @@ + #include "nsClipboard.h" + #include "nsWaylandDisplay.h" + +-struct FastTrackClipboard; +- + class DataOffer { + public: + void AddMIMEType(const char* aMimeType); +@@ -134,9 +132,6 @@ class nsRetrievalContextWayland : public + + void ClearDragAndDropDataOffer(); + +- void TransferFastTrackClipboard(int aClipboardRequestNumber, +- GtkSelectionData* aSelectionData); +- + virtual ~nsRetrievalContextWayland() override; + + private: +@@ -149,7 +144,6 @@ class nsRetrievalContextWayland : public + mozilla::UniquePtr mPrimaryOffer; + RefPtr mDragContext; + +- int mClipboardRequestNumber; + char* mClipboardData; + uint32_t mClipboardDataLength; + +