Skip to content

Commit

Permalink
Bug 1056941 - Fix dangerous destructors in Fennec code; r=blassey
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Chen committed Aug 26, 2014
1 parent c8e5c6d commit 3dcbdea
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 19 deletions.
3 changes: 3 additions & 0 deletions dom/mobilemessage/src/android/MobileMessageDatabaseService.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ namespace mobilemessage {

class MobileMessageDatabaseService MOZ_FINAL : public nsIMobileMessageDatabaseService
{
private:
~MobileMessageDatabaseService() {}

public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILEMESSAGEDATABASESERVICE
Expand Down
3 changes: 3 additions & 0 deletions dom/mobilemessage/src/android/SmsService.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ namespace mobilemessage {

class SmsService MOZ_FINAL : public nsISmsService
{
private:
~SmsService() {}

public:
NS_DECL_ISUPPORTS
NS_DECL_NSISMSSERVICE
Expand Down
3 changes: 3 additions & 0 deletions dom/system/android/nsHapticFeedback.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class nsHapticFeedback MOZ_FINAL : public nsIHapticFeedback
{
private:
~nsHapticFeedback() {}

public:
NS_DECL_ISUPPORTS
NS_DECL_NSIHAPTICFEEDBACK
Expand Down
3 changes: 3 additions & 0 deletions gfx/thebes/gfxAndroidPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ static FT_Library gPlatformFTLibrary = nullptr;
class FreetypeReporter MOZ_FINAL : public nsIMemoryReporter,
public CountingAllocatorBase<FreetypeReporter>
{
private:
~FreetypeReporter() {}

public:
NS_DECL_ISUPPORTS

Expand Down
4 changes: 3 additions & 1 deletion image/decoders/icon/android/nsIconChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ class nsIconChannel MOZ_FINAL : public nsIChannel {
NS_FORWARD_NSICHANNEL(mRealChannel->)

nsIconChannel() {}
~nsIconChannel() {}

/**
* Called by nsIconProtocolHandler after it creates this channel.
* Must be called before calling any other function on this object.
* If this method fails, no other function must be called on this object.
*/
nsresult Init(nsIURI* aURI);

private:
~nsIconChannel() {}

/**
* The channel to the temp icon file (e.g. to /tmp/2qy9wjqw.html).
* Will always be non-null after a successful Init.
Expand Down
5 changes: 2 additions & 3 deletions mobile/android/components/build/nsShellService.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ class nsShellService MOZ_FINAL : public nsIShellService
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE

nsShellService() {};
nsShellService() {}

private:
~nsShellService() {};

~nsShellService() {}
};

#define nsShellService_CID \
Expand Down
4 changes: 2 additions & 2 deletions netwerk/base/src/Tickler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ class TicklerTimer MOZ_FINAL : public nsITimerCallback
mTickler = do_GetWeakReference(aTickler);
}

~TicklerTimer() {};

private:
~TicklerTimer() {}

nsWeakPtr mTickler;
};

Expand Down
8 changes: 6 additions & 2 deletions netwerk/protocol/device/AndroidCaptureProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
#include "mozilla/ReentrantMonitor.h"

class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
private:
~AndroidCaptureProvider();

public:
AndroidCaptureProvider();
~AndroidCaptureProvider();

NS_DECL_THREADSAFE_ISUPPORTS

Expand All @@ -28,9 +30,11 @@ class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
};

class AndroidCameraInputStream MOZ_FINAL : public nsIAsyncInputStream, mozilla::net::CameraStreamImpl::FrameCallback {
private:
~AndroidCameraInputStream();

public:
AndroidCameraInputStream();
~AndroidCameraInputStream();

NS_IMETHODIMP Init(nsACString& aContentType, nsCaptureParams* aParams);

Expand Down
2 changes: 2 additions & 0 deletions netwerk/system/android/nsAndroidNetworkLinkService.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class nsAndroidNetworkLinkService: public nsINetworkLinkService
NS_DECL_NSINETWORKLINKSERVICE

nsAndroidNetworkLinkService();

private:
virtual ~nsAndroidNetworkLinkService();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class nsAndroidSystemProxySettings : public nsISystemProxySettings
nsresult Init();

private:
~nsAndroidSystemProxySettings() {};
virtual ~nsAndroidSystemProxySettings() {}
};

NS_IMPL_ISUPPORTS(nsAndroidSystemProxySettings, nsISystemProxySettings)
Expand Down
4 changes: 2 additions & 2 deletions uriloader/exthandler/android/nsAndroidHandlerApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class nsAndroidHandlerApp : public nsISharingHandlerApp {
NS_DECL_NSIHANDLERAPP
NS_DECL_NSISHARINGHANDLERAPP

public:
nsAndroidHandlerApp(const nsAString& aName, const nsAString& aDescription,
const nsAString& aPackageName,
const nsAString& aClassName,
const nsACString& aMimeType, const nsAString& aAction);
virtual ~nsAndroidHandlerApp();

private:
virtual ~nsAndroidHandlerApp();

nsString mName;
nsString mDescription;
nsString mPackageName;
Expand Down
14 changes: 9 additions & 5 deletions uriloader/exthandler/android/nsMIMEInfoAndroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class nsMIMEInfoAndroid MOZ_FINAL : public nsIMIMEInfo

nsMIMEInfoAndroid(const nsACString& aMIMEType);

protected:
private:
~nsMIMEInfoAndroid() {}

virtual nsresult LaunchDefaultWithFile(nsIFile* aFile);
virtual nsresult LoadUriInternal(nsIURI *aURI);
nsCOMPtr<nsIMutableArray> mHandlerApps;
Expand All @@ -40,16 +42,18 @@ class nsMIMEInfoAndroid MOZ_FINAL : public nsIMIMEInfo
nsHandlerInfoAction mPrefAction;
nsString mDescription;
nsCOMPtr<nsIHandlerApp> mPrefApp;


public:
class SystemChooser MOZ_FINAL : public nsIHandlerApp {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIHANDLERAPP
SystemChooser(nsMIMEInfoAndroid* aOuter): mOuter(aOuter) {};
SystemChooser(nsMIMEInfoAndroid* aOuter): mOuter(aOuter) {}

private:
~SystemChooser() {}

nsMIMEInfoAndroid* mOuter;

};
};

Expand Down
4 changes: 4 additions & 0 deletions widget/android/GfxInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ GfxInfo::GfxInfo()
{
}

GfxInfo::~GfxInfo()
{
}

/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
* has occurred because they depend on it for information. (See bug 591561) */
nsresult
Expand Down
3 changes: 3 additions & 0 deletions widget/android/GfxInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ namespace widget {

class GfxInfo : public GfxInfoBase
{
private:
~GfxInfo();

public:
GfxInfo();

Expand Down
4 changes: 4 additions & 0 deletions widget/android/nsAndroidProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ class AndroidInputStream : public nsIInputStream
mBridgeInputStream = env->NewGlobalRef(GeckoAppShell::CreateInputStream(connection));
mBridgeChannel = env->NewGlobalRef(AndroidBridge::ChannelCreate(mBridgeInputStream));
}

private:
virtual ~AndroidInputStream() {
JNIEnv *env = GetJNIForThread();
env->DeleteGlobalRef(mBridgeInputStream);
env->DeleteGlobalRef(mBridgeChannel);
}

public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIINPUTSTREAM

Expand Down
2 changes: 2 additions & 0 deletions widget/android/nsAndroidProtocolHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class nsAndroidProtocolHandler MOZ_FINAL : public nsIProtocolHandler,

// nsAndroidProtocolHandler methods:
nsAndroidProtocolHandler() {}

private:
~nsAndroidProtocolHandler() {}
};

Expand Down
5 changes: 4 additions & 1 deletion widget/android/nsAppShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ class ThumbnailRunnable : public nsRunnable {
};

class WakeLockListener MOZ_FINAL : public nsIDOMMozWakeLockListener {
public:
private:
~WakeLockListener() {}

public:
NS_DECL_ISUPPORTS;

nsresult Callback(const nsAString& topic, const nsAString& state) {
Expand Down
3 changes: 3 additions & 0 deletions widget/android/nsClipboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

class nsClipboard MOZ_FINAL : public nsIClipboard
{
private:
~nsClipboard() {}

public:
NS_DECL_ISUPPORTS
NS_DECL_NSICLIPBOARD
Expand Down
3 changes: 3 additions & 0 deletions widget/android/nsDeviceContextAndroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class nsDeviceContextSpecAndroid MOZ_FINAL : public nsIDeviceContextSpec
{
private:
~nsDeviceContextSpecAndroid() {}

public:
NS_DECL_ISUPPORTS

Expand Down
4 changes: 3 additions & 1 deletion widget/android/nsScreenManagerAndroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ class nsScreenAndroid MOZ_FINAL : public nsBaseScreen

class nsScreenManagerAndroid MOZ_FINAL : public nsIScreenManager
{
private:
~nsScreenManagerAndroid();

public:
nsScreenManagerAndroid();
~nsScreenManagerAndroid();

NS_DECL_ISUPPORTS
NS_DECL_NSISCREENMANAGER
Expand Down
4 changes: 4 additions & 0 deletions widget/android/nsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ static StaticRefPtr<ContentCreationNotifier> gContentCreationNotifier;
// are created. Currently an update for the screen size is sent.
class ContentCreationNotifier MOZ_FINAL : public nsIObserver
{
private:
~ContentCreationNotifier() {}

public:
NS_DECL_ISUPPORTS

NS_IMETHOD Observe(nsISupports* aSubject,
Expand Down
4 changes: 3 additions & 1 deletion widget/android/nsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ namespace mozilla {
class nsWindow :
public nsBaseWidget
{
private:
virtual ~nsWindow();

public:
using nsBaseWidget::GetLayerManager;

nsWindow();
virtual ~nsWindow();

NS_DECL_ISUPPORTS_INHERITED

Expand Down

0 comments on commit 3dcbdea

Please sign in to comment.