Skip to content

Commit

Permalink
Bug 1231378 - part 2 - Fix uninitialized members of classes in dom/*,…
Browse files Browse the repository at this point in the history
… r=smaug
  • Loading branch information
bakulf committed Jan 12, 2016
1 parent 8ed4c36 commit 83b88d3
Show file tree
Hide file tree
Showing 22 changed files with 118 additions and 17 deletions.
4 changes: 4 additions & 0 deletions dom/alarm/AlarmHalService.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class AlarmHalService : public nsIAlarmHalService,
NS_DECL_ISUPPORTS
NS_DECL_NSIALARMHALSERVICE

AlarmHalService()
: mAlarmEnabled(false)
{}

void Init();

static already_AddRefed<AlarmHalService> GetInstance();
Expand Down
3 changes: 2 additions & 1 deletion dom/broadcastchannel/BroadcastChannelChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ namespace dom {
using namespace workers;

BroadcastChannelChild::BroadcastChannelChild(const nsACString& aOrigin)
: mActorDestroyed(false)
: mBC(nullptr)
, mActorDestroyed(false)
{
CopyUTF8toUTF16(aOrigin, mOrigin);
}
Expand Down
2 changes: 2 additions & 0 deletions dom/datastore/DataStoreService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class DataStoreInfo
const nsAString& aManifestURL,
bool aReadOnly,
bool aEnabled)
: mReadOnly(true)
, mEnabled(false)
{
Init(aName, aOriginURL, aManifestURL, aReadOnly, aEnabled);
}
Expand Down
1 change: 0 additions & 1 deletion dom/fetch/InternalRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion dom/fetch/InternalRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class InternalRequest final
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)
Expand Down Expand Up @@ -413,7 +414,6 @@ class InternalRequest final
bool mForceOriginHeader;
bool mPreserveContentCodings;
bool mSameOriginDataURL;
bool mSandboxedStorageAreaURLs;
bool mSkipServiceWorker;
bool mSynchronous;
bool mUnsafeRequest;
Expand Down
9 changes: 8 additions & 1 deletion dom/geolocation/nsGeolocationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ class GeolocationSetting final {
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;
Expand Down
14 changes: 14 additions & 0 deletions dom/indexedDB/IDBRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion dom/messagechannel/MessagePortChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MessagePortChild final : public PMessagePortChild
public:
NS_INLINE_DECL_REFCOUNTING(MessagePortChild)

MessagePortChild() {}
MessagePortChild() : mPort(nullptr) {}

void SetPort(MessagePort* aPort)
{
Expand Down
10 changes: 8 additions & 2 deletions dom/mobileconnection/MobileCallForwardingOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ class MobileCallForwardingOptions final : public nsIMobileCallForwardingOptions

private:
// Don't try to use the default constructor.
MobileCallForwardingOptions() {}
MobileCallForwardingOptions()
: mActive(false)
, mAction(0)
, mReason(0)
, mTimeSeconds(0)
, mServiceClass(0)
{}

~MobileCallForwardingOptions() {}

Expand All @@ -43,4 +49,4 @@ class MobileCallForwardingOptions final : public nsIMobileCallForwardingOptions
} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_MobileCallForwardingOptions_h
#endif // mozilla_dom_MobileCallForwardingOptions_h
2 changes: 2 additions & 0 deletions dom/mobileconnection/ipc/MobileConnectionChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions dom/network/UDPSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ UDPSocket::UDPSocket(nsPIDOMWindow* aOwner,
: DOMEventTargetHelper(aOwner)
, mRemoteAddress(aRemoteAddress)
, mRemotePort(aRemotePort)
, mAddressReuse(false)
, mLoopback(false)
, mReadyState(SocketReadyState::Opening)
{
MOZ_ASSERT(aOwner);
Expand Down
4 changes: 4 additions & 0 deletions dom/power/PowerManagerService.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ class PowerManagerService
NS_DECL_ISUPPORTS
NS_DECL_NSIPOWERMANAGERSERVICE

PowerManagerService()
: mWatchdogTimeoutSecs(0)
{}

static already_AddRefed<PowerManagerService> GetInstance();

void Init();
Expand Down
1 change: 1 addition & 0 deletions dom/tv/TVTuner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)

TVTuner::TVTuner(nsPIDOMWindow* aWindow)
: DOMEventTargetHelper(aWindow)
, mStreamType(0)
{
}

Expand Down
5 changes: 4 additions & 1 deletion dom/tv/TVTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ NS_IMPL_ISUPPORTS(TVTunerData, nsITVTunerData)
TVTunerData::TVTunerData()
: mSupportedSourceTypes(nullptr)
, mCount(0)
, mStreamType(0)
{
}

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion editor/libeditor/SetDocTitleTxn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ using namespace mozilla;
// note that aEditor is not refcounted
SetDocTitleTxn::SetDocTitleTxn()
: EditTxn()
, mIsTransient(false)
, mEditor(nullptr)
, mIsTransient(false)
{
}

Expand Down
7 changes: 7 additions & 0 deletions editor/libeditor/nsHTMLEditRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
25 changes: 25 additions & 0 deletions editor/libeditor/nsHTMLEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
Expand Down
2 changes: 1 addition & 1 deletion editor/libeditor/nsHTMLURIRefObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
#define MATCHES(tagName, str) tagName.EqualsIgnoreCase(str)

nsHTMLURIRefObject::nsHTMLURIRefObject()
: mCurAttrIndex(0), mAttributeCnt(0)
{
mCurAttrIndex = mAttributeCnt = 0;
}

nsHTMLURIRefObject::~nsHTMLURIRefObject()
Expand Down
9 changes: 9 additions & 0 deletions editor/libeditor/nsTextEditRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
21 changes: 16 additions & 5 deletions editor/libeditor/nsTextEditRules.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion editor/txtsvc/nsFilteredContentIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class nsFilteredContentIterator final : public nsIContentIterator
void ClearDidSkip() { mDidSkip = false; }

protected:
nsFilteredContentIterator() { }
nsFilteredContentIterator() : mDidSkip(false), mIsOutOfRange(false) { }

virtual ~nsFilteredContentIterator();

Expand Down
5 changes: 4 additions & 1 deletion gfx/2d/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ class Log
// 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);
}

Expand Down

0 comments on commit 83b88d3

Please sign in to comment.