Backout 7475b716558d (bug 1119281) for Windows XPCShell permafailure

This commit is contained in:
Wes Kocher 2015-01-09 16:35:50 -08:00
parent 46ce05e652
commit abaac8e08d
2 changed files with 5 additions and 37 deletions

View File

@ -214,7 +214,6 @@ this.TelemetryPing = Object.freeze({
*/ */
reset: function() { reset: function() {
this.uninstall(); this.uninstall();
Impl._clientID = null;
return this.setup(); return this.setup();
}, },
/** /**
@ -223,7 +222,6 @@ this.TelemetryPing = Object.freeze({
setup: function() { setup: function() {
return Impl.setupChromeProcess(true); return Impl.setupChromeProcess(true);
}, },
/** /**
* Used only for testing purposes. * Used only for testing purposes.
*/ */
@ -234,13 +232,6 @@ this.TelemetryPing = Object.freeze({
// Ignore errors // Ignore errors
} }
}, },
/**
* Used only for testing purposes.
*/
shutdown: function() {
return Impl.shutdown(true);
},
/** /**
* Descriptive metadata * Descriptive metadata
* *
@ -1034,7 +1025,10 @@ let Impl = {
AsyncShutdown.sendTelemetry.addBlocker( AsyncShutdown.sendTelemetry.addBlocker(
"Telemetry: shutting down", "Telemetry: shutting down",
function condition(){ function condition(){
this.shutdown(); this.uninstall();
if (Telemetry.canSend) {
return this.savePendingPings();
}
}.bind(this)); }.bind(this));
Services.obs.addObserver(this, "sessionstore-windows-restored", false); Services.obs.addObserver(this, "sessionstore-windows-restored", false);
@ -1181,6 +1175,7 @@ let Impl = {
#ifdef MOZ_WIDGET_ANDROID #ifdef MOZ_WIDGET_ANDROID
Services.obs.removeObserver(this, "application-background", false); Services.obs.removeObserver(this, "application-background", false);
#endif #endif
this._clientID = null;
}, },
getPayload: function getPayload() { getPayload: function getPayload() {
@ -1313,16 +1308,4 @@ let Impl = {
get clientID() { get clientID() {
return this._clientID; return this._clientID;
}, },
/**
* This tells TelemetryPing to uninitialize and save any pending pings.
* @param testing Optional. If true, always saves the ping whether Telemetry
* can send pings or not, which is used for testing.
*/
shutdown: function(testing = false) {
this.uninstall();
if (Telemetry.canSend || testing) {
return this.savePendingPings();
}
},
}; };

View File

@ -22,7 +22,6 @@ Cu.import("resource://gre/modules/TelemetryFile.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this); Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/Promise.jsm", this); Cu.import("resource://gre/modules/Promise.jsm", this);
Cu.import("resource://gre/modules/Preferences.jsm"); Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/osfile.jsm", this);
const IGNORE_HISTOGRAM = "test::ignore_me"; const IGNORE_HISTOGRAM = "test::ignore_me";
const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED"; const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED";
@ -622,20 +621,6 @@ add_task(function* test_runOldPingFile() {
do_check_false(histogramsFile.exists()); do_check_false(histogramsFile.exists());
}); });
add_task(function* test_savedSessionClientID() {
// Assure that we store the ping properly when saving sessions on shutdown.
// We make the TelemetryPings shutdown to trigger a session save.
const dir = TelemetryFile.pingDirectoryPath;
yield OS.File.removeDir(dir, {ignoreAbsent: true});
yield OS.File.makeDir(dir);
TelemetryPing.shutdown();
yield TelemetryFile.loadSavedPings();
Assert.equal(TelemetryFile.pingsLoaded, 1);
let ping = TelemetryFile.popPendingPings().next();
Assert.equal(ping.value.payload.clientID, gDataReportingClientID);
});
add_task(function* stopServer(){ add_task(function* stopServer(){
gHttpServer.stop(do_test_finished); gHttpServer.stop(do_test_finished);
}); });