diff options
-rw-r--r-- | firefox.spec | 11 | ||||
-rw-r--r-- | mozilla-1631061-1.patch | 331 | ||||
-rw-r--r-- | mozilla-1631061-2.patch | 91 |
3 files changed, 433 insertions, 0 deletions
diff --git a/firefox.spec b/firefox.spec index 6e13020..4defa6e 100644 --- a/firefox.spec +++ b/firefox.spec @@ -25,6 +25,12 @@ # https://bugzilla.redhat.com/show_bug.cgi?id=1897522 ExcludeArch: s390x +# Exclude ARM due to +# https://bugzilla.redhat.com/show_bug.cgi?id=1922599 +%if 0%{?fedora} > 33 +ExcludeArch: armv7hl +%endif + # Temporary disable tests on Rawhide/arm/i686 due to failures %if 0%{?fedora} > 33 %ifarch armv7hl @@ -76,6 +82,11 @@ ExcludeArch: s390x %global build_with_pgo 1 %endif %endif +# Disable PGO on Rawhide due to +# https://bugzilla.redhat.com/show_bug.cgi?id=1922600 +%if 0%{?fedora} > 33 +%global build_with_pgo 0 +%endif %if 0%{?flatpak} %global build_with_pgo 0 %endif diff --git a/mozilla-1631061-1.patch b/mozilla-1631061-1.patch new file mode 100644 index 0000000..d1bf650 --- /dev/null +++ b/mozilla-1631061-1.patch @@ -0,0 +1,331 @@ +diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp +--- a/widget/gtk/nsClipboardWayland.cpp ++++ b/widget/gtk/nsClipboardWayland.cpp +@@ -155,6 +155,8 @@ + } + + bool WaylandDataOffer::RequestDataTransfer(const char* aMimeType, int fd) { ++ LOGCLIP( ++ ("WaylandDataOffer::RequestDataTransfer MIME %s FD %d\n", aMimeType, fd)); + if (mWaylandDataOffer) { + wl_data_offer_receive(mWaylandDataOffer, aMimeType, fd); + return true; +@@ -164,6 +166,8 @@ + } + + void WaylandDataOffer::DragOfferAccept(const char* aMimeType, uint32_t aTime) { ++ LOGDRAG(("WaylandDataOffer::DragOfferAccept MIME %s aTime %d\n", aMimeType, ++ aTime)); + wl_data_offer_accept(mWaylandDataOffer, aTime, aMimeType); + } + +@@ -175,6 +179,9 @@ + uint32_t preferredAction = gdk_to_wl_actions(aPreferredAction); + uint32_t allActions = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE; + ++ LOGDRAG(("WaylandDataOffer::SetDragStatus aPreferredAction %d\n", ++ aPreferredAction)); ++ + /* We only don't choose a preferred action if we don't accept any. + * If we do accept any, it is currently alway copy and move + */ +@@ -412,12 +419,17 @@ + + char* nsWaylandDragContext::GetData(const char* aMimeType, + uint32_t* aContentLength) { ++ LOGDRAG(("nsWaylandDragContext::GetData %s\n", aMimeType)); + mDataOffer->DragOfferAccept(aMimeType, mTime); + return mDataOffer->GetData(mDisplay, aMimeType, aContentLength); + } + + void nsRetrievalContextWayland::RegisterNewDataOffer( + wl_data_offer* aWaylandDataOffer) { ++ LOGCLIP( ++ ("nsRetrievalContextWayland::RegisterNewDataOffer (wl_data_offer) %p\n", ++ aWaylandDataOffer)); ++ + DataOffer* dataOffer = static_cast<DataOffer*>( + g_hash_table_lookup(mActiveOffers, aWaylandDataOffer)); + MOZ_ASSERT( +@@ -432,6 +444,9 @@ + + void nsRetrievalContextWayland::RegisterNewDataOffer( + gtk_primary_selection_offer* aPrimaryDataOffer) { ++ LOGCLIP(("nsRetrievalContextWayland::RegisterNewDataOffer (primary) %p\n", ++ aPrimaryDataOffer)); ++ + DataOffer* dataOffer = static_cast<DataOffer*>( + g_hash_table_lookup(mActiveOffers, aPrimaryDataOffer)); + MOZ_ASSERT( +@@ -446,6 +461,9 @@ + + void nsRetrievalContextWayland::RegisterNewDataOffer( + zwp_primary_selection_offer_v1* aPrimaryDataOffer) { ++ LOGCLIP(("nsRetrievalContextWayland::RegisterNewDataOffer (primary ZWP) %p\n", ++ aPrimaryDataOffer)); ++ + DataOffer* dataOffer = static_cast<DataOffer*>( + g_hash_table_lookup(mActiveOffers, aPrimaryDataOffer)); + MOZ_ASSERT( +@@ -460,6 +478,10 @@ + + void nsRetrievalContextWayland::SetClipboardDataOffer( + wl_data_offer* aWaylandDataOffer) { ++ LOGCLIP( ++ ("nsRetrievalContextWayland::SetClipboardDataOffer (wl_data_offer) %p\n", ++ aWaylandDataOffer)); ++ + // Delete existing clipboard data offer + mClipboardOffer = nullptr; + +@@ -468,7 +490,11 @@ + if (aWaylandDataOffer != nullptr) { + DataOffer* dataOffer = static_cast<DataOffer*>( + g_hash_table_lookup(mActiveOffers, aWaylandDataOffer)); +- NS_ASSERTION(dataOffer, "We're missing stored clipboard data offer!"); ++#ifdef MOZ_LOGGING ++ if (!dataOffer) { ++ LOGCLIP((" We're missing stored clipboard data offer!\n")); ++ } ++#endif + if (dataOffer) { + g_hash_table_remove(mActiveOffers, aWaylandDataOffer); + mClipboardOffer = WrapUnique(dataOffer); +@@ -478,6 +504,9 @@ + + void nsRetrievalContextWayland::SetPrimaryDataOffer( + gtk_primary_selection_offer* aPrimaryDataOffer) { ++ LOGCLIP(("nsRetrievalContextWayland::SetPrimaryDataOffer (primary) %p\n", ++ aPrimaryDataOffer)); ++ + // Release any primary offer we have. + mPrimaryOffer = nullptr; + +@@ -486,7 +515,11 @@ + if (aPrimaryDataOffer) { + DataOffer* dataOffer = static_cast<DataOffer*>( + g_hash_table_lookup(mActiveOffers, aPrimaryDataOffer)); +- NS_ASSERTION(dataOffer, "We're missing primary data offer!"); ++#ifdef MOZ_LOGGING ++ if (!dataOffer) { ++ LOGCLIP((" We're missing stored primary data offer!\n")); ++ } ++#endif + if (dataOffer) { + g_hash_table_remove(mActiveOffers, aPrimaryDataOffer); + mPrimaryOffer = WrapUnique(dataOffer); +@@ -496,6 +529,9 @@ + + void nsRetrievalContextWayland::SetPrimaryDataOffer( + zwp_primary_selection_offer_v1* aPrimaryDataOffer) { ++ LOGCLIP(("nsRetrievalContextWayland::SetPrimaryDataOffer (primary ZWP)%p\n", ++ aPrimaryDataOffer)); ++ + // Release any primary offer we have. + mPrimaryOffer = nullptr; + +@@ -504,7 +540,11 @@ + if (aPrimaryDataOffer) { + DataOffer* dataOffer = static_cast<DataOffer*>( + g_hash_table_lookup(mActiveOffers, aPrimaryDataOffer)); +- NS_ASSERTION(dataOffer, "We're missing primary data offer!"); ++#ifdef MOZ_LOGGING ++ if (!dataOffer) { ++ LOGCLIP((" We're missing stored primary data offer!\n")); ++ } ++#endif + if (dataOffer) { + g_hash_table_remove(mActiveOffers, aPrimaryDataOffer); + mPrimaryOffer = WrapUnique(dataOffer); +@@ -514,12 +554,19 @@ + + void nsRetrievalContextWayland::AddDragAndDropDataOffer( + wl_data_offer* aDropDataOffer) { ++ LOGCLIP(("nsRetrievalContextWayland::AddDragAndDropDataOffer %p\n", ++ aDropDataOffer)); ++ + // Remove any existing D&D contexts. + mDragContext = nullptr; + + WaylandDataOffer* dataOffer = static_cast<WaylandDataOffer*>( + g_hash_table_lookup(mActiveOffers, aDropDataOffer)); +- NS_ASSERTION(dataOffer, "We're missing drag and drop data offer!"); ++#ifdef MOZ_LOGGING ++ if (!dataOffer) { ++ LOGCLIP((" We're missing stored Drag & Drop data offer!\n")); ++ } ++#endif + if (dataOffer) { + g_hash_table_remove(mActiveOffers, aDropDataOffer); + mDragContext = new nsWaylandDragContext(dataOffer, mDisplay->GetDisplay()); +@@ -531,6 +578,7 @@ + } + + void nsRetrievalContextWayland::ClearDragAndDropDataOffer(void) { ++ LOGCLIP(("nsRetrievalContextWayland::ClearDragAndDropDataOffer()\n")); + mDragContext = nullptr; + } + +@@ -539,7 +587,7 @@ + static void data_device_data_offer(void* data, + struct wl_data_device* data_device, + struct wl_data_offer* offer) { +- LOGCLIP(("data_device_data_offer() callback\n")); ++ LOGCLIP(("data_device_data_offer(), wl_data_offer %p\n", offer)); + nsRetrievalContextWayland* context = + static_cast<nsRetrievalContextWayland*>(data); + context->RegisterNewDataOffer(offer); +@@ -549,7 +597,7 @@ + static void data_device_selection(void* data, + struct wl_data_device* wl_data_device, + struct wl_data_offer* offer) { +- LOGCLIP(("data_device_selection() callback\n")); ++ LOGCLIP(("data_device_selection(), set wl_data_offer %p\n", offer)); + nsRetrievalContextWayland* context = + static_cast<nsRetrievalContextWayland*>(data); + context->SetClipboardDataOffer(offer); +@@ -650,7 +698,7 @@ + static void primary_selection_data_offer( + void* data, struct gtk_primary_selection_device* primary_selection_device, + struct gtk_primary_selection_offer* primary_offer) { +- LOGCLIP(("primary_selection_data_offer() callback\n")); ++ LOGCLIP(("primary_selection_data_offer()\n")); + // create and add listener + nsRetrievalContextWayland* context = + static_cast<nsRetrievalContextWayland*>(data); +@@ -661,7 +709,7 @@ + void* data, + struct zwp_primary_selection_device_v1* primary_selection_device, + struct zwp_primary_selection_offer_v1* primary_offer) { +- LOGCLIP(("primary_selection_data_offer() callback\n")); ++ LOGCLIP(("primary_selection_data_offer()\n")); + // create and add listener + nsRetrievalContextWayland* context = + static_cast<nsRetrievalContextWayland*>(data); +@@ -671,7 +719,7 @@ + static void primary_selection_selection( + void* data, struct gtk_primary_selection_device* primary_selection_device, + struct gtk_primary_selection_offer* primary_offer) { +- LOGCLIP(("primary_selection_selection() callback\n")); ++ LOGCLIP(("primary_selection_selection()\n")); + nsRetrievalContextWayland* context = + static_cast<nsRetrievalContextWayland*>(data); + context->SetPrimaryDataOffer(primary_offer); +@@ -681,7 +729,7 @@ + void* data, + struct zwp_primary_selection_device_v1* primary_selection_device, + struct zwp_primary_selection_offer_v1* primary_offer) { +- LOGCLIP(("primary_selection_selection() callback\n")); ++ LOGCLIP(("primary_selection_selection()\n")); + nsRetrievalContextWayland* context = + static_cast<nsRetrievalContextWayland*>(data); + context->SetPrimaryDataOffer(primary_offer); +@@ -803,17 +851,26 @@ + + void nsRetrievalContextWayland::TransferFastTrackClipboard( + int aClipboardRequestNumber, GtkSelectionData* aSelectionData) { ++ LOGCLIP(("nsRetrievalContextWayland::TransferFastTrackClipboard()\n")); ++ + if (mClipboardRequestNumber == aClipboardRequestNumber) { ++ LOGCLIP((" request number matches\n")); + int dataLength = gtk_selection_data_get_length(aSelectionData); +- if (dataLength > 0) { +- mClipboardDataLength = dataLength; +- mClipboardData = reinterpret_cast<char*>( +- g_malloc(sizeof(char) * (mClipboardDataLength + 1))); +- memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData), +- sizeof(char) * mClipboardDataLength); +- mClipboardData[mClipboardDataLength] = '\0'; ++ if (!dataLength) { ++ LOGCLIP( ++ (" gtk_selection_data_get_length() returned 0 data length!\n")); ++ return; + } ++ LOGCLIP((" fastracking %d bytes of data.\n", dataLength)); ++ mClipboardDataLength = dataLength; ++ mClipboardData = reinterpret_cast<char*>( ++ g_malloc(sizeof(char) * (mClipboardDataLength + 1))); ++ memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData), ++ sizeof(char) * mClipboardDataLength); ++ mClipboardData[mClipboardDataLength] = '\0'; ++ LOGCLIP((" done, mClipboardData = %p\n", mClipboardData)); + } else { ++ LOGCLIP((" request number does not match!\n")); + NS_WARNING("Received obsoleted clipboard data!"); + } + } +@@ -833,25 +890,29 @@ + */ + GdkAtom selection = GetSelectionAtom(aWhichClipboard); + if (gdk_selection_owner_get(selection)) { +- LOGCLIP((" Internal clipboard content\n")); ++ LOGCLIP((" Asking for 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)); + } else { +- LOGCLIP((" Remote clipboard content\n")); ++ LOGCLIP((" Asking for 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!"); ++ LOGCLIP((" We're missing dataOffer! mClipboardData = null\n")); + mClipboardData = nullptr; + mClipboardDataLength = 0; + } else { ++ LOGCLIP( ++ (" Getting clipboard data from compositor, MIME %s\n", aMimeType)); + mClipboardData = dataOffer->GetData(mDisplay->GetDisplay(), aMimeType, + &mClipboardDataLength); ++ LOGCLIP((" Got %d bytes of data, mClipboardData = %p\n", ++ mClipboardDataLength, mClipboardData)); + } + } + +@@ -861,25 +922,36 @@ + + const char* nsRetrievalContextWayland::GetClipboardText( + int32_t aWhichClipboard) { +- LOGCLIP(("nsRetrievalContextWayland::GetClipboardText [%p]\n", this)); ++ GdkAtom selection = GetSelectionAtom(aWhichClipboard); + +- GdkAtom selection = GetSelectionAtom(aWhichClipboard); ++ LOGCLIP(("nsRetrievalContextWayland::GetClipboardText [%p], clipboard %s\n", ++ this, ++ (selection == GDK_SELECTION_PRIMARY) ? "Primary" : "Selection")); ++ + const auto& dataOffer = + (selection == GDK_SELECTION_PRIMARY) ? mPrimaryOffer : mClipboardOffer; +- if (!dataOffer) return nullptr; ++ if (!dataOffer) { ++ LOGCLIP((" We're missing data offer!\n")); ++ return nullptr; ++ } + + for (unsigned int i = 0; i < TEXT_MIME_TYPES_NUM; i++) { + if (dataOffer->HasTarget(sTextMimeTypes[i])) { ++ LOGCLIP((" We have %s MIME type in clipboard, ask for it.\n", ++ sTextMimeTypes[i])); + uint32_t unused; + return GetClipboardData(sTextMimeTypes[i], aWhichClipboard, &unused); + } + } ++ ++ LOGCLIP((" There isn't text MIME type in clipboard!\n")); + return nullptr; + } + + void nsRetrievalContextWayland::ReleaseClipboardData( + const char* aClipboardData) { +- LOGCLIP(("nsRetrievalContextWayland::ReleaseClipboardData [%p]\n", this)); ++ LOGCLIP(("nsRetrievalContextWayland::ReleaseClipboardData [%p]\n", ++ aClipboardData)); + + NS_ASSERTION(aClipboardData == mClipboardData, + "Releasing unknown clipboard data!"); + diff --git a/mozilla-1631061-2.patch b/mozilla-1631061-2.patch new file mode 100644 index 0000000..ae90baa --- /dev/null +++ b/mozilla-1631061-2.patch @@ -0,0 +1,91 @@ +changeset: 567293:4d5e5e9f146e +tag: tip +parent: 567291:3bdf0c33844f +user: stransky <stransky@redhat.com> +date: Fri Jan 29 12:13:15 2021 +0100 +files: widget/gtk/nsClipboardWayland.cpp +description: +Bug 1631061 [Wayland] Clear clipboard content when gtk_clipboard_request_contents() fails, r?jhorak + +Differential Revision: https://phabricator.services.mozilla.com/D103461 + + +diff --git a/widget/gtk/nsClipboardWayland.cpp b/widget/gtk/nsClipboardWayland.cpp +--- a/widget/gtk/nsClipboardWayland.cpp ++++ b/widget/gtk/nsClipboardWayland.cpp +@@ -842,7 +842,8 @@ struct FastTrackClipboard { + + static void wayland_clipboard_contents_received( + GtkClipboard* clipboard, GtkSelectionData* selection_data, gpointer data) { +- LOGCLIP(("wayland_clipboard_contents_received() callback\n")); ++ LOGCLIP(("wayland_clipboard_contents_received() selection_data = %p\n", ++ selection_data)); + FastTrackClipboard* fastTrack = static_cast<FastTrackClipboard*>(data); + fastTrack->mRetrievalContex->TransferFastTrackClipboard( + fastTrack->mClipboardRequestNumber, selection_data); +@@ -851,24 +852,34 @@ static void wayland_clipboard_contents_r + + void nsRetrievalContextWayland::TransferFastTrackClipboard( + int aClipboardRequestNumber, GtkSelectionData* aSelectionData) { +- LOGCLIP(("nsRetrievalContextWayland::TransferFastTrackClipboard()\n")); ++ LOGCLIP( ++ ("nsRetrievalContextWayland::TransferFastTrackClipboard(), " ++ "aSelectionData = %p\n", ++ aSelectionData)); ++ ++ int dataLength = gtk_selection_data_get_length(aSelectionData); ++ if (dataLength < 0) { ++ LOGCLIP( ++ (" gtk_clipboard_request_contents() failed to get clipboard " ++ "data!\n")); ++ ReleaseClipboardData(mClipboardData); ++ return; ++ } + + if (mClipboardRequestNumber == aClipboardRequestNumber) { + LOGCLIP((" request number matches\n")); +- int dataLength = gtk_selection_data_get_length(aSelectionData); +- if (!dataLength) { +- LOGCLIP( +- (" gtk_selection_data_get_length() returned 0 data length!\n")); +- return; +- } + LOGCLIP((" fastracking %d bytes of data.\n", dataLength)); + mClipboardDataLength = dataLength; +- mClipboardData = reinterpret_cast<char*>( +- g_malloc(sizeof(char) * (mClipboardDataLength + 1))); +- memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData), +- sizeof(char) * mClipboardDataLength); +- mClipboardData[mClipboardDataLength] = '\0'; +- LOGCLIP((" done, mClipboardData = %p\n", mClipboardData)); ++ if (dataLength > 0) { ++ mClipboardData = reinterpret_cast<char*>( ++ g_malloc(sizeof(char) * (mClipboardDataLength + 1))); ++ memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData), ++ sizeof(char) * mClipboardDataLength); ++ mClipboardData[mClipboardDataLength] = '\0'; ++ LOGCLIP((" done, mClipboardData = %p\n", mClipboardData)); ++ } else { ++ ReleaseClipboardData(mClipboardData); ++ } + } else { + LOGCLIP((" request number does not match!\n")); + NS_WARNING("Received obsoleted clipboard data!"); +@@ -952,11 +963,10 @@ void nsRetrievalContextWayland::ReleaseC + const char* aClipboardData) { + LOGCLIP(("nsRetrievalContextWayland::ReleaseClipboardData [%p]\n", + aClipboardData)); +- +- NS_ASSERTION(aClipboardData == mClipboardData, +- "Releasing unknown clipboard data!"); +- g_free((void*)aClipboardData); +- ++ if (aClipboardData != mClipboardData) { ++ NS_WARNING("Wayland clipboard: Releasing unknown clipboard data!"); ++ } ++ g_free((void*)mClipboardData); ++ mClipboardDataLength = 0; + mClipboardData = nullptr; +- mClipboardDataLength = 0; + } + |