commit 148ae86d4adb9ed46250e320cd958aee8fd48b63
parent 46303fdd8dae83d16e3c6f49ab2b2d59062455bd
Author: Josh Aas <jaas@kflag.net>
Date: Mon, 24 Nov 2025 15:13:50 +0000
Bug 2001899 - get rid of unnecessary toolkit MacUtils. r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D273746
Diffstat:
5 files changed, 21 insertions(+), 55 deletions(-)
diff --git a/toolkit/xre/MacLaunchHelper.mm b/toolkit/xre/MacLaunchHelper.mm
@@ -6,7 +6,6 @@
#include "MacLaunchHelper.h"
#include "MacAutoreleasePool.h"
-#include "MacUtils.h"
#include <Cocoa/Cocoa.h>
#include <crt_externs.h>
@@ -16,7 +15,6 @@
#include <stdio.h>
using namespace mozilla;
-using namespace mozilla::MacUtils;
using namespace mozilla::MacLaunchHelper;
static void RegisterAppWithLaunchServices(NSString* aBundlePath) {
@@ -35,6 +33,27 @@ static void RegisterAppWithLaunchServices(NSString* aBundlePath) {
}
}
+/**
+ * Helper to launch macOS tasks via NSTask and wait for the launched task to
+ * terminate.
+ */
+static void LaunchTask(NSString* aPath, NSArray* aArguments) {
+ MacAutoreleasePool pool;
+
+ @try {
+ NSTask* task = [[NSTask alloc] init];
+ [task setExecutableURL:[NSURL fileURLWithPath:aPath]];
+ if (aArguments) {
+ [task setArguments:aArguments];
+ }
+ [task launchAndReturnError:nil];
+ [task waitUntilExit];
+ [task release];
+ } @catch (NSException* e) {
+ NSLog(@"%@: %@", e.name, e.reason);
+ }
+}
+
static void StripQuarantineBit(NSString* aBundlePath) {
MacAutoreleasePool pool;
diff --git a/toolkit/xre/MacRunFromDmgUtils.mm b/toolkit/xre/MacRunFromDmgUtils.mm
@@ -15,7 +15,6 @@
#include "MacLaunchHelper.h"
#include "MacRunFromDmgUtils.h"
-#include "MacUtils.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/intl/Localization.h"
@@ -37,7 +36,6 @@
// https://developer.apple.com/documentation/iokit
// https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/
-using namespace mozilla::MacUtils;
using namespace mozilla::MacLaunchHelper;
namespace mozilla::MacRunFromDmgUtils {
diff --git a/toolkit/xre/MacUtils.h b/toolkit/xre/MacUtils.h
@@ -1,17 +0,0 @@
-/* -*- 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 MacUtils_h_
-#define MacUtils_h_
-
-#include <Cocoa/Cocoa.h>
-
-namespace mozilla::MacUtils {
-
-void LaunchTask(NSString* aPath, NSArray* aArguments);
-
-} // namespace mozilla::MacUtils
-
-#endif
diff --git a/toolkit/xre/MacUtils.mm b/toolkit/xre/MacUtils.mm
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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/. */
-
-#include "MacAutoreleasePool.h"
-#include "MacUtils.h"
-
-namespace mozilla::MacUtils {
-
-/**
- * Helper to launch macOS tasks via NSTask and wait for the launched task to
- * terminate.
- */
-void LaunchTask(NSString* aPath, NSArray* aArguments) {
- MacAutoreleasePool pool;
-
- @try {
- NSTask* task = [[NSTask alloc] init];
- [task setExecutableURL:[NSURL fileURLWithPath:aPath]];
- if (aArguments) {
- [task setArguments:aArguments];
- }
- [task launchAndReturnError:nil];
- [task waitUntilExit];
- [task release];
- } @catch (NSException* e) {
- NSLog(@"%@: %@", e.name, e.reason);
- }
-}
-
-} // namespace mozilla::MacUtils
diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
@@ -73,14 +73,12 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
EXPORTS.mozilla += [
"MacRunFromDmgUtils.h",
- "MacUtils.h",
]
UNIFIED_SOURCES += [
"MacApplicationDelegate.mm",
"MacAutoreleasePool.mm",
"MacLaunchHelper.mm",
"MacRunFromDmgUtils.mm",
- "MacUtils.mm",
"nsCommandLineServiceMac.mm",
"nsNativeAppSupportCocoa.mm",
"updaterfileutils_osx.mm",