From 733d1e3812b01363a31bf9e8e7b163714dae23eb Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 16 Apr 2010 09:08:36 +0100 Subject: [PATCH 001/132] bug 558027 - gfxFontUtils::MakeEOTHeader is too fussy, an empty version string is acceptable. r=jdaggett --- gfx/thebes/src/gfxFontUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/thebes/src/gfxFontUtils.cpp b/gfx/thebes/src/gfxFontUtils.cpp index 8caf3f070088..3e3a79e5c142 100644 --- a/gfx/thebes/src/gfxFontUtils.cpp +++ b/gfx/thebes/src/gfxFontUtils.cpp @@ -1802,8 +1802,8 @@ gfxFontUtils::MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength, break; } - if (needNames != 0) - { + // the Version name is allowed to be null + if ((needNames & ~(1 << EOTFixedHeader::EOT_VERSION_NAME_INDEX)) != 0) { return NS_ERROR_FAILURE; } From 9d8ea2452152cd58923b1349b2d22384f2cc2d48 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Fri, 16 Apr 2010 10:33:03 +0100 Subject: [PATCH 002/132] Bug 559609 Remove non-toolkit dependency from aboutRights-unbranded.xhtml. r=gavin --- toolkit/content/aboutRights-unbranded.xhtml | 2 -- 1 file changed, 2 deletions(-) diff --git a/toolkit/content/aboutRights-unbranded.xhtml b/toolkit/content/aboutRights-unbranded.xhtml index 0a030d491731..6f329bd4148b 100644 --- a/toolkit/content/aboutRights-unbranded.xhtml +++ b/toolkit/content/aboutRights-unbranded.xhtml @@ -4,8 +4,6 @@ %htmlDTD; %brandDTD; - - %securityPrefsDTD; %aboutRightsDTD; ]> From b1b0c735df20f2c3877edfa42f37ccae541b83fd Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Mon, 15 Mar 2010 14:04:42 +0200 Subject: [PATCH 003/132] Bug 551344 part 2 - Address sicking's review comments in nsHtml5TreeOpExecutor.cpp. r=jonas. --- parser/html/nsHtml5TreeOpExecutor.cpp | 19 ++++++++++--------- parser/html/nsHtml5TreeOpExecutor.h | 2 +- parser/html/nsHtml5TreeOperation.cpp | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp index 90892f0e924e..f6b957c88ba0 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp +++ b/parser/html/nsHtml5TreeOpExecutor.cpp @@ -118,8 +118,9 @@ nsHtml5TreeOpExecutor::DidBuildModel(PRBool aTerminated) NS_PRECONDITION(mStarted, "Bad life cycle."); if (!aTerminated) { - // Break out of update batch if we are in one - // and aren't forcibly terminating + // This is needed to avoid unblocking loads too many times on one hand + // and on the other hand to avoid destroying the frame constructor from + // within an update batch. See bug 537683. EndDocUpdate(); // If the above caused a call to nsIParser::Terminate(), let that call @@ -131,7 +132,7 @@ nsHtml5TreeOpExecutor::DidBuildModel(PRBool aTerminated) static_cast (mParser.get())->DropStreamParser(); - // This is comes from nsXMLContentSink and nsHTMLContentSink + // This comes from nsXMLContentSink and nsHTMLContentSink DidBuildModelImpl(aTerminated); if (!mLayoutStarted) { @@ -214,11 +215,11 @@ nsHtml5TreeOpExecutor::SetDocumentCharsetAndSource(nsACString& aCharset, PRInt32 // nsHTMLDocument::StartDocumentLoad // We need to call muCV->SetPrevDocCharacterSet here in case // the charset is detected by parser DetectMetaTag - nsCOMPtr muCV; + nsCOMPtr mucv; nsCOMPtr cv; mDocShell->GetContentViewer(getter_AddRefs(cv)); if (cv) { - muCV = do_QueryInterface(cv); + mucv = do_QueryInterface(cv); } else { // in this block of code, if we get an error result, we return // it but if we get a null pointer, that's perfectly legal for @@ -236,12 +237,12 @@ nsHtml5TreeOpExecutor::SetDocumentCharsetAndSource(nsACString& aCharset, PRInt32 nsresult rv = parent->GetContentViewer(getter_AddRefs(parentContentViewer)); if (NS_SUCCEEDED(rv) && parentContentViewer) { - muCV = do_QueryInterface(parentContentViewer); + mucv = do_QueryInterface(parentContentViewer); } } } - if (muCV) { - muCV->SetPrevDocCharacterSet(aCharset); + if (mucv) { + mucv->SetPrevDocCharacterSet(aCharset); } } } @@ -655,7 +656,7 @@ nsHtml5TreeOpExecutor::IsScriptEnabled() } void -nsHtml5TreeOpExecutor::DocumentMode(nsHtml5DocumentMode m) +nsHtml5TreeOpExecutor::SetDocumentMode(nsHtml5DocumentMode m) { nsCompatibility mode = eCompatibility_NavQuirks; switch (m) { diff --git a/parser/html/nsHtml5TreeOpExecutor.h b/parser/html/nsHtml5TreeOpExecutor.h index 1b7303cdca7b..74fce31f104b 100644 --- a/parser/html/nsHtml5TreeOpExecutor.h +++ b/parser/html/nsHtml5TreeOpExecutor.h @@ -325,7 +325,7 @@ class nsHtml5TreeOpExecutor : public nsContentSink, void StartLayout(); - void DocumentMode(nsHtml5DocumentMode m); + void SetDocumentMode(nsHtml5DocumentMode m); nsresult Init(nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel); diff --git a/parser/html/nsHtml5TreeOperation.cpp b/parser/html/nsHtml5TreeOperation.cpp index 13f8736587cb..28b667e9bdbb 100644 --- a/parser/html/nsHtml5TreeOperation.cpp +++ b/parser/html/nsHtml5TreeOperation.cpp @@ -637,7 +637,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder, return rv; } case eTreeOpDocumentMode: { - aBuilder->DocumentMode(mOne.mode); + aBuilder->SetDocumentMode(mOne.mode); return rv; } case eTreeOpSetStyleLineNumber: { From 2c9733fb259007754f5bf6a64c2e0ebb39c68c3d Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Fri, 9 Apr 2010 17:11:56 +0300 Subject: [PATCH 004/132] Bug 551344 part 3 - Address sicking's review comments in nsHtml5StreamParser.cpp. r=jonas. --- parser/html/nsHtml5StreamParser.cpp | 46 ++++++++++++++++++----------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp index d3b953dbe528..2b97472af44e 100644 --- a/parser/html/nsHtml5StreamParser.cpp +++ b/parser/html/nsHtml5StreamParser.cpp @@ -245,7 +245,7 @@ nsHtml5StreamParser::SetupDecodingAndWriteSniffingBufferAndCurrentSegment(const NS_ENSURE_SUCCESS(rv, rv); rv = convManager->GetUnicodeDecoder(mCharset.get(), getter_AddRefs(mUnicodeDecoder)); if (rv == NS_ERROR_UCONV_NOCONV) { - mCharset.Assign("windows-1252"); // lower case is the raw form + mCharset.AssignLiteral("windows-1252"); // lower case is the raw form mCharsetSource = kCharsetFromWeakDocTypeDefault; rv = convManager->GetUnicodeDecoderRaw(mCharset.get(), getter_AddRefs(mUnicodeDecoder)); mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource); @@ -284,6 +284,7 @@ nsHtml5StreamParser::SetupDecodingFromBom(const char* aCharsetName, const char* NS_ENSURE_SUCCESS(rv, rv); rv = convManager->GetUnicodeDecoderRaw(aDecoderCharsetName, getter_AddRefs(mUnicodeDecoder)); NS_ENSURE_SUCCESS(rv, rv); + mUnicodeDecoder->SetInputErrorBehavior(nsIUnicodeDecoder::kOnError_Recover); mCharset.Assign(aCharsetName); mCharsetSource = kCharsetFromByteOrderMark; mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource); @@ -322,7 +323,7 @@ nsHtml5StreamParser::FinalizeSniffing(const PRUint8* aFromSegment, // can be nul } if (mCharsetSource == kCharsetUninitialized) { // Hopefully this case is never needed, but dealing with it anyway - mCharset.Assign("windows-1252"); + mCharset.AssignLiteral("windows-1252"); mCharsetSource = kCharsetFromWeakDocTypeDefault; mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource); } @@ -337,7 +338,7 @@ nsHtml5StreamParser::SniffStreamBytes(const PRUint8* aFromSegment, NS_ASSERTION(IsParserThread(), "Wrong thread!"); nsresult rv = NS_OK; PRUint32 writeCount; - for (PRUint32 i = 0; i < aCount; i++) { + for (PRUint32 i = 0; i < aCount && mBomState != BOM_SNIFFING_OVER; i++) { switch (mBomState) { case BOM_SNIFFING_NOT_STARTED: NS_ASSERTION(i == 0, "Bad BOM sniffing state."); @@ -400,11 +401,11 @@ nsHtml5StreamParser::SniffStreamBytes(const PRUint8* aFromSegment, mBomState = BOM_SNIFFING_OVER; break; default: - goto bom_loop_end; + mBomState = BOM_SNIFFING_OVER; + break; } } // if we get here, there either was no BOM or the BOM sniffing isn't complete yet - bom_loop_end: if (!mMetaScanner) { mMetaScanner = new nsHtml5MetaScanner(); @@ -431,6 +432,7 @@ nsHtml5StreamParser::SniffStreamBytes(const PRUint8* aFromSegment, mMetaScanner->sniff(&readable, getter_AddRefs(mUnicodeDecoder), mCharset); if (mUnicodeDecoder) { // meta scan successful + mUnicodeDecoder->SetInputErrorBehavior(nsIUnicodeDecoder::kOnError_Recover); mCharsetSource = kCharsetFromMetaPrescan; mTreeBuilder->SetDocumentCharset(mCharset, mCharsetSource); mMetaScanner = nsnull; @@ -473,23 +475,33 @@ nsHtml5StreamParser::WriteStreamBytes(const PRUint8* aFromSegment, NS_ASSERTION(mLastBuffer->getEnd() <= NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE, "The Unicode decoder wrote too much data."); if (NS_FAILED(convResult)) { - if (totalByteCount < aCount) { // mimicking nsScanner even though this seems wrong + // There's an illegal byte in the input. It's now the responsibility + // of this calling code to output a U+FFFD REPLACEMENT CHARACTER and + // reset the decoder. + + NS_ASSERTION(totalByteCount < aCount, + "The decoder signaled an error but consumed all input."); + if (totalByteCount < aCount) { + // advance over the bad byte ++totalByteCount; ++aFromSegment; } + + // Emit the REPLACEMENT CHARACTER mLastBuffer->getBuffer()[end] = 0xFFFD; ++end; mLastBuffer->setEnd(end); if (end == NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE) { - mLastBuffer = (mLastBuffer->next = new nsHtml5UTF16Buffer(NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE)); + mLastBuffer = mLastBuffer->next = new nsHtml5UTF16Buffer(NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE); } + mUnicodeDecoder->Reset(); if (totalByteCount == aCount) { *aWriteCount = totalByteCount; return NS_OK; } } else if (convResult == NS_PARTIAL_MORE_OUTPUT) { - mLastBuffer = (mLastBuffer->next = new nsHtml5UTF16Buffer(NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE)); + mLastBuffer = mLastBuffer->next = new nsHtml5UTF16Buffer(NS_HTML5_STREAM_PARSER_READ_BUFFER_SIZE); NS_ASSERTION(totalByteCount < aCount, "The Unicode decoder has consumed too many bytes."); } else { NS_ASSERTION(totalByteCount == aCount, "The Unicode decoder consumed the wrong number of bytes."); @@ -702,7 +714,6 @@ nsHtml5StreamParser::internalEncodingDeclaration(nsString* aEncoding) return; } - // The encodings are different. if (mReparseForbidden) { return; // not reparsing even if we wanted to } @@ -736,7 +747,6 @@ nsHtml5StreamParser::internalEncodingDeclaration(nsString* aEncoding) return; } - // we still want to reparse mTreeBuilder->NeedsCharsetSwitchTo(preferred); mTreeBuilder->Flush(); Interrupt(); @@ -779,7 +789,7 @@ nsHtml5StreamParser::ParseAvailableData() return; // no more data for now but expecting more case STREAM_ENDED: if (mAtEOF) { - return; + return; } mAtEOF = PR_TRUE; mTokenizer->eof(); @@ -793,10 +803,9 @@ nsHtml5StreamParser::ParseAvailableData() NS_NOTREACHED("It should be impossible to reach this."); return; } - } else { - mFirstBuffer = mFirstBuffer->next; - continue; } + mFirstBuffer = mFirstBuffer->next; + continue; } // now we have a non-empty buffer @@ -864,6 +873,7 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer, if (mSpeculations.IsEmpty()) { // Not quite sure how exactly this happens... // Maybe an artifact of defer scripts? + NS_WARNING("ContinueAfterScripts called without speculations."); return; } nsHtml5Speculation* speculation = mSpeculations.ElementAt(0); @@ -901,9 +911,11 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer, { mozilla::MutexAutoLock tokenizerAutoLock(mTokenizerMutex); #ifdef DEBUG + { nsCOMPtr mainThread; NS_GetMainThread(getter_AddRefs(mainThread)); mAtomTable.SetPermittedLookupThread(mainThread); + } #endif // In principle, the speculation mutex should be acquired here, // but there's no point, because the parser thread only acquires it @@ -931,7 +943,7 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer, mTreeBuilder->SetOpSink(mExecutor->GetStage()); mExecutor->StartReadingFromStage(); mSpeculating = PR_FALSE; - mFlushTimer->Cancel(); // just in case + mFlushTimer->Cancel(); mFlushTimer->InitWithFuncCallback(nsHtml5StreamParser::TimerCallback, static_cast (this), sTimerContinueDelay, @@ -956,7 +968,7 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer, mTreeBuilder->SetOpSink(mExecutor->GetStage()); mExecutor->StartReadingFromStage(); mSpeculating = PR_FALSE; - mFlushTimer->Cancel(); // just in case + mFlushTimer->Cancel(); mFlushTimer->InitWithFuncCallback(nsHtml5StreamParser::TimerCallback, static_cast (this), sTimerContinueDelay, @@ -1042,7 +1054,7 @@ nsHtml5StreamParser::PostTimerFlush() { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - mFlushTimer->Cancel(); // just in case + mFlushTimer->Cancel(); // The following line reads a mutex-protected variable without acquiring // the mutex. This is OK, because failure to exit early here is harmless. From 85b2495de13e6b2b57aceb5f2a96b37e658ae9be Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Fri, 9 Apr 2010 17:11:56 +0300 Subject: [PATCH 005/132] Test adjustment for bug 500631 - Update html5lib tree builder test data to reflect the new isindex prompt from the spec. r=bnewman. --- parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt b/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt index d33996e0ccb6..54944c69c9c4 100644 --- a/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt +++ b/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt @@ -515,7 +515,7 @@ Line: 1 Col: 23 Unexpected start tag isindex. Don't use it! |
|
|