From ae4af7b7e598b4fec037254a1fd03ac3495695a4 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Sun, 3 Feb 2019 08:21:19 +0100 Subject: Stage 1-4: Update tests --- toolkit/modules/tests/xpcshell/test_Log.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toolkit/modules') diff --git a/toolkit/modules/tests/xpcshell/test_Log.js b/toolkit/modules/tests/xpcshell/test_Log.js index 429bbcc50..6aee99c93 100644 --- a/toolkit/modules/tests/xpcshell/test_Log.js +++ b/toolkit/modules/tests/xpcshell/test_Log.js @@ -381,12 +381,12 @@ add_task(function* log_message_with_params() { ob = function() {}; ob.toJSON = function() {throw "oh noes JSON"}; do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}), - 'Fail is (function () {})'); + 'Fail is (function() {})'); // Fall back to .toString if both .toJSON and .toSource fail. ob.toSource = function() {throw "oh noes SOURCE"}; do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}), - 'Fail is function () {}'); + 'Fail is function() {}'); // Fall back to '[object]' if .toJSON, .toSource and .toString fail. ob.toString = function() {throw "oh noes STRING"}; @@ -450,7 +450,7 @@ add_task(function* log_message_with_params() { // doesn't cause the logger to fail. let vOf = {a: 1, valueOf: function() {throw "oh noes valueOf"}}; do_check_eq(formatMessage("Broken valueOf ${}", vOf), - 'Broken valueOf ({a:1, valueOf:(function () {throw "oh noes valueOf"})})'); + 'Broken valueOf ({a:1, valueOf:(function() {throw "oh noes valueOf"})})'); // Test edge cases of bad data to formatter: // If 'params' is not an object, format it as a basic type. -- cgit v1.2.3 From 4c431486433428b18610c3578b693f3e1f1136eb Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 13 Mar 2019 09:50:54 +0100 Subject: Remove CloudSync Tag #812 --- toolkit/modules/AppConstants.jsm | 7 ------- toolkit/modules/moz.build | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'toolkit/modules') diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm index 1e2204f7e..ae0eea1c4 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.jsm @@ -102,13 +102,6 @@ MOZ_SAFE_BROWSING: false, #endif - MOZ_SERVICES_CLOUDSYNC: -#ifdef MOZ_SERVICES_CLOUDSYNC - true, -#else - false, -#endif - MOZ_UPDATER: #ifdef MOZ_UPDATER true, diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index e0acdb19e..8f66417c1 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -151,8 +151,7 @@ for var in ('ANDROID_PACKAGE_NAME', for var in ('MOZ_TOOLKIT_SEARCH', 'MOZ_SYSTEM_NSS', 'MOZ_UPDATER', - 'MOZ_SWITCHBOARD', - 'MOZ_SERVICES_CLOUDSYNC'): + 'MOZ_SWITCHBOARD'): if CONFIG[var]: DEFINES[var] = True -- cgit v1.2.3 From 8757548a3e5b5cc4d159d61eb4a12c7af1be548e Mon Sep 17 00:00:00 2001 From: Ascrod <32915892+Ascrod@users.noreply.github.com> Date: Sat, 13 Apr 2019 11:22:15 -0400 Subject: Issue #991 Part 8: Toolkit everything else --- toolkit/modules/NewTabUtils.jsm | 20 ++++++++------------ toolkit/modules/PermissionsUtils.jsm | 5 +---- toolkit/modules/UpdateUtils.jsm | 18 +++--------------- .../modules/secondscreen/SimpleServiceDiscovery.jsm | 5 +---- 4 files changed, 13 insertions(+), 35 deletions(-) (limited to 'toolkit/modules') diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm index 548d87dda..35e38156f 100644 --- a/toolkit/modules/NewTabUtils.jsm +++ b/toolkit/modules/NewTabUtils.jsm @@ -119,18 +119,14 @@ LinksStorage.prototype = { get _storedVersion() { if (this.__storedVersion === undefined) { - try { - this.__storedVersion = - Services.prefs.getIntPref("browser.newtabpage.storageVersion"); - } catch (ex) { - // The storage version is unknown, so either: - // - it's a new profile - // - it's a profile where versioning information got lost - // In this case we still run through all of the valid migrations, - // starting from 1, as if it was a downgrade. As previously stated the - // migrations should already support running on an updated store. - this.__storedVersion = 1; - } + // The storage version is unknown, so either: + // - it's a new profile + // - it's a profile where versioning information got lost + // In this case we still run through all of the valid migrations, + // starting from 1, as if it was a downgrade. As previously stated the + // migrations should already support running on an updated store. + this.__storedVersion = + Services.prefs.getIntPref("browser.newtabpage.storageVersion", 1); } return this.__storedVersion; }, diff --git a/toolkit/modules/PermissionsUtils.jsm b/toolkit/modules/PermissionsUtils.jsm index dfed76f0c..4bf43a3ec 100644 --- a/toolkit/modules/PermissionsUtils.jsm +++ b/toolkit/modules/PermissionsUtils.jsm @@ -16,10 +16,7 @@ function importPrefBranch(aPrefBranch, aPermission, aAction) { let list = Services.prefs.getChildList(aPrefBranch, {}); for (let pref of list) { - let origins = ""; - try { - origins = Services.prefs.getCharPref(pref); - } catch (e) {} + let origins = Services.prefs.getCharPref(pref, ""); if (!origins) continue; diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm index e92b1b797..fed7c7637 100644 --- a/toolkit/modules/UpdateUtils.jsm +++ b/toolkit/modules/UpdateUtils.jsm @@ -31,13 +31,9 @@ this.UpdateUtils = { * Whether or not to include the partner bits. Default: true. */ getUpdateChannel(aIncludePartners = true) { - let channel = AppConstants.MOZ_UPDATE_CHANNEL; + let channel = defaults.getCharPref("app.update.channel", + AppConstants.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 { @@ -93,15 +89,7 @@ this.UpdateUtils = { /* Get the distribution pref values, from defaults only */ function getDistributionPrefValue(aPrefName) { - var prefValue = "default"; - - try { - prefValue = Services.prefs.getDefaultBranch(null).getCharPref(aPrefName); - } catch (e) { - // use default when pref not found - } - - return prefValue; + return prefValue = Services.prefs.getDefaultBranch(null).getCharPref(aPrefName, "default"); } /** diff --git a/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm b/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm index cf9617ea1..4abc93ad1 100644 --- a/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm +++ b/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm @@ -186,10 +186,7 @@ var SimpleServiceDiscovery = { }, _searchFixedDevices: function _searchFixedDevices() { - let fixedDevices = null; - try { - fixedDevices = Services.prefs.getCharPref("browser.casting.fixedDevices"); - } catch (e) {} + let fixedDevices = Services.prefs.getCharPref("browser.casting.fixedDevices", ""); if (!fixedDevices) { return; -- cgit v1.2.3 From bca1943ca7bc8282cbf83be4898ab1d7e9e5355f Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 21 Apr 2019 11:28:27 -0400 Subject: Fix variable used before being declared in UpdateUtils.jsm Fall out from #991 --- toolkit/modules/UpdateUtils.jsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolkit/modules') diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm index fed7c7637..4e796a2da 100644 --- a/toolkit/modules/UpdateUtils.jsm +++ b/toolkit/modules/UpdateUtils.jsm @@ -31,9 +31,9 @@ this.UpdateUtils = { * Whether or not to include the partner bits. Default: true. */ getUpdateChannel(aIncludePartners = true) { + let defaults = Services.prefs.getDefaultBranch(null); let channel = defaults.getCharPref("app.update.channel", AppConstants.MOZ_UPDATE_CHANNEL); - let defaults = Services.prefs.getDefaultBranch(null); if (aIncludePartners) { try { -- cgit v1.2.3 From cb5d20deb7fed28887b9ea8edfad7792e59c1679 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Thu, 25 Apr 2019 06:02:08 -0400 Subject: Add application ID and widget toolkit placeholders to UpdateUtils.jsm --- toolkit/modules/UpdateUtils.jsm | 15 +++++++++++---- toolkit/modules/moz.build | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'toolkit/modules') diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm index 4e796a2da..4c6e7776d 100644 --- a/toolkit/modules/UpdateUtils.jsm +++ b/toolkit/modules/UpdateUtils.jsm @@ -2,6 +2,8 @@ * 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/. */ +#filter substitution + this.EXPORTED_SYMBOLS = ["UpdateUtils"]; const { classes: Cc, interfaces: Ci, utils: Cu } = Components; @@ -65,23 +67,28 @@ this.UpdateUtils = { * @return The formatted URL. */ formatUpdateURL(url) { + url = url.replace(/%ID%/g, Services.appinfo.ID); url = url.replace(/%PRODUCT%/g, Services.appinfo.name); url = url.replace(/%VERSION%/g, Services.appinfo.version); url = url.replace(/%BUILD_ID%/g, Services.appinfo.appBuildID); url = url.replace(/%BUILD_TARGET%/g, Services.appinfo.OS + "_" + this.ABI); url = url.replace(/%OS_VERSION%/g, this.OSVersion); - url = url.replace(/%SYSTEM_CAPABILITIES%/g, gSystemCapabilities); + url = url.replace(/%WIDGET_TOOLKIT%/g, "@MOZ_WIDGET_TOOLKIT@"); + url = url.replace(/%CHANNEL%/g, this.UpdateChannel); + if (/%LOCALE%/.test(url)) { url = url.replace(/%LOCALE%/g, this.Locale); } - url = url.replace(/%CHANNEL%/g, this.UpdateChannel); + + url = url.replace(/%CUSTOM%/g, Preferences.get(PREF_APP_UPDATE_CUSTOM, "")); + url = url.replace(/\+/g, "%2B"); + + url = url.replace(/%SYSTEM_CAPABILITIES%/g, gSystemCapabilities); url = url.replace(/%PLATFORM_VERSION%/g, Services.appinfo.platformVersion); url = url.replace(/%DISTRIBUTION%/g, getDistributionPrefValue(PREF_APP_DISTRIBUTION)); url = url.replace(/%DISTRIBUTION_VERSION%/g, getDistributionPrefValue(PREF_APP_DISTRIBUTION_VERSION)); - url = url.replace(/%CUSTOM%/g, Preferences.get(PREF_APP_UPDATE_CUSTOM, "")); - url = url.replace(/\+/g, "%2B"); return url; } diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index 8f66417c1..ba71a5a3c 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -92,7 +92,6 @@ EXTRA_JS_MODULES += [ 'Sqlite.jsm', 'Task.jsm', 'Timer.jsm', - 'UpdateUtils.jsm', 'WebChannel.jsm', 'WindowDraggingUtils.jsm', 'ZipUtils.jsm', @@ -104,6 +103,7 @@ EXTRA_PP_JS_MODULES += [ 'NewTabUtils.jsm', 'Troubleshoot.jsm', 'UpdateChannel.jsm', + 'UpdateUtils.jsm', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'): -- cgit v1.2.3 From 9cf2c92c3ecdb06ae68571ae4bcee2f95f3bf5bf Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Thu, 25 Apr 2019 07:50:52 -0400 Subject: Remove UpdateChannel.jsm --- toolkit/modules/UpdateChannel.jsm | 47 --------------------------------------- toolkit/modules/moz.build | 1 - 2 files changed, 48 deletions(-) delete mode 100644 toolkit/modules/UpdateChannel.jsm (limited to 'toolkit/modules') diff --git a/toolkit/modules/UpdateChannel.jsm b/toolkit/modules/UpdateChannel.jsm deleted file mode 100644 index c2bdce8ad..000000000 --- a/toolkit/modules/UpdateChannel.jsm +++ /dev/null @@ -1,47 +0,0 @@ -#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 ba71a5a3c..4e647bd7f 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -102,7 +102,6 @@ EXTRA_JS_MODULES.sessionstore += ['sessionstore/Utils.jsm'] EXTRA_PP_JS_MODULES += [ 'NewTabUtils.jsm', 'Troubleshoot.jsm', - 'UpdateChannel.jsm', 'UpdateUtils.jsm', ] -- cgit v1.2.3 From 8db31d53674d6b9d7f15f50d06d73c5661fc0c0a Mon Sep 17 00:00:00 2001 From: adeshkp Date: Sat, 25 May 2019 15:59:01 -0400 Subject: Issue #246 - Remove "enhanced" newtab code from toolkit --- toolkit/modules/NewTabUtils.jsm | 42 +---------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) (limited to 'toolkit/modules') diff --git a/toolkit/modules/NewTabUtils.jsm b/toolkit/modules/NewTabUtils.jsm index 35e38156f..500d08fa5 100644 --- a/toolkit/modules/NewTabUtils.jsm +++ b/toolkit/modules/NewTabUtils.jsm @@ -36,7 +36,6 @@ XPCOMUtils.defineLazyGetter(this, "gUnicodeConverter", function () { // Boolean preferences that control newtab content const PREF_NEWTAB_ENABLED = "browser.newtabpage.enabled"; -const PREF_NEWTAB_ENHANCED = "browser.newtabpage.enhanced"; // The preference that tells the number of rows of the newtab grid. const PREF_NEWTAB_ROWS = "browser.newtabpage.rows"; @@ -199,11 +198,6 @@ var AllPages = { */ _enabled: null, - /** - * Cached value that tells whether the New Tab Page feature is enhanced. - */ - _enhanced: null, - /** * Adds a page to the internal list of pages. * @param aPage The page to register. @@ -241,29 +235,6 @@ var AllPages = { Services.prefs.setBoolPref(PREF_NEWTAB_ENABLED, !!aEnabled); }, - /** - * Returns whether the history tiles are enhanced. - */ - get enhanced() { -#if defined(MC_BASILISK) || defined(HYPE_ICEWEASEL) - // 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 - }, - - /** - * Enables or disables the enhancement of history tiles feature. - */ - set enhanced(aEnhanced) { - if (this.enhanced != aEnhanced) - Services.prefs.setBoolPref(PREF_NEWTAB_ENHANCED, !!aEnhanced); - }, - /** * Returns the number of registered New Tab Pages (i.e. the number of open * about:newtab instances). @@ -296,9 +267,6 @@ var AllPages = { case PREF_NEWTAB_ENABLED: this._enabled = null; break; - case PREF_NEWTAB_ENHANCED: - this._enhanced = null; - break; } } // and all notifications get forwarded to each page. @@ -313,7 +281,6 @@ var AllPages = { */ _addObserver: function AllPages_addObserver() { Services.prefs.addObserver(PREF_NEWTAB_ENABLED, this, true); - Services.prefs.addObserver(PREF_NEWTAB_ENHANCED, this, true); Services.obs.addObserver(this, "page-thumbnail:create", true); this._addObserver = function () {}; }, @@ -480,8 +447,6 @@ var PinnedLinks = { return false; } aLink.type = "history"; - // always remove targetedSite - delete aLink.targetedSite; return true; }, @@ -1099,11 +1064,8 @@ var Links = { _getMergedProviderLinks: function Links__getMergedProviderLinks() { // Build a list containing a copy of each provider's sortedLinks list. let linkLists = []; + let { console } = Cu.import("resource://gre/modules/Console.jsm", {}); for (let provider of this._providers.keys()) { - if (!AllPages.enhanced && provider != PlacesProvider) { - // Only show history tiles if we're not in 'enhanced' mode. - continue; - } let links = this._providers.get(provider); if (links && links.sortedLinks) { linkLists.push(links.sortedLinks.slice()); @@ -1305,8 +1267,6 @@ var Telemetry = { let probes = [ { histogram: "NEWTAB_PAGE_ENABLED", value: AllPages.enabled }, - { histogram: "NEWTAB_PAGE_ENHANCED", - value: AllPages.enhanced }, { histogram: "NEWTAB_PAGE_PINNED_SITES_COUNT", value: PinnedLinks.links.length }, { histogram: "NEWTAB_PAGE_BLOCKED_SITES_COUNT", -- cgit v1.2.3