Bug 1028588 - Fix dangerous public destructors in uriloader - r=smaug

This commit is contained in:
Benoit Jacob 2014-06-23 14:49:09 -04:00
parent 5023541089
commit 6cbcf7b515
16 changed files with 36 additions and 19 deletions

View File

@ -31,9 +31,10 @@ public:
NS_DECL_ISUPPORTS
nsURILoader();
~nsURILoader();
protected:
~nsURILoader();
/**
* Equivalent to nsIURILoader::openChannel, but allows specifying whether the
* channel is opened already.

View File

@ -25,7 +25,6 @@ public:
NS_DECL_NSIREQUESTOBSERVER
ExternalHelperAppChild();
virtual ~ExternalHelperAppChild();
// Give the listener a real nsExternalAppHandler to complete processing on
// the child.
@ -33,6 +32,7 @@ public:
virtual bool RecvCancel(const nsresult& aStatus) MOZ_OVERRIDE;
private:
virtual ~ExternalHelperAppChild();
nsresult DivertToParent(nsIDivertableChannel *divertable, nsIRequest *request);
nsRefPtr<nsExternalAppHandler> mHandler;

View File

@ -19,9 +19,9 @@ public:
nsDBusHandlerApp() { }
protected:
virtual ~nsDBusHandlerApp() { }
protected:
nsString mName;
nsString mDetailedDescription;
nsCString mService;

View File

@ -65,7 +65,6 @@ public:
NS_DECL_NSIOBSERVER
nsExternalHelperAppService();
virtual ~nsExternalHelperAppService();
/**
* Initializes internal state. Will be called automatically when
@ -113,6 +112,8 @@ public:
bool *aExists) = 0;
protected:
virtual ~nsExternalHelperAppService();
/**
* Searches the "extra" array of MIMEInfo objects for an object
* with a specific type. If found, it will modify the passed-in
@ -226,14 +227,14 @@ public:
const nsAString& aFilename,
uint32_t aReason, bool aForceSave);
~nsExternalAppHandler();
/**
* Clean up after the request was diverted to the parent process.
*/
void DidDivertRequest(nsIRequest *request);
protected:
~nsExternalAppHandler();
nsCOMPtr<nsIFile> mTempFile;
nsCOMPtr<nsIURI> mSourceUrl;
nsString mTempFileExtension;

View File

@ -38,11 +38,12 @@ public:
NS_DECL_NSIREQUEST
nsExtProtocolChannel();
virtual ~nsExtProtocolChannel();
nsresult SetURI(nsIURI*);
private:
virtual ~nsExtProtocolChannel();
nsresult OpenURL();
void Finish(nsresult aResult);

View File

@ -25,9 +25,10 @@ public:
NS_DECL_NSIEXTERNALPROTOCOLHANDLER
nsExternalProtocolHandler();
~nsExternalProtocolHandler();
protected:
~nsExternalProtocolHandler();
// helper function
bool HaveExternalProtocolHandler(nsIURI * aURI);
nsCString m_schemeName;

View File

@ -26,9 +26,10 @@ public:
nsLocalHandlerApp(const nsAString & aName, nsIFile *aExecutable)
: mName(aName), mExecutable(aExecutable) { }
virtual ~nsLocalHandlerApp() { }
protected:
virtual ~nsLocalHandlerApp() { }
nsString mName;
nsString mDetailedDescription;
nsTArray<nsString> mParameters;

View File

