Bug 1231378 - part 2 - Fix uninitialized members of classes in dom/*, r=smaug

This commit is contained in:
Andrea Marchesini 2016-01-12 18:16:59 +00:00
parent 40339f259e
commit da5c7a3c74
22 changed files with 118 additions and 17 deletions

View File

@ -33,6 +33,10 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIALARMHALSERVICE NS_DECL_NSIALARMHALSERVICE
AlarmHalService()
: mAlarmEnabled(false)
{}
void Init(); void Init();
static already_AddRefed<AlarmHalService> GetInstance(); static already_AddRefed<AlarmHalService> GetInstance();

View File

@ -27,7 +27,8 @@ namespace dom {
using namespace workers; using namespace workers;
BroadcastChannelChild::BroadcastChannelChild(const nsACString& aOrigin) BroadcastChannelChild::BroadcastChannelChild(const nsACString& aOrigin)
: mActorDestroyed(false) : mBC(nullptr)
, mActorDestroyed(false)
{ {
CopyUTF8toUTF16(aOrigin, mOrigin); CopyUTF8toUTF16(aOrigin, mOrigin);
} }

View File

@ -79,6 +79,8 @@ public:
const nsAString& aManifestURL, const nsAString& aManifestURL,
bool aReadOnly, bool aReadOnly,
bool aEnabled) bool aEnabled)
: mReadOnly(true)
, mEnabled(false)
{ {
Init(aName, aOriginURL, aManifestURL, aReadOnly, aEnabled); Init(aName, aOriginURL, aManifestURL, aReadOnly, aEnabled);
} }

View File

@ -86,7 +86,6 @@ InternalRequest::InternalRequest(const InternalRequest& aOther)
, mForceOriginHeader(aOther.mForceOriginHeader) , mForceOriginHeader(aOther.mForceOriginHeader)
, mPreserveContentCodings(aOther.mPreserveContentCodings) , mPreserveContentCodings(aOther.mPreserveContentCodings)
, mSameOriginDataURL(aOther.mSameOriginDataURL) , mSameOriginDataURL(aOther.mSameOriginDataURL)
, mSandboxedStorageAreaURLs(aOther.mSandboxedStorageAreaURLs)
, mSkipServiceWorker(aOther.mSkipServiceWorker) , mSkipServiceWorker(aOther.mSkipServiceWorker)
, mSynchronous(aOther.mSynchronous) , mSynchronous(aOther.mSynchronous)
, mUnsafeRequest(aOther.mUnsafeRequest) , mUnsafeRequest(aOther.mUnsafeRequest)

View File

@ -91,6 +91,7 @@ public:
explicit InternalRequest() explicit InternalRequest()
: mMethod("GET") : mMethod("GET")
, mHeaders(new InternalHeaders(HeadersGuardEnum::None)) , mHeaders(new InternalHeaders(HeadersGuardEnum::None))
, mContentPolicyType(nsIContentPolicy::TYPE_FETCH)
, mReferrer(NS_LITERAL_STRING(kFETCH_CLIENT_REFERRER_STR)) , mReferrer(NS_LITERAL_STRING(kFETCH_CLIENT_REFERRER_STR))
, mMode(RequestMode::No_cors) , mMode(RequestMode::No_cors)
, mCredentialsMode(RequestCredentials::Omit) , mCredentialsMode(RequestCredentials::Omit)
@ -413,7 +414,6 @@ private:
bool mForceOriginHeader; bool mForceOriginHeader;
bool mPreserveContentCodings; bool mPreserveContentCodings;
bool mSameOriginDataURL; bool mSameOriginDataURL;
bool mSandboxedStorageAreaURLs;
bool mSkipServiceWorker; bool mSkipServiceWorker;
bool mSynchronous; bool mSynchronous;
bool mUnsafeRequest; bool mUnsafeRequest;

View File

@ -102,7 +102,14 @@ public:
inline const nsString& GetOrigin() const { return mOrigin; } inline const nsString& GetOrigin() const { return mOrigin; }
private: private:
GeolocationSetting() {} // can't default construct GeolocationSetting() :
#ifdef MOZ_APPROX_LOCATION
mDistance(0),
#endif
mLatitude(0),
mLongitude(0)
{} // can't default construct
GeolocationFuzzMethod mFuzzMethod; GeolocationFuzzMethod mFuzzMethod;
#ifdef MOZ_APPROX_LOCATION #ifdef MOZ_APPROX_LOCATION
int32_t mDistance; int32_t mDistance;

View File

@ -51,6 +51,13 @@ NS_DEFINE_IID(kIDBRequestIID, PRIVATE_IDBREQUEST_IID);
IDBRequest::IDBRequest(IDBDatabase* aDatabase) IDBRequest::IDBRequest(IDBDatabase* aDatabase)
: IDBWrapperCache(aDatabase) : IDBWrapperCache(aDatabase)
#ifdef DEBUG
, mOwningThread(nullptr)
#endif
, mLoggingSerialNumber(0)
, mLineNo(0)
, mColumn(0)
, mHaveResultOrErrorCode(false)
{ {
MOZ_ASSERT(aDatabase); MOZ_ASSERT(aDatabase);
aDatabase->AssertIsOnOwningThread(); aDatabase->AssertIsOnOwningThread();
@ -60,6 +67,13 @@ IDBRequest::IDBRequest(IDBDatabase* aDatabase)
IDBRequest::IDBRequest(nsPIDOMWindow* aOwner) IDBRequest::IDBRequest(nsPIDOMWindow* aOwner)
: IDBWrapperCache(aOwner) : IDBWrapperCache(aOwner)
#ifdef DEBUG
, mOwningThread(nullptr)
#endif
, mLoggingSerialNumber(0)
, mLineNo(0)
, mColumn(0)
, mHaveResultOrErrorCode(false)
{ {
InitMembers(); InitMembers();
} }

View File

@ -19,7 +19,7 @@ class MessagePortChild final : public PMessagePortChild
public: public:
NS_INLINE_DECL_REFCOUNTING(MessagePortChild) NS_INLINE_DECL_REFCOUNTING(MessagePortChild)
MessagePortChild() {} MessagePortChild() : mPort(nullptr) {}
void SetPort(MessagePort* aPort) void SetPort(MessagePort* aPort)
{ {

View File

@ -27,7 +27,13 @@ public:
private: private:
// Don't try to use the default constructor. // Don't try to use the default constructor.
MobileCallForwardingOptions() {} MobileCallForwardingOptions()
: mActive(false)
, mAction(0)
, mReason(0)
, mTimeSeconds(0)
, mServiceClass(0)
{}
~MobileCallForwardingOptions() {} ~MobileCallForwardingOptions() {}

View File

@ -18,6 +18,8 @@ NS_IMPL_ISUPPORTS(MobileConnectionChild, nsIMobileConnection)
MobileConnectionChild::MobileConnectionChild(uint32_t aServiceId) MobileConnectionChild::MobileConnectionChild(uint32_t aServiceId)
: mServiceId(aServiceId) : mServiceId(aServiceId)
, mLive(true) , mLive(true)
, mRadioState(0)
, mNetworkSelectionMode(0)
{ {
MOZ_COUNT_CTOR(MobileConnectionChild); MOZ_COUNT_CTOR(MobileConnectionChild);
} }

View File

@ -118,6 +118,8 @@ UDPSocket::UDPSocket(nsPIDOMWindow* aOwner,
: DOMEventTargetHelper(aOwner) : DOMEventTargetHelper(aOwner)
, mRemoteAddress(aRemoteAddress) , mRemoteAddress(aRemoteAddress)
, mRemotePort(aRemotePort) , mRemotePort(aRemotePort)
, mAddressReuse(false)
, mLoopback(false)
, mReadyState(SocketReadyState::Opening) , mReadyState(SocketReadyState::Opening)
{ {
MOZ_ASSERT(aOwner); MOZ_ASSERT(aOwner);

View File

@ -31,6 +31,10 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIPOWERMANAGERSERVICE NS_DECL_NSIPOWERMANAGERSERVICE
PowerManagerService()
: mWatchdogTimeoutSecs(0)
{}
static already_AddRefed<PowerManagerService> GetInstance(); static already_AddRefed<PowerManagerService> GetInstance();
void Init(); void Init();

View File

@ -32,6 +32,7 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
TVTuner::TVTuner(nsPIDOMWindow* aWindow) TVTuner::TVTuner(nsPIDOMWindow* aWindow)
: DOMEventTargetHelper(aWindow) : DOMEventTargetHelper(aWindow)
, mStreamType(0)
{ {
} }

View File

@ -20,6 +20,7 @@ NS_IMPL_ISUPPORTS(TVTunerData, nsITVTunerData)
TVTunerData::TVTunerData() TVTunerData::TVTunerData()
: mSupportedSourceTypes(nullptr) : mSupportedSourceTypes(nullptr)
, mCount(0) , mCount(0)
, mStreamType(0)
{ {
} }
@ -275,7 +276,9 @@ TVChannelData::SetIsFree(bool aIsFree)
NS_IMPL_ISUPPORTS(TVProgramData, nsITVProgramData) NS_IMPL_ISUPPORTS(TVProgramData, nsITVProgramData)
TVProgramData::TVProgramData() TVProgramData::TVProgramData()
: mAudioLanguages(nullptr) : mStartTime(0)
, mDuration(0)
, mAudioLanguages(nullptr)
, mAudioLanguageCount(0) , mAudioLanguageCount(0)
, mSubtitleLanguages(nullptr) , mSubtitleLanguages(nullptr)
, mSubtitleLanguageCount(0) , mSubtitleLanguageCount(0)

View File

@ -25,6 +25,7 @@ using namespace mozilla;
// note that aEditor is not refcounted // note that aEditor is not refcounted
SetDocTitleTxn::SetDocTitleTxn() SetDocTitleTxn::SetDocTitleTxn()
: EditTxn() : EditTxn()
, mEditor(nullptr)
, mIsTransient(false) , mIsTransient(false)
{ {
} }

View File

@ -170,6 +170,13 @@ class nsEditableTextFunctor : public nsBoolDomIterFunctor
********************************************************/ ********************************************************/
nsHTMLEditRules::nsHTMLEditRules() nsHTMLEditRules::nsHTMLEditRules()
: mHTMLEditor(nullptr)
, mListenerEnabled(false)
, mReturnInEmptyLIKillsList(false)
, mDidDeleteSelection(false)
, mDidRangedDelete(false)
, mRestoreContentEditableCount(false)
, mJoinOffset(0)
{ {
InitFields(); InitFields();
} }

