diff options
Diffstat (limited to 'toolkit/modules')
-rw-r--r-- | toolkit/modules/AppConstants.jsm | 23 | ||||
-rw-r--r-- | toolkit/modules/NewTabUtils.jsm | 5 | ||||
-rw-r--r-- | toolkit/modules/Services.jsm | 30 | ||||
-rw-r--r-- | toolkit/modules/Troubleshoot.jsm | 32 | ||||
-rw-r--r-- | toolkit/modules/UpdateChannel.jsm | 47 | ||||
-rw-r--r-- | toolkit/modules/moz.build | 8 |
6 files changed, 77 insertions, 68 deletions
diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm index 7ce8e1f09..93acea0ec 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.jsm @@ -183,13 +183,6 @@ this.AppConstants = Object.freeze({ Services.vc.compare(platformVersion, version) <= 0; }, - MOZ_CRASHREPORTER: -#ifdef MOZ_CRASHREPORTER - true, -#else - false, -#endif - MOZ_VERIFY_MAR_SIGNATURE: #ifdef MOZ_VERIFY_MAR_SIGNATURE true, @@ -204,13 +197,6 @@ this.AppConstants = Object.freeze({ false, #endif - E10S_TESTING_ONLY: -#ifdef E10S_TESTING_ONLY - true, -#else - false, -#endif - DEBUG: #ifdef DEBUG true, @@ -308,7 +294,14 @@ this.AppConstants = Object.freeze({ MOZ_APP_NAME: "@MOZ_APP_NAME@", MOZ_APP_VERSION: "@MOZ_APP_VERSION@", MOZ_APP_VERSION_DISPLAY: "@MOZ_APP_VERSION_DISPLAY@", - MOZ_BUILD_APP: "@MOZ_BUILD_APP@", + + MOZ_BUILD_APP: +#ifdef MOZ_PHOENIX + "browser", +#else + "@MOZ_BUILD_APP@", +#endif + MOZ_MACBUNDLE_NAME: "@MOZ_MACBUNDLE_NAME@", MOZ_UPDATE_CHANNEL: "@MOZ_UPDATE_CHANNEL@", INSTALL_LOCALE: "@AB_CD@", diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm index df8dae89d..e452a6fb2 100644 --- a/toolkit/modules/NewTabUtils.jsm +++ b/toolkit/modules/NewTabUtils.jsm @@ -249,10 +249,15 @@ var AllPages = { * Returns whether the history tiles are enhanced. */ get enhanced() { +#ifdef MC_BASILISK + // Hard-block the use of sponsored tiles. + return false; +#else if (this._enhanced === null) this._enhanced = Services.prefs.getBoolPref(PREF_NEWTAB_ENHANCED); return this._enhanced; +#endif }, /** diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm index 1a6c3ea87..58d87ffb1 100644 --- a/toolkit/modules/Services.jsm +++ b/toolkit/modules/Services.jsm @@ -39,15 +39,6 @@ XPCOMUtils.defineLazyGetter(Services, "dirsvc", function () { .QueryInterface(Ci.nsIProperties); }); -if (AppConstants.MOZ_CRASHREPORTER) { - XPCOMUtils.defineLazyGetter(Services, "crashmanager", () => { - let ns = {}; - Components.utils.import("resource://gre/modules/CrashManager.jsm", ns); - - return ns.CrashManager.Singleton; - }); -} - XPCOMUtils.defineLazyGetter(Services, "mm", () => { return Cc["@mozilla.org/globalmessagemanager;1"] .getService(Ci.nsIMessageBroadcaster) @@ -61,8 +52,9 @@ XPCOMUtils.defineLazyGetter(Services, "ppmm", () => { }); var initTable = [ - ["androidBridge", "@mozilla.org/android/bridge;1", "nsIAndroidBridge", - AppConstants.platform == "android"], +#ifdef MOZ_WIDGET_ANDROID + ["androidBridge", "@mozilla.org/android/bridge;1", "nsIAndroidBridge"], +#endif ["appShell", "@mozilla.org/appshell/appShellService;1", "nsIAppShellService"], ["cache", "@mozilla.org/network/cache-service;1", "nsICacheService"], ["cache2", "@mozilla.org/netwerk/cache-storage-service;1", "nsICacheStorageService"], @@ -80,12 +72,14 @@ var initTable = [ ["obs", "@mozilla.org/observer-service;1", "nsIObserverService"], ["perms", "@mozilla.org/permissionmanager;1", "nsIPermissionManager"], ["prompt", "@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService"], - ["profiler", "@mozilla.org/tools/profiler;1", "nsIProfiler", - AppConstants.MOZ_ENABLE_PROFILER_SPS], +#ifdef MOZ_ENABLE_PROFILER_SPS + ["profiler", "@mozilla.org/tools/profiler;1", "nsIProfiler"], +#endif ["scriptloader", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"], ["scriptSecurityManager", "@mozilla.org/scriptsecuritymanager;1", "nsIScriptSecurityManager"], - ["search", "@mozilla.org/browser/search-service;1", "nsIBrowserSearchService", - AppConstants.MOZ_TOOLKIT_SEARCH], +#ifdef MOZ_TOOLKIT_SEARCH + ["search", "@mozilla.org/browser/search-service;1", "nsIBrowserSearchService"], +#endif ["storage", "@mozilla.org/storage/service;1", "mozIStorageService"], ["domStorageManager", "@mozilla.org/dom/localStorage-manager;1", "nsIDOMStorageManager"], ["strings", "@mozilla.org/intl/stringbundle;1", "nsIStringBundleService"], @@ -107,10 +101,8 @@ var initTable = [ ["qms", "@mozilla.org/dom/quota-manager-service;1", "nsIQuotaManagerService"], ]; -initTable.forEach(([name, contract, intf, enabled = true]) => { - if (enabled) { - XPCOMUtils.defineLazyServiceGetter(Services, name, contract, intf); - } +initTable.forEach(([name, contract, intf]) => { + XPCOMUtils.defineLazyServiceGetter(Services, name, contract, intf); }); diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index cc545b4c4..60f7e8666 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -12,13 +12,6 @@ Cu.import("resource://gre/modules/AddonManager.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/AppConstants.jsm"); -var Experiments; -try { - Experiments = Cu.import("resource:///modules/experiments/Experiments.jsm").Experiments; -} -catch (e) { -} - // We use a preferences whitelist to make sure we only show preferences that // are useful for support and won't compromise the user's privacy. Note that // entries are *prefixes*: for example, "accessibility." applies to all prefs @@ -263,18 +256,6 @@ var dataProviders = { }); }, - experiments: function experiments(done) { - if (Experiments === undefined) { - done([]); - return; - } - - // getExperiments promises experiment history - Experiments.instance().getExperiments().then( - experiments => done(experiments) - ); - }, - modifiedPreferences: function modifiedPreferences(done) { done(getPrefList(name => Services.prefs.prefHasUserValue(name))); }, @@ -549,19 +530,6 @@ var dataProviders = { } }; -if (AppConstants.MOZ_CRASHREPORTER) { - dataProviders.crashes = function crashes(done) { - let CrashReports = Cu.import("resource://gre/modules/CrashReports.jsm").CrashReports; - let reports = CrashReports.getReports(); - let now = new Date(); - let reportsNew = reports.filter(report => (now - report.date < Troubleshoot.kMaxCrashAge)); - let reportsSubmitted = reportsNew.filter(report => (!report.pending)); - let reportsPendingCount = reportsNew.length - reportsSubmitted.length; - let data = {submitted : reportsSubmitted, pending : reportsPendingCount}; - done(data); - } -} - if (AppConstants.MOZ_SANDBOX) { dataProviders.sandbox = function sandbox(done) { let data = {}; diff --git a/toolkit/modules/UpdateChannel.jsm b/toolkit/modules/UpdateChannel.jsm new file mode 100644 index 000000000..c2bdce8ad --- /dev/null +++ b/toolkit/modules/UpdateChannel.jsm @@ -0,0 +1,47 @@ +#filter substitution + +/* 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/. */ + +this.EXPORTED_SYMBOLS = ["UpdateChannel"]; + +const Cu = Components.utils; + +Cu.import("resource://gre/modules/Services.jsm"); + +this.UpdateChannel = { + /** + * Read the update channel from defaults only. We do this to ensure that + * the channel is tightly coupled with the application and does not apply + * to other instances of the application that may use the same profile. + * + * @param [optional] aIncludePartners + * Whether or not to include the partner bits. Default: true. + */ + get: function UpdateChannel_get(aIncludePartners = true) { + let channel = "@MOZ_UPDATE_CHANNEL@"; + let defaults = Services.prefs.getDefaultBranch(null); + try { + channel = defaults.getCharPref("app.update.channel"); + } catch (e) { + // use default value when pref not found + } + + if (aIncludePartners) { + try { + let partners = Services.prefs.getChildList("app.partner.").sort(); + if (partners.length) { + channel += "-cck"; + partners.forEach(function (prefName) { + channel += "-" + Services.prefs.getCharPref(prefName); + }); + } + } catch (e) { + Cu.reportError(e); + } + } + + return channel; + } +}; diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index 9e08fe9f0..60f3cc3da 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -57,7 +57,6 @@ EXTRA_JS_MODULES += [ 'Locale.jsm', 'Log.jsm', 'Memory.jsm', - 'NewTabUtils.jsm', 'NLP.jsm', 'ObjectUtils.jsm', 'PageMenu.jsm', @@ -85,7 +84,6 @@ EXTRA_JS_MODULES += [ 'SelectContentHelper.jsm', 'SelectParentHelper.jsm', 'ServiceRequest.jsm', - 'Services.jsm', 'SessionRecorder.jsm', 'sessionstore/FormData.jsm', 'sessionstore/ScrollPosition.jsm', @@ -105,6 +103,11 @@ EXTRA_JS_MODULES += [ EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js'] EXTRA_JS_MODULES.sessionstore += ['sessionstore/Utils.jsm'] +EXTRA_PP_JS_MODULES += ['NewTabUtils.jsm'] + +if not CONFIG['MOZ_WEBEXTENSIONS']: + EXTRA_PP_JS_MODULES += ['UpdateChannel.jsm'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'): DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1 @@ -116,6 +119,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'): EXTRA_PP_JS_MODULES += [ 'AppConstants.jsm', + 'Services.jsm', ] if 'Android' != CONFIG['OS_TARGET']: |