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
parent 813a9b991b
commit da89cee2be
2 changed files with 11 additions and 8 deletions

View File

@ -2313,7 +2313,8 @@ let BrowserOnClick = {
switch (msg.name) {
case "Browser:CertExceptionError":
this.onAboutCertError(msg.target, msg.json.elementId,
msg.json.isTopFrame, msg.json.location);
msg.json.isTopFrame, msg.json.location,
msg.objects.failedChannel);
break;
case "Browser:SiteBlockedError":
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");
switch (elementId) {
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) {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_CLICK_ADD_EXCEPTION);
}
let sslStatus = failedChannel.securityInfo.QueryInterface(Ci.nsISSLStatusProvider)
.SSLStatus;
let params = { exceptionAdded : false,
sslStatus : sslStatus };

View File

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