Bug 1239118 - Export an object named after module in NewTabRemoteResource r=ursula

MozReview-Commit-ID: EB7Or6jhoN7

--HG--
extra : rebase_source : 51aca10c21bc6ae5310c5568f866039d27c7a5a3
This commit is contained in:
Olivier Yiptong 2016-03-03 15:51:38 -05:00
Родитель d27e176906
Коммит 9f92cc4921
2 изменённых файлов: 14 добавлений и 12 удалений

Просмотреть файл

@ -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"}
}
};

Просмотреть файл

@ -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;
},
/*