diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/mozapps/macos-frameworks | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/mozapps/macos-frameworks')
9 files changed, 223 insertions, 0 deletions
diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.h b/toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.h new file mode 100644 index 0000000000..670fa2e091 --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.h @@ -0,0 +1,17 @@ +/* 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 ChannelPrefs_h_ +#define ChannelPrefs_h_ + +#import <Foundation/Foundation.h> + +extern "C" { + +// Returns the channel name, as an autoreleased string. +extern NSString* ChannelPrefsGetChannel(void) __attribute__((weak_import)) +__attribute__((visibility("default"))); +} + +#endif // ChannelPrefs_h_ diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.mm b/toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.mm new file mode 100644 index 0000000000..f437bb857d --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefs/ChannelPrefs.mm @@ -0,0 +1,12 @@ +/* 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 "ChannelPrefs.h" + +#include "mozilla/HelperMacros.h" + +NSString* ChannelPrefsGetChannel() { + return [NSString stringWithCString:MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL) + encoding:NSUTF8StringEncoding]; +} diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefs/Info.plist b/toolkit/mozapps/macos-frameworks/ChannelPrefs/Info.plist new file mode 100644 index 0000000000..f7ce763d75 --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefs/Info.plist @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>ChannelPrefs</string> + <key>CFBundleIdentifier</key> + <string>org.mozilla.channelprefs</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>ChannelPrefs</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1.0</string> +</dict> +</plist> diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefs/Makefile.in b/toolkit/mozapps/macos-frameworks/ChannelPrefs/Makefile.in new file mode 100644 index 0000000000..43552a771e --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefs/Makefile.in @@ -0,0 +1,14 @@ +# vim:set ts=8 sw=8 sts=8 noet: +# 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 $(topsrcdir)/config/rules.mk + +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) +libs:: + rm -rf $(DIST)/bin/ChannelPrefs.framework + + $(NSINSTALL) $(DIST)/bin/ChannelPrefs $(DIST)/bin/ChannelPrefs.framework + $(NSINSTALL) $(srcdir)/Info.plist $(DIST)/bin/ChannelPrefs.framework/Resources +endif diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefs/README.md b/toolkit/mozapps/macos-frameworks/ChannelPrefs/README.md new file mode 100644 index 0000000000..a6285323f6 --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefs/README.md @@ -0,0 +1,70 @@ +# ChannelPrefs macOS Framework + +## Summary + +The ChannelPrefs macOS Framework is used to initialize the `app.update.channel` +pref during startup. + +## What is `app.update.channel` and what is it used for? + +`app.update.channel` is used to set the download channel for application +updates. + +## Why do we need a Framework instead of compiling the download channel directly into the executable? + +There are three main use cases that make it necessary for the +`app.update.channel` pref to be set by external means, such as a macOS +Framework: + + 1. Allowing users on the Beta channel to test RC builds + +Beta users have their update channel set to 'beta'. However, RC builds by +definition have their channel set to `release`, since these are release +candidates that could get released to our release population. If we were to +indiscriminately update our Beta users to an RC build, we would lose our entire +Beta population since everyone would get switched to the `release` channel. + + 2. Switching users to another channel, such as ESR + +In contrast to the Beta use case outlined above, there are times where we +explicitly WANT to switch users to a different channel. An example of this is +when hardware or a particular macOS version have reached their EOL. In this +case, we usually switch users to our ESR channel for extended support. + + 3. QA update testing + +QA requires a way to temporarily switch the update channel to a test channel in +order to test updates before new releases. + +## How does the ChannelPrefs macOS Framework address these use cases? + +We are able to accommodate all three use cases above by enabling the updater to +ignore certain files on disk if they were already present, but continue to force +update them if so desired. + +In the case of a Beta user updating to an RC build, the updater would encounter +a ChannelPrefs macOS Framework inside the .app bundle that has an update channel +of `beta`. In this case, the updater will not update the Framework, but update +everything else. This beta user is now able to run the RC build with the update +channel still set to `beta`. + +In the case of switching users to the ESR channel, the updater will be set to +forcefully update the ChannelPrefs macOS Framework, even if already present on +disk. After the update, the user will now be set to the `esr` channel and start +receiving updates through this channel. + +Before releases, QA replaces the ChannelPrefs macOS Framework within the .app +bundle and point the channel at a test channel in order to test updates. During +testing, the new Framework file would remain in place for typical update +testing, but gets replaced in case QA was testing channel switching. + +## Why is a macOS Framework the best solution to store the update channel? + +Apple has started strengthening code signature checks and the requirements on +developers such as ourselves on how their apps are signed. In particular, +most files in the .app bundle are now included in signature verifications. + +A macOS Framework is the ideal solution to store the update channel because +Frameworks are the only component within a .app bundle that can be replaced +without invalidating the code signature on the .app bundle, as long as both the +previous and the new Framework are signed. diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefs/moz.build b/toolkit/mozapps/macos-frameworks/ChannelPrefs/moz.build new file mode 100644 index 0000000000..13f4186b99 --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefs/moz.build @@ -0,0 +1,22 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +with Files("**"): + BUG_COMPONENT = ("Toolkit", "Application Update") + +Framework("ChannelPrefs") + +EXPORTS += [ + "ChannelPrefs.h", +] + +UNIFIED_SOURCES += [ + "ChannelPrefs.mm", +] + +OS_LIBS += [ + "-framework Foundation", +] diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefsUtil.h b/toolkit/mozapps/macos-frameworks/ChannelPrefsUtil.h new file mode 100644 index 0000000000..0f2c38632e --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefsUtil.h @@ -0,0 +1,16 @@ +/* -*- 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 ChannelPrefsUtil_h_ +#define ChannelPrefsUtil_h_ + +#include "Units.h" + +class ChannelPrefsUtil { + public: + static bool GetChannelPrefValue(nsACString& aValue); +}; + +#endif // ChannelPrefsUtil_h_ diff --git a/toolkit/mozapps/macos-frameworks/ChannelPrefsUtil.mm b/toolkit/mozapps/macos-frameworks/ChannelPrefsUtil.mm new file mode 100644 index 0000000000..4113b84f5b --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/ChannelPrefsUtil.mm @@ -0,0 +1,26 @@ +/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: + * 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* 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/. */ + +#import <ChannelPrefs/ChannelPrefs.h> + +#include "ChannelPrefsUtil.h" + +#include "nsCocoaUtils.h" + +/* static */ +bool ChannelPrefsUtil::GetChannelPrefValue(nsACString& aValue) { + // `ChannelPrefsGetChannel` is resolved at runtime and requires + // the ChannelPrefs framework to be loaded. + if (ChannelPrefsGetChannel) { + nsAutoString value; + nsCocoaUtils::GetStringForNSString(ChannelPrefsGetChannel(), value); + CopyUTF16toUTF8(value, aValue); + return true; + } + + return false; +} diff --git a/toolkit/mozapps/macos-frameworks/moz.build b/toolkit/mozapps/macos-frameworks/moz.build new file mode 100644 index 0000000000..b1a315500c --- /dev/null +++ b/toolkit/mozapps/macos-frameworks/moz.build @@ -0,0 +1,22 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +with Files("**"): + BUG_COMPONENT = ("Toolkit", "Application Update") + +FINAL_LIBRARY = "xul" + +DIRS += [ + "ChannelPrefs", +] + +EXPORTS += [ + "ChannelPrefsUtil.h", +] + +UNIFIED_SOURCES += [ + "ChannelPrefsUtil.mm", +] |