More upstream patches for Gnome search provider.
This commit is contained in:
parent
1ea403d86b
commit
96d904afbd
@ -1,7 +1,80 @@
|
||||
diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit/xre/DBusService.cpp
|
||||
--- firefox-126.0/toolkit/xre/DBusService.cpp.D209910 2024-05-09 12:20:44.081565311 +0200
|
||||
+++ firefox-126.0/toolkit/xre/DBusService.cpp 2024-05-09 12:59:43.865983543 +0200
|
||||
@@ -0,0 +1,299 @@
|
||||
diff --git a/widget/gtk/DBusService.h b/widget/gtk/DBusService.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/widget/gtk/DBusService.h
|
||||
@@ -0,0 +1,67 @@
|
||||
+/* -*- 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 DBusService_h__
|
||||
+#define DBusService_h__
|
||||
+
|
||||
+#include <glib.h>
|
||||
+#include <gio/gio.h>
|
||||
+#include "mozilla/RefPtr.h"
|
||||
+#include "mozilla/GRefPtr.h"
|
||||
+
|
||||
+namespace mozilla::widget {
|
||||
+
|
||||
+class DBusService final {
|
||||
+ public:
|
||||
+ explicit DBusService(const char* aAppFile) : mAppFile(aAppFile) {}
|
||||
+ ~DBusService();
|
||||
+
|
||||
+ // nsBaseAppShell overrides:
|
||||
+ bool Init();
|
||||
+ void Run();
|
||||
+
|
||||
+ void StartDBusListening();
|
||||
+ void StopDBusListening();
|
||||
+
|
||||
+ static void DBusSessionSleepCallback(GDBusProxy* aProxy, gchar* aSenderName,
|
||||
+ gchar* aSignalName,
|
||||
+ GVariant* aParameters,
|
||||
+ gpointer aUserData);
|
||||
+ static void DBusTimedatePropertiesChangedCallback(GDBusProxy* aProxy,
|
||||
+ gchar* aSenderName,
|
||||
+ gchar* aSignalName,
|
||||
+ GVariant* aParameters,
|
||||
+ gpointer aUserData);
|
||||
+ static void DBusConnectClientResponse(GObject* aObject, GAsyncResult* aResult,
|
||||
+ gpointer aUserData);
|
||||
+
|
||||
+ bool LaunchApp(const char* aCommand, const char** aURIList, int aURIListLen);
|
||||
+
|
||||
+ void HandleFreedesktopActivate(GVariant* aParameters,
|
||||
+ GDBusMethodInvocation* aReply);
|
||||
+ void HandleFreedesktopOpen(GVariant* aParameters,
|
||||
+ GDBusMethodInvocation* aReply);
|
||||
+ void HandleFreedesktopActivateAction(GVariant* aParameters,
|
||||
+ GDBusMethodInvocation* aReply);
|
||||
+
|
||||
+ bool StartFreedesktopListener();
|
||||
+ void StopFreedesktopListener();
|
||||
+
|
||||
+ void OnBusAcquired(GDBusConnection* aConnection);
|
||||
+ void OnNameAcquired(GDBusConnection* aConnection);
|
||||
+ void OnNameLost(GDBusConnection* aConnection);
|
||||
+
|
||||
+ private:
|
||||
+ // The connection is owned by DBus library
|
||||
+ uint mDBusID = 0;
|
||||
+ uint mRegistrationId = 0;
|
||||
+ GDBusConnection* mConnection = nullptr;
|
||||
+ RefPtr<GDBusNodeInfo> mIntrospectionData;
|
||||
+ const char* mAppFile = nullptr;
|
||||
+};
|
||||
+
|
||||
+} // namespace mozilla::widget
|
||||
+
|
||||
+#endif // DBusService_h__
|
||||
diff --git a/widget/gtk/DBusService.cpp b/widget/gtk/DBusService.cpp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/widget/gtk/DBusService.cpp
|
||||
@@ -0,0 +1,327 @@
|
||||
+/* -*- 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
|
||||
@ -21,6 +94,7 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+#include "nsIObserverService.h"
|
||||
+#include "WidgetUtilsGtk.h"
|
||||
+#include "prproces.h"
|
||||
+#include "mozilla/XREAppData.h"
|
||||
+#include "nsPrintfCString.h"
|
||||
+
|
||||
+using namespace mozilla;
|
||||
@ -62,7 +136,10 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ return path;
|
||||
+}
|
||||
+
|
||||
+static const char* introspect_template =
|
||||
+// See
|
||||
+// https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s07.html
|
||||
+// for details
|
||||
+static const char* kIntrospectTemplate =
|
||||
+ "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection "
|
||||
+ "1.0//EN\"\n"
|
||||
+ "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
|
||||
@ -83,7 +160,7 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ "</interface>\n"
|
||||
+ "</node>\n";
|
||||
+
|
||||
+void DBusService::LaunchApp(const char* aCommand, const char** aURIList,
|
||||
+bool DBusService::LaunchApp(const char* aCommand, const char** aURIList,
|
||||
+ int aURIListLen) {
|
||||
+ // Allocate space for all uris, executable name, command if supplied and
|
||||
+ // null terminator
|
||||
@ -92,7 +169,7 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ paramsNum++;
|
||||
+ }
|
||||
+
|
||||
+ char** argv = (char**)moz_xmalloc(sizeof(char*) * (paramsNum));
|
||||
+ char** argv = (char**)moz_xmalloc(sizeof(char*) * paramsNum);
|
||||
+ int argc = 0;
|
||||
+ argv[argc++] = strdup(mAppFile);
|
||||
+ if (aCommand) {
|
||||
@ -105,9 +182,11 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+
|
||||
+ nsAutoCString exePath;
|
||||
+ nsCOMPtr<nsIFile> lf;
|
||||
+ bool ret = false;
|
||||
+ if (NS_SUCCEEDED(XRE_GetBinaryPath(getter_AddRefs(lf)))) {
|
||||
+ if (NS_SUCCEEDED(lf->GetNativePath(exePath))) {
|
||||
+ PR_CreateProcessDetached(exePath.get(), argv, nullptr, nullptr);
|
||||
+ ret = (PR_CreateProcessDetached(exePath.get(), argv, nullptr, nullptr) !=
|
||||
+ PR_FAILURE);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -115,6 +194,7 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ free(argv[i]);
|
||||
+ }
|
||||
+ free(argv);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+// The Activate method is called when the application is started without
|
||||
@ -122,7 +202,12 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+// Open :: (a{sv}) → ()
|
||||
+void DBusService::HandleFreedesktopActivate(GVariant* aParameters,
|
||||
+ GDBusMethodInvocation* aReply) {
|
||||
+ LaunchApp(nullptr, nullptr, 0);
|
||||
+ if (!LaunchApp(nullptr, nullptr, 0)) {
|
||||
+ g_dbus_method_invocation_return_error(aReply, G_DBUS_ERROR,
|
||||
+ G_DBUS_ERROR_FAILED,
|
||||
+ "Failed to run target application.");
|
||||
+ return;
|
||||
+ }
|
||||
+ g_dbus_method_invocation_return_value(aReply, nullptr);
|
||||
+}
|
||||
+
|
||||
@ -134,8 +219,13 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ RefPtr<GVariant> variant =
|
||||
+ dont_AddRef(g_variant_get_child_value(aParameters, 0));
|
||||
+ gsize uriNum = 0;
|
||||
+ const char** uriArray = g_variant_get_strv(variant, &uriNum);
|
||||
+ LaunchApp(nullptr, uriArray, uriNum);
|
||||
+ GUniquePtr<const char*> uriArray(g_variant_get_strv(variant, &uriNum));
|
||||
+ if (!LaunchApp(nullptr, uriArray.get(), uriNum)) {
|
||||
+ g_dbus_method_invocation_return_error(aReply, G_DBUS_ERROR,
|
||||
+ G_DBUS_ERROR_FAILED,
|
||||
+ "Failed to run target application.");
|
||||
+ return;
|
||||
+ }
|
||||
+ g_dbus_method_invocation_return_value(aReply, nullptr);
|
||||
+}
|
||||
+
|
||||
@ -159,14 +249,20 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ // actionName matches desktop action defined in .desktop file.
|
||||
+ // We implement it for .desktop file shipped by flatpak
|
||||
+ // (taskcluster/docker/firefox-flatpak/org.mozilla.firefox.desktop)
|
||||
+ bool ret = false;
|
||||
+ if (!strcmp(actionName, "new-window")) {
|
||||
+ LaunchApp(nullptr, nullptr, 0);
|
||||
+ ret = LaunchApp(nullptr, nullptr, 0);
|
||||
+ } else if (!strcmp(actionName, "new-private-window")) {
|
||||
+ LaunchApp("--private-window", nullptr, 0);
|
||||
+ ret = LaunchApp("--private-window", nullptr, 0);
|
||||
+ } else if (!strcmp(actionName, "profile-manager-window")) {
|
||||
+ LaunchApp("--ProfileManager", nullptr, 0);
|
||||
+ ret = LaunchApp("--ProfileManager", nullptr, 0);
|
||||
+ }
|
||||
+ if (!ret) {
|
||||
+ g_dbus_method_invocation_return_error(aReply, G_DBUS_ERROR,
|
||||
+ G_DBUS_ERROR_FAILED,
|
||||
+ "Failed to run target application.");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ g_dbus_method_invocation_return_value(aReply, nullptr);
|
||||
+}
|
||||
+
|
||||
@ -179,19 +275,22 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ MOZ_ASSERT(aUserData);
|
||||
+ MOZ_ASSERT(NS_IsMainThread());
|
||||
+
|
||||
+ if (strcmp("org.freedesktop.Application", aInterfaceName) == 0) {
|
||||
+ if (strcmp("Activate", aMethodName) == 0) {
|
||||
+ static_cast<DBusService*>(aUserData)->HandleFreedesktopActivate(
|
||||
+ aParameters, aInvocation);
|
||||
+ } else if (strcmp("Open", aMethodName) == 0) {
|
||||
+ static_cast<DBusService*>(aUserData)->HandleFreedesktopOpen(aParameters,
|
||||
+ aInvocation);
|
||||
+ } else if (strcmp("ActivateAction", aMethodName) == 0) {
|
||||
+ static_cast<DBusService*>(aUserData)->HandleFreedesktopActivateAction(
|
||||
+ aParameters, aInvocation);
|
||||
+ } else {
|
||||
+ g_warning("DBusService: HandleMethodCall() wrong method %s", aMethodName);
|
||||
+ }
|
||||
+ if (strcmp("org.freedesktop.Application", aInterfaceName) != 0) {
|
||||
+ g_warning("DBusService: HandleMethodCall() wrong interface name %s",
|
||||
+ aInterfaceName);
|
||||
+ return;
|
||||
+ }
|
||||
+ if (strcmp("Activate", aMethodName) == 0) {
|
||||
+ static_cast<DBusService*>(aUserData)->HandleFreedesktopActivate(
|
||||
+ aParameters, aInvocation);
|
||||
+ } else if (strcmp("Open", aMethodName) == 0) {
|
||||
+ static_cast<DBusService*>(aUserData)->HandleFreedesktopOpen(aParameters,
|
||||
+ aInvocation);
|
||||
+ } else if (strcmp("ActivateAction", aMethodName) == 0) {
|
||||
+ static_cast<DBusService*>(aUserData)->HandleFreedesktopActivateAction(
|
||||
+ aParameters, aInvocation);
|
||||
+ } else {
|
||||
+ g_warning("DBusService: HandleMethodCall() wrong method %s", aMethodName);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
@ -227,7 +326,7 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+void DBusService::OnBusAcquired(GDBusConnection* aConnection) {
|
||||
+ GUniquePtr<GError> error;
|
||||
+ mIntrospectionData = dont_AddRef(g_dbus_node_info_new_for_xml(
|
||||
+ introspect_template, getter_Transfers(error)));
|
||||
+ kIntrospectTemplate, getter_Transfers(error)));
|
||||
+ if (!mIntrospectionData) {
|
||||
+ g_warning("DBusService: g_dbus_node_info_new_for_xml() failed! %s",
|
||||
+ error->message);
|
||||
@ -270,6 +369,8 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ }
|
||||
+
|
||||
+ mDBusID = g_bus_own_name(
|
||||
+ // if org.mozilla.Firefox is taken it means we're already running
|
||||
+ // so use G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE and quit.
|
||||
+ G_BUS_TYPE_SESSION, GetDBusBusName(), G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE,
|
||||
+ [](GDBusConnection* aConnection, const gchar*,
|
||||
+ gpointer aUserData) -> void {
|
||||
@ -301,85 +402,18 @@ diff -up firefox-126.0/toolkit/xre/DBusService.cpp.D209910 firefox-126.0/toolkit
|
||||
+ }
|
||||
+ mIntrospectionData = nullptr;
|
||||
+}
|
||||
diff -up firefox-126.0/toolkit/xre/DBusService.h.D209910 firefox-126.0/toolkit/xre/DBusService.h
|
||||
--- firefox-126.0/toolkit/xre/DBusService.h.D209910 2024-05-09 12:20:44.081565311 +0200
|
||||
+++ firefox-126.0/toolkit/xre/DBusService.h 2024-05-09 12:20:44.081565311 +0200
|
||||
@@ -0,0 +1,64 @@
|
||||
+/* -*- 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 DBusService_h__
|
||||
+#define DBusService_h__
|
||||
+
|
||||
+#include <glib.h>
|
||||
+#include <gio/gio.h>
|
||||
+#include "mozilla/RefPtr.h"
|
||||
+#include "mozilla/GRefPtr.h"
|
||||
+
|
||||
+class DBusService final {
|
||||
+ public:
|
||||
+ DBusService(const char* aAppFile) : mAppFile(aAppFile){};
|
||||
+
|
||||
+ // nsBaseAppShell overrides:
|
||||
+ bool Init();
|
||||
+ void Run();
|
||||
+
|
||||
+ void StartDBusListening();
|
||||
+ void StopDBusListening();
|
||||
+
|
||||
+ static void DBusSessionSleepCallback(GDBusProxy* aProxy, gchar* aSenderName,
|
||||
+ gchar* aSignalName,
|
||||
+ GVariant* aParameters,
|
||||
+ gpointer aUserData);
|
||||
+ static void DBusTimedatePropertiesChangedCallback(GDBusProxy* aProxy,
|
||||
+ gchar* aSenderName,
|
||||
+ gchar* aSignalName,
|
||||
+ GVariant* aParameters,
|
||||
+ gpointer aUserData);
|
||||
+ static void DBusConnectClientResponse(GObject* aObject, GAsyncResult* aResult,
|
||||
+ gpointer aUserData);
|
||||
+
|
||||
+ void LaunchApp(const char* aCommand, const char** aURIList, int aURIListLen);
|
||||
+
|
||||
+ void HandleFreedesktopActivate(GVariant* aParameters,
|
||||
+ GDBusMethodInvocation* aReply);
|
||||
+ void HandleFreedesktopOpen(GVariant* aParameters,
|
||||
+ GDBusMethodInvocation* aReply);
|
||||
+ void HandleFreedesktopActivateAction(GVariant* aParameters,
|
||||
+ GDBusMethodInvocation* aReply);
|
||||
+
|
||||
+ bool StartFreedesktopListener();
|
||||
+ void StopFreedesktopListener();
|
||||
+
|
||||
+ void OnBusAcquired(GDBusConnection* aConnection);
|
||||
+ void OnNameAcquired(GDBusConnection* aConnection);
|
||||
+ void OnNameLost(GDBusConnection* aConnection);
|
||||
+
|
||||
+ private:
|
||||
+ virtual ~DBusService();
|
||||
+
|
||||
+ // The connection is owned by DBus library
|
||||
+ uint mDBusID = 0;
|
||||
+ uint mRegistrationId = 0;
|
||||
+ GDBusConnection* mConnection = nullptr;
|
||||
+ RefPtr<GDBusNodeInfo> mIntrospectionData;
|
||||
+ const char* mAppFile = nullptr;
|
||||
+};
|
||||
+
|
||||
+#endif // DBusService_h__
|
||||
diff -up firefox-126.0/toolkit/xre/moz.build.D209910 firefox-126.0/toolkit/xre/moz.build
|
||||
--- firefox-126.0/toolkit/xre/moz.build.D209910 2024-05-06 22:50:25.000000000 +0200
|
||||
+++ firefox-126.0/toolkit/xre/moz.build 2024-05-09 12:20:44.081565311 +0200
|
||||
@@ -99,6 +99,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gt
|
||||
UNIFIED_SOURCES += [
|
||||
"nsNativeAppSupportUnix.cpp",
|
||||
diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
|
||||
--- a/widget/gtk/moz.build
|
||||
+++ b/widget/gtk/moz.build
|
||||
@@ -172,9 +172,10 @@
|
||||
"AsyncDBus.h",
|
||||
]
|
||||
+ if CONFIG["MOZ_ENABLE_DBUS"]:
|
||||
+ UNIFIED_SOURCES += [
|
||||
+ "DBusService.cpp",
|
||||
+ ]
|
||||
CXXFLAGS += CONFIG["MOZ_X11_SM_CFLAGS"]
|
||||
else:
|
||||
UNIFIED_SOURCES += [
|
||||
"AsyncDBus.cpp",
|
||||
"DBusMenu.cpp",
|
||||
+ "DBusService.cpp",
|
||||
]
|
||||
CXXFLAGS += CONFIG["MOZ_DBUS_CFLAGS"]
|
||||
|
||||
CXXFLAGS += ["-Werror=switch"]
|
||||
|
@ -1,19 +1,9 @@
|
||||
changeset: 743537:1bf2a3b85d0a
|
||||
tag: tip
|
||||
parent: 743535:29f24b1fbada
|
||||
user: stransky <stransky@redhat.com>
|
||||
date: Thu May 09 10:38:21 2024 +0200
|
||||
files: toolkit/xre/nsAppRunner.cpp
|
||||
description:
|
||||
Bug 1894912 [Linux] Launch DBusService on --dbus-service param r?emilio
|
||||
|
||||
Differential Revision: https://phabricator.services.mozilla.com/D209911
|
||||
|
||||
|
||||
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
|
||||
--- a/toolkit/xre/nsAppRunner.cpp
|
||||
+++ b/toolkit/xre/nsAppRunner.cpp
|
||||
@@ -267,6 +267,9 @@
|
||||
@@ -265,10 +265,13 @@
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
# include "nsAppShell.h"
|
||||
#endif
|
||||
@ -23,7 +13,11 @@ diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
|
||||
|
||||
extern uint32_t gRestartMode;
|
||||
extern void InstallSignalHandlers(const char* ProgramName);
|
||||
@@ -2134,6 +2137,10 @@ static void DumpHelp() {
|
||||
|
||||
#define FILE_COMPATIBILITY_INFO "compatibility.ini"_ns
|
||||
@@ -2132,10 +2135,14 @@
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(XP_MACOSX)
|
||||
printf(" --headless Run without a GUI.\n");
|
||||
#endif
|
||||
|
||||
@ -34,16 +28,21 @@ diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
|
||||
// this works, but only after the components have registered. so if you drop
|
||||
// in a new command line handler, --help won't not until the second run. out
|
||||
// of the bug, because we ship a component.reg file, it works correctly.
|
||||
@@ -4372,6 +4379,16 @@ int XREMain::XRE_mainInit(bool* aExitFla
|
||||
DumpArbitraryHelp();
|
||||
}
|
||||
@@ -4370,10 +4377,21 @@
|
||||
DumpFullVersion();
|
||||
*aExitFlag = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef MOZ_ENABLE_DBUS
|
||||
+ if (CheckArg("dbus-service")) {
|
||||
+ DBusService* dbusService = new DBusService(gArgv[0]);
|
||||
+ UniquePtr<DBusService> dbusService = MakeUnique<DBusService>(gArgv[0]);
|
||||
+ if (dbusService->Init()) {
|
||||
+ dbusService->Run();
|
||||
+ }
|
||||
+ *aExitFlag = true;
|
||||
+ return 1;
|
||||
+ }
|
||||
+#endif
|
||||
@ -51,4 +50,6 @@ diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
|
||||
rv = XRE_InitCommandLine(gArgc, gArgv);
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
58
D210158.1715685536.diff
Normal file
58
D210158.1715685536.diff
Normal file
@ -0,0 +1,58 @@
|
||||
diff --git a/widget/gtk/DBusService.cpp b/widget/gtk/DBusService.cpp
|
||||
--- a/widget/gtk/DBusService.cpp
|
||||
+++ b/widget/gtk/DBusService.cpp
|
||||
@@ -83,42 +83,27 @@
|
||||
"</interface>\n"
|
||||
"</node>\n";
|
||||
|
||||
bool DBusService::LaunchApp(const char* aCommand, const char** aURIList,
|
||||
int aURIListLen) {
|
||||
- // Allocate space for all uris, executable name, command if supplied and
|
||||
- // null terminator
|
||||
- int paramsNum = aURIListLen + 2;
|
||||
+ nsAutoCString param(mAppFile);
|
||||
if (aCommand) {
|
||||
- paramsNum++;
|
||||
- }
|
||||
-
|
||||
- char** argv = (char**)moz_xmalloc(sizeof(char*) * paramsNum);
|
||||
- int argc = 0;
|
||||
- argv[argc++] = strdup(mAppFile);
|
||||
- if (aCommand) {
|
||||
- argv[argc++] = strdup(aCommand);
|
||||
+ param.Append(" ");
|
||||
+ param.Append(aCommand);
|
||||
}
|
||||
for (int i = 0; aURIList && i < aURIListLen; i++) {
|
||||
- argv[argc++] = strdup(aURIList[i]);
|
||||
- }
|
||||
- argv[argc++] = nullptr;
|
||||
-
|
||||
- nsAutoCString exePath;
|
||||
- nsCOMPtr<nsIFile> lf;
|
||||
- bool ret = false;
|
||||
- if (NS_SUCCEEDED(XRE_GetBinaryPath(getter_AddRefs(lf)))) {
|
||||
- if (NS_SUCCEEDED(lf->GetNativePath(exePath))) {
|
||||
- ret = (PR_CreateProcessDetached(exePath.get(), argv, nullptr, nullptr) !=
|
||||
- PR_FAILURE);
|
||||
- }
|
||||
+ param.Append(" ");
|
||||
+ param.Append(aURIList[i]);
|
||||
}
|
||||
|
||||
- for (int i = 0; i < argc; i++) {
|
||||
- free(argv[i]);
|
||||
+ char* argv[] = {strdup("/bin/sh"), strdup("-c"), strdup(param.get()),
|
||||
+ nullptr};
|
||||
+ int ret =
|
||||
+ PR_CreateProcessDetached("/bin/sh", argv, nullptr, nullptr) != PR_FAILURE;
|
||||
+ for (auto str : argv) {
|
||||
+ free(str);
|
||||
}
|
||||
- free(argv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// The Activate method is called when the application is started without
|
||||
// files to open.
|
||||
|
49
D210159.1715685538.diff
Normal file
49
D210159.1715685538.diff
Normal file
@ -0,0 +1,49 @@
|
||||
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
|
||||
--- a/toolkit/xre/nsAppRunner.cpp
|
||||
+++ b/toolkit/xre/nsAppRunner.cpp
|
||||
@@ -2136,11 +2136,15 @@
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(XP_MACOSX)
|
||||
printf(" --headless Run without a GUI.\n");
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_ENABLE_DBUS)
|
||||
- printf(" --dbus-service Run as DBus service.\n");
|
||||
+ printf(
|
||||
+ " --dbus-service <launcher> Run as DBus service for "
|
||||
+ "org.freedesktop.Application and\n"
|
||||
+ " set a launcher (usually /usr/bin/appname "
|
||||
+ "script) for it.");
|
||||
#endif
|
||||
|
||||
// this works, but only after the components have registered. so if you drop
|
||||
// in a new command line handler, --help won't not until the second run. out
|
||||
// of the bug, because we ship a component.reg file, it works correctly.
|
||||
@@ -4378,17 +4382,24 @@
|
||||
*aExitFlag = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
- if (CheckArg("dbus-service")) {
|
||||
- UniquePtr<DBusService> dbusService = MakeUnique<DBusService>(gArgv[0]);
|
||||
+ const char* dbusServiceLauncher = nullptr;
|
||||
+ ar = CheckArg("dbus-service", &dbusServiceLauncher, CheckArgFlag::None);
|
||||
+ if (ar == ARG_BAD) {
|
||||
+ Output(true, "Missing launcher param for --dbus-service\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (ar == ARG_FOUND) {
|
||||
+ UniquePtr<DBusService> dbusService =
|
||||
+ MakeUnique<DBusService>(dbusServiceLauncher);
|
||||
if (dbusService->Init()) {
|
||||
dbusService->Run();
|
||||
}
|
||||
*aExitFlag = true;
|
||||
- return 1;
|
||||
+ return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
rv = XRE_InitCommandLine(gArgc, gArgv);
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
19
firefox.spec
19
firefox.spec
@ -189,7 +189,7 @@ ExcludeArch: i686
|
||||
Summary: Mozilla Firefox Web browser
|
||||
Name: firefox
|
||||
Version: 126.0
|
||||
Release: 2%{?pre_tag}%{?dist}
|
||||
Release: 3%{?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
|
||||
@ -275,11 +275,14 @@ Patch242: 0026-Add-KDE-integration-to-Firefox.patch
|
||||
# Upstream patches
|
||||
Patch402: mozilla-1196777.patch
|
||||
Patch407: mozilla-1667096.patch
|
||||
Patch408: D209910.diff
|
||||
Patch409: D209911.diff
|
||||
# https://webrtc-review.googlesource.com/c/src/+/349881
|
||||
Patch410: libwebrtc-video-capture-pipewire-drop-corrupted-buffers.patch
|
||||
|
||||
Patch420: D209910.1715685533.diff
|
||||
Patch421: D209911.1715685535.diff
|
||||
Patch422: D210158.1715685536.diff
|
||||
Patch423: D210159.1715685538.diff
|
||||
|
||||
# PGO/LTO patches
|
||||
Patch600: pgo.patch
|
||||
Patch602: mozilla-1516803.patch
|
||||
@ -594,10 +597,13 @@ export LIBCLANG_RT=`pwd`/wasi-sdk-20/build/compiler-rt/lib/wasi/libclang_rt.buil
|
||||
|
||||
%patch402 -p1 -b .1196777
|
||||
%patch407 -p1 -b .1667096
|
||||
%patch408 -p1 -b .D209910
|
||||
%patch409 -p1 -b .D209911
|
||||
%patch410 -p1 -b .libwebrtc-video-capture-pipewire-drop-corrupted-buffers
|
||||
|
||||
%patch420 -p1 -b .D209910.1715685533
|
||||
%patch421 -p1 -b .D209911.1715685535
|
||||
%patch422 -p1 -b .D210158.1715685536
|
||||
%patch423 -p1 -b .D210159.1715685538
|
||||
|
||||
# PGO patches
|
||||
%if %{build_with_pgo}
|
||||
%if !%{build_with_clang}
|
||||
@ -1231,6 +1237,9 @@ fi
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
%changelog
|
||||
* Mon May 13 2024 Martin Stransky <stransky@redhat.com>- 126.0-3
|
||||
- More upstream patches for Gnome search provider.
|
||||
|
||||
* Fri May 10 2024 Martin Stransky <stransky@redhat.com>- 126.0-2
|
||||
- Fix Gnome search provider for Fedora 40+
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
[D-BUS Service]
|
||||
Name=org.mozilla.firefox
|
||||
Exec=/usr/lib64/firefox/firefox --dbus-service
|
||||
Exec=/usr/lib64/firefox/firefox --dbus-service /usr/bin/firefox
|
||||
|
Loading…
Reference in New Issue
Block a user