mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +09:00
Issue #21 - Remove Telemetry from Push and devtools.
This commit is contained in:
parent
44388b01a3
commit
69ebaa5450
8 changed files with 1 additions and 71 deletions
|
|
@ -180,13 +180,10 @@ function loadSourceText(source) {
|
||||||
[PROMISE]: Task.spawn(function* () {
|
[PROMISE]: Task.spawn(function* () {
|
||||||
let transportType = gClient.localTransport ? "_LOCAL" : "_REMOTE";
|
let transportType = gClient.localTransport ? "_LOCAL" : "_REMOTE";
|
||||||
let histogramId = "DEVTOOLS_DEBUGGER_DISPLAY_SOURCE" + transportType + "_MS";
|
let histogramId = "DEVTOOLS_DEBUGGER_DISPLAY_SOURCE" + transportType + "_MS";
|
||||||
let histogram = Services.telemetry.getHistogramById(histogramId);
|
|
||||||
let startTime = Date.now();
|
let startTime = Date.now();
|
||||||
|
|
||||||
const response = yield sourceClient.source();
|
const response = yield sourceClient.source();
|
||||||
|
|
||||||
histogram.add(Date.now() - startTime);
|
|
||||||
|
|
||||||
// Automatically pretty print if enabled and the test is
|
// Automatically pretty print if enabled and the test is
|
||||||
// detected to be "minified"
|
// detected to be "minified"
|
||||||
if (Prefs.autoPrettyPrint &&
|
if (Prefs.autoPrettyPrint &&
|
||||||
|
|
|
||||||
|
|
@ -11474,7 +11474,6 @@ var Debugger =
|
||||||
if (telemetry) {
|
if (telemetry) {
|
||||||
var transportType = this._transport.onOutputStreamReady === undefined ? "LOCAL_" : "REMOTE_";
|
var transportType = this._transport.onOutputStreamReady === undefined ? "LOCAL_" : "REMOTE_";
|
||||||
var histogramId = "DEVTOOLS_DEBUGGER_RDP_" + transportType + telemetry + "_MS";
|
var histogramId = "DEVTOOLS_DEBUGGER_RDP_" + transportType + telemetry + "_MS";
|
||||||
histogram = Services.telemetry.getHistogramById(histogramId);
|
|
||||||
startTime = +new Date();
|
startTime = +new Date();
|
||||||
}
|
}
|
||||||
var outgoingPacket = {
|
var outgoingPacket = {
|
||||||
|
|
@ -11513,10 +11512,6 @@ var Debugger =
|
||||||
if (thisCallback) {
|
if (thisCallback) {
|
||||||
thisCallback(aResponse);
|
thisCallback(aResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (histogram) {
|
|
||||||
histogram.add(+new Date() - startTime);
|
|
||||||
}
|
|
||||||
}, "DebuggerClient.requester request callback"));
|
}, "DebuggerClient.requester request callback"));
|
||||||
}, "DebuggerClient.requester");
|
}, "DebuggerClient.requester");
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,7 @@ const {SIDE, BOTTOM, WINDOW} = Toolbox.HostType;
|
||||||
|
|
||||||
const URL = "data:text/html;charset=utf8,browser_toolbox_hosts_telemetry.js";
|
const URL = "data:text/html;charset=utf8,browser_toolbox_hosts_telemetry.js";
|
||||||
|
|
||||||
function getHostHistogram() {
|
|
||||||
return Services.telemetry.getHistogramById("DEVTOOLS_TOOLBOX_HOST");
|
|
||||||
}
|
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
// Reset it to make counting easier
|
|
||||||
getHostHistogram().clear();
|
|
||||||
|
|
||||||
info("Create a test tab and open the toolbox");
|
info("Create a test tab and open the toolbox");
|
||||||
let tab = yield addTab(URL);
|
let tab = yield addTab(URL);
|
||||||
let target = TargetFactory.forTab(tab);
|
let target = TargetFactory.forTab(tab);
|
||||||
|
|
@ -27,9 +20,6 @@ add_task(function* () {
|
||||||
|
|
||||||
toolbox = target = null;
|
toolbox = target = null;
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
getHostHistogram().clear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function* changeToolboxHost(toolbox) {
|
function* changeToolboxHost(toolbox) {
|
||||||
|
|
@ -43,8 +33,5 @@ function* changeToolboxHost(toolbox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkResults() {
|
function checkResults() {
|
||||||
let counts = getHostHistogram().snapshot().counts;
|
// STUB
|
||||||
is(counts[0], 3, "Toolbox HostType bottom has 3 successful entries");
|
|
||||||
is(counts[1], 2, "Toolbox HostType side has 2 successful entries");
|
|
||||||
is(counts[2], 2, "Toolbox HostType window has 2 successful entries");
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,6 @@ Push.prototype = {
|
||||||
subscribe: function(options) {
|
subscribe: function(options) {
|
||||||
console.debug("subscribe()", this._scope);
|
console.debug("subscribe()", this._scope);
|
||||||
|
|
||||||
let histogram = Services.telemetry.getHistogramById("PUSH_API_USED");
|
|
||||||
histogram.add(true);
|
|
||||||
return this.askPermission().then(() =>
|
return this.askPermission().then(() =>
|
||||||
this.createPromise((resolve, reject) => {
|
this.createPromise((resolve, reject) => {
|
||||||
let callback = new PushSubscriptionCallback(this, resolve, reject);
|
let callback = new PushSubscriptionCallback(this, resolve, reject);
|
||||||
|
|
@ -180,20 +178,14 @@ Push.prototype = {
|
||||||
principal: this._principal,
|
principal: this._principal,
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
|
||||||
allow: function() {
|
allow: function() {
|
||||||
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_GRANTED");
|
|
||||||
histogram.add();
|
|
||||||
allowCallback();
|
allowCallback();
|
||||||
},
|
},
|
||||||
cancel: function() {
|
cancel: function() {
|
||||||
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_DENIED");
|
|
||||||
histogram.add();
|
|
||||||
cancelCallback();
|
cancelCallback();
|
||||||
},
|
},
|
||||||
window: this._window,
|
window: this._window,
|
||||||
};
|
};
|
||||||
|
|
||||||
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_REQUESTED");
|
|
||||||
histogram.add(1);
|
|
||||||
// Using askPermission from nsIDOMWindowUtils that takes care of the
|
// Using askPermission from nsIDOMWindowUtils that takes care of the
|
||||||
// remoting if needed.
|
// remoting if needed.
|
||||||
let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
|
let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ PushRecord.prototype = {
|
||||||
Math.round(8 * Math.pow(daysElapsed, -0.8)),
|
Math.round(8 * Math.pow(daysElapsed, -0.8)),
|
||||||
prefs.get("maxQuotaPerSubscription")
|
prefs.get("maxQuotaPerSubscription")
|
||||||
);
|
);
|
||||||
Services.telemetry.getHistogramById("PUSH_API_QUOTA_RESET_TO").add(this.quota);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -125,7 +124,6 @@ PushRecord.prototype = {
|
||||||
// We check for ctime > 0 to skip older records that did not have ctime.
|
// We check for ctime > 0 to skip older records that did not have ctime.
|
||||||
if (this.isExpired() && this.ctime > 0) {
|
if (this.isExpired() && this.ctime > 0) {
|
||||||
let duration = Date.now() - this.ctime;
|
let duration = Date.now() - this.ctime;
|
||||||
Services.telemetry.getHistogramById("PUSH_API_QUOTA_EXPIRATION_TIME").add(duration / 1000);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* jshint moz: true, esnext: true */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
@ -51,16 +50,6 @@ const PUSH_SERVICE_CONNECTION_DISABLE = 3;
|
||||||
const PUSH_SERVICE_ACTIVE_OFFLINE = 4;
|
const PUSH_SERVICE_ACTIVE_OFFLINE = 4;
|
||||||
const PUSH_SERVICE_RUNNING = 5;
|
const PUSH_SERVICE_RUNNING = 5;
|
||||||
|
|
||||||
// Telemetry failure to send push notification to Service Worker reasons.
|
|
||||||
// Key not found in local database.
|
|
||||||
const kDROP_NOTIFICATION_REASON_KEY_NOT_FOUND = 0;
|
|
||||||
// User cleared history.
|
|
||||||
const kDROP_NOTIFICATION_REASON_NO_HISTORY = 1;
|
|
||||||
// Version of message received not newer than previous one.
|
|
||||||
const kDROP_NOTIFICATION_REASON_NO_VERSION_INCREMENT = 2;
|
|
||||||
// Subscription has expired.
|
|
||||||
const kDROP_NOTIFICATION_REASON_EXPIRED = 3;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State is change only in couple of functions:
|
* State is change only in couple of functions:
|
||||||
* init - change state to PUSH_SERVICE_INIT if state was PUSH_SERVICE_UNINIT
|
* init - change state to PUSH_SERVICE_INIT if state was PUSH_SERVICE_UNINIT
|
||||||
|
|
@ -655,7 +644,6 @@ this.PushService = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.telemetry.getHistogramById("PUSH_API_NOTIFY_REGISTRATION_LOST").add();
|
|
||||||
gPushNotifier.notifySubscriptionChange(record.scope, record.principal);
|
gPushNotifier.notifySubscriptionChange(record.scope, record.principal);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -729,12 +717,6 @@ this.PushService = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_recordDidNotNotify: function(reason) {
|
|
||||||
Services.telemetry.
|
|
||||||
getHistogramById("PUSH_API_NOTIFICATION_RECEIVED_BUT_DID_NOT_NOTIFY").
|
|
||||||
add(reason);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches an incoming message to a service worker, recalculating the
|
* Dispatches an incoming message to a service worker, recalculating the
|
||||||
* quota for the associated push registration. If the quota is exceeded,
|
* quota for the associated push registration. If the quota is exceeded,
|
||||||
|
|
@ -757,7 +739,6 @@ this.PushService = {
|
||||||
*/
|
*/
|
||||||
receivedPushMessage(keyID, messageID, headers, data, updateFunc) {
|
receivedPushMessage(keyID, messageID, headers, data, updateFunc) {
|
||||||
console.debug("receivedPushMessage()");
|
console.debug("receivedPushMessage()");
|
||||||
Services.telemetry.getHistogramById("PUSH_API_NOTIFICATION_RECEIVED").add();
|
|
||||||
|
|
||||||
return this._updateRecordAfterPush(keyID, updateFunc).then(record => {
|
return this._updateRecordAfterPush(keyID, updateFunc).then(record => {
|
||||||
if (record.quotaApplies()) {
|
if (record.quotaApplies()) {
|
||||||
|
|
@ -790,14 +771,12 @@ this.PushService = {
|
||||||
_updateRecordAfterPush(keyID, updateFunc) {
|
_updateRecordAfterPush(keyID, updateFunc) {
|
||||||
return this.getByKeyID(keyID).then(record => {
|
return this.getByKeyID(keyID).then(record => {
|
||||||
if (!record) {
|
if (!record) {
|
||||||
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_KEY_NOT_FOUND);
|
|
||||||
throw new Error("No record for key ID " + keyID);
|
throw new Error("No record for key ID " + keyID);
|
||||||
}
|
}
|
||||||
return record.getLastVisit().then(lastVisit => {
|
return record.getLastVisit().then(lastVisit => {
|
||||||
// As a special case, don't notify the service worker if the user
|
// As a special case, don't notify the service worker if the user
|
||||||
// cleared their history.
|
// cleared their history.
|
||||||
if (!isFinite(lastVisit)) {
|
if (!isFinite(lastVisit)) {
|
||||||
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_HISTORY);
|
|
||||||
throw new Error("Ignoring message sent to unvisited origin");
|
throw new Error("Ignoring message sent to unvisited origin");
|
||||||
}
|
}
|
||||||
return lastVisit;
|
return lastVisit;
|
||||||
|
|
@ -807,7 +786,6 @@ this.PushService = {
|
||||||
return this._db.update(keyID, record => {
|
return this._db.update(keyID, record => {
|
||||||
let newRecord = updateFunc(record);
|
let newRecord = updateFunc(record);
|
||||||
if (!newRecord) {
|
if (!newRecord) {
|
||||||
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_NO_VERSION_INCREMENT);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Because `unregister` is advisory only, we can still receive messages
|
// Because `unregister` is advisory only, we can still receive messages
|
||||||
|
|
@ -871,7 +849,6 @@ this.PushService = {
|
||||||
return record;
|
return record;
|
||||||
}).then(record => {
|
}).then(record => {
|
||||||
if (record.isExpired()) {
|
if (record.isExpired()) {
|
||||||
this._recordDidNotNotify(kDROP_NOTIFICATION_REASON_EXPIRED);
|
|
||||||
// Drop the registration in the background. If the user returns to the
|
// Drop the registration in the background. If the user returns to the
|
||||||
// site, the service worker will be notified on the next `idle-daily`
|
// site, the service worker will be notified on the next `idle-daily`
|
||||||
// event.
|
// event.
|
||||||
|
|
@ -945,11 +922,6 @@ this.PushService = {
|
||||||
let payload = ArrayBuffer.isView(message) ?
|
let payload = ArrayBuffer.isView(message) ?
|
||||||
new Uint8Array(message.buffer) : message;
|
new Uint8Array(message.buffer) : message;
|
||||||
|
|
||||||
if (aPushRecord.quotaApplies()) {
|
|
||||||
// Don't record telemetry for chrome push messages.
|
|
||||||
Services.telemetry.getHistogramById("PUSH_API_NOTIFY").add();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (payload) {
|
if (payload) {
|
||||||
gPushNotifier.notifyPushWithData(aPushRecord.scope,
|
gPushNotifier.notifyPushWithData(aPushRecord.scope,
|
||||||
aPushRecord.principal,
|
aPushRecord.principal,
|
||||||
|
|
@ -998,7 +970,6 @@ this.PushService = {
|
||||||
_registerWithServer: function(aPageRecord) {
|
_registerWithServer: function(aPageRecord) {
|
||||||
console.debug("registerWithServer()", aPageRecord);
|
console.debug("registerWithServer()", aPageRecord);
|
||||||
|
|
||||||
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_ATTEMPT").add();
|
|
||||||
return this._sendRequest("register", aPageRecord)
|
return this._sendRequest("register", aPageRecord)
|
||||||
.then(record => this._onRegisterSuccess(record),
|
.then(record => this._onRegisterSuccess(record),
|
||||||
err => this._onRegisterError(err))
|
err => this._onRegisterError(err))
|
||||||
|
|
@ -1014,12 +985,9 @@ this.PushService = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_sendUnregister(aRecord, aReason) {
|
_sendUnregister(aRecord, aReason) {
|
||||||
Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_ATTEMPT").add();
|
|
||||||
return this._sendRequest("unregister", aRecord, aReason).then(function(v) {
|
return this._sendRequest("unregister", aRecord, aReason).then(function(v) {
|
||||||
Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_SUCCEEDED").add();
|
|
||||||
return v;
|
return v;
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
Services.telemetry.getHistogramById("PUSH_API_UNSUBSCRIBE_FAILED").add();
|
|
||||||
return Promise.reject(e);
|
return Promise.reject(e);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -1033,11 +1001,9 @@ this.PushService = {
|
||||||
|
|
||||||
return this._db.put(aRecord)
|
return this._db.put(aRecord)
|
||||||
.then(record => {
|
.then(record => {
|
||||||
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_SUCCEEDED").add();
|
|
||||||
return record;
|
return record;
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
|
|
||||||
// Unable to save. Destroy the subscription in the background.
|
// Unable to save. Destroy the subscription in the background.
|
||||||
this._backgroundUnregister(aRecord,
|
this._backgroundUnregister(aRecord,
|
||||||
Ci.nsIPushErrorReporter.UNSUBSCRIBE_MANUAL);
|
Ci.nsIPushErrorReporter.UNSUBSCRIBE_MANUAL);
|
||||||
|
|
@ -1051,7 +1017,6 @@ this.PushService = {
|
||||||
*/
|
*/
|
||||||
_onRegisterError: function(reply) {
|
_onRegisterError: function(reply) {
|
||||||
console.debug("_onRegisterError()");
|
console.debug("_onRegisterError()");
|
||||||
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_FAILED").add()
|
|
||||||
if (!reply.error) {
|
if (!reply.error) {
|
||||||
console.warn("onRegisterError: Called without valid error message!",
|
console.warn("onRegisterError: Called without valid error message!",
|
||||||
reply);
|
reply);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* jshint moz: true, esnext: true */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
@ -332,7 +331,6 @@ SubscriptionListener.prototype = {
|
||||||
ctime: Date.now(),
|
ctime: Date.now(),
|
||||||
});
|
});
|
||||||
|
|
||||||
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_HTTP2_TIME").add(Date.now() - this._ctime);
|
|
||||||
this._resolve(reply);
|
this._resolve(reply);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* jshint moz: true, esnext: true */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
@ -638,7 +637,6 @@ this.PushServiceWebSocket = {
|
||||||
appServerKey: tmp.record.appServerKey,
|
appServerKey: tmp.record.appServerKey,
|
||||||
ctime: Date.now(),
|
ctime: Date.now(),
|
||||||
});
|
});
|
||||||
Services.telemetry.getHistogramById("PUSH_API_SUBSCRIBE_WS_TIME").add(Date.now() - tmp.ctime);
|
|
||||||
tmp.resolve(record);
|
tmp.resolve(record);
|
||||||
} else {
|
} else {
|
||||||
console.error("handleRegisterReply: Unexpected server response", reply);
|
console.error("handleRegisterReply: Unexpected server response", reply);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue