diff --git a/.eslintignore b/.eslintignore index 02e51ca7655a..d0c56441c9d1 100644 --- a/.eslintignore +++ b/.eslintignore @@ -57,7 +57,6 @@ browser/components/pocket/content/panels/js/vendor/** # Ignore newtab files # Kept in sync with browser/components/newtab/.eslintignore -browser/components/newtab/bin/prerender.js browser/components/newtab/data/ browser/components/newtab/logs/ browser/components/newtab/prerendered/ diff --git a/browser/components/newtab/.eslintignore b/browser/components/newtab/.eslintignore index 7c128b30ba53..f7f27c26afe9 100644 --- a/browser/components/newtab/.eslintignore +++ b/browser/components/newtab/.eslintignore @@ -1,5 +1,4 @@ -bin/prerender.js -data/ -logs/ -prerendered/ +data/ +logs/ +prerendered/ vendor/ diff --git a/browser/components/newtab/.mcignore b/browser/components/newtab/.mcignore index 0241ed5b4f6e..0cd29c0b3f2b 100644 --- a/browser/components/newtab/.mcignore +++ b/browser/components/newtab/.mcignore @@ -7,8 +7,6 @@ npm-debug.log .gitignore /.git/ -/bin/prerender.js -/bin/prerender.js.map /data/locales.json /dist/ /logs/ diff --git a/browser/components/newtab/AboutNewTabService.jsm b/browser/components/newtab/AboutNewTabService.jsm index 015954112cc9..5a3638dfd1a3 100644 --- a/browser/components/newtab/AboutNewTabService.jsm +++ b/browser/components/newtab/AboutNewTabService.jsm @@ -31,14 +31,12 @@ const IS_PRIVILEGED_PROCESS = Services.appinfo.remoteType === E10SUtils.PRIVILEG const IS_RELEASE_OR_BETA = AppConstants.RELEASE_OR_BETA; const PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS = "browser.tabs.remote.separatePrivilegedContentProcess"; -const PREF_ACTIVITY_STREAM_PRERENDER_ENABLED = "browser.newtabpage.activity-stream.prerender"; const PREF_ACTIVITY_STREAM_DEBUG = "browser.newtabpage.activity-stream.debug"; function AboutNewTabService() { Services.obs.addObserver(this, TOPIC_APP_QUIT); Services.obs.addObserver(this, TOPIC_LOCALES_CHANGE); Services.prefs.addObserver(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS, this); - Services.prefs.addObserver(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED, this); if (!IS_RELEASE_OR_BETA) { Services.prefs.addObserver(PREF_ACTIVITY_STREAM_DEBUG, this); } @@ -90,7 +88,6 @@ AboutNewTabService.prototype = { _newTabURL: ABOUT_URL, _activityStreamEnabled: false, - _activityStreamPrerender: false, _activityStreamPath: "", _activityStreamDebug: false, _privilegedAboutContentProcess: false, @@ -110,9 +107,6 @@ AboutNewTabService.prototype = { this._privilegedAboutContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS); this.updatePrerenderedPath(); this.notifyChange(); - } else if (data === PREF_ACTIVITY_STREAM_PRERENDER_ENABLED) { - this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED); - this.notifyChange(); } else if (!IS_RELEASE_OR_BETA && data === PREF_ACTIVITY_STREAM_DEBUG) { this._activityStreamDebug = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_DEBUG, false); this.updatePrerenderedPath(); @@ -158,10 +152,6 @@ AboutNewTabService.prototype = { `${BASE_URL}data/content/activity-stream.bundle.js`, ]; - if (this._activityStreamPrerender) { - scripts.unshift(`${BASE_URL}prerendered/static/activity-stream-initial-state.js`); - } - for (let script of scripts) { Services.scriptloader.loadSubScript(script, win); // Synchronous call } @@ -217,7 +207,6 @@ AboutNewTabService.prototype = { this._activityStreamEnabled = false; } this._privilegedAboutContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS); - this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED); if (!IS_RELEASE_OR_BETA) { this._activityStreamDebug = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_DEBUG, false); } @@ -245,13 +234,11 @@ AboutNewTabService.prototype = { get defaultURL() { // Generate the desired activity stream resource depending on state, e.g., // resource://activity-stream/prerendered/ar/activity-stream.html - // resource://activity-stream/prerendered/en-US/activity-stream-prerendered.html // resource://activity-stream/prerendered/static/activity-stream-debug.html return [ "resource://activity-stream/prerendered/", this._activityStreamPath, "activity-stream", - this._activityStreamPrerender ? "-prerendered" : "", // Debug version loads dev scripts but noscripts separately loads scripts this._activityStreamDebug && !this._privilegedAboutContentProcess ? "-debug" : "", this._privilegedAboutContentProcess ? "-noscripts" : "", @@ -262,15 +249,10 @@ AboutNewTabService.prototype = { /* * Returns the about:welcome URL * - * This is calculated in the same way the default URL is, except that we don't - * allow prerendering. + * This is calculated in the same way the default URL is. */ get welcomeURL() { - const prerenderEnabled = this._activityStreamPrerender; - this._activityStreamPrerender = false; - const url = this.defaultURL; - this._activityStreamPrerender = prerenderEnabled; - return url; + return this.defaultURL; }, get newTabURL() { @@ -301,10 +283,6 @@ AboutNewTabService.prototype = { return this._activityStreamEnabled; }, - get activityStreamPrerender() { - return this._activityStreamPrerender; - }, - get activityStreamDebug() { return this._activityStreamDebug; }, @@ -352,7 +330,6 @@ AboutNewTabService.prototype = { Services.obs.removeObserver(this, TOPIC_APP_QUIT); Services.obs.removeObserver(this, TOPIC_LOCALES_CHANGE); Services.prefs.removeObserver(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS, this); - Services.prefs.removeObserver(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED, this); if (!IS_RELEASE_OR_BETA) { Services.prefs.removeObserver(PREF_ACTIVITY_STREAM_DEBUG, this); } diff --git a/browser/components/newtab/bin/render-activity-stream-html.js b/browser/components/newtab/bin/render-activity-stream-html.js index 54b1521e2434..510485dada8b 100644 --- a/browser/components/newtab/bin/render-activity-stream-html.js +++ b/browser/components/newtab/bin/render-activity-stream-html.js @@ -3,9 +3,6 @@ const fs = require("fs"); const {mkdir} = require("shelljs"); const path = require("path"); -// Note: this file is generated by webpack from content-src/activity-stream-prerender.jsx -const {prerender} = require("./prerender"); - const {CENTRAL_LOCALES, DEFAULT_LOCALE} = require("./locales"); // Note: DEFAULT_OPTIONS.baseUrl should match BASE_URL in aboutNewTabService.js @@ -64,11 +61,9 @@ function getTextDirection(locale) { * {str} options.baseUrl The base URL for all local assets * {bool} options.debug Should we use dev versions of JS libraries? * {bool} options.noscripts Should we include scripts in the prerendered files? - * @param {str} html The prerendered HTML created with React.renderToString (optional) * @return {str} An HTML document as a string */ -function templateHTML(options, html) { - const isPrerendered = !!html; +function templateHTML(options) { const debugString = options.debug ? "-dev" : ""; const scripts = [ "chrome://browser/content/contentSearchUI.js", @@ -82,9 +77,6 @@ function templateHTML(options, html) { `${options.baseUrl}prerendered/${options.locale}/activity-stream-strings.js`, `${options.baseUrl}data/content/activity-stream.bundle.js`, ]; - if (isPrerendered) { - scripts.unshift(`${options.baseUrl}prerendered/static/activity-stream-initial-state.js`); - } // Add spacing and script tags const scriptRender = `\n${scripts.map(script => ` `).join("\n")}`; @@ -101,7 +93,7 @@ function templateHTML(options, html) {
-