зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1799332: Add a macOS Framework to replace the use of channel-prefs.js on macOS. r=glandium,mstange,KrisWright,bytesized
Differential Revision: https://phabricator.services.mozilla.com/D184711
This commit is contained in:
Родитель
be58cf7181
Коммит
e755967a21
|
@ -105,5 +105,7 @@ ifdef MOZ_UPDATER
|
|||
mv -f '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater' '$(dist_dest)/Contents/Library/LaunchServices'
|
||||
ln -s ../../../../Library/LaunchServices/org.mozilla.updater '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater'
|
||||
endif
|
||||
$(MKDIR) -p '$(dist_dest)/Contents/Frameworks'
|
||||
mv '$(dist_dest)/Contents/Resources/ChannelPrefs.framework' '$(dist_dest)/Contents/Frameworks'
|
||||
printf APPLMOZB > '$(dist_dest)/Contents/PkgInfo'
|
||||
endif
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#ifdef MOZ_UPDATER
|
||||
@APPNAME@/Contents/Library/LaunchServices
|
||||
#endif
|
||||
@APPNAME@/Contents/Frameworks
|
||||
@APPNAME@/Contents/PkgInfo
|
||||
@RESPATH@/firefox.icns
|
||||
@RESPATH@/document.icns
|
||||
|
|
|
@ -112,6 +112,10 @@
|
|||
# include "mozilla/WidgetUtilsGtk.h"
|
||||
#endif // defined(MOZ_WIDGET_GTK)
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
# include "ChannelPrefsUtil.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
using ipc::FileDescriptor;
|
||||
|
@ -4844,6 +4848,27 @@ nsresult Preferences::InitInitialObjects(bool aIsStartup) {
|
|||
NS_WARNING("Error parsing application default preferences.");
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
// On macOS, channel-prefs.js is no longer bundled with the application and
|
||||
// the "app.update.channel" pref is now read from a Framework instead.
|
||||
// Previously, channel-prefs.js was read as one of the files in
|
||||
// NS_APP_PREF_DEFAULTS_50_DIR (see just above). See bug 1799332 for more
|
||||
// info.
|
||||
nsAutoCString appUpdatePrefKey;
|
||||
appUpdatePrefKey.Assign(kChannelPref);
|
||||
nsAutoCString appUpdatePrefValue;
|
||||
PrefValue channelPrefValue;
|
||||
channelPrefValue.mStringVal = MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL);
|
||||
if (ChannelPrefsUtil::GetChannelPrefValue(appUpdatePrefValue)) {
|
||||
channelPrefValue.mStringVal = appUpdatePrefValue.get();
|
||||
}
|
||||
pref_SetPref(appUpdatePrefKey, PrefType::String, PrefValueKind::Default,
|
||||
channelPrefValue,
|
||||
/* isSticky */ false,
|
||||
/* isLocked */ true,
|
||||
/* fromInit */ true);
|
||||
#endif
|
||||
|
||||
// Load jar:$app/omni.jar!/defaults/preferences/*.js
|
||||
// or jar:$gre/omni.jar!/defaults/preferences/*.js.
|
||||
RefPtr<nsZipArchive> appJarReader = Omnijar::GetReader(Omnijar::APP);
|
||||
|
|
|
@ -659,6 +659,10 @@ class MacArtifactJob(ArtifactJob):
|
|||
# 'xpcshell',
|
||||
"XUL",
|
||||
],
|
||||
"Contents/Frameworks",
|
||||
[
|
||||
"ChannelPrefs.framework/Versions/A/ChannelPrefs",
|
||||
],
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
|
@ -100,6 +100,7 @@ def Libxul(name, output_category=None):
|
|||
LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSCustomTouchBarItem"]
|
||||
LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSPopoverTouchBarItem"]
|
||||
LDFLAGS += ["-lresolv"]
|
||||
LDFLAGS += ["-Wl,-rpath,@executable_path/../Frameworks/ChannelPrefs.framework"]
|
||||
|
||||
if CONFIG["MOZ_DEBUG_SYMBOLS"] and CONFIG["CC_TYPE"] == "clang-cl":
|
||||
LDFLAGS += ["-NATVIS:%s/toolkit/library/gecko.natvis" % TOPSRCDIR]
|
||||
|
@ -232,6 +233,9 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
|||
"-framework CoreSymbolication",
|
||||
"cups",
|
||||
]
|
||||
USE_LIBS += [
|
||||
"ChannelPrefs",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
|
||||
OS_LIBS += [
|
||||
|
|
|
@ -55,6 +55,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|||
DIRS += ["system/unixproxy"]
|
||||
elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
||||
DIRS += [
|
||||
"mozapps/macos-frameworks",
|
||||
"system/commonproxy",
|
||||
"system/osxproxy",
|
||||
]
|
||||
|
|
|
@ -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_
|
|
@ -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];
|
||||
}
|
|
@ -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>
|
|
@ -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
|
|
@ -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",
|
||||
]
|
|
@ -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_
|
|
@ -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;
|
||||
}
|
|
@ -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",
|
||||
]
|
Загрузка…
Ссылка в новой задаче