Backed out changeset 6829ed75952b (bug 1898361) for causing build bustage at NimbusMessagingControllerTest.kt. CLOSED TREE
This commit is contained in:
@@ -3139,8 +3139,6 @@ pref("startup.homepage_override_url_nimbus", "");
|
|||||||
// These prefs are referring to the Fx update version
|
// These prefs are referring to the Fx update version
|
||||||
pref("startup.homepage_override_nimbus_maxVersion", "");
|
pref("startup.homepage_override_nimbus_maxVersion", "");
|
||||||
pref("startup.homepage_override_nimbus_minVersion", "");
|
pref("startup.homepage_override_nimbus_minVersion", "");
|
||||||
// Pref to disable all What's New pages
|
|
||||||
pref("startup.homepage_override_nimbus_disable_wnp", false);
|
|
||||||
|
|
||||||
// Pref to enable the content relevancy feature.
|
// Pref to enable the content relevancy feature.
|
||||||
pref("toolkit.contentRelevancy.enabled", false);
|
pref("toolkit.contentRelevancy.enabled", false);
|
||||||
|
|||||||
@@ -189,20 +189,13 @@ function needHomepageOverride(updateMilestones = true) {
|
|||||||
* The default override page
|
* The default override page
|
||||||
* @param nimbusOverridePage
|
* @param nimbusOverridePage
|
||||||
* Nimbus provided URL
|
* Nimbus provided URL
|
||||||
* @param disableWnp
|
|
||||||
* Boolean, disables all WNPs if true
|
|
||||||
* @return The override page.
|
* @return The override page.
|
||||||
*/
|
*/
|
||||||
function getPostUpdateOverridePage(
|
function getPostUpdateOverridePage(
|
||||||
update,
|
update,
|
||||||
defaultOverridePage,
|
defaultOverridePage,
|
||||||
nimbusOverridePage,
|
nimbusOverridePage
|
||||||
disableWnp
|
|
||||||
) {
|
) {
|
||||||
if (disableWnp) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
update = update.QueryInterface(Ci.nsIWritablePropertyBag);
|
update = update.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||||
let actions = update.getProperty("actions");
|
let actions = update.getProperty("actions");
|
||||||
// When the update doesn't specify actions fallback to the original behavior
|
// When the update doesn't specify actions fallback to the original behavior
|
||||||
@@ -791,22 +784,15 @@ nsBrowserContentHandler.prototype = {
|
|||||||
"startup.homepage_override_nimbus_minVersion",
|
"startup.homepage_override_nimbus_minVersion",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
// Pref used to disable all WNPs
|
|
||||||
const disableWNP = Services.prefs.getBoolPref(
|
|
||||||
"startup.homepage_override_nimbus_disable_wnp",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
let nimbusWNP;
|
let nimbusWNP;
|
||||||
// minVersion and maxVersion optional variables
|
|
||||||
const versionMatch =
|
|
||||||
(!maxVersion ||
|
|
||||||
Services.vc.compare(update.appVersion, maxVersion) <= 0) &&
|
|
||||||
(!minVersion ||
|
|
||||||
Services.vc.compare(update.appVersion, minVersion) >= 0);
|
|
||||||
|
|
||||||
// The update version should be less than or equal to maxVersion and
|
// The update version should be less than or equal to maxVersion and
|
||||||
// greater or equal to minVersion set by the experiment.
|
// greater or equal to minVersion set by the experiment.
|
||||||
if (nimbusOverrideUrl && versionMatch) {
|
if (
|
||||||
|
nimbusOverrideUrl &&
|
||||||
|
Services.vc.compare(update.appVersion, maxVersion) <= 0 &&
|
||||||
|
Services.vc.compare(update.appVersion, minVersion) >= 0
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
let uri = Services.io.newURI(nimbusOverrideUrl);
|
let uri = Services.io.newURI(nimbusOverrideUrl);
|
||||||
// Only allow https://www.mozilla.org and https://www.mozilla.com
|
// Only allow https://www.mozilla.org and https://www.mozilla.com
|
||||||
@@ -830,21 +816,19 @@ nsBrowserContentHandler.prototype = {
|
|||||||
overridePage = getPostUpdateOverridePage(
|
overridePage = getPostUpdateOverridePage(
|
||||||
update,
|
update,
|
||||||
overridePage,
|
overridePage,
|
||||||
nimbusWNP,
|
nimbusWNP
|
||||||
disableWNP
|
|
||||||
);
|
);
|
||||||
// Record a Nimbus exposure event for the whatsNewPage feature.
|
// Record a Nimbus exposure event for the whatsNewPage feature.
|
||||||
// The override page could be set in 3 ways: 1. set by Nimbus; 2.
|
// The override page could be set in 3 ways: 1. set by Nimbus 2.
|
||||||
// set by the update file (openURL); 3. defaulting to the
|
// set by the update file(openURL) 3. The default evergreen page(Set by the
|
||||||
// evergreen page (set by the startup.homepage_override_url pref,
|
// startup.homepage_override_url pref, could be different
|
||||||
// value depends on the Fx channel). This is done to record that
|
// depending on the Fx channel). This is done to record that the
|
||||||
// the control cohort could have seen the experimental What's New
|
// control cohort could have seen the experimental What's New Page
|
||||||
// Page (and will instead see the default What's New Page, or
|
// (and will instead see the default What's New Page).
|
||||||
// won't see a WNP if the experiment disabled it by setting
|
// recordExposureEvent only records an event if the user is
|
||||||
// disable_wnp). `recordExposureEvent` only records an event if
|
// enrolled in an experiment or rollout on the whatsNewPage
|
||||||
// the user is enrolled in an experiment or rollout on the
|
// feature, so it's safe to call it unconditionally.
|
||||||
// whatsNewPage feature, so it's safe to call it unconditionally.
|
if (overridePage) {
|
||||||
if (overridePage || (versionMatch && disableWNP)) {
|
|
||||||
let nimbusWNPFeature = lazy.NimbusFeatures.whatsNewPage;
|
let nimbusWNPFeature = lazy.NimbusFeatures.whatsNewPage;
|
||||||
nimbusWNPFeature
|
nimbusWNPFeature
|
||||||
.ready()
|
.ready()
|
||||||
|
|||||||
@@ -21,4 +21,3 @@ prefs = [
|
|||||||
["browser_whats_new_page.js"]
|
["browser_whats_new_page.js"]
|
||||||
|
|
||||||
["include:./browser_whats_new_page_nimbus.toml"]
|
["include:./browser_whats_new_page_nimbus.toml"]
|
||||||
["include:./browser_whats_new_page_nimbus_disable.toml"]
|
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
add_task(async function nimbus_whats_new_page_disable() {
|
|
||||||
// The test harness will use the current tab and remove the tab's history.
|
|
||||||
gBrowser.selectedTab = gBrowser.tabs[0];
|
|
||||||
await TestUtils.waitForCondition(
|
|
||||||
() =>
|
|
||||||
gBrowser.selectedBrowser &&
|
|
||||||
gBrowser.selectedBrowser.currentURI &&
|
|
||||||
gBrowser.selectedBrowser.currentURI.spec == "about:blank",
|
|
||||||
`Expected about:blank but got ${gBrowser.selectedBrowser.currentURI.spec}`
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
gBrowser.selectedBrowser.currentURI.spec,
|
|
||||||
"about:blank",
|
|
||||||
"What's New pages should be disabled"
|
|
||||||
);
|
|
||||||
|
|
||||||
let um = Cc["@mozilla.org/updates/update-manager;1"].getService(
|
|
||||||
Ci.nsIUpdateManager
|
|
||||||
);
|
|
||||||
await TestUtils.waitForCondition(
|
|
||||||
async () => !(await um.getReadyUpdate()),
|
|
||||||
"Waiting for the ready update to be removed"
|
|
||||||
);
|
|
||||||
ok(!(await um.getReadyUpdate()), "There should not be a ready update");
|
|
||||||
let history;
|
|
||||||
await TestUtils.waitForCondition(async () => {
|
|
||||||
history = await um.getHistory();
|
|
||||||
return !!history[0];
|
|
||||||
}, "Waiting for the ready update to be moved to the update history");
|
|
||||||
ok(!!history[0], "There should be an update in the update history");
|
|
||||||
|
|
||||||
// Leave no trace. Since this test modifies its support files put them back in
|
|
||||||
// their original state.
|
|
||||||
let alternatePath = Services.prefs.getCharPref("app.update.altUpdateDirPath");
|
|
||||||
let testRoot = Services.prefs.getCharPref("mochitest.testRoot");
|
|
||||||
let relativePath = alternatePath.substring("<test-root>".length);
|
|
||||||
if (AppConstants.platform == "win") {
|
|
||||||
relativePath = relativePath.replace(/\//g, "\\");
|
|
||||||
}
|
|
||||||
alternatePath = testRoot + relativePath;
|
|
||||||
let updateDir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
|
|
||||||
updateDir.initWithPath(alternatePath);
|
|
||||||
|
|
||||||
let activeUpdateFile = updateDir.clone();
|
|
||||||
activeUpdateFile.append("active-update.xml");
|
|
||||||
await TestUtils.waitForCondition(
|
|
||||||
() => !activeUpdateFile.exists(),
|
|
||||||
"Waiting until the active-update.xml file does not exist"
|
|
||||||
);
|
|
||||||
|
|
||||||
let updatesFile = updateDir.clone();
|
|
||||||
updatesFile.append("updates.xml");
|
|
||||||
await TestUtils.waitForCondition(
|
|
||||||
() => updatesFile.exists(),
|
|
||||||
"Waiting until the updates.xml file exists"
|
|
||||||
);
|
|
||||||
|
|
||||||
let fos = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(
|
|
||||||
Ci.nsIFileOutputStream
|
|
||||||
);
|
|
||||||
let flags =
|
|
||||||
FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE;
|
|
||||||
|
|
||||||
let stateSucceeded = "succeeded\n";
|
|
||||||
let updateStatusFile = updateDir.clone();
|
|
||||||
updateStatusFile.append("updates");
|
|
||||||
updateStatusFile.append("0");
|
|
||||||
updateStatusFile.append("update.status");
|
|
||||||
updateStatusFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
|
||||||
fos.init(updateStatusFile, flags, FileUtils.PERMS_FILE, 0);
|
|
||||||
fos.write(stateSucceeded, stateSucceeded.length);
|
|
||||||
fos.close();
|
|
||||||
|
|
||||||
let xmlContents =
|
|
||||||
'<?xml version="1.0"?><updates xmlns="http://www.mozilla.org/2005/' +
|
|
||||||
'app-update"><update xmlns="http://www.mozilla.org/2005/app-update" ' +
|
|
||||||
'appVersion="61.0" buildID="20990101111111" channel="test" ' +
|
|
||||||
'detailsURL="https://127.0.0.1/" displayVersion="1.0" installDate="' +
|
|
||||||
'1555716429454" isCompleteUpdate="true" name="What\'s New Page Test" ' +
|
|
||||||
'previousAppVersion="60.0" serviceURL="https://127.0.0.1/update.xml" ' +
|
|
||||||
'type="minor" platformVersion="99999999.0" actions="showURL" ' +
|
|
||||||
'openURL="https://example.com/|https://example.com/"><patch size="1" ' +
|
|
||||||
'type="complete" URL="https://127.0.0.1/complete.mar" ' +
|
|
||||||
'selected="true" state="pending"/></update></updates>\n';
|
|
||||||
activeUpdateFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
|
|
||||||
fos.init(activeUpdateFile, flags, FileUtils.PERMS_FILE, 0);
|
|
||||||
fos.write(xmlContents, xmlContents.length);
|
|
||||||
fos.close();
|
|
||||||
|
|
||||||
updatesFile.remove(false);
|
|
||||||
Cc["@mozilla.org/updates/update-manager;1"]
|
|
||||||
.getService(Ci.nsIUpdateManager)
|
|
||||||
.internal.reload(false);
|
|
||||||
});
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[DEFAULT]
|
|
||||||
|
|
||||||
["browser_whats_new_page_nimbus_disable.js"]
|
|
||||||
# These are prefs set by nimbus to be used for What's new pages
|
|
||||||
prefs = ["startup.homepage_override_url_nimbus='https://www.mozilla.org/en-US/projects/firefox/whatsnew/|https://www.mozilla.org/en-US/projects/firefox/whatsnew/'",
|
|
||||||
"startup.homepage_override_nimbus_maxVersion='99999999.0'", "startup.homepage_override_nimbus_disable_wnp=true"]
|
|
||||||
@@ -1414,14 +1414,6 @@ whatsNewPage:
|
|||||||
setPref:
|
setPref:
|
||||||
branch: user
|
branch: user
|
||||||
pref: startup.homepage_override_nimbus_minVersion
|
pref: startup.homepage_override_nimbus_minVersion
|
||||||
disableWNP:
|
|
||||||
description: >-
|
|
||||||
Block all What's New Pages. Used to compare no-WNP control branches to
|
|
||||||
WNP treatment branches.
|
|
||||||
type: boolean
|
|
||||||
setPref:
|
|
||||||
branch: user
|
|
||||||
pref: startup.homepage_override_nimbus_disable_wnp
|
|
||||||
|
|
||||||
pbNewtab:
|
pbNewtab:
|
||||||
description: "A Firefox Messaging System message for the pbNewtab message channel"
|
description: "A Firefox Messaging System message for the pbNewtab message channel"
|
||||||
|
|||||||
Reference in New Issue
Block a user