View File

@ -96,17 +96,42 @@ IsNamedAnchorTag(const nsString& s)
nsHTMLEditor::nsHTMLEditor() nsHTMLEditor::nsHTMLEditor()
: nsPlaintextEditor() : nsPlaintextEditor()
, mCRInParagraphCreatesParagraph(false) , mCRInParagraphCreatesParagraph(false)
, mCSSAware(false)
, mSelectedCellIndex(0) , mSelectedCellIndex(0)
, mIsObjectResizingEnabled(true) , mIsObjectResizingEnabled(true)
, mIsResizing(false) , mIsResizing(false)
, mPreserveRatio(false)
, mResizedObjectIsAnImage(false)
, mIsAbsolutelyPositioningEnabled(true) , mIsAbsolutelyPositioningEnabled(true)
, mResizedObjectIsAbsolutelyPositioned(false) , mResizedObjectIsAbsolutelyPositioned(false)
, mGrabberClicked(false) , mGrabberClicked(false)
, mIsMoving(false) , mIsMoving(false)
, mSnapToGridEnabled(false) , mSnapToGridEnabled(false)
, mIsInlineTableEditingEnabled(true) , mIsInlineTableEditingEnabled(true)
, mOriginalX(0)
, mOriginalY(0)
, mResizedObjectX(0)
, mResizedObjectY(0)
, mResizedObjectWidth(0)
, mResizedObjectHeight(0)
, mResizedObjectMarginLeft(0)
, mResizedObjectMarginTop(0)
, mResizedObjectBorderLeft(0)
, mResizedObjectBorderTop(0)
, mXIncrementFactor(0)
, mYIncrementFactor(0)
, mWidthIncrementFactor(0)
, mHeightIncrementFactor(0)
, mInfoXIncrement(20) , mInfoXIncrement(20)
, mInfoYIncrement(20) , mInfoYIncrement(20)
, mPositionedObjectX(0)
, mPositionedObjectY(0)
, mPositionedObjectWidth(0)
, mPositionedObjectHeight(0)
, mPositionedObjectMarginLeft(0)
, mPositionedObjectMarginTop(0)
, mPositionedObjectBorderLeft(0)
, mPositionedObjectBorderTop(0)
, mGridSize(0) , mGridSize(0)
{ {
} }

