Bug 1232696 - Remove NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW as it causes segfaulting for GCC 6 builds (2 of 5, fixes for dom/). r=bkelly.

This commit is contained in:
Julian Seward 2017-01-24 17:10:39 +01:00
Родитель cf549b474e
Коммит 6f7fcae338
13 изменённых файлов: 191 добавлений и 41 удалений

Просмотреть файл

@ -237,14 +237,37 @@ public:
protected:
nsMutationReceiverBase(nsINode* aTarget, nsDOMMutationObserver* aObserver)
: mTarget(aTarget), mObserver(aObserver), mRegisterTarget(aTarget)
: mTarget(aTarget)
, mObserver(aObserver)
, mRegisterTarget(aTarget)
, mSubtree(false)
, mChildList(false)
, mCharacterData(false)
, mCharacterDataOldValue(false)
, mNativeAnonymousChildList(false)
, mAttributes(false)
, mAllAttributes(false)
, mAttributeOldValue(false)
, mAnimations(false)
{
}
nsMutationReceiverBase(nsINode* aRegisterTarget,
nsMutationReceiverBase* aParent)
: mTarget(nullptr), mObserver(nullptr), mParent(aParent),
mRegisterTarget(aRegisterTarget), mKungFuDeathGrip(aParent->Target())
: mTarget(nullptr)
, mObserver(nullptr)
, mParent(aParent)
, mRegisterTarget(aRegisterTarget)
, mKungFuDeathGrip(aParent->Target())
, mSubtree(false)
, mChildList(false)
, mCharacterData(false)
, mCharacterDataOldValue(false)
, mNativeAnonymousChildList(false)
, mAttributes(false)
, mAllAttributes(false)
, mAttributeOldValue(false)
, mAnimations(false)
{
NS_ASSERTION(mParent->Subtree(), "Should clone a non-subtree observer!");
}
@ -369,7 +392,6 @@ public:
void Disconnect(bool aRemoveFromObserver);
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_ISUPPORTS
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE

Просмотреть файл

