gecko/content/base/src/nsBadCertHandler.js
Kyle Huey 45adfbf2c8 Bug 798491: Add an option to stick all chrome JSMs/JS components in the same compartment. r=mrbkap,philikon
--HG--
extra : rebase_source : 98337b6a8c07d05e8c961a452dd05a7d75c3c60b
2012-10-31 09:13:28 -07:00

46 lines
1.3 KiB
JavaScript

/* 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/. */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
/**
* This component's job is to prevent "bad cert" security dialogs from
* being shown to the user when in XHR backgroundRequest mode. This
* causes the request to simply fail if the certificate is bad.
*/
function BadCertHandler() {
}
BadCertHandler.prototype = {
// Suppress any certificate errors
notifyCertProblem: function(socketInfo, status, targetSite) {
return true;
},
// Suppress any ssl errors
notifySSLError: function(socketInfo, error, targetSite) {
return true;
},
// nsIInterfaceRequestor
getInterface: function(iid) {
return this.QueryInterface(iid);
},
// nsISupports
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBadCertListener2,
Ci.nsISSLErrorListener,
Ci.nsIInterfaceRequestor]),
classID: Components.ID("{dbded6ec-edbf-4054-a834-287b82c260f9}"),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([BadCertHandler]);