Bug 954534 - Use Firefox untrusted cert dialog for "SSL Handshake failed" errors: instantbird/ part, r=florian.

This commit is contained in:
Patrick Cloke 2013-04-10 22:49:24 -04:00
Родитель 7c994c36f0
Коммит dedf7de3d7
3 изменённых файлов: 32 добавлений и 2 удалений

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

@ -6,7 +6,9 @@
<!DOCTYPE bindings [ <!DOCTYPE bindings [
<!ENTITY % accountsDTD SYSTEM "chrome://instantbird/locale/accounts.dtd"> <!ENTITY % accountsDTD SYSTEM "chrome://instantbird/locale/accounts.dtd">
<!ENTITY % certManagerDTD SYSTEM "chrome://pippki/locale/certManager.dtd">
%accountsDTD; %accountsDTD;
%certManagerDTD;
]> ]>
<bindings id="accountBindings" <bindings id="accountBindings"
@ -25,7 +27,7 @@
</xul:stack> </xul:stack>
<xul:spacer flex="1"/> <xul:spacer flex="1"/>
</xul:vbox> </xul:vbox>
<xul:vbox flex="1"> <xul:vbox flex="1" align="start">
<xul:label xbl:inherits="value=name" crop="end" class="accountName"/> <xul:label xbl:inherits="value=name" crop="end" class="accountName"/>
<xul:label class="connecting" crop="end" anonid="connecting" value="&account.connecting;"/> <xul:label class="connecting" crop="end" anonid="connecting" value="&account.connecting;"/>
<xul:label class="connected" crop="end" anonid="connected"/> <xul:label class="connected" crop="end" anonid="connected"/>
@ -33,6 +35,10 @@
<xul:label class="disconnected" crop="end" value="&account.disconnected;"/> <xul:label class="disconnected" crop="end" value="&account.disconnected;"/>
<xul:description class="error" anonid="error"/> <xul:description class="error" anonid="error"/>
<xul:description class="error" anonid="reconnect"/> <xul:description class="error" anonid="reconnect"/>
<xul:label class="addException text-link"
onclick="gAccountManager.addException()"
value="&certmgr.addException.label;"
accesskey="&certmgr.addException.accesskey;"/>
<xul:spacer flex="1"/> <xul:spacer flex="1"/>
</xul:vbox> </xul:vbox>
<xul:checkbox label="&account.autoSignOn.label;" dir="reverse" <xul:checkbox label="&account.autoSignOn.label;" dir="reverse"
@ -63,8 +69,10 @@
state = "disconnected"; state = "disconnected";
if (this._account.connectionErrorReason != Ci.prplIAccount.NO_ERROR) if (this._account.connectionErrorReason != Ci.prplIAccount.NO_ERROR)
this.updateConnectionError(); this.updateConnectionError();
else else {
this.removeAttribute("error"); this.removeAttribute("error");
this.removeAttribute("certError");
}
} else if (this._account.connecting) { } else if (this._account.connecting) {
state = "connecting"; state = "connecting";
this.updateConnectionState(); this.updateConnectionState();
@ -91,6 +99,8 @@
progress.setAttribute("value", text); progress.setAttribute("value", text);
if (this.reconnectUpdateInterval) if (this.reconnectUpdateInterval)
this._cancelReconnectTimer(); this._cancelReconnectTimer();
this.removeAttribute("certError");
]]> ]]>
</body> </body>
</method> </method>
@ -117,6 +127,10 @@
text = bundle.getFormattedString(key, [text]); text = bundle.getFormattedString(key, [text]);
this.setAttribute("error", "true"); this.setAttribute("error", "true");
if ((Ci.imIAccount.ERROR_CERT_NOT_PROVIDED <= errorReason &&
errorReason <= Ci.imIAccount.ERROR_CERT_OTHER_ERROR) &&
account.prplAccount.connectionTarget)
this.setAttribute("certError", "true");
var error = document.getAnonymousElementByAttribute(this, "anonid", var error = document.getAnonymousElementByAttribute(this, "anonid",
"error"); "error");
error.textContent = text; error.textContent = text;

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

@ -24,6 +24,8 @@ richlistitem[error="true"] .disconnected,
richlistitem[selected="true"]:not([state="disconnected"]) .connectButton, richlistitem[selected="true"]:not([state="disconnected"]) .connectButton,
richlistitem[selected="true"][state="disconnected"] .disconnectButton, richlistitem[selected="true"][state="disconnected"] .disconnectButton,
richlistitem[selected="true"][state="disconnecting"] .disconnectButton, richlistitem[selected="true"][state="disconnecting"] .disconnectButton,
richlistitem[selected="true"]:not([certError="true"]) .addException,
richlistitem:not([selected="true"]) .addException,
richlistitem:not([selected="true"]) .autoSignOn, richlistitem:not([selected="true"]) .autoSignOn,
richlistitem:not([reconnectPending="true"]) description[anonid="reconnect"] richlistitem:not([reconnectPending="true"]) description[anonid="reconnect"]
{ {

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

@ -207,6 +207,20 @@ var gAccountManager = {
account.disconnect(); account.disconnect();
} }
}, },
addException: function am_addException() {
let account = this.accountList.selectedItem.account;
if (!account.disconnected || !account.prplAccount.connectionTarget)
return;
// Open the Gecko SSL exception dialog.
let params = {exceptionAdded: false, prefetchCert: true,
location: account.prplAccount.connectionTarget};
window.openDialog("chrome://pippki/content/exceptionDialog.xul", "",
"chrome,centerscreen,modal", params);
// Reconnect the account if an exception was added.
if (params.exceptionAdded)
account.connect();
},
copyDebugLog: function am_copyDebugLog() { copyDebugLog: function am_copyDebugLog() {
let account = this.accountList.selectedItem.account; let account = this.accountList.selectedItem.account;
let text = account.getDebugMessages().map(function(dbgMsg) { let text = account.getDebugMessages().map(function(dbgMsg) {