@ -70,7 +70,6 @@ class nsMIMEInfoBase : public nsIMIMEInfo {
nsMIMEInfoBase(const char *aMIMEType = "");
nsMIMEInfoBase(const nsACString& aMIMEType);
nsMIMEInfoBase(const nsACString& aType, HandlerClass aClass);
virtual ~nsMIMEInfoBase(); // must be virtual, as the the base class's Release should call the subclass's destructor
void SetMIMEType(const nsACString & aMIMEType) { mSchemeOrType = aMIMEType; }
@ -92,6 +91,8 @@ class nsMIMEInfoBase : public nsIMIMEInfo {
bool HasExtensions() const { return mExtensions.Length() != 0; }
protected:
virtual ~nsMIMEInfoBase(); // must be virtual, as the the base class's Release should call the subclass's destructor
/**
* Launch the default application for the given file.
* For even more control over the launching, override launchWithFile.

View File

@ -42,11 +42,12 @@ public:
const bool& isUpgrade) MOZ_OVERRIDE;
OfflineCacheUpdateChild(nsIDOMWindow* aWindow);
~OfflineCacheUpdateChild();
void SetDocument(nsIDOMDocument *aDocument);
private:
~OfflineCacheUpdateChild();
nsresult AssociateDocument(nsIDOMDocument *aDocument,
nsIApplicationCache *aApplicationCache);
void GatherObservers(nsCOMArray<nsIOfflineCacheUpdateObserver> &aObservers);

View File

@ -60,11 +60,12 @@ public:
NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER
OfflineCacheUpdateGlue();
~OfflineCacheUpdateGlue();
void SetDocument(nsIDOMDocument *aDocument);
private:
~OfflineCacheUpdateGlue();
nsRefPtr<nsOfflineCacheUpdate> mUpdate;
/* Document that requested this update */

View File

@ -47,11 +47,12 @@ public:
}
OfflineCacheUpdateParent(uint32_t aAppId, bool aIsInBrowser);
~OfflineCacheUpdateParent();
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
private:
~OfflineCacheUpdateParent();
bool mIPCClosed;
bool mIsInBrowserElement;

View File

@ -142,6 +142,8 @@ public:
private:
~nsManifestCheck() {}
static NS_METHOD ReadManifest(nsIInputStream *aInputStream,
void *aClosure,
const char *aFromSegment,

View File

@ -58,7 +58,6 @@ public:
nsIApplicationCache *aApplicationCache,
nsIApplicationCache *aPreviousApplicationCache,
uint32_t aType);
virtual ~nsOfflineCacheUpdateItem();
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIURI> mReferrerURI;
@ -90,6 +89,8 @@ private:
uint16_t mState;
protected:
virtual ~nsOfflineCacheUpdateItem();
int64_t mBytesRead;
};
@ -206,7 +207,6 @@ public:
NS_DECL_NSIRUNNABLE
nsOfflineCacheUpdate();
~nsOfflineCacheUpdate();
static nsresult GetCacheKey(nsIURI *aURI, nsACString &aKey);
@ -226,6 +226,8 @@ public:
virtual nsresult UpdateFinished(nsOfflineCacheUpdate *aUpdate);
protected:
~nsOfflineCacheUpdate();
friend class nsOfflineCacheUpdateItem;
void OnByteProgress(uint64_t byteIncrement);
@ -328,7 +330,6 @@ public:
NS_DECL_NSIOBSERVER
nsOfflineCacheUpdateService();
~nsOfflineCacheUpdateService();
nsresult Init();
@ -365,6 +366,8 @@ public:
static nsTHashtable<nsCStringHashKey>* AllowedDomains();
private:
~nsOfflineCacheUpdateService();
nsresult ProcessNextUpdate();
nsTArray<nsRefPtr<nsOfflineCacheUpdate> > mUpdates;

View File

@ -150,6 +150,8 @@ public:
}
private:
~nsOfflineCachePendingUpdate() {}
nsRefPtr<nsOfflineCacheUpdateService> mService;
nsCOMPtr<nsIURI> mManifestURI;
nsCOMPtr<nsIURI> mDocumentURI;

View File

@ -75,9 +75,10 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
nsPrefetchQueueEnumerator(nsPrefetchService *aService);
~nsPrefetchQueueEnumerator();
private:
~nsPrefetchQueueEnumerator();
void Increment();
nsRefPtr<nsPrefetchService> mService;

View File

@ -99,8 +99,6 @@ public:
nsIURI *aReferrerURI,
nsIDOMNode *aSource);
~nsPrefetchNode() {}
nsresult OpenChannel();
nsresult CancelChannel(nsresult error);
@ -110,6 +108,8 @@ public:
nsCOMPtr<nsIWeakReference> mSource;
private:
~nsPrefetchNode() {}
nsRefPtr<nsPrefetchService> mService;
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsIChannel> mRedirectChannel;