From 9f92cc492190431bd9f13c28c9383435c2202f00 Mon Sep 17 00:00:00 2001 From: Olivier Yiptong Date: Thu, 3 Mar 2016 15:51:38 -0500 Subject: [PATCH] Bug 1239118 - Export an object named after module in NewTabRemoteResource r=ursula MozReview-Commit-ID: EB7Or6jhoN7 --HG-- extra : rebase_source : 51aca10c21bc6ae5310c5568f866039d27c7a5a3 --- .../newtab/NewTabRemoteResources.jsm | 18 ++++++++++-------- .../components/newtab/aboutNewTabService.js | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/browser/components/newtab/NewTabRemoteResources.jsm b/browser/components/newtab/NewTabRemoteResources.jsm index 901470d6297d..bef45e3f056e 100644 --- a/browser/components/newtab/NewTabRemoteResources.jsm +++ b/browser/components/newtab/NewTabRemoteResources.jsm @@ -1,13 +1,15 @@ -/* exported MODE_CHANNEL_MAP */ +/* exported NewTabRemoteResources */ "use strict"; -this.EXPORTED_SYMBOLS = ["MODE_CHANNEL_MAP"]; +this.EXPORTED_SYMBOLS = ["NewTabRemoteResources"]; -const MODE_CHANNEL_MAP = { - "production": {origin: "https://content.cdn.mozilla.net"}, - "staging": {origin: "https://content-cdn.stage.mozaws.net"}, - "test": {origin: "https://example.com"}, - "test2": {origin: "http://mochi.test:8888"}, - "dev": {origin: "http://localhost:8888"} +const NewTabRemoteResources = { + MODE_CHANNEL_MAP: { + production: {origin: "https://content.cdn.mozilla.net"}, + staging: {origin: "https://content-cdn.stage.mozaws.net"}, + test: {origin: "https://example.com"}, + test2: {origin: "http://mochi.test:8888"}, + dev: {origin: "http://localhost:8888"} + } }; diff --git a/browser/components/newtab/aboutNewTabService.js b/browser/components/newtab/aboutNewTabService.js index c46b53bc7914..60734ab5ad12 100644 --- a/browser/components/newtab/aboutNewTabService.js +++ b/browser/components/newtab/aboutNewTabService.js @@ -5,7 +5,7 @@ */ /* globals XPCOMUtils, NewTabPrefsProvider, Services, - Locale, UpdateUtils, MODE_CHANNEL_MAP + Locale, UpdateUtils, NewTabRemoteResources */ "use strict"; @@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "NewTabPrefsProvider", "resource:///modules/NewTabPrefsProvider.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Locale", "resource://gre/modules/Locale.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "MODE_CHANNEL_MAP", +XPCOMUtils.defineLazyModuleGetter(this, "NewTabRemoteResources", "resource:///modules/NewTabRemoteResources.jsm"); const LOCAL_NEWTAB_URL = "chrome://browser/content/newtab/newTab.xhtml"; @@ -168,10 +168,10 @@ AboutNewTabService.prototype = { .replace("%LOCALE%", Locale.getLocale()) .replace("%CHANNEL%", releaseName); let mode = Services.prefs.getCharPref(PREF_REMOTE_MODE, "production"); - if (!(mode in MODE_CHANNEL_MAP)) { + if (!(mode in NewTabRemoteResources.MODE_CHANNEL_MAP)) { mode = "production"; } - return MODE_CHANNEL_MAP[mode].origin + path; + return NewTabRemoteResources.MODE_CHANNEL_MAP[mode].origin + path; }, /*