mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 818565 - Replace test-ping with a function. r=vladan.
This commit is contained in:
parent
5e02012d67
commit
efd3eb763b
@ -964,13 +964,26 @@ TelemetryPing.prototype = {
|
||||
this._addons = aAddOns;
|
||||
},
|
||||
|
||||
sendIdlePing: function sendIdlePing(aTest, aServer) {
|
||||
if (this._isIdleObserver) {
|
||||
idleService.removeIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||
this._isIdleObserver = false;
|
||||
}
|
||||
if (aTest) {
|
||||
this.send("test-ping", aServer);
|
||||
} else if (Telemetry.canSend) {
|
||||
this.send("idle-daily", aServer);
|
||||
}
|
||||
},
|
||||
|
||||
testPing: function testPing(server) {
|
||||
this.sendIdlePing(true, server);
|
||||
},
|
||||
|
||||
/**
|
||||
* This observer drives telemetry.
|
||||
*/
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
// Allows to change the server for testing
|
||||
var server = this._server;
|
||||
|
||||
switch (aTopic) {
|
||||
case "profile-after-change":
|
||||
this.setup();
|
||||
@ -1027,20 +1040,8 @@ TelemetryPing.prototype = {
|
||||
this._pingLoadsCompleted = 0;
|
||||
this.loadHistograms(aSubject.QueryInterface(Ci.nsIFile), aData != "async");
|
||||
break;
|
||||
case "test-ping":
|
||||
server = aData;
|
||||
// fall through
|
||||
case "idle":
|
||||
if (this._isIdleObserver) {
|
||||
idleService.removeIdleObserver(this, IDLE_TIMEOUT_SECONDS);
|
||||
this._isIdleObserver = false;
|
||||
}
|
||||
if (aTopic == "test-ping") {
|
||||
this.send("test-ping", server);
|
||||
}
|
||||
else if (Telemetry.canSend && aTopic == "idle") {
|
||||
this.send("idle-daily", server);
|
||||
}
|
||||
this.sendIdlePing(false, this._server);
|
||||
break;
|
||||
case "quit-application-granted":
|
||||
if (Telemetry.canSend) {
|
||||
|
@ -14,4 +14,5 @@ interface nsITelemetryPing : nsIObserver {
|
||||
void gatherStartup();
|
||||
void enableLoadSaveNotifications(); /* Used only for testing. */
|
||||
void setAddOns(in AString aAddOns);
|
||||
void testPing(in AString aServer);
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ function telemetry_ping () {
|
||||
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
|
||||
TelemetryPing.gatherStartup();
|
||||
TelemetryPing.enableLoadSaveNotifications();
|
||||
TelemetryPing.observe(null, "test-ping", SERVER);
|
||||
TelemetryPing.testPing(SERVER);
|
||||
}
|
||||
|
||||
// Mostly useful so that you can dump payloads from decodeRequestPayload.
|
||||
|
Loading…
Reference in New Issue
Block a user