Bug 1399696 - aboutNewTabService should initialize with the correct _activityStreamPrerender value
MozReview-Commit-ID: BrLNwO74S5q
--- a/browser/components/newtab/aboutNewTabService.js
+++ b/browser/components/newtab/aboutNewTabService.js
@@ -70,17 +70,17 @@ function AboutNewTabService() {
* Loading a chrome resource, or an about: URL in the redirector with either the
* LOAD_NORMAL or LOAD_REPLACE flags yield unexpected behaviors, so a roundtrip
* to the redirector from browser chrome is avoided.
*/
AboutNewTabService.prototype = {
_newTabURL: ABOUT_URL,
_activityStreamEnabled: false,
- _activityStreamPrerender: true,
+ _activityStreamPrerender: false,
_overridden: false,
classID: Components.ID("{dfcd2adc-7867-4d3a-ba70-17501f208142}"),
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIAboutNewTabService,
Ci.nsIObserver
]),
_xpcom_categories: [{
@@ -131,16 +131,17 @@ AboutNewTabService.prototype = {
// exit there is no change of state
return false;
}
if (stateEnabled) {
this._activityStreamEnabled = true;
} else {
this._activityStreamEnabled = false;
}
+ this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED);
this._newtabURL = ABOUT_URL;
return true;
},
/*
* Returns the default URL.
*
* This URL only depends on the browser.newtabpage.activity-stream.enabled pref. Overriding
--- a/browser/components/newtab/tests/xpcshell/test_AboutNewTabService.js
+++ b/browser/components/newtab/tests/xpcshell/test_AboutNewTabService.js
@@ -22,16 +22,24 @@ const ACTIVITY_STREAM_PRERENDER_PREF = "
function cleanup() {
Services.prefs.clearUserPref(ACTIVITY_STREAM_PREF);
Services.prefs.clearUserPref(ACTIVITY_STREAM_PRERENDER_PREF);
aboutNewTabService.resetNewTabURL();
}
do_register_cleanup(cleanup);
+add_task(async function test_as_and_prerender_initialized() {
+ Assert.equal(aboutNewTabService.activityStreamEnabled, Services.prefs.getBoolPref(ACTIVITY_STREAM_PREF),
+ ".activityStreamEnabled should be set to the correct initial value");
+ Assert.equal(aboutNewTabService.activityStreamPrerender, Services.prefs.getBoolPref(ACTIVITY_STREAM_PRERENDER_PREF),
+ ".activityStreamPrerender should be set to the correct initial value");
+ Services.prefs.getBoolPref(ACTIVITY_STREAM_PREF);
+});
+
/**
* Test the overriding of the default URL
*/
add_task(async function test_override_activity_stream_disabled() {
let notificationPromise;
Services.prefs.setBoolPref(ACTIVITY_STREAM_PREF, false);
// tests default is the local newtab resource