bug 1034270 - expose the channel that failed to load to onAboutCertError in browser.js r=felipe

This commit is contained in:
David Keeler 2014-07-07 15:33:07 -07:00
Родитель d73c4453a2
Коммит 089ea7d66c
2 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -2313,7 +2313,8 @@ let BrowserOnClick = {
switch (msg.name) { switch (msg.name) {
case "Browser:CertExceptionError": case "Browser:CertExceptionError":
this.onAboutCertError(msg.target, msg.json.elementId, this.onAboutCertError(msg.target, msg.json.elementId,
msg.json.isTopFrame, msg.json.location); msg.json.isTopFrame, msg.json.location,
msg.objects.failedChannel);
break; break;
case "Browser:SiteBlockedError": case "Browser:SiteBlockedError":
this.onAboutBlocked(msg.json.elementId, msg.json.isMalware, this.onAboutBlocked(msg.json.elementId, msg.json.isMalware,
@ -2326,19 +2327,16 @@ let BrowserOnClick = {
} }
}, },
onAboutCertError: function (browser, elementId, isTopFrame, location) { onAboutCertError: function (browser, elementId, isTopFrame, location, failedChannel) {
let secHistogram = Services.telemetry.getHistogramById("SECURITY_UI"); let secHistogram = Services.telemetry.getHistogramById("SECURITY_UI");
switch (elementId) { switch (elementId) {
case "exceptionDialogButton": case "exceptionDialogButton":
let docshell = aOwnerDoc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
let securityInfo = docshell.failedChannel.securityInfo;
let sslStatus = securityInfo.QueryInterface(Ci.nsISSLStatusProvider).SSLStatus;
if (isTopFrame) { if (isTopFrame) {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CLICK_ADD_EXCEPTION); secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CLICK_ADD_EXCEPTION);
} }
let sslStatus = failedChannel.securityInfo.QueryInterface(Ci.nsISSLStatusProvider)
.SSLStatus;
let params = { exceptionAdded : false, let params = { exceptionAdded : false,
sslStatus : sslStatus }; sslStatus : sslStatus };

Просмотреть файл

@ -307,10 +307,15 @@ let ClickEventHandler = {
}, },
onAboutCertError: function (targetElement, ownerDoc) { onAboutCertError: function (targetElement, ownerDoc) {
let docshell = ownerDoc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
sendAsyncMessage("Browser:CertExceptionError", { sendAsyncMessage("Browser:CertExceptionError", {
location: ownerDoc.location.href, location: ownerDoc.location.href,
elementId: targetElement.getAttribute("id"), elementId: targetElement.getAttribute("id"),
isTopFrame: (ownerDoc.defaultView.parent === ownerDoc.defaultView) isTopFrame: (ownerDoc.defaultView.parent === ownerDoc.defaultView),
}, {
failedChannel: docshell.failedChannel
}); });
}, },