зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1088141 - Add telemetry for SSL Error Reports (r=felipe)
This commit is contained in:
Родитель
b81203c055
Коммит
e72754ef17
|
@ -112,6 +112,12 @@
|
||||||
.addEventListener('click', function togglePanelVisibility() {
|
.addEventListener('click', function togglePanelVisibility() {
|
||||||
var panel = document.getElementById('certificateErrorReportingPanel');
|
var panel = document.getElementById('certificateErrorReportingPanel');
|
||||||
toggleDisplay(panel);
|
toggleDisplay(panel);
|
||||||
|
|
||||||
|
if (panel.style.display == "block") {
|
||||||
|
// send event to trigger telemetry ping
|
||||||
|
var event = new CustomEvent("AboutNetErrorUIExpanded", {bubbles:true});
|
||||||
|
document.dispatchEvent(event);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2692,6 +2692,12 @@ let gMenuButtonUpdateBadge = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Values for telemtery bins: see TLS_ERROR_REPORT_UI in Histograms.json
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_AUTO_CHECKED = 2;
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_AUTO_UNCHECKED = 3;
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_MANUAL_SEND = 4;
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_AUTO_SEND = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle command events bubbling up from error page content
|
* Handle command events bubbling up from error page content
|
||||||
* or from about:newtab or from remote error pages that invoke
|
* or from about:newtab or from remote error pages that invoke
|
||||||
|
@ -2705,6 +2711,7 @@ let BrowserOnClick = {
|
||||||
mm.addMessageListener("Browser:EnableOnlineMode", this);
|
mm.addMessageListener("Browser:EnableOnlineMode", this);
|
||||||
mm.addMessageListener("Browser:SendSSLErrorReport", this);
|
mm.addMessageListener("Browser:SendSSLErrorReport", this);
|
||||||
mm.addMessageListener("Browser:SetSSLErrorReportAuto", this);
|
mm.addMessageListener("Browser:SetSSLErrorReportAuto", this);
|
||||||
|
mm.addMessageListener("Browser:SSLErrorReportTelemetry", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function () {
|
||||||
|
@ -2714,6 +2721,7 @@ let BrowserOnClick = {
|
||||||
mm.removeMessageListener("Browser:EnableOnlineMode", this);
|
mm.removeMessageListener("Browser:EnableOnlineMode", this);
|
||||||
mm.removeMessageListener("Browser:SendSSLErrorReport", this);
|
mm.removeMessageListener("Browser:SendSSLErrorReport", this);
|
||||||
mm.removeMessageListener("Browser:SetSSLErrorReportAuto", this);
|
mm.removeMessageListener("Browser:SetSSLErrorReportAuto", this);
|
||||||
|
mm.removeMessageListener("Browser:SSLErrorReportTelemetry", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (event) {
|
handleEvent: function (event) {
|
||||||
|
@ -2760,6 +2768,16 @@ let BrowserOnClick = {
|
||||||
break;
|
break;
|
||||||
case "Browser:SetSSLErrorReportAuto":
|
case "Browser:SetSSLErrorReportAuto":
|
||||||
Services.prefs.setBoolPref("security.ssl.errorReporting.automatic", msg.json.automatic);
|
Services.prefs.setBoolPref("security.ssl.errorReporting.automatic", msg.json.automatic);
|
||||||
|
let bin = TLS_ERROR_REPORT_TELEMETRY_AUTO_UNCHECKED;
|
||||||
|
if (msg.json.automatic) {
|
||||||
|
bin = TLS_ERROR_REPORT_TELEMETRY_AUTO_CHECKED;
|
||||||
|
}
|
||||||
|
Services.telemetry.getHistogramById("TLS_ERROR_REPORT_UI").add(bin);
|
||||||
|
break;
|
||||||
|
case "Browser:SSLErrorReportTelemetry":
|
||||||
|
let reportStatus = msg.data.reportStatus;
|
||||||
|
Services.telemetry.getHistogramById("TLS_ERROR_REPORT_UI")
|
||||||
|
.add(reportStatus);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2781,6 +2799,12 @@ let BrowserOnClick = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let bin = TLS_ERROR_REPORT_TELEMETRY_MANUAL_SEND;
|
||||||
|
if (Services.prefs.getBoolPref("security.ssl.errorReporting.automatic")) {
|
||||||
|
bin = TLS_ERROR_REPORT_TELEMETRY_AUTO_SEND;
|
||||||
|
}
|
||||||
|
Services.telemetry.getHistogramById("TLS_ERROR_REPORT_UI").add(bin);
|
||||||
|
|
||||||
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
|
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
|
||||||
.getService(Ci.nsISerializationHelper);
|
.getService(Ci.nsISerializationHelper);
|
||||||
let transportSecurityInfo = serhelper.deserializeObject(securityInfo);
|
let transportSecurityInfo = serhelper.deserializeObject(securityInfo);
|
||||||
|
|
|
@ -177,11 +177,18 @@ Cc["@mozilla.org/eventlistenerservice;1"]
|
||||||
.getService(Ci.nsIEventListenerService)
|
.getService(Ci.nsIEventListenerService)
|
||||||
.addSystemEventListener(global, "contextmenu", handleContentContextMenu, false);
|
.addSystemEventListener(global, "contextmenu", handleContentContextMenu, false);
|
||||||
|
|
||||||
|
// Values for telemtery bins: see TLS_ERROR_REPORT_UI in Histograms.json
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_UI_SHOWN = 0;
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_EXPANDED = 1;
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_SUCCESS = 6;
|
||||||
|
const TLS_ERROR_REPORT_TELEMETRY_FAILURE = 7;
|
||||||
|
|
||||||
let AboutNetErrorListener = {
|
let AboutNetErrorListener = {
|
||||||
init: function(chromeGlobal) {
|
init: function(chromeGlobal) {
|
||||||
chromeGlobal.addEventListener('AboutNetErrorLoad', this, false, true);
|
chromeGlobal.addEventListener('AboutNetErrorLoad', this, false, true);
|
||||||
chromeGlobal.addEventListener('AboutNetErrorSetAutomatic', this, false, true);
|
chromeGlobal.addEventListener('AboutNetErrorSetAutomatic', this, false, true);
|
||||||
chromeGlobal.addEventListener('AboutNetErrorSendReport', this, false, true);
|
chromeGlobal.addEventListener('AboutNetErrorSendReport', this, false, true);
|
||||||
|
chromeGlobal.addEventListener('AboutNetErrorUIExpanded', this, false, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
get isAboutNetError() {
|
get isAboutNetError() {
|
||||||
|
@ -203,6 +210,10 @@ let AboutNetErrorListener = {
|
||||||
case "AboutNetErrorSendReport":
|
case "AboutNetErrorSendReport":
|
||||||
this.onSendReport(aEvent);
|
this.onSendReport(aEvent);
|
||||||
break;
|
break;
|
||||||
|
case "AboutNetErrorUIExpanded":
|
||||||
|
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
|
||||||
|
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_EXPANDED});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -215,6 +226,10 @@ let AboutNetErrorListener = {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
|
||||||
|
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_UI_SHOWN});
|
||||||
|
|
||||||
if (automatic) {
|
if (automatic) {
|
||||||
this.onSendReport(evt);
|
this.onSendReport(evt);
|
||||||
}
|
}
|
||||||
|
@ -259,11 +274,15 @@ let AboutNetErrorListener = {
|
||||||
// show the retry button
|
// show the retry button
|
||||||
retryBtn.style.removeProperty("display");
|
retryBtn.style.removeProperty("display");
|
||||||
reportSendingMsg.style.display = "none";
|
reportSendingMsg.style.display = "none";
|
||||||
|
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
|
||||||
|
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_FAILURE});
|
||||||
break;
|
break;
|
||||||
case "complete":
|
case "complete":
|
||||||
// Show a success indicator
|
// Show a success indicator
|
||||||
reportSentMsg.style.removeProperty("display");
|
reportSentMsg.style.removeProperty("display");
|
||||||
reportSendingMsg.style.display = "none";
|
reportSendingMsg.style.display = "none";
|
||||||
|
sendAsyncMessage("Browser:SSLErrorReportTelemetry",
|
||||||
|
{reportStatus: TLS_ERROR_REPORT_TELEMETRY_SUCCESS});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,7 +303,7 @@ let AboutNetErrorListener = {
|
||||||
sendAsyncMessage("Browser:SendSSLErrorReport", {
|
sendAsyncMessage("Browser:SendSSLErrorReport", {
|
||||||
elementId: evt.target.id,
|
elementId: evt.target.id,
|
||||||
documentURI: contentDoc.documentURI,
|
documentURI: contentDoc.documentURI,
|
||||||
location: contentDoc.location,
|
location: {hostname: contentDoc.location.hostname, port: contentDoc.location.port},
|
||||||
securityInfo: serializedSecurityInfo
|
securityInfo: serializedSecurityInfo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7204,6 +7204,12 @@
|
||||||
"kind": "flag",
|
"kind": "flag",
|
||||||
"description": "a testing histogram; not meant to be touched"
|
"description": "a testing histogram; not meant to be touched"
|
||||||
},
|
},
|
||||||
|
"TLS_ERROR_REPORT_UI": {
|
||||||
|
"expires_in_version": "never",
|
||||||
|
"kind": "enumerated",
|
||||||
|
"n_values": 15,
|
||||||
|
"description": "User interaction with the TLS Error Reporter in about:neterror (0=Error seen, 1='auto' checked, 2='auto' unchecked, 3=Sent manually, 4=Sent automatically, 5=Send success, 6=Send failure, 7=Report section expanded)"
|
||||||
|
},
|
||||||
"CERT_OCSP_ENABLED": {
|
"CERT_OCSP_ENABLED": {
|
||||||
"expires_in_version": "never",
|
"expires_in_version": "never",
|
||||||
"kind": "boolean",
|
"kind": "boolean",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче