Added fix for mzbz#1896846

This commit is contained in:
Martin Stransky 2024-05-15 10:46:18 +02:00
parent 7d1a9652e5
commit 4fa72a1163
2 changed files with 127 additions and 1 deletions

121
D210430.1715848796.diff Normal file
View File

@ -0,0 +1,121 @@
diff --git a/toolkit/components/remote/nsDBusRemoteClient.h b/toolkit/components/remote/nsDBusRemoteClient.h
--- a/toolkit/components/remote/nsDBusRemoteClient.h
+++ b/toolkit/components/remote/nsDBusRemoteClient.h
@@ -29,10 +29,10 @@
void Shutdown();
private:
bool GetRemoteDestinationName(const char* aProgram, const char* aProfile,
nsCString& aDestinationName);
- nsresult DoSendDBusCommandLine(const char* aProgram, const char* aProfile,
- const char* aBuffer, int aLength);
+ nsresult DoSendDBusCommandLine(const char* aProfile, const char* aBuffer,
+ int aLength);
};
#endif // DBusRemoteClient_h__
diff --git a/toolkit/components/remote/nsDBusRemoteClient.cpp b/toolkit/components/remote/nsDBusRemoteClient.cpp
--- a/toolkit/components/remote/nsDBusRemoteClient.cpp
+++ b/toolkit/components/remote/nsDBusRemoteClient.cpp
@@ -6,10 +6,11 @@
* 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 "nsDBusRemoteClient.h"
#include "RemoteUtils.h"
+#include "nsAppRunner.h"
#include "mozilla/XREAppData.h"
#include "mozilla/Logging.h"
#include "mozilla/Base64.h"
#include "nsPrintfCString.h"
#include "mozilla/GUniquePtr.h"
@@ -36,11 +37,11 @@
}
nsresult nsDBusRemoteClient::SendCommandLine(
const char* aProgram, const char* aProfile, int32_t argc, char** argv,
const char* aStartupToken, char** aResponse, bool* aWindowFound) {
- NS_ENSURE_TRUE(aProgram, NS_ERROR_INVALID_ARG);
+ NS_ENSURE_TRUE(aProfile, NS_ERROR_INVALID_ARG);
LOG("nsDBusRemoteClient::SendCommandLine");
int commandLineLength;
char* commandLine =
@@ -48,12 +49,11 @@
if (!commandLine) {
LOG(" failed to create command line");
return NS_ERROR_FAILURE;
}
- nsresult rv =
- DoSendDBusCommandLine(aProgram, aProfile, commandLine, commandLineLength);
+ nsresult rv = DoSendDBusCommandLine(aProfile, commandLine, commandLineLength);
free(commandLine);
*aWindowFound = NS_SUCCEEDED(rv);
LOG("DoSendDBusCommandLine %s", NS_SUCCEEDED(rv) ? "OK" : "FAILED");
@@ -97,18 +97,17 @@
}
return true;
}
-nsresult nsDBusRemoteClient::DoSendDBusCommandLine(const char* aProgram,
- const char* aProfile,
+nsresult nsDBusRemoteClient::DoSendDBusCommandLine(const char* aProfile,
const char* aBuffer,
int aLength) {
LOG("nsDBusRemoteClient::DoSendDBusCommandLine()");
- nsAutoCString appName(aProgram);
- mozilla::XREAppData::SanitizeNameForDBus(appName);
+ nsAutoCString appName;
+ gAppData->GetDBusAppName(appName);
nsAutoCString destinationName;
if (!GetRemoteDestinationName(appName.get(), aProfile, destinationName)) {
LOG(" failed to get remote destination name");
return NS_ERROR_FAILURE;
diff --git a/toolkit/components/remote/nsDBusRemoteServer.cpp b/toolkit/components/remote/nsDBusRemoteServer.cpp
--- a/toolkit/components/remote/nsDBusRemoteServer.cpp
+++ b/toolkit/components/remote/nsDBusRemoteServer.cpp
@@ -6,10 +6,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDBusRemoteServer.h"
#include "nsCOMPtr.h"
+#include "nsAppRunner.h"
#include "mozilla/XREAppData.h"
#include "mozilla/Base64.h"
#include "mozilla/ScopeExit.h"
#include "mozilla/GUniquePtr.h"
#include "MainThreadUtils.h"
@@ -186,17 +187,18 @@
nsresult nsDBusRemoteServer::Startup(const char* aAppName,
const char* aProfileName) {
MOZ_DIAGNOSTIC_ASSERT(!mDBusID);
- // Don't even try to start without any application/profile name
- if (!aAppName || aAppName[0] == '\0' || !aProfileName ||
- aProfileName[0] == '\0')
- return NS_ERROR_INVALID_ARG;
+ // Don't even try to start without any profile name
+ if (!aProfileName || aProfileName[0] == '\0') return NS_ERROR_INVALID_ARG;
- mAppName = aAppName;
- mozilla::XREAppData::SanitizeNameForDBus(mAppName);
+ // aAppName is remoting name which can be something like org.mozilla.appname
+ // or so.
+ // For DBus service we rather use general application DBus identifier
+ // which is shared by all DBus services.
+ gAppData->GetDBusAppName(mAppName);
nsAutoCString profileName;
MOZ_TRY(
mozilla::Base64Encode(aProfileName, strlen(aProfileName), profileName));

View File

@ -189,7 +189,7 @@ ExcludeArch: i686
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 126.0
Release: 5%{?pre_tag}%{?dist}
Release: 6%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@ -282,6 +282,7 @@ Patch420: D209910.1715685533.diff
Patch421: D209911.1715685535.diff
Patch422: D210158.1715685536.diff
Patch423: D210159.1715685538.diff
Patch424: D210430.1715848796.diff
# PGO/LTO patches
Patch600: pgo.patch
@ -603,6 +604,7 @@ export LIBCLANG_RT=`pwd`/wasi-sdk-20/build/compiler-rt/lib/wasi/libclang_rt.buil
%patch421 -p1 -b .D209911.1715685535
%patch422 -p1 -b .D210158.1715685536
%patch423 -p1 -b .D210159.1715685538
%patch424 -p1 -b .D210430.1715848796
# PGO patches
%if %{build_with_pgo}
@ -1237,6 +1239,9 @@ fi
#---------------------------------------------------------------------
%changelog
* Wed May 15 2024 Martin Stransky <stransky@redhat.com>- 126.0-6
- Added fix for mzbz#1896846
* Tue May 14 2024 Martin Stransky <stransky@redhat.com>- 126.0-5
- Updated upstream patches