View File

@ -59,8 +59,8 @@
#define MATCHES(tagName, str) tagName.EqualsIgnoreCase(str) #define MATCHES(tagName, str) tagName.EqualsIgnoreCase(str)
nsHTMLURIRefObject::nsHTMLURIRefObject() nsHTMLURIRefObject::nsHTMLURIRefObject()
: mCurAttrIndex(0), mAttributeCnt(0)
{ {
mCurAttrIndex = mAttributeCnt = 0;
} }
nsHTMLURIRefObject::~nsHTMLURIRefObject() nsHTMLURIRefObject::~nsHTMLURIRefObject()

View File

@ -57,6 +57,15 @@ using namespace mozilla::dom;
********************************************************/ ********************************************************/
nsTextEditRules::nsTextEditRules() nsTextEditRules::nsTextEditRules()
: mEditor(nullptr)
, mPasswordIMEIndex(0)
, mCachedSelectionOffset(0)
, mActionNesting(0)
, mLockRulesSniffing(false)
, mDidExplicitlySetInterline(false)
, mDeleteBidiImmediately(false)
, mLastStart(0)
, mLastLength(0)
{ {
InitFields(); InitFields();
} }

View File

@ -335,10 +335,21 @@ class nsAutoLockListener
{ {
public: public:
explicit nsAutoLockListener(bool *enabled) : mEnabled(enabled) explicit nsAutoLockListener(bool *enabled)
{if (mEnabled) { mOldState=*mEnabled; *mEnabled = false;}} : mEnabled(enabled), mOldState(false)
{
if (mEnabled) {
mOldState = *mEnabled;
*mEnabled = false;
}
}
~nsAutoLockListener() ~nsAutoLockListener()
{if (mEnabled) *mEnabled = mOldState;} {
if (mEnabled) {
*mEnabled = mOldState;
}
}
protected: protected:
bool *mEnabled; bool *mEnabled;

View File

@ -45,7 +45,7 @@ public:
void ClearDidSkip() { mDidSkip = false; } void ClearDidSkip() { mDidSkip = false; }
protected: protected:
nsFilteredContentIterator() { } nsFilteredContentIterator() : mDidSkip(false), mIsOutOfRange(false) { }
virtual ~nsFilteredContentIterator(); virtual ~nsFilteredContentIterator();

View File

@ -260,7 +260,10 @@ public:
// version of that method for different loggers, this is OK. Once we do, // version of that method for different loggers, this is OK. Once we do,
// change BasicLogger::ShouldOutputMessage to Logger::ShouldOutputMessage. // change BasicLogger::ShouldOutputMessage to Logger::ShouldOutputMessage.
explicit Log(int aOptions = Log::DefaultOptions(L == LOG_CRITICAL), explicit Log(int aOptions = Log::DefaultOptions(L == LOG_CRITICAL),
LogReason aReason = LogReason::MustBeMoreThanThis) { LogReason aReason = LogReason::MustBeMoreThanThis)
: mOptions(0)
, mLogIt(false)
{
Init(aOptions, BasicLogger::ShouldOutputMessage(L), aReason); Init(aOptions, BasicLogger::ShouldOutputMessage(L), aReason);
} }