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_NSIALARMHALSERVICE
AlarmHalService()
: mAlarmEnabled(false)
{}
void Init();
static already_AddRefed<AlarmHalService> GetInstance();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,13 @@ public:
private:
// Don't try to use the default constructor.
MobileCallForwardingOptions() {}
MobileCallForwardingOptions()
: mActive(false)
, mAction(0)
, mReason(0)
, mTimeSeconds(0)
, mServiceClass(0)
{}
~MobileCallForwardingOptions() {}
@ -43,4 +49,4 @@ private:
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_MobileCallForwardingOptions_h
#endif // mozilla_dom_MobileCallForwardingOptions_h

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -96,17 +96,42 @@ IsNamedAnchorTag(const nsString& s)
nsHTMLEditor::nsHTMLEditor()
: nsPlaintextEditor()
, mCRInParagraphCreatesParagraph(false)
, mCSSAware(false)
, mSelectedCellIndex(0)
, mIsObjectResizingEnabled(true)
, mIsResizing(false)
, mPreserveRatio(false)
, mResizedObjectIsAnImage(false)
, mIsAbsolutelyPositioningEnabled(true)
, mResizedObjectIsAbsolutelyPositioned(false)
, mGrabberClicked(false)
, mIsMoving(false)
, mSnapToGridEnabled(false)
, 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)
, mInfoYIncrement(20)
, mPositionedObjectX(0)
, mPositionedObjectY(0)
, mPositionedObjectWidth(0)
, mPositionedObjectHeight(0)
, mPositionedObjectMarginLeft(0)
, mPositionedObjectMarginTop(0)
, mPositionedObjectBorderLeft(0)
, mPositionedObjectBorderTop(0)
, mGridSize(0)
{
}

View File

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

View File

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

View File

@ -333,14 +333,25 @@ class nsAutoLockRulesSniffing
*/
class nsAutoLockListener
{
public:
public:
explicit nsAutoLockListener(bool *enabled)
: mEnabled(enabled), mOldState(false)
{
if (mEnabled) {
mOldState = *mEnabled;
*mEnabled = false;
}
}
explicit nsAutoLockListener(bool *enabled) : mEnabled(enabled)
{if (mEnabled) { mOldState=*mEnabled; *mEnabled = false;}}
~nsAutoLockListener()
{if (mEnabled) *mEnabled = mOldState;}
{
if (mEnabled) {
*mEnabled = mOldState;
}
}
protected:
protected:
bool *mEnabled;
bool mOldState;
};

View File

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

View File

@ -260,7 +260,10 @@ public:
// version of that method for different loggers, this is OK. Once we do,
// change BasicLogger::ShouldOutputMessage to Logger::ShouldOutputMessage.
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);
}