@ -1283,27 +1283,91 @@ nsIDocument::nsIDocument()
mUpgradeInsecureRequests(false),
mUpgradeInsecurePreloads(false),
mCharacterSet(NS_LITERAL_CSTRING("ISO-8859-1")),
mCharacterSetSource(0),
mParentDocument(nullptr),
mCachedRootElement(nullptr),
mNodeInfoManager(nullptr),
mBidiEnabled(false),
mMathMLEnabled(false),
mIsInitialDocumentInWindow(false),
mLoadedAsData(false),
mLoadedAsInteractiveData(false),
mMayStartLayout(true),
mHaveFiredTitleChange(false),
mIsShowing(false),
mVisible(true),
mHasReferrerPolicyCSP(false),
mRemovedFromDocShell(false),
// mAllowDNSPrefetch starts true, so that we can always reliably && it
// with various values that might disable it. Since we never prefetch
// unless we get a window, and in that case the docshell value will get
// &&-ed in, this is safe.
mAllowDNSPrefetch(true),
mIsStaticDocument(false),
mCreatingStaticClone(false),
mInUnlinkOrDeletion(false),
mHasHadScriptHandlingObject(false),
mIsBeingUsedAsImage(false),
mIsSyntheticDocument(false),
mHasLinksToUpdate(false),
mNeedLayoutFlush(false),
mNeedStyleFlush(false),
mMayHaveDOMMutationObservers(false),
mMayHaveAnimationObservers(false),
mHasMixedActiveContentLoaded(false),
mHasMixedActiveContentBlocked(false),
mHasMixedDisplayContentLoaded(false),
mHasMixedDisplayContentBlocked(false),
mHasMixedContentObjectSubrequest(false),
mHasCSP(false),
mHasUnsafeEvalCSP(false),
mHasUnsafeInlineCSP(false),
mHasTrackingContentBlocked(false),
mHasTrackingContentLoaded(false),
mBFCacheDisallowed(false),
mHasHadDefaultView(false),
mStyleSheetChangeEventsEnabled(false),
mIsSrcdocDocument(false),
mDidDocumentOpen(false),
mHasDisplayDocument(false),
mFontFaceSetDirty(true),
mGetUserFontSetCalled(false),
mPostedFlushUserFontSet(false),
mEverInForeground(false),
mCompatMode(eCompatibility_FullStandards),
mReadyState(ReadyState::READYSTATE_UNINITIALIZED),
mStyleBackendType(mozilla::StyleBackendType::Gecko),
#ifdef MOZILLA_INTERNAL_API
mVisibilityState(dom::VisibilityState::Hidden),
#else
mDummy(0),
#endif
mType(eUnknown),
mDefaultElementType(0),
mAllowXULXBL(eTriUnset),
#ifdef DEBUG
mIsLinkUpdateRegistrationsForbidden(false),
#endif
mBidiOptions(IBMBIDI_DEFAULT_BIDI_OPTIONS),
mSandboxFlags(0),
mPartID(0),
mMarkedCCGeneration(0),
mPresShell(nullptr),
mSubtreeModifiedDepth(0),
mEventsSuppressed(0),
mAnimationsPaused(0),
mExternalScriptsBeingEvaluated(0),
mFrameRequestCallbackCounter(0),
mStaticCloneCount(0),
mWindow(nullptr),
mBFCacheEntry(nullptr),
mInSyncOperationCount(0),
mBlockDOMContentLoaded(0),
mDidFireDOMContentLoaded(true),
mHasScrollLinkedEffect(false),
mUseCounters(0),
mChildDocumentUseCounters(0),
mNotifiedPageForUseCounter(0),
mUserHasInteracted(false)
{
SetIsInDocument();
@ -1311,12 +1375,54 @@ nsIDocument::nsIDocument()
PR_INIT_CLIST(&mDOMMediaQueryLists);
}
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
nsDocument::nsDocument(const char* aContentType)
: nsIDocument()
, mIsTopLevelContentDocument(false)
, mIsContentDocument(false)
, mSubDocuments(nullptr)
, mHeaderData(nullptr)
, mIsGoingAway(false)
, mInDestructor(false)
, mMayHaveTitleElement(false)
, mHasWarnedAboutBoxObjects(false)
, mDelayFrameLoaderInitialization(false)
, mSynchronousDOMContentLoaded(false)
, mInXBLUpdate(false)
, mInFlush(false)
, mParserAborted(false)
, mCurrentOrientationAngle(0)
, mCurrentOrientationType(OrientationType::Portrait_primary)
, mSSApplicableStateNotificationPending(false)
, mReportedUseCounters(false)
, mStyleSetFilled(false)
, mPendingFullscreenRequests(0)
, mXMLDeclarationBits(0)
, mBoxObjectTable(nullptr)
, mUpdateNestLevel(0)
, mOnloadBlockCount(0)
, mAsyncOnloadBlockCount(0)
#ifdef DEBUG
, mStyledLinksCleared(false)
#endif
, mPreloadPictureDepth(0)
, mScrolledToRefAlready(0)
, mChangeScrollPosWhenScrollingToRef(0)
, mViewportType(Unknown)
, mValidWidth(false)
, mValidHeight(false)
, mAutoSize(false)
, mAllowZoom(false)
, mAllowDoubleTapZoom(false)
, mValidScaleFloat(false)
, mValidMaxScale(false)
, mScaleStrEmpty(false)
, mWidthStrEmpty(false)
, mStackRefCnt(0)
, mNeedsReleaseAfterStackRefCntRelease(false)
, mMaybeServiceWorkerControlled(false)
#ifdef DEBUG
, mWillReparent(false)
#endif
{
SetContentTypeInternal(nsDependentCString(aContentType));

Просмотреть файл

@ -9,7 +9,6 @@
#include "mozilla/FlushType.h" // for enum
#include "nsAutoPtr.h" // for member
#include "nsCOMArray.h" // for member
#include "nsCRT.h" // for NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
#include "nsCompatibility.h" // for member
#include "nsCOMPtr.h" // for member
#include "nsGkAtoms.h" // for static class members
@ -217,7 +216,6 @@ public:
typedef mozilla::dom::FullscreenRequest FullscreenRequest;
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID)
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
#ifdef MOZILLA_INTERNAL_API
nsIDocument();

Просмотреть файл

@ -136,11 +136,21 @@ ImageListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aCtxt, nsresult
}
ImageDocument::ImageDocument()
: MediaDocument(),
mOriginalZoomLevel(1.0)
: MediaDocument()
, mVisibleWidth(0.0)
, mVisibleHeight(0.0)
, mImageWidth(0)
, mImageHeight(0)
, mResizeImageByDefault(false)
, mClickResizingEnabled(false)
, mImageIsOverflowingHorizontally(false)
, mImageIsOverflowingVertically(false)
, mImageIsResized(false)
, mShouldResize(false)
, mFirstResize(false)
, mObservingImageLoader(false)
, mOriginalZoomLevel(1.0)
{
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
}
ImageDocument::~ImageDocument()

