Bug 1232696 - Remove NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW as it causes segfaulting for GCC 6 builds (4 of 5, fixes for parser/). r=hsivonen.

This commit is contained in:
Julian Seward 2017-01-24 17:11:43 +01:00
parent ebea2b59c1
commit bb66f7fb55
9 changed files with 33 additions and 12 deletions

View File

@ -22,6 +22,8 @@ NS_IMPL_ADDREF_INHERITED(nsHtml5DocumentBuilder, nsContentSink)
NS_IMPL_RELEASE_INHERITED(nsHtml5DocumentBuilder, nsContentSink)
nsHtml5DocumentBuilder::nsHtml5DocumentBuilder(bool aRunsToCompletion)
: mBroken(NS_OK)
, mFlushState(eHtml5FlushState::eNotFlushing)
{
mRunsToCompletion = aRunsToCompletion;
}

View File

@ -119,9 +119,6 @@ protected:
* parser needs to be marked as broken, because some input has been lost
* and parsing more input could lead to a DOM where pieces of HTML source
* that weren't supposed to become scripts become scripts.
*
* Since NS_OK is actually 0, zeroing operator new takes care of
* initializing this.
*/
nsresult mBroken;
eHtml5FlushState mFlushState;

View File

@ -23,8 +23,6 @@ class nsParserBase;
class nsHtml5OplessBuilder : public nsHtml5DocumentBuilder
{
public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
nsHtml5OplessBuilder();
~nsHtml5OplessBuilder();
void Start();

View File

@ -35,15 +35,22 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsHtml5Parser)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
nsHtml5Parser::nsHtml5Parser()
: mFirstBuffer(new nsHtml5OwningUTF16Buffer((void*)nullptr))
: mLastWasCR(false)
, mDocWriteSpeculativeLastWasCR(false)
, mBlocked(false)
, mDocWriteSpeculatorActive(false)
, mInsertionPointPushLevel(0)
, mDocumentClosed(false)
, mInDocumentWrite(false)
, mFirstBuffer(new nsHtml5OwningUTF16Buffer((void*)nullptr))
, mLastBuffer(mFirstBuffer)
, mExecutor(new nsHtml5TreeOpExecutor())
, mTreeBuilder(new nsHtml5TreeBuilder(mExecutor, nullptr))
, mTokenizer(new nsHtml5Tokenizer(mTreeBuilder, false))
, mRootContextLineNumber(1)
, mReturnToStreamParserPermitted(false)
{
mTokenizer->setInterner(&mAtomTable);
// There's a zeroing operator new for everything else
}
nsHtml5Parser::~nsHtml5Parser()

View File

@ -31,7 +31,6 @@ class nsHtml5Parser final : public nsIParser,
public nsSupportsWeakReference
{
public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHtml5Parser, nsIParser)

View File

@ -149,7 +149,10 @@ class nsHtml5LoadFlusher : public Runnable
nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor,
nsHtml5Parser* aOwner,
eParserMode aMode)
: mFirstBuffer(nullptr) // Will be filled when starting
: mSniffingLength(0)
, mBomState(eBomState::BOM_SNIFFING_NOT_STARTED)
, mCharsetSource(kCharsetUninitialized)
, mReparseForbidden(false)
, mLastBuffer(nullptr) // Will be filled when starting
, mExecutor(aExecutor)
, mTreeBuilder(new nsHtml5TreeBuilder((aMode == VIEW_SOURCE_HTML ||
@ -160,12 +163,23 @@ nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor,
, mTokenizer(new nsHtml5Tokenizer(mTreeBuilder, aMode == VIEW_SOURCE_XML))
, mTokenizerMutex("nsHtml5StreamParser mTokenizerMutex")
, mOwner(aOwner)
, mLastWasCR(false)
, mStreamState(eHtml5StreamState::STREAM_NOT_STARTED)
, mSpeculating(false)
, mAtEOF(false)
, mSpeculationMutex("nsHtml5StreamParser mSpeculationMutex")
, mSpeculationFailureCount(0)
, mTerminated(false)
, mInterrupted(false)
, mTerminatedMutex("nsHtml5StreamParser mTerminatedMutex")
, mThread(nsHtml5Module::GetStreamParserThread())
, mExecutorFlusher(new nsHtml5ExecutorFlusher(aExecutor))
, mLoadFlusher(new nsHtml5LoadFlusher(aExecutor))
, mFeedChardet(false)
, mInitialEncodingWasFromParentFrame(false)
, mFlushTimer(do_CreateInstance("@mozilla.org/timer;1"))
, mFlushTimerArmed(false)
, mFlushTimerEverFired(false)
, mMode(aMode)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");

View File

@ -108,7 +108,6 @@ class nsHtml5StreamParser : public nsICharsetDetectionObserver {
friend class nsHtml5TimerKungFu;
public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHtml5StreamParser,
nsICharsetDetectionObserver)

View File

@ -65,10 +65,16 @@ static nsITimer* gFlushTimer = nullptr;
nsHtml5TreeOpExecutor::nsHtml5TreeOpExecutor()
: nsHtml5DocumentBuilder(false)
, mSuppressEOF(false)
, mReadingFromStage(false)
, mStreamParser(nullptr)
, mPreloadedURLs(23) // Mean # of preloadable resources per page on dmoz
, mSpeculationReferrerPolicy(mozilla::net::RP_Unset)
, mStarted(false)
, mRunFlushLoopOnStack(false)
, mCallContinueInterruptedParsingIfEnabled(false)
, mAlreadyComplainedAboutCharset(false)
{
// zeroing operator new for everything else
}
nsHtml5TreeOpExecutor::~nsHtml5TreeOpExecutor()

View File

@ -38,7 +38,6 @@ class nsHtml5TreeOpExecutor final : public nsHtml5DocumentBuilder,
typedef mozilla::net::ReferrerPolicy ReferrerPolicy;
public:
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_ISUPPORTS_INHERITED
private: