Fix Bug 1504754 - Debug noscripts version of new tab page fail to load (#4560)

This commit is contained in:
Ed Lee 2018-11-27 10:59:08 -08:00 коммит произвёл GitHub
Родитель 3803f348fc
Коммит 678c6cc941
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 11 добавлений и 8 удалений

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

@ -108,6 +108,7 @@ AboutNewTabService.prototype = {
case "nsPref:changed": case "nsPref:changed":
if (data === PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS) { if (data === PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS) {
this._privilegedContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS); this._privilegedContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS);
this.updatePrerenderedPath();
this.notifyChange(); this.notifyChange();
} else if (data === PREF_ACTIVITY_STREAM_PRERENDER_ENABLED) { } else if (data === PREF_ACTIVITY_STREAM_PRERENDER_ENABLED) {
this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED); this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED);
@ -229,9 +230,10 @@ AboutNewTabService.prototype = {
* Figure out what path under prerendered to use based on current state. * Figure out what path under prerendered to use based on current state.
*/ */
updatePrerenderedPath() { updatePrerenderedPath() {
// Debug files are specially packaged in a non-localized directory // Debug files are specially packaged in a non-localized directory, but with
this._activityStreamPath = `${this._activityStreamDebug ? "static" : // dynamic script loading, localized debug is supported.
this.activityStreamLocale}/`; this._activityStreamPath = `${this._activityStreamDebug &&
!this._privilegedContentProcess ? "static" : this.activityStreamLocale}/`;
}, },
/* /*
@ -250,7 +252,8 @@ AboutNewTabService.prototype = {
this._activityStreamPath, this._activityStreamPath,
"activity-stream", "activity-stream",
this._activityStreamPrerender ? "-prerendered" : "", this._activityStreamPrerender ? "-prerendered" : "",
this._activityStreamDebug ? "-debug" : "", // Debug version loads dev scripts but noscripts separately loads scripts
this._activityStreamDebug && !this._privilegedContentProcess ? "-debug" : "",
this._privilegedContentProcess ? "-noscripts" : "", this._privilegedContentProcess ? "-noscripts" : "",
".html", ".html",
].join(""); ].join("");

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

@ -152,10 +152,8 @@ function writeFiles(name, destPath, filesMap, {html, state}, options) {
const STATIC_FILES = new Map([ const STATIC_FILES = new Map([
["activity-stream-debug.html", ({options}) => templateHTML(options)], ["activity-stream-debug.html", ({options}) => templateHTML(options)],
["activity-stream-debug-noscripts.html", ({options}) => templateHTML(Object.assign({}, options, {noscripts: true}))],
["activity-stream-initial-state.js", ({state}) => templateJs("gActivityStreamPrerenderedState", "static", state)], ["activity-stream-initial-state.js", ({state}) => templateJs("gActivityStreamPrerenderedState", "static", state)],
["activity-stream-prerendered-debug.html", ({html, options}) => templateHTML(options, html)], ["activity-stream-prerendered-debug.html", ({html, options}) => templateHTML(options, html)],
["activity-stream-prerendered-debug-noscripts.html", ({html, options}) => templateHTML(Object.assign({}, options, {noscripts: true}), html)],
]); ]);
const LOCALIZED_FILES = new Map([ const LOCALIZED_FILES = new Map([

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

@ -42,9 +42,11 @@ function setExpectedUrlsWithScripts() {
function setExpectedUrlsWithoutScripts() { function setExpectedUrlsWithoutScripts() {
ACTIVITY_STREAM_PRERENDER_URL = "resource://activity-stream/prerendered/en-US/activity-stream-prerendered-noscripts.html"; ACTIVITY_STREAM_PRERENDER_URL = "resource://activity-stream/prerendered/en-US/activity-stream-prerendered-noscripts.html";
ACTIVITY_STREAM_PRERENDER_DEBUG_URL = "resource://activity-stream/prerendered/static/activity-stream-prerendered-debug-noscripts.html";
ACTIVITY_STREAM_URL = "resource://activity-stream/prerendered/en-US/activity-stream-noscripts.html"; ACTIVITY_STREAM_URL = "resource://activity-stream/prerendered/en-US/activity-stream-noscripts.html";
ACTIVITY_STREAM_DEBUG_URL = "resource://activity-stream/prerendered/static/activity-stream-debug-noscripts.html";
// Debug urls are the same as non-debug because debug scripts load dynamically
ACTIVITY_STREAM_PRERENDER_DEBUG_URL = ACTIVITY_STREAM_PRERENDER_URL;
ACTIVITY_STREAM_DEBUG_URL = ACTIVITY_STREAM_URL;
} }
function nextChangeNotificationPromise(aNewURL, testMessage) { function nextChangeNotificationPromise(aNewURL, testMessage) {