Просмотреть файл

@ -102,9 +102,6 @@ PluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
return MediaDocumentStreamListener::OnStartRequest(request, ctxt);
}
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
PluginDocument::PluginDocument()
{}

Просмотреть файл

@ -121,8 +121,6 @@ public:
HTMLContentSink();
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
nsresult Init(nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer,
nsIChannel* aChannel);
@ -633,8 +631,12 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult,
}
HTMLContentSink::HTMLContentSink()
: mMaxTextRun(0)
, mCurrentContext(nullptr)
, mHeadContext(nullptr)
, mHaveSeenHead(false)
, mNotifiedRootInsertion(false)
{
// Note: operator new zeros our memory
}
HTMLContentSink::~HTMLContentSink()

Просмотреть файл

@ -169,15 +169,19 @@ NS_NewHTMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData)
return NS_OK;
}
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
nsHTMLDocument::nsHTMLDocument()
: nsDocument("text/html")
, mNumForms(0)
, mWriteLevel(0)
, mLoadFlags(0)
, mTooDeepWriteRecursion(false)
, mDisableDocWrite(false)
, mWarnedWidthHeight(false)
, mContentEditableCount(0)
, mEditingState(EditingState::eOff)
, mDisableCookieAccess(false)
, mPendingMaybeEditingStateChanged(false)
{
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
mType = eHTML;
mDefaultElementType = kNameSpaceID_XHTML;
mCompatMode = eCompatibility_NavQuirks;

Просмотреть файл

@ -265,8 +265,10 @@ static bool UnloadPluginsASAP()
}
nsPluginHost::nsPluginHost()
// No need to initialize members to nullptr, false etc because this class
// has a zeroing operator new.
: mPluginsLoaded(false)
, mOverrideInternalTypes(false)
, mPluginsDisabled(false)
, mPluginEpoch(0)
{
// Bump the pluginchanged epoch on startup. This insures content gets a
// good plugin list the first time it requests it. Normally we'd just

Просмотреть файл

@ -85,8 +85,6 @@ public:
static already_AddRefed<nsPluginHost> GetInst();
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_ISUPPORTS
NS_DECL_NSIPLUGINHOST
NS_DECL_NSIOBSERVER

Просмотреть файл

@ -60,8 +60,6 @@ public:
nsXBLContentSink();
~nsXBLContentSink();
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
nsresult Init(nsIDocument* aDoc,
nsIURI* aURL,
nsISupports* aContainer);

Просмотреть файл

@ -229,11 +229,13 @@ namespace dom {
XMLDocument::XMLDocument(const char* aContentType)
: nsDocument(aContentType),
mAsync(true)
mChannelIsPending(false),
mAsync(true),
mLoopingForSyncLoad(false),
mIsPlainDocument(false),
mSuppressParserErrorElement(false),
mSuppressParserErrorConsoleMessages(false)
{
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
mType = eGenericXML;
}

Просмотреть файл

@ -37,8 +37,6 @@ class nsXMLFragmentContentSink : public nsXMLContentSink,
public:
nsXMLFragmentContentSink();
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsXMLFragmentContentSink,

Просмотреть файл

@ -190,13 +190,26 @@ namespace dom {
XULDocument::XULDocument(void)
: XMLDocument("application/vnd.mozilla.xul+xml"),
mNextSrcLoadWaiter(nullptr),
mApplyingPersistedAttrs(false),
mIsWritingFastLoad(false),
mDocumentLoaded(false),
mStillWalking(false),
mRestrictPersistence(false),
mTemplateBuilderTable(nullptr),
mPendingSheets(0),
mDocLWTheme(Doc_Theme_Uninitialized),
mState(eState_Master),
mResolutionPhase(nsForwardReference::eStart)
mCurrentScriptProto(nullptr),
mOffThreadCompiling(false),
mOffThreadCompileStringBuf(nullptr),
mOffThreadCompileStringLength(0),
mResolutionPhase(nsForwardReference::eStart),
mBroadcasterMap(nullptr),
mInitialLayoutComplete(false),
mHandlingDelayedAttrChange(false),
mHandlingDelayedBroadcasters(false)
{
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
// Override the default in nsDocument
mCharacterSet.AssignLiteral("UTF-8");