fx115: Fix detecting insecure connection no longer works
This commit is contained in:
parent
38287cec07
commit
c16f5d1524
1 changed files with 8 additions and 12 deletions
|
@ -5,6 +5,8 @@
|
||||||
Zotero.HTTP = new function() {
|
Zotero.HTTP = new function() {
|
||||||
var _errorDelayIntervals = [2500, 5000, 10000, 20000, 40000, 60000, 120000, 240000, 300000];
|
var _errorDelayIntervals = [2500, 5000, 10000, 20000, 40000, 60000, 120000, 240000, 300000];
|
||||||
var _errorDelayMax = 60 * 60 * 1000; // 1 hour
|
var _errorDelayMax = 60 * 60 * 1000; // 1 hour
|
||||||
|
|
||||||
|
var { SecurityInfo } = ChromeUtils.importESModule("resource://gre/modules/SecurityInfo.sys.mjs");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception returned for unexpected status when promise* is used
|
* Exception returned for unexpected status when promise* is used
|
||||||
|
@ -1260,15 +1262,14 @@ Zotero.HTTP = new function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let secInfo = channel.securityInfo;
|
let { state, errorMessage } = SecurityInfo.getSecurityInfo(channel);
|
||||||
|
|
||||||
let msg;
|
let msg;
|
||||||
let dialogButtonText;
|
let dialogButtonText;
|
||||||
let dialogButtonCallback;
|
let dialogButtonCallback;
|
||||||
if (secInfo instanceof Ci.nsITransportSecurityInfo) {
|
if (state !== 'secure') {
|
||||||
secInfo.QueryInterface(Ci.nsITransportSecurityInfo);
|
if (state === 'broken' || state === 'insecure') {
|
||||||
if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
|
msg = errorMessage ?? channel.securityInfo?.errorCodeString ?? '';
|
||||||
== Ci.nsIWebProgressListener.STATE_IS_INSECURE) {
|
|
||||||
msg = secInfo.errorCodeString;
|
|
||||||
if (channel.originalURI?.spec.includes(ZOTERO_CONFIG.DOMAIN_NAME)
|
if (channel.originalURI?.spec.includes(ZOTERO_CONFIG.DOMAIN_NAME)
|
||||||
|| channel.originalURI?.spec.includes(ZOTERO_CONFIG.PROXY_AUTH_URL.match(/^https:\/\/([^\/]+)\//)[1])) {
|
|| channel.originalURI?.spec.includes(ZOTERO_CONFIG.PROXY_AUTH_URL.match(/^https:\/\/([^\/]+)\//)[1])) {
|
||||||
msg = Zotero.getString('networkError.connectionMonitored', Zotero.appName)
|
msg = Zotero.getString('networkError.connectionMonitored', Zotero.appName)
|
||||||
|
@ -1283,10 +1284,6 @@ Zotero.HTTP = new function() {
|
||||||
Zotero.launchURL('https://www.zotero.org/support/kb/ssl_certificate_error');
|
Zotero.launchURL('https://www.zotero.org/support/kb/ssl_certificate_error');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
|
|
||||||
== Ci.nsIWebProgressListener.STATE_IS_BROKEN) {
|
|
||||||
msg = secInfo.errorCodeString;
|
|
||||||
}
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
throw new Zotero.HTTP.SecurityException(
|
throw new Zotero.HTTP.SecurityException(
|
||||||
msg,
|
msg,
|
||||||
|
@ -1301,8 +1298,7 @@ Zotero.HTTP = new function() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
async function _checkRetry(req) {
|
async function _checkRetry(req) {
|
||||||
var retryAfter = req.getResponseHeader("Retry-After");
|
var retryAfter = req.getResponseHeader("Retry-After");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue