bug 750421 - remove unnecessary nsIBadCertListener2 and nsISSLErrorListener implementations r=mayhemer r=mounir r=dolske

This commit is contained in:
Brian Smith 2013-03-06 11:25:03 -08:00
parent 4e28d37be4
commit 13bcb99fd4
16 changed files with 2 additions and 184 deletions

View File

@ -432,8 +432,6 @@
@BINPATH@/components/nsHandlerService.js
@BINPATH@/components/nsWebHandlerApp.manifest
@BINPATH@/components/nsWebHandlerApp.js
@BINPATH@/components/nsBadCertHandler.manifest
@BINPATH@/components/nsBadCertHandler.js
@BINPATH@/components/satchel.manifest
@BINPATH@/components/nsFormAutoComplete.js
@BINPATH@/components/nsFormHistory.js

View File

@ -420,8 +420,6 @@
@BINPATH@/components/nsHandlerService.js
@BINPATH@/components/nsWebHandlerApp.manifest
@BINPATH@/components/nsWebHandlerApp.js
@BINPATH@/components/nsBadCertHandler.manifest
@BINPATH@/components/nsBadCertHandler.js
@BINPATH@/components/satchel.manifest
@BINPATH@/components/nsFormAutoComplete.js
@BINPATH@/components/nsFormHistory.js

View File

@ -167,8 +167,6 @@ GQI_SRCS = contentbase.gqi
FORCE_STATIC_LIB = 1
EXTRA_COMPONENTS = \
$(srcdir)/nsBadCertHandler.js \
nsBadCertHandler.manifest \
contentSecurityPolicy.manifest \
contentAreaDropListener.js \
contentAreaDropListener.manifest \

View File

@ -1,45 +0,0 @@
/* 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]);

View File

@ -1,2 +0,0 @@
component {dbded6ec-edbf-4054-a834-287b82c260f9} nsBadCertHandler.js
contract @mozilla.org/content/xmlhttprequest-bad-cert-handler;1 {dbded6ec-edbf-4054-a834-287b82c260f9}

View File

@ -336,8 +336,6 @@
@BINPATH@/components/nsHandlerService.js
@BINPATH@/components/nsWebHandlerApp.manifest
@BINPATH@/components/nsWebHandlerApp.js
@BINPATH@/components/nsBadCertHandler.manifest
@BINPATH@/components/nsBadCertHandler.js
@BINPATH@/components/satchel.manifest
@BINPATH@/components/nsFormAutoComplete.js
@BINPATH@/components/nsFormHistory.js

View File

@ -103,9 +103,6 @@ this.NetUtil = {
* @param aSource
* The nsIURI, nsIFile, string spec, nsIChannel, or nsIInputStream
* to open.
* Note: If passing an nsIChannel whose notificationCallbacks is
* already set, callers are responsible for implementations
* of nsIBadCertListener/nsISSLErrorListener.
* @param aCallback
* The callback function that will be notified upon completion. It
* will get two arguments:
@ -155,13 +152,6 @@ this.NetUtil = {
channel = this.newChannel(aSource);
}
// Add a BadCertHandler to suppress SSL/cert error dialogs, but only if
// the channel doesn't already have a notificationCallbacks.
if (!channel.notificationCallbacks) {
// Pass true to avoid optional redirect-cert-checking behavior.
channel.notificationCallbacks = new BadCertHandler(true);
}
channel.asyncOpen(listener, null);
},
@ -339,9 +329,3 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
// Define our lazy getters.
XPCOMUtils.defineLazyServiceGetter(this, "ioUtil", "@mozilla.org/io-util;1",
"nsIIOUtil");
XPCOMUtils.defineLazyGetter(this, "BadCertHandler", function () {
var obj = {};
Cu.import("resource://gre/modules/CertUtils.jsm", obj);
return obj.BadCertHandler;
});

View File

@ -13,7 +13,6 @@
#include "nsNetUtil.h"
#include "nsISupportsPriority.h"
#include "nsIAuthPromptProvider.h"
#include "nsIBadCertListener2.h"
#include "nsICacheEntryDescriptor.h"
#include "nsSerializationHelper.h"
#include "nsISerializable.h"

View File

@ -14,7 +14,6 @@
#include "nsNetUtil.h"
#include "nsISupportsPriority.h"
#include "nsIAuthPromptProvider.h"
#include "nsIBadCertListener2.h"
#include "nsICacheEntryDescriptor.h"
#include "nsSerializationHelper.h"
#include "nsISerializable.h"

View File

@ -997,18 +997,6 @@ LivemarkLoadListener.prototype = {
this._livemark.expireTime = Date.now() + aMilliseconds;
},
// nsIBadCertListener2
notifyCertProblem: function LLL_certProblem(aSocketInfo, aStatus, aTargetSite)
{
return true;
},
// nsISSLErrorListener
notifySSLError: function LLL_SSLError(aSocketInfo, aError, aTargetSite)
{
return true;
},
// nsIInterfaceRequestor
getInterface: function LLL_getInterface(aIID)
{
@ -1020,8 +1008,6 @@ LivemarkLoadListener.prototype = {
Ci.nsIFeedResultListener
, Ci.nsIStreamListener
, Ci.nsIRequestObserver
, Ci.nsIBadCertListener2
, Ci.nsISSLErrorListener
, Ci.nsIInterfaceRequestor
])
}

View File

@ -386,8 +386,6 @@ loadListener.prototype = {
aIID.equals(Ci.nsIStreamListener) ||
aIID.equals(Ci.nsIChannelEventSink) ||
aIID.equals(Ci.nsIInterfaceRequestor) ||
aIID.equals(Ci.nsIBadCertListener2) ||
aIID.equals(Ci.nsISSLErrorListener) ||
// See FIXME comment below
aIID.equals(Ci.nsIHttpEventSink) ||
aIID.equals(Ci.nsIProgressEventSink) ||
@ -444,16 +442,6 @@ loadListener.prototype = {
return this.QueryInterface(aIID);
},
// nsIBadCertListener2
notifyCertProblem: function SRCH_certProblem(socketInfo, status, targetSite) {
return true;
},
// nsISSLErrorListener
notifySSLError: function SRCH_SSLError(socketInfo, error, targetSite) {
return true;
},
// FIXME: bug 253127
// nsIHttpEventSink
onRedirect: function (aChannel, aNewChannel) {},

View File

@ -464,7 +464,6 @@ SuggestAutoComplete.prototype = {
this._suggestURI = submission.uri;
var method = (submission.postData ? "POST" : "GET");
this._request.open(method, this._suggestURI.spec, true);
this._request.channel.notificationCallbacks = new SearchSuggestLoadListener();
if (this._request.channel instanceof Ci.nsIPrivateBrowsingChannel) {
this._request.channel.setPrivate(privacyMode);
}
@ -524,30 +523,6 @@ SuggestAutoComplete.prototype = {
Ci.nsIAutoCompleteObserver])
};
function SearchSuggestLoadListener() {
}
SearchSuggestLoadListener.prototype = {
// nsIBadCertListener2
notifyCertProblem: function SSLL_certProblem(socketInfo, status, targetSite) {
return true;
},
// nsISSLErrorListener
notifySSLError: function SSLL_SSLError(socketInfo, error, targetSite) {
return true;
},
// nsIInterfaceRequestor
getInterface: function SSLL_getInterface(iid) {
return this.QueryInterface(iid);
},
// nsISupports
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBadCertListener2,
Ci.nsISSLErrorListener,
Ci.nsIInterfaceRequestor])
};
/**
* SearchSuggestAutoComplete is a service implementation that handles suggest
* results specific to web searches.

View File

@ -112,25 +112,13 @@ PROT_XMLFetcher.prototype = {
fetcher._callback(responseText, status);
},
// 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);
},
QueryInterface: function(iid) {
if (!iid.equals(Components.interfaces.nsIBadCertListener2) &&
!iid.equals(Components.interfaces.nsISSLErrorListener) &&
!iid.equals(Components.interfaces.nsIInterfaceRequestor) &&
if (!iid.equals(Components.interfaces.nsIInterfaceRequestor) &&
!iid.equals(Components.interfaces.nsISupports))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;

View File

@ -42,14 +42,12 @@ nsUrlClassifierStreamUpdater::nsUrlClassifierStreamUpdater()
}
NS_IMPL_THREADSAFE_ISUPPORTS9(nsUrlClassifierStreamUpdater,
NS_IMPL_THREADSAFE_ISUPPORTS7(nsUrlClassifierStreamUpdater,
nsIUrlClassifierStreamUpdater,
nsIUrlClassifierUpdateObserver,
nsIRequestObserver,
nsIStreamListener,
nsIObserver,
nsIBadCertListener2,
nsISSLErrorListener,
nsIInterfaceRequestor,
nsITimerCallback)
@ -525,32 +523,6 @@ nsUrlClassifierStreamUpdater::Observe(nsISupports *aSubject, const char *aTopic,
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// nsIBadCertListener2 implementation
NS_IMETHODIMP
nsUrlClassifierStreamUpdater::NotifyCertProblem(nsIInterfaceRequestor *socketInfo,
nsISSLStatus *status,
const nsACString &targetSite,
bool *_retval)
{
*_retval = true;
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// nsISSLErrorListener implementation
NS_IMETHODIMP
nsUrlClassifierStreamUpdater::NotifySSLError(nsIInterfaceRequestor *socketInfo,
int32_t error,
const nsACString &targetSite,
bool *_retval)
{
*_retval = true;
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// nsIInterfaceRequestor implementation

View File

@ -14,8 +14,6 @@
#include "nsIStreamListener.h"
#include "nsNetUtil.h"
#include "nsTArray.h"
#include "nsIBadCertListener2.h"
#include "nsISSLErrorListener.h"
#include "nsITimer.h"
#include "mozilla/Attributes.h"
@ -26,8 +24,6 @@ class nsUrlClassifierStreamUpdater MOZ_FINAL : public nsIUrlClassifierStreamUpda
public nsIUrlClassifierUpdateObserver,
public nsIStreamListener,
public nsIObserver,
public nsIBadCertListener2,
public nsISSLErrorListener,
public nsIInterfaceRequestor,
public nsITimerCallback
{
@ -40,8 +36,6 @@ public:
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSIBADCERTLISTENER2
NS_DECL_NSISSLERRORLISTENER
NS_DECL_NSIOBSERVER
NS_DECL_NSITIMERCALLBACK

View File

@ -209,16 +209,6 @@ BadCertHandler.prototype = {
callback.onRedirectVerifyCallback(Components.results.NS_OK);
},
// 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);
@ -227,8 +217,6 @@ BadCertHandler.prototype = {
// nsISupports
QueryInterface: function(iid) {
if (!iid.equals(Ci.nsIChannelEventSink) &&
!iid.equals(Ci.nsIBadCertListener2) &&
!iid.equals(Ci.nsISSLErrorListener) &&
!iid.equals(Ci.nsIInterfaceRequestor) &&
!iid.equals(Ci.nsISupports))
throw Cr.NS_ERROR_NO_INTERFACE;