This commit is contained in:
Wes Kocher 2014-04-28 16:20:24 -07:00
Родитель f2ad22eb49 00007267c8
Коммит 177f1467fe
8 изменённых файлов: 67 добавлений и 14 удалений

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

@ -200,6 +200,10 @@ const PanelUI = {
}
},
isReady: function() {
return !!this._isReady;
},
/**
* Registering the menu panel is done lazily for performance reasons. This
* method is exposed so that CustomizationMode can force panel-readyness in the
@ -263,6 +267,7 @@ const PanelUI = {
}
this._updateQuitTooltip();
this.panel.hidden = false;
this._isReady = true;
}.bind(this)).then(null, Cu.reportError);
return this._readyPromise;

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

@ -188,10 +188,12 @@ CustomizeMode.prototype = {
// The menu panel is lazy, and registers itself when the popup shows. We
// need to force the menu panel to register itself, or else customization
// is really not going to work. We pass "true" to ensureRegistered to
// is really not going to work. We pass "true" to ensureReady to
// indicate that we're handling calling startBatchUpdate and
// endBatchUpdate.
yield window.PanelUI.ensureReady(true);
if (!window.PanelUI.isReady()) {
yield window.PanelUI.ensureReady(true);
}
// Hide the palette before starting the transition for increased perf.
this.visiblePalette.hidden = true;

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

@ -1123,7 +1123,9 @@ Experiments.Experiments.prototype = {
let desc = TELEMETRY_LOG.ACTIVATION;
let data = [TELEMETRY_LOG.ACTIVATION.REJECTED, id];
data = data.concat(reason);
TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY, data);
const key = TELEMETRY_LOG.ACTIVATION_KEY;
TelemetryLog.log(key, data);
this._log.trace("evaluateExperiments() - added " + key + " to TelemetryLog: " + JSON.stringify(data));
}
if (!applicable) {

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

@ -175,6 +175,7 @@ add_task(function* test_telemetryBasics() {
expectedLogLength += 2;
let log = TelemetryPing.getPayload().log;
do_print("Telemetry log: " + JSON.stringify(log));
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
checkEvent(log[log.length-2], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.REJECTED, EXPERIMENT1_ID, "startTime"]);

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

@ -30,6 +30,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://services-common/utils.js");
Cu.import("resource://gre/modules/UpdateChannel.jsm");
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
@ -503,7 +504,7 @@ this.DataReportingPolicy.prototype = Object.freeze({
*/
get minimumPolicyVersion() {
// First check if the current channel has an ove
let channel = Services.appinfo.defaultUpdateChannel;
let channel = UpdateChannel.get(false);
let channelPref = this._prefs.get("minimumPolicyVersion.channel-" + channel);
return channelPref !== undefined ?
channelPref : this._prefs.get("minimumPolicyVersion", 1);

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

@ -0,0 +1,36 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/Preferences.jsm");
Components.utils.import("resource://gre/modules/UpdateChannel.jsm");
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const TEST_CHANNEL = "TestChannel";
const PREF_PARTNER_A = "app.partner.test_partner_a";
const TEST_PARTNER_A = "TestPartnerA";
const PREF_PARTNER_B = "app.partner.test_partner_b";
const TEST_PARTNER_B = "TestPartnerB";
function test_get() {
let defaultPrefs = new Preferences({ defaultBranch: true });
let currentChannel = defaultPrefs.get(PREF_APP_UPDATE_CHANNEL);
do_check_eq(UpdateChannel.get(), currentChannel);
do_check_eq(UpdateChannel.get(false), currentChannel);
defaultPrefs.set(PREF_APP_UPDATE_CHANNEL, TEST_CHANNEL);
do_check_eq(UpdateChannel.get(), TEST_CHANNEL);
do_check_eq(UpdateChannel.get(false), TEST_CHANNEL);
defaultPrefs.set(PREF_PARTNER_A, TEST_PARTNER_A);
defaultPrefs.set(PREF_PARTNER_B, TEST_PARTNER_B);
do_check_eq(UpdateChannel.get(),
TEST_CHANNEL + "-cck-" + TEST_PARTNER_A + "-" + TEST_PARTNER_B);
do_check_eq(UpdateChannel.get(false), TEST_CHANNEL);
}
function run_test() {
test_get();
}

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

@ -3,3 +3,4 @@ head =
tail =
[test_contentAreaUtils.js]
[test_updateChannelModule.js]

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

@ -15,8 +15,11 @@ this.UpdateChannel = {
* Read the update channel from defaults only. We do this to ensure that
* the channel is tightly coupled with the application and does not apply
* to other instances of the application that may use the same profile.
*
* @param [optional] aIncludePartners
* Whether or not to include the partner bits. Default: true.
*/
get: function UpdateChannel_get() {
get: function UpdateChannel_get(aIncludePartners = true) {
let channel = "@MOZ_UPDATE_CHANNEL@";
let defaults = Services.prefs.getDefaultBranch(null);
try {
@ -25,16 +28,18 @@ this.UpdateChannel = {
// use default value when pref not found
}
try {
let partners = Services.prefs.getChildList("app.partner.").sort();
if (partners.length) {
channel += "-cck";
partners.forEach(function (prefName) {
channel += "-" + Services.prefs.getCharPref(prefName);
});
if (aIncludePartners) {
try {
let partners = Services.prefs.getChildList("app.partner.").sort();
if (partners.length) {
channel += "-cck";
partners.forEach(function (prefName) {
channel += "-" + Services.prefs.getCharPref(prefName);
});
}
} catch (e) {
Cu.reportError(e);
}
} catch (e) {
Cu.reportError(e);
}
return channel;