merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-01-11 12:09:50 +01:00
commit 956c7532ac
5 changed files with 22 additions and 4 deletions

View File

@ -88,7 +88,7 @@
class="syncTabsMenuItem subviewbutton"
label="&syncTabsMenu3.label;"
oncommand="BrowserOpenSyncTabs();"
disabled="true"/>
hidden="true"/>
<toolbarbutton id="appMenuRestoreLastSession"
label="&appMenuHistory.restoreSession.label;"
class="subviewbutton"

View File

@ -739,6 +739,7 @@ var Impl = {
try {
// TODO: This should probably happen after all the delayed init here.
this._initialized = true;
TelemetryEnvironment.delayedInit();
yield TelemetrySend.setup(this._testMode);

View File

@ -65,6 +65,10 @@ this.TelemetryEnvironment = {
return getGlobal().onInitialized();
},
delayedInit: function() {
return getGlobal().delayedInit();
},
registerChangeListener: function(name, listener) {
return getGlobal().registerChangeListener(name, listener);
},
@ -664,6 +668,7 @@ function EnvironmentCache() {
this._log.trace("constructor");
this._shutdown = false;
this._delayedInitFinished = false;
// A map of listeners that will be called on environment changes.
this._changeListeners = new Map();
@ -740,6 +745,13 @@ EnvironmentCache.prototype = {
return Promise.resolve(this.currentEnvironment);
},
/**
* This gets called when the delayed init completes.
*/
delayedInit: function() {
this._delayedInitFinished = true;
},
/**
* Register a listener for environment changes.
* @param name The name of the listener. If a new listener is registered
@ -1304,6 +1316,7 @@ EnvironmentCache.prototype = {
// We are already skipping change events in _checkChanges if there is a pending change task running.
let now = Policy.now();
if (this._lastEnvironmentChangeDate &&
this._delayedInitFinished &&
(CHANGE_THROTTLE_INTERVAL_MS >=
(now.getTime() - this._lastEnvironmentChangeDate.getTime()))) {
this._log.trace("_onEnvironmentChange - throttling changes, now: " + now +
@ -1311,7 +1324,9 @@ EnvironmentCache.prototype = {
return;
}
this._lastEnvironmentChangeDate = now;
if(this._delayedInitFinished) {
this._lastEnvironmentChangeDate = now;
}
for (let [name, listener] of this._changeListeners) {
try {

View File

@ -653,6 +653,7 @@ function isRejected(promise) {
add_task(function* asyncSetup() {
yield spoofProfileReset();
TelemetryEnvironment.delayedInit();
});
add_task(function* test_checkEnvironment() {

View File

@ -24,8 +24,9 @@ function check_event(event, id, data)
}
}
function* run_test()
add_task(function* ()
{
do_get_profile();
yield TelemetrySession.setup();
TelemetryLog.log(TEST_PREFIX + "1", ["val", 123, undefined]);
@ -45,4 +46,4 @@ function* run_test()
do_check_true(log[1][1] <= log[2][1]);
yield TelemetrySession.shutdown();
}
});