From 302bf1b523012e11b60425d6eee1221ebc2724eb Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 3 Nov 2019 00:17:46 -0400 Subject: Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1 --- .../content/accountcreation/MyBadCertHandler.js | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 mailnews/base/prefs/content/accountcreation/MyBadCertHandler.js (limited to 'mailnews/base/prefs/content/accountcreation/MyBadCertHandler.js') diff --git a/mailnews/base/prefs/content/accountcreation/MyBadCertHandler.js b/mailnews/base/prefs/content/accountcreation/MyBadCertHandler.js new file mode 100644 index 000000000..9f4c5034e --- /dev/null +++ b/mailnews/base/prefs/content/accountcreation/MyBadCertHandler.js @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This class implements nsIBadCertListener. It's job is to prevent "bad cert" + * security dialogs from being shown to the user. We call back to the + * 'callback' object's method "processCertError" so that it can deal with it as + * needed (in the case of autoconfig, setting up temporary overrides). + */ +function BadCertHandler(callback) +{ + this._init(callback); +} + +BadCertHandler.prototype = +{ + _init: function(callback) { + this._callback = callback; + }, + + // Suppress any certificate errors + notifyCertProblem: function(socketInfo, status, targetSite) { + return this._callback.processCertError(socketInfo, status, targetSite); + }, + + // nsIInterfaceRequestor + getInterface: function(iid) { + return this.QueryInterface(iid); + }, + + // nsISupports + QueryInterface: function(iid) { + if (!iid.equals(Components.interfaces.nsIBadCertListener2) && + !iid.equals(Components.interfaces.nsIInterfaceRequestor) && + !iid.equals(Components.interfaces.nsISupports)) + throw Components.results.NS_ERROR_NO_INTERFACE; + return this; + } +}; -- cgit v1.2.3