Bug 1239118 - Export an object named after module in NewTabRemoteResource r?ursula
MozReview-Commit-ID: EB7Or6jhoN7
--- 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"}
+ }
};
--- a/browser/components/newtab/aboutNewTabService.js
+++ b/browser/components/newtab/aboutNewTabService.js
@@ -1,31 +1,31 @@
/*
* 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/.
*/
/* globals XPCOMUtils, NewTabPrefsProvider, Services,
- Locale, UpdateUtils, MODE_CHANNEL_MAP
+ Locale, UpdateUtils, NewTabRemoteResources
*/
"use strict";
const {utils: Cu, interfaces: Ci} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
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";
const REMOTE_NEWTAB_PATH = "/v%VERSION%/%CHANNEL%/%LOCALE%/index.html";
const ABOUT_URL = "about:newtab";
@@ -153,20 +153,20 @@ AboutNewTabService.prototype = {
*/
generateRemoteURL() {
let releaseName = this.releaseFromUpdateChannel(UpdateUtils.UpdateChannel);
let path = REMOTE_NEWTAB_PATH
.replace("%VERSION%", REMOTE_NEWTAB_VERSION)
.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;
},
/*
* Returns the default URL.
*
* This URL only depends on the browser.newtabpage.remote pref. Overriding
* the newtab page has no effect on the result of this function.
*