--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1512,18 +1512,16 @@ pref("toolkit.telemetry.updatePing.enabl
pref("toolkit.telemetry.bhrPing.enabled", true);
// Enables using Hybrid Content Telemetry from Mozilla privileged pages.
pref("toolkit.telemetry.hybridContent.enabled", true);
// Telemetry experiments settings.
pref("experiments.enabled", true);
pref("experiments.manifest.fetchIntervalSeconds", 86400);
pref("experiments.manifest.uri", "https://telemetry-experiment.cdn.mozilla.net/manifest/v1/firefox/%VERSION%/%CHANNEL%");
-// Whether experiments are supported by the current application profile.
-pref("experiments.supported", true);
// Ping Centre Telemetry settings.
pref("browser.ping-centre.telemetry", true);
pref("browser.ping-centre.log", false);
pref("browser.ping-centre.staging.endpoint", "https://onyx_tiles.stage.mozaws.net/v3/links/ping-centre");
pref("browser.ping-centre.production.endpoint", "https://tiles.services.mozilla.com/v3/links/ping-centre");
// Enable GMP support in the addon manager.
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -45,18 +45,16 @@ const PREF_BRANCH = "exper
const PREF_ENABLED = "enabled"; // experiments.enabled
const PREF_ACTIVE_EXPERIMENT = "activeExperiment"; // whether we have an active experiment
const PREF_LOGGING = "logging";
const PREF_LOGGING_LEVEL = PREF_LOGGING + ".level"; // experiments.logging.level
const PREF_LOGGING_DUMP = PREF_LOGGING + ".dump"; // experiments.logging.dump
const PREF_MANIFEST_URI = "manifest.uri"; // experiments.logging.manifest.uri
const PREF_FORCE_SAMPLE = "force-sample-value"; // experiments.force-sample-value
-const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";
-
const CACHE_WRITE_RETRY_DELAY_SEC = 60 * 3;
const MANIFEST_FETCH_TIMEOUT_MSEC = 60 * 3 * 1000; // 3 minutes
const TELEMETRY_LOG = {
// log(key, [kind, experimentId, details])
ACTIVATION_KEY: "EXPERIMENT_ACTIVATION",
ACTIVATION: {
// Successfully activated.
@@ -514,31 +512,33 @@ Experiments.Experiments.prototype = {
},
_registerWithAddonManager(previousExperimentsProvider) {
this._log.trace("Registering instance with Addon Manager.");
AddonManager.addAddonListener(this);
AddonManager.addInstallListener(this);
+ /*
+ * this is broken as of bug 1450801
if (!gAddonProvider) {
// The properties of this AddonType should be kept in sync with the
// experiment AddonType registered in XPIProvider.
this._log.trace("Registering previous experiment add-on provider.");
gAddonProvider = previousExperimentsProvider || new Experiments.PreviousExperimentProvider(this);
AddonManagerPrivate.registerProvider(gAddonProvider, [
new AddonManagerPrivate.AddonType("experiment",
URI_EXTENSION_STRINGS,
"type.experiment.name",
AddonManager.VIEW_TYPE_LIST,
11000,
AddonManager.TYPE_UI_HIDE_EMPTY),
]);
}
-
+ */
},
_unregisterWithAddonManager() {
this._log.trace("Unregistering instance with Addon Manager.");
this._log.trace("Removing install listener from add-on manager.");
AddonManager.removeInstallListener(this);
this._log.trace("Removing addon listener from add-on manager.");
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1052,18 +1052,16 @@ pref("toolkit.scrollbox.verticalScrollDi
pref("toolkit.scrollbox.horizontalScrollDistance", 5);
pref("toolkit.scrollbox.clickToScroll.scrollDelay", 150);
// Telemetry settings.
// Server to submit telemetry pings to.
pref("toolkit.telemetry.server", "https://incoming.telemetry.mozilla.org");
// Telemetry server owner. Please change if you set toolkit.telemetry.server to a different server
pref("toolkit.telemetry.server_owner", "Mozilla");
-// Information page about telemetry (temporary ; will be about:telemetry in the end)
-pref("toolkit.telemetry.infoURL", "https://www.mozilla.org/legal/privacy/firefox.html#telemetry");
// Determines whether full SQL strings are returned when they might contain sensitive info
// i.e. dynamically constructed SQL strings or SQL executed by addons against addon DBs
pref("toolkit.telemetry.debugSlowSql", false);
// Whether to use the unified telemetry behavior, requires a restart.
pref("toolkit.telemetry.unified", true);
// AsyncShutdown delay before crashing in case of shutdown freeze
#ifndef MOZ_ASAN
pref("toolkit.asyncshutdown.crash_timeout", 60000); // 1 minute
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -67,18 +67,16 @@ user_pref("layout.accessiblecaret.enable
user_pref("dom.webcomponents.shadowdom.enabled", false);
user_pref("dom.webcomponents.customelements.enabled", true);
// Existing tests assume there is no font size inflation.
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
// Disable the caret blinking so we get stable snapshot
user_pref("ui.caretBlinkTime", -1);
-// AddonManager tests require that the experiments provider be present.
-user_pref("experiments.supported", true);
// Point the manifest at something local so we don't risk it hitting production
// data and installing experiments that may vary over time.
user_pref("experiments.manifest.uri", "http://%(server)s/experiments-dummy/manifest");
// Don't allow background tabs to be zombified, otherwise for tests that
// open additional tabs, the test harness tab itself might get unloaded.
user_pref("browser.tabs.disableBackgroundZombification", true);
--- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
+++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
@@ -207,27 +207,16 @@
<!ENTITY eula.title "End-User License Agreement">
<!ENTITY eula.width "560px">
<!ENTITY eula.height "400px">
<!ENTITY eula.accept "Accept and Install…">
<!ENTITY settings.path.button.label "Browse…">
-<!-- LOCALIZATION NOTE (experiment.info.label): The strings related to
- experiments are present on the "Experiments" tab of the add-ons manager.
- This tab won't be displayed unless an Experiment add-on is installed.
- Install https://people.mozilla.org/~gszorc/dummy-experiment-addon.xpi
- to cause this tab to appear. -->
-<!ENTITY experiment.info.label "What’s this? Telemetry may install and run experiments from time to time.">
-<!ENTITY experiment.info.learnmore "Learn More">
-<!ENTITY experiment.info.learnmore.accesskey "L">
-<!ENTITY experiment.info.changetelemetry "Telemetry Settings">
-<!ENTITY experiment.info.changetelemetry.accesskey "T">
-
<!ENTITY setting.learnmore "Learn More…">
<!ENTITY disabledUnsigned.heading "Some add-ons have been disabled">
<!-- LOCALIZATION NOTE (disabledUnsigned.description.start, disabledUnsigned.description.findAddonsLink, disabledUnsigned.description.end):
These entities form a sentence, with
disabledUnsigned.description.findAddonsLink being a link to an external site. -->
<!ENTITY disabledUnsigned.description.start "The following add-ons have not been verified for use in &brandShortName;. You can ">
<!ENTITY disabledUnsigned.description.findAddonsLink "find replacements">
--- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties
+++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties
@@ -87,70 +87,31 @@ details.notification.vulnerableUpdatable
#LOCALIZATION NOTE (details.notification.vulnerableNoUpdate) %1$S is the add-on name
details.notification.vulnerableNoUpdate=%1$S is known to be vulnerable. Use with caution.
details.notification.vulnerableNoUpdate.link=More Information
#LOCALIZATION NOTE (details.notification.restartless-uninstall) %1$S is the add-on name.
details.notification.restartless-uninstall=%1$S will be uninstalled after you close this tab.
#LOCALIZATION NOTE (details.notification.gmpPending) %1$S is the add-on name
details.notification.gmpPending=%1$S will be installed shortly.
-# LOCALIZATION NOTE (details.experiment.time.daysRemaining):
-# Semicolon-separated list of plural forms.
-# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
-# #1 is the number of days from now that the experiment will remain active (detail view).
-details.experiment.time.daysRemaining=#1 day remaining;#1 days remaining
-#LOCALIZATION NOTE (details.experiment.time.endsToday) The experiment will end in less than a day (detail view).
-details.experiment.time.endsToday=Less than a day remaining
-# LOCALIZATION NOTE (details.experiment.time.daysPassed):
-# Semicolon-separated list of plural forms.
-# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
-# #1 is the number of days since the experiment ran (detail view).
-details.experiment.time.daysPassed=#1 day ago;#1 days ago
-#LOCALIZATION NOTE (details.experiment.time.endedToday) The experiment ended less than a day ago (detail view).
-details.experiment.time.endedToday=Less than a day ago
-#LOCALIZATION NOTE (details.experiment.state.active) This experiment is active (detail view).
-details.experiment.state.active=Active
-#LOCALIZATION NOTE (details.experiment.state.complete) This experiment is complete (it was previously active) (detail view).
-details.experiment.state.complete=Complete
-
-# LOCALIZATION NOTE (experiment.time.daysRemaining):
-# Semicolon-separated list of plural forms.
-# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
-# #1 is the number of days from now that the experiment will remain active (list view item).
-experiment.time.daysRemaining=#1 day remaining;#1 days remaining
-#LOCALIZATION NOTE (experiment.time.endsToday) The experiment will end in less than a day (list view item).
-experiment.time.endsToday=Less than a day remaining
-# LOCALIZATION NOTE (experiment.time.daysPassed):
-# Semicolon-separated list of plural forms.
-# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
-# #1 is the number of days since the experiment ran (list view item).
-experiment.time.daysPassed=#1 day ago;#1 days ago
-#LOCALIZATION NOTE (experiment.time.endedToday) The experiment ended less than a day ago (list view item).
-experiment.time.endedToday=Less than a day ago
-#LOCALIZATION NOTE (experiment.state.active) This experiment is active (list view item).
-experiment.state.active=Active
-#LOCALIZATION NOTE (experiment.state.complete) This experiment is complete (it was previously active) (list view item).
-experiment.state.complete=Complete
-
installFromFile.dialogTitle=Select add-on to install
installFromFile.filterName=Add-ons
uninstallAddonTooltip=Uninstall this add-on
enableAddonTooltip=Enable this add-on
disableAddonTooltip=Disable this add-on
#LOCALIZATION NOTE (eulaHeader) %S is name of the add-on asking the user to agree to the EULA
eulaHeader=%S requires that you accept the following End User License Agreement before installation can proceed:
type.extension.name=Extensions
type.themes.name=Themes
type.locale.name=Languages
type.plugin.name=Plugins
type.dictionary.name=Dictionaries
type.service.name=Services
-type.experiment.name=Experiments
type.legacy.name=Legacy Extensions
type.unsupported.name=Unsupported
#LOCALIZATION NOTE(legacyWarning.description) %S is the brandShortName
legacyWarning.description=Missing something? Some extensions are no longer supported by %S.
#LOCALIZATION NOTE(legacyThemeWarning.description) %S is the brandShortName
legacyThemeWarning.description=Missing something? Some themes are no longer supported by %S.
--- a/toolkit/mozapps/extensions/content/extensions.css
+++ b/toolkit/mozapps/extensions/content/extensions.css
@@ -136,18 +136,17 @@ row[unsupported="true"] {
/* Plugins aren't yet disabled by safemode (bug 342333),
so don't show that warning when viewing plugins. */
#addons-page[warning="safemode"] .view-pane[type="plugin"] .global-warning-container,
#addons-page[warning="safemode"] #detail-view[loading="true"] .global-warning {
display: none;
}
#addons-page .view-pane:not([type="theme"]) #getthemes-container,
-#addons-page .view-pane:not([type="plugin"]) #plugindeprecation-notice,
-#addons-page .view-pane:not([type="experiment"]) .experiment-info-container {
+#addons-page .view-pane:not([type="plugin"]) #plugindeprecation-notice {
display: none;
}
.addon .relnotes {
-moz-user-select: text;
}
#detail-name, #detail-desc, #detail-fulldesc {
-moz-user-select: text;
@@ -171,44 +170,11 @@ richlistitem:not([selected]) * {
#header-utils-btn {
-moz-user-focus: normal;
}
.discover-button[disabled="true"] {
display: none;
}
-#experiments-learn-more[disabled="true"] {
- display: none;
-}
-
-#experiments-change-telemetry[disabled="true"] {
- display: none;
-}
-
.view-pane:not(#legacy-view) .addon-control.replacement {
display: none;
}
-
-.view-pane[type="experiment"] .error,
-.view-pane[type="experiment"] .warning,
-.view-pane[type="experiment"] .addon:not([pending="uninstall"]) .pending,
-.view-pane[type="experiment"] .disabled-postfix,
-.view-pane[type="experiment"] .update-postfix,
-.view-pane[type="experiment"] .addon-control.enable,
-.view-pane[type="experiment"] .addon-control.disable,
-#detail-view[type="experiment"] .alert-container,
-#detail-view[type="experiment"] #detail-version,
-#detail-view[type="experiment"] #detail-creator,
-#detail-view[type="experiment"] #detail-enable-btn,
-#detail-view[type="experiment"] #detail-disable-btn {
- display: none;
-}
-
-.view-pane:not([type="experiment"]) .experiment-container,
-.view-pane:not([type="experiment"]) #detail-experiment-container {
- display: none;
-}
-
-.addon[type="experiment"][status="installing"] .experiment-time,
-.addon[type="experiment"][status="installing"] .experiment-state {
- display: none;
-}
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -26,19 +26,16 @@ ChromeUtils.defineModuleGetter(this, "Pr
"resource://gre/modules/Preferences.jsm");
ChromeUtils.defineModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
ChromeUtils.defineModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
-ChromeUtils.defineModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
-
XPCOMUtils.defineLazyPreferenceGetter(this, "WEBEXT_PERMISSION_PROMPTS",
"extensions.webextPermissionPrompts", false);
XPCOMUtils.defineLazyPreferenceGetter(this, "XPINSTALL_ENABLED",
"xpinstall.enabled", true);
XPCOMUtils.defineLazyPreferenceGetter(this, "SUPPORT_URL", "app.support.baseURL",
"", null, val => Services.urlFormatter.formatURL(val));
@@ -278,33 +275,16 @@ function isDiscoverEnabled() {
if (!XPINSTALL_ENABLED) {
return false;
}
return true;
}
-function getExperimentEndDate(aAddon) {
- if (!("@mozilla.org/browser/experiments-service;1" in Cc)) {
- return 0;
- }
-
- if (!aAddon.isActive) {
- return aAddon.endDate;
- }
-
- let experiment = Experiments.instance().getActiveExperiment();
- if (!experiment) {
- return 0;
- }
-
- return experiment.endDate;
-}
-
/**
* Obtain the main DOMWindow for the current context.
*/
function getMainWindow() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
@@ -314,33 +294,16 @@ function getMainWindow() {
function getBrowserElement() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.chromeEventHandler;
}
/**
- * Obtain the DOMWindow that can open a preferences pane.
- *
- * This is essentially "get the browser chrome window" with the added check
- * that the supposed browser chrome window is capable of opening a preferences
- * pane.
- *
- * This may return null if we can't find the browser chrome window.
- */
-function getMainWindowWithPreferencesPane() {
- let mainWindow = getMainWindow();
- if (mainWindow && "openPreferences" in mainWindow) {
- return mainWindow;
- }
- return null;
-}
-
-/**
* A wrapper around the HTML5 session history service that allows the browser
* back/forward controls to work within the manager
*/
var HTML5History = {
get index() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.sessionHistory.index;
@@ -1393,37 +1356,16 @@ var gViewController = {
return ((addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) &&
hasPermission(aAddon, "disable"));
},
doCommand(aAddon) {
aAddon.userDisabled = true;
}
},
- cmd_experimentsLearnMore: {
- isEnabled() {
- let mainWindow = getMainWindow();
- return mainWindow && "switchToTabHavingURI" in mainWindow;
- },
- doCommand() {
- let url = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- openOptionsInTab(url);
- },
- },
-
- cmd_experimentsOpenTelemetryPreferences: {
- isEnabled() {
- return !!getMainWindowWithPreferencesPane();
- },
- doCommand() {
- let mainWindow = getMainWindowWithPreferencesPane();
- mainWindow.openPreferences("privacy-reports", { origin: "experimentsOpenPref" });
- },
- },
-
cmd_showUnsignedExtensions: {
isEnabled() {
return true;
},
doCommand() {
gViewController.loadView("addons://list/extension?unsigned=true");
},
},
@@ -1525,20 +1467,16 @@ function isInState(aInstall, aState) {
var state = AddonManager["STATE_" + aState.toUpperCase()];
return aInstall.state == state;
}
function shouldShowVersionNumber(aAddon) {
if (!aAddon.version)
return false;
- // The version number is hidden for experiments.
- if (aAddon.type == "experiment")
- return false;
-
// The version number is hidden for lightweight themes.
if (aAddon.type == "theme")
return !/@personas\.mozilla\.org$/.test(aAddon.id);
return true;
}
function createItem(aObj, aIsInstall) {
@@ -1561,20 +1499,16 @@ function createItem(aObj, aIsInstall) {
item.mAddon = aObj;
item.setAttribute("status", "installed");
// set only attributes needed for sorting and XBL binding,
// the binding handles the rest
item.setAttribute("value", aObj.id);
- if (aObj.type == "experiment") {
- item.endDate = getExperimentEndDate(aObj);
- }
-
return item;
}
function sortElements(aElements, aSortBy, aAscending) {
// aSortBy is an Array of attributes to sort by, in decending
// order of priority.
const DATE_FIELDS = ["updateDate"];
@@ -2576,23 +2510,16 @@ var gListView = {
this.removeItem(aInstall, true);
},
onInstallEnded(aInstall) {
// Remove any install entries for upgrades, their status will appear against
// the existing item
if (aInstall.existingAddon)
this.removeItem(aInstall, true);
-
- if (aInstall.addon.type == "experiment") {
- let item = this.getListItemForID(aInstall.addon.id);
- if (item) {
- item.endDate = getExperimentEndDate(aInstall.addon);
- }
- }
},
addItem(aObj, aIsInstall) {
if (aObj.type != this._type)
return;
if (aIsInstall && aObj.existingAddon)
return;
@@ -2839,44 +2766,16 @@ var gDetailView = {
if (first && window.getComputedStyle(gridRow).getPropertyValue("display") != "none") {
gridRow.setAttribute("first-row", true);
first = false;
} else {
gridRow.removeAttribute("first-row");
}
}
- if (this._addon.type == "experiment") {
- let prefix = "details.experiment.";
- let active = this._addon.isActive;
-
- let stateKey = prefix + "state." + (active ? "active" : "complete");
- let node = document.getElementById("detail-experiment-state");
- node.value = gStrings.ext.GetStringFromName(stateKey);
-
- let now = Date.now();
- let end = getExperimentEndDate(this._addon);
- let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
-
- let timeKey = prefix + "time.";
- let timeMessage;
- if (days < 1) {
- timeKey += (active ? "endsToday" : "endedToday");
- timeMessage = gStrings.ext.GetStringFromName(timeKey);
- } else {
- timeKey += (active ? "daysRemaining" : "daysPassed");
- days = Math.round(days);
- let timeString = gStrings.ext.GetStringFromName(timeKey);
- timeMessage = PluralForm.get(days, timeString)
- .replace("#1", days);
- }
-
- document.getElementById("detail-experiment-time").value = timeMessage;
- }
-
this.fillSettingsRows(aScrollToPreferences, () => {
this.updateState();
gViewController.notifyViewChanged();
});
},
show(aAddonId, aRequest) {
let index = aAddonId.indexOf("/preferences");
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -736,25 +736,16 @@
<xul:label anonid="legacy" class="legacy-warning text-link" value="&addon.legacy.label;"/>
<xul:label class="disabled-postfix" value="&addon.disabled.postfix;"/>
<xul:label class="update-postfix" value="&addon.update.postfix;"/>
<xul:spacer flex="5000"/> <!-- Necessary to make the name crop -->
</xul:hbox>
<xul:label anonid="date-updated" class="date-updated"
unknown="&addon.unknownDate;"/>
</xul:hbox>
- <xul:hbox class="experiment-container">
- <svg width="6" height="6" viewBox="0 0 6 6" version="1.1"
- xmlns="http://www.w3.org/2000/svg"
- class="experiment-bullet-container">
- <circle cx="3" cy="3" r="3" class="experiment-bullet"/>
- </svg>
- <xul:label anonid="experiment-state" class="experiment-state"/>
- <xul:label anonid="experiment-time" class="experiment-time"/>
- </xul:hbox>
<xul:hbox class="advancedinfo-container" flex="1">
<xul:vbox class="description-outer-container" flex="1">
<xul:hbox class="description-container">
<xul:label anonid="description" class="description" crop="end" flex="1"/>
<xul:button anonid="details-btn" class="details button-link"
label="&addon.details.label;"
tooltiptext="&addon.details.tooltip;"
@@ -910,22 +901,16 @@
<field name="_infoContainer">
document.getAnonymousElementByAttribute(this, "anonid",
"info-container");
</field>
<field name="_info">
document.getAnonymousElementByAttribute(this, "anonid",
"info");
</field>
- <field name="_experimentState">
- document.getAnonymousElementByAttribute(this, "anonid", "experiment-state");
- </field>
- <field name="_experimentTime">
- document.getAnonymousElementByAttribute(this, "anonid", "experiment-time");
- </field>
<field name="_icon">
document.getAnonymousElementByAttribute(this, "anonid", "icon");
</field>
<field name="_dateUpdated">
document.getAnonymousElementByAttribute(this, "anonid",
"date-updated");
</field>
<field name="_description">
@@ -1293,47 +1278,16 @@
this._removeBtn.hidden = true;
}
this.setAttribute("active", this.mAddon.isActive);
var showProgress = (this.mAddon.install &&
this.mAddon.install.state != AddonManager.STATE_INSTALLED);
this._showStatus(showProgress ? "progress" : "none");
-
- if (this.mAddon.type == "experiment") {
- this.removeAttribute("notification");
- let prefix = "experiment.";
- let active = this.mAddon.isActive;
-
- if (!showProgress) {
- let stateKey = prefix + "state." + (active ? "active" : "complete");
- this._experimentState.value = gStrings.ext.GetStringFromName(stateKey);
-
- let now = Date.now();
- let end = this.endDate;
- let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
-
- let timeKey = prefix + "time.";
- let timeMessage;
-
- if (days < 1) {
- timeKey += (active ? "endsToday" : "endedToday");
- timeMessage = gStrings.ext.GetStringFromName(timeKey);
- } else {
- timeKey += (active ? "daysRemaining" : "daysPassed");
- days = Math.round(days);
- let timeString = gStrings.ext.GetStringFromName(timeKey);
- timeMessage = PluralForm.get(days, timeString)
- .replace("#1", days);
- }
-
- this._experimentTime.value = timeMessage;
- }
- }
]]></body>
</method>
<method name="_fetchReleaseNotes">
<parameter name="aURI"/>
<body><![CDATA[
if (!aURI || this._relNotesLoaded) {
sendToggleEvent();
--- a/toolkit/mozapps/extensions/content/extensions.xul
+++ b/toolkit/mozapps/extensions/content/extensions.xul
@@ -102,18 +102,16 @@
<command id="cmd_installFromFile"/>
<command id="cmd_debugAddons"/>
<command id="cmd_back"/>
<command id="cmd_forward"/>
<command id="cmd_enableCheckCompatibility"/>
<command id="cmd_enableUpdateSecurity"/>
<command id="cmd_toggleAutoUpdateDefault"/>
<command id="cmd_resetAddonAutoUpdate"/>
- <command id="cmd_experimentsLearnMore"/>
- <command id="cmd_experimentsOpenTelemetryPreferences"/>
<command id="cmd_showUnsignedExtensions"/>
<command id="cmd_showAllExtensions"/>
</commandset>
<!-- view commands - these act on the selected addon -->
<commandset id="viewCommandSet"
events="richlistbox-select" commandupdater="true">
<command id="cmd_showItemDetails"/>
@@ -323,35 +321,16 @@
</hbox>
<button class="button-link global-warning-updatesecurity"
label="&warning.updatesecurity.enable.label;"
tooltiptext="&warning.updatesecurity.enable.tooltip;"
command="cmd_enableUpdateSecurity"/>
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
</hbox>
</hbox>
- <vbox class="alert-container experiment-info-container">
- <vbox class="alert">
- <description>
- &experiment.info.label;
- <hbox>
- <button id="experiments-learn-more"
- label="&experiment.info.learnmore;"
- tooltiptext="&experiment.info.learnmore;"
- accesskey="&experiment.info.learnmore.accesskey;"
- command="cmd_experimentsLearnMore"/>
- <button id="experiments-change-telemetry"
- label="&experiment.info.changetelemetry;"
- tooltiptext="&experiment.info.changetelemetry;"
- accesskey="&experiment.info.changetelemetry.accesskey;"
- command="cmd_experimentsOpenTelemetryPreferences"/>
- </hbox>
- </description>
- </vbox>
- </vbox>
<vbox id="addon-list-empty" class="alert-container"
flex="1" hidden="true">
<spacer class="alert-spacer-before"/>
<vbox class="alert">
<label value="&listEmpty.installed.label;"/>
<button class="discover-button"
id="discover-button-install"
label="&listEmpty.button.label;"
@@ -514,25 +493,16 @@
<label id="detail-version"/>
<label id="detail-legacy-warning" class="legacy-warning text-link" value="&addon.legacy.label;"/>
<label class="disabled-postfix" value="&addon.disabled.postfix;"/>
<label class="update-postfix" value="&addon.update.postfix;"/>
<spacer flex="5000"/> <!-- Necessary to allow the name to wrap -->
</hbox>
<label id="detail-creator" class="creator"/>
</vbox>
- <hbox id="detail-experiment-container">
- <svg width="8" height="8" viewBox="0 0 8 8" version="1.1"
- xmlns="http://www.w3.org/2000/svg"
- id="detail-experiment-bullet-container">
- <circle cx="4" cy="4" r="4" id="detail-experiment-bullet"/>
- </svg>
- <label id="detail-experiment-state"/>
- <label id="detail-experiment-time"/>
- </hbox>
<hbox id="detail-desc-container" align="start">
<vbox id="detail-screenshot-box" pack="center" hidden="true"> <!-- Necessary to work around bug 394738 -->
<image id="detail-screenshot"/>
</vbox>
<vbox flex="1">
<description id="detail-desc"/>
<description id="detail-fulldesc"/>
</vbox>
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -6487,22 +6487,9 @@ var addonTypes = [
AddonManager.VIEW_TYPE_LIST, 7000,
AddonManager.TYPE_UI_HIDE_EMPTY | AddonManager.TYPE_SUPPORTS_UNDO_RESTARTLESS_UNINSTALL),
new AddonManagerPrivate.AddonType("locale", URI_EXTENSION_STRINGS,
"type.locale.name",
AddonManager.VIEW_TYPE_LIST, 8000,
AddonManager.TYPE_UI_HIDE_EMPTY | AddonManager.TYPE_SUPPORTS_UNDO_RESTARTLESS_UNINSTALL),
];
-// We only register experiments support if the application supports them.
-// Ideally, we would install an observer to watch the pref. Installing
-// an observer for this pref is not necessary here and may be buggy with
-// regards to registering this XPIProvider twice.
-if (Services.prefs.getBoolPref("experiments.supported", false)) {
- addonTypes.push(
- new AddonManagerPrivate.AddonType("experiment",
- URI_EXTENSION_STRINGS,
- "type.experiment.name",
- AddonManager.VIEW_TYPE_LIST, 11000,
- AddonManager.TYPE_UI_HIDE_EMPTY | AddonManager.TYPE_SUPPORTS_UNDO_RESTARTLESS_UNINSTALL));
-}
-
AddonManagerPrivate.registerProvider(XPIProvider, addonTypes);
deleted file mode 100644
index 1c2b793f1ea9c6f73c99192fbd372170e55f9536..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_experiment1/install.rdf
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>test-experiment1@experiments.mozilla.org</em:id>
- <em:version>1.0</em:version>
- <em:type>128</em:type>
-
- <!-- Front End MetaData -->
- <em:name>Test Experiment 1</em:name>
- <em:description>Test Description</em:description>
-
- </Description>
-</RDF>
--- a/toolkit/mozapps/extensions/test/browser/browser.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser.ini
@@ -59,17 +59,16 @@ skip-if = os == "linux" && !debug # Bug
[browser_bug679604.js]
[browser_bug590347.js]
[browser_checkAddonCompatibility.js]
[browser_details.js]
[browser_discovery.js]
[browser_dragdrop.js]
skip-if = buildapp == 'mulet'
[browser_dragdrop_incompat.js]
-[browser_experiments.js]
[browser_file_xpi_no_process_switch.js]
[browser_getmorethemes.js]
[browser_globalwarnings.js]
[browser_gmpProvider.js]
skip-if = os == 'linux' && !debug # Bug 1398766
[browser_inlinesettings_browser.js]
[browser_installssl.js]
[browser_langpack_signing.js]
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ /dev/null
@@ -1,617 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-ChromeUtils.import("resource://gre/modules/Promise.jsm", this);
-
-var {AddonManagerTesting} = ChromeUtils.import("resource://testing-common/AddonManagerTesting.jsm", {});
-var {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js", {});
-
-var gManagerWindow;
-var gCategoryUtilities;
-var gExperiments;
-var gHttpServer;
-
-var gSavedManifestURI;
-var gIsEnUsLocale;
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-function getExperimentAddons() {
- return new Promise(resolve => {
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- resolve(addons);
- });
- });
-}
-
-function patchPolicy(policy, data) {
- for (let key of Object.keys(data)) {
- Object.defineProperty(policy, key, {
- value: data[key],
- writable: true,
- });
- }
-}
-
-function defineNow(policy, time) {
- patchPolicy(policy, { now: () => new Date(time) });
-}
-
-function openDetailsView(aId) {
- let item = get_addon_element(gManagerWindow, aId);
- Assert.ok(item, "Should have got add-on element.");
- is_element_visible(item, "Add-on element should be visible.");
-
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
-
- return new Promise(resolve => {
- wait_for_view_load(gManagerWindow, resolve);
- });
-}
-
-function clickRemoveButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "remove-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-function clickUndoButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "undo-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-add_task(async function initializeState() {
- gManagerWindow = await open_manager();
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("experiments.enabled");
- if (gHttpServer) {
- gHttpServer.stop(() => {});
- if (gSavedManifestURI !== undefined) {
- Services.prefs.setCharPref("experments.manifest.uri", gSavedManifestURI);
- }
- }
- if (gExperiments) {
- let tmp = {};
- ChromeUtils.import("resource:///modules/experiments/Experiments.jsm", tmp);
- gExperiments._policy = new tmp.Experiments.Policy();
- }
- });
-
- gIsEnUsLocale = Services.locale.getAppLocaleAsLangTag() == "en-US";
-
- // The Experiments Manager will interfere with us by preventing installs
- // of experiments it doesn't know about. We remove it from the equation
- // because here we are only concerned with core Addon Manager operation,
- // not the superset Experiments Manager has imposed.
- if ("@mozilla.org/browser/experiments-service;1" in Cc) {
- let tmp = {};
- ChromeUtils.import("resource:///modules/experiments/Experiments.jsm", tmp);
- // There is a race condition between XPCOM service initialization and
- // this test running. We have to initialize the instance first, then
- // uninitialize it to prevent this.
- gExperiments = tmp.Experiments.instance();
- await gExperiments._mainTask;
- await gExperiments.uninit();
- }
-});
-
-// On an empty profile with no experiments, the experiment category
-// should be hidden.
-add_task(async function testInitialState() {
- Assert.ok(gCategoryUtilities.get("experiment", false), "Experiment tab is defined.");
- Assert.ok(!gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab hidden by default.");
-});
-
-add_task(async function testExperimentInfoNotVisible() {
- await gCategoryUtilities.openType("extension");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_hidden(el, "Experiment info not visible on other types.");
-});
-
-// If we have an active experiment, we should see the experiments tab
-// and that tab should have some messages.
-add_task(async function testActiveExperiment() {
- let addon = await install_addon("addons/browser_experiment1.xpi");
-
- Assert.ok(addon.userDisabled, "Add-on is disabled upon initial install.");
- Assert.equal(addon.isActive, false, "Add-on is not active.");
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
-
- await gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(async function testExperimentLearnMore() {
- await gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-learn-more");
-
- is_element_visible(btn, "Learn more button visible.");
-
- // Actual URL is irrelevant.
- let expected = "http://mochi.test:8888/server.js";
- Services.prefs.setCharPref("toolkit.telemetry.infoURL", expected);
-
- info("Opening telemetry privacy policy.");
- let loadPromise = BrowserTestUtils.waitForNewTab(gBrowser, expected);
- EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
- await loadPromise;
-
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
- BrowserTestUtils.removeTab(gBrowser.selectedTab);
-});
-
-add_task(async function testOpenPreferences() {
- await gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
-
- is_element_visible(btn, "Change telemetry button visible in in-content UI.");
-
- let deferred = Promise.defer();
-
- function ensureElementIsVisible(preferencesPane, visibleElement) {
- Services.obs.addObserver(function observer(prefWin, topic, data) {
- Services.obs.removeObserver(observer, preferencesPane + "-pane-loaded");
- info(preferencesPane + " preference pane opened.");
- executeSoon(function() {
- // We want this test to fail if the preferences pane changes,
- // but we can't check if the data-choices button is visible
- // since it is only in the DOM when MOZ_TELEMETRY_REPORTING=1.
- let el = prefWin.document.getElementById(visibleElement);
- is_element_visible(el);
-
- prefWin.close();
- info("Closed preferences pane.");
-
- deferred.resolve();
- });
- }, preferencesPane + "-pane-loaded");
- }
-
- ensureElementIsVisible("privacy", "dataCollectionGroup");
-
- info("Loading preferences pane.");
- // We need to focus before synthesizing the mouse event (bug 1240052) as
- // synthesizeMouseAtCenter currently only synthesizes the mouse in the child process.
- // This can cause some subtle differences if the child isn't focused.
- await SimpleTest.promiseFocus();
- await BrowserTestUtils.synthesizeMouseAtCenter("#experiments-change-telemetry", {},
- gBrowser.selectedBrowser);
-
- await deferred.promise;
-});
-
-add_task(async function testButtonPresence() {
- await gCategoryUtilities.openType("experiment");
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- // Corresponds to the uninstall permission.
- is_element_visible(el, "Remove button is visible.");
- // Corresponds to lack of disable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button not visible.");
- // Corresponds to lack of enable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button not visible.");
-});
-
-// Remove the add-on we've been testing with.
-add_task(async function testCleanup() {
- await AddonManagerTesting.uninstallAddonByID("test-experiment1@experiments.mozilla.org");
- // Verify some conditions, just in case.
- let addons = await getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-});
-
-// The following tests should ideally live in browser/experiments/. However,
-// they rely on some of the helper functions from head.js, which can't easily
-// be consumed from other directories. So, they live here.
-
-add_task(async function testActivateExperiment() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let root = "http://localhost:" + gHttpServer.identity.primaryPort + "/";
- gHttpServer.registerPathHandler("/manifest", (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify({
- "version": 1,
- "experiments": [
- {
- id: "experiment-1",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- }));
- response.processAsync();
- response.finish();
- });
-
- gSavedManifestURI = Services.prefs.getCharPref("experiments.manifest.uri");
- Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest");
-
- // We need to remove the cache file to help ensure consistent state.
- await OS.File.remove(gExperiments._cacheFilePath);
-
- Services.telemetry.canRecordExtended = true;
- Services.prefs.setBoolPref("experiments.enabled", true);
-
- info("Initializing experiments service.");
- await gExperiments.init();
- info("Experiments service finished first run.");
-
- // Check conditions, just to be sure.
- let experiments = await gExperiments.getExperiments();
- Assert.equal(experiments.length, 0, "No experiments known to the service.");
-
- // This makes testing easier.
- gExperiments._policy.ignoreHashes = true;
-
- info("Manually updating experiments manifest.");
- await gExperiments.updateManifest();
- info("Experiments update complete.");
-
- await new Promise(resolve => {
- gHttpServer.stop(() => {
- gHttpServer = null;
-
- info("getting experiment by ID");
- AddonManager.getAddonByID("test-experiment1@experiments.mozilla.org", (addon) => {
- Assert.ok(addon, "Add-on installed via Experiments manager.");
-
- resolve();
- });
- });
-
- });
-
- Assert.ok(gCategoryUtilities.isTypeVisible, "experiment", "Experiment tab visible.");
- await gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(async function testDeactivateExperiment() {
- if (!gExperiments) {
- return;
- }
-
- // Fake an empty manifest to purge data from previous manifest.
- await gExperiments._updateExperiments({
- "version": 1,
- "experiments": [],
- });
-
- await gExperiments.disableExperiment("testing");
-
- // We should have a record of the previously-active experiment.
- let experiments = await gExperiments.getExperiments();
- Assert.equal(experiments.length, 1, "1 experiment is known.");
- Assert.equal(experiments[0].active, false, "Experiment is not active.");
-
- // We should have a previous experiment in the add-ons manager.
- let addons = await new Promise(resolve => {
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- resolve(addons);
- });
- });
- Assert.equal(addons.length, 1, "1 experiment add-on known.");
- Assert.ok(addons[0].appDisabled, "It is a previous experiment.");
- Assert.equal(addons[0].id, "experiment-1", "Add-on ID matches expected.");
-
- // Verify the UI looks sane.
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
- let item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- Assert.ok(!item.active, "Element should not be active.");
- item.parentNode.ensureElementIsVisible(item);
-
- // User control buttons should not be present because previous experiments
- // should have no permissions.
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- is_element_hidden(el, "Remove button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
- is_element_hidden(el, "Preferences button is not visible.");
-});
-
-add_task(async function testActivateRealExperiments() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- await gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-2",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- await gExperiments._run();
-
- // Check the active experiment.
-
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- let { version } = await get_tooltip_info(item);
- Assert.equal(version, undefined, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check the previous experiment.
-
- item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day ago");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- ({ version } = await get_tooltip_info(item));
- Assert.equal(version, undefined, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Install an "older" experiment.
-
- await gExperiments.disableExperiment("experiment-2");
-
- let now = Date.now();
- let fakeNow = now - 5 * MS_IN_ONE_DAY;
- defineNow(gExperiments._policy, fakeNow);
-
- await gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-3",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: fakeNow / 1000 - SEC_IN_ONE_DAY,
- endTime: now / 1000 + 10 * SEC_IN_ONE_DAY,
- maxActiveSeconds: 100 * SEC_IN_ONE_DAY,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- await gExperiments._run();
-
- // Check the active experiment.
-
- item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "10 days remaining");
- }
-
- // Disable it and check it's previous experiment entry.
-
- await gExperiments.disableExperiment("experiment-3");
-
- item = get_addon_element(gManagerWindow, "experiment-3");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-});
-
-add_task(async function testDetailView() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- defineNow(gExperiments._policy, Date.now());
- await gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-4",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- await gExperiments._run();
-
- // Check active experiment.
-
- await openDetailsView("test-experiment1@experiments.mozilla.org");
-
- let el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check previous experiment.
-
- await gCategoryUtilities.openType("experiment");
- await openDetailsView("experiment-3");
-
- el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-});
-
-add_task(async function testRemoveAndUndo() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- await gCategoryUtilities.openType("experiment");
-
- let addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-
- await clickRemoveButton(addon);
- addon.parentNode.ensureElementIsVisible(addon);
-
- let el = gManagerWindow.document.getAnonymousElementByAttribute(addon, "class", "pending");
- is_element_visible(el, "Uninstall undo information should be visible.");
-
- await clickUndoButton(addon);
- addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-});
-
-add_task(async function testCleanup() {
- if (gExperiments) {
- Services.prefs.clearUserPref("experiments.enabled");
- Services.prefs.setCharPref("experiments.manifest.uri", gSavedManifestURI);
-
- // We perform the uninit/init cycle to purge any leftover state.
- await OS.File.remove(gExperiments._cacheFilePath);
- await gExperiments.uninit();
- await gExperiments.init();
- }
-
- // Check post-conditions.
- let addons = await getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-
- await close_manager(gManagerWindow);
-});