Bug 1749935 - Inline nsParser::CancelParsingEvents. r=hsivonen

Differential Revision: https://phabricator.services.mozilla.com/D135898
This commit is contained in:
Peter Van der Beken 2022-02-14 13:03:52 +00:00
Родитель ec144630b6
Коммит 470c69ad81
6 изменённых файлов: 9 добавлений и 49 удалений

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

@ -476,12 +476,6 @@ nsHtml5Parser::Terminate() {
return executor->DidBuildModel(true);
}
NS_IMETHODIMP
nsHtml5Parser::CancelParsingEvents() {
MOZ_ASSERT_UNREACHABLE("Don't call this!");
return NS_ERROR_NOT_IMPLEMENTED;
}
bool nsHtml5Parser::IsInsertionPointDefined() {
return !mExecutor->IsFlushing() && !mInsertionPointPermanentlyUndefined &&
(!GetStreamParser() || mScriptNestingLevel != 0);

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

@ -136,11 +136,6 @@ class nsHtml5Parser final : public nsIParser, public nsSupportsWeakReference {
*/
NS_IMETHOD Terminate() override;
/**
* Don't call. For interface compat only.
*/
NS_IMETHOD CancelParsingEvents() override;
/**
* True if the insertion point (per HTML5) is defined.
*/

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

@ -157,18 +157,6 @@ class nsIParser : public nsParserBase {
NS_IMETHOD Terminate(void) = 0;
/**
* Call this method to cancel any pending parsing events.
* Parsing events may be pending if all of the document's content
* has been passed to the parser but the parser has been interrupted
* because processing the tokens took too long.
*
* @update kmcclusk 05/18/01
* @return NS_OK if succeeded else ERROR.
*/
NS_IMETHOD CancelParsingEvents() = 0;
/**
* True if the insertion point (per HTML5) is defined.
*/

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

@ -270,17 +270,6 @@ nsParser::SetContentSink(nsIContentSink* aSink) {
NS_IMETHODIMP_(nsIContentSink*)
nsParser::GetContentSink() { return mSink; }
NS_IMETHODIMP
nsParser::CancelParsingEvents() {
if (mFlags & NS_PARSER_FLAG_PENDING_CONTINUE_EVENT) {
NS_ASSERTION(mContinueEvent, "mContinueEvent is null");
// Revoke the pending continue parsing event
mContinueEvent = nullptr;
mFlags &= ~NS_PARSER_FLAG_PENDING_CONTINUE_EVENT;
}
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
/**
@ -371,13 +360,16 @@ nsParser::Terminate(void) {
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
mInternalState = result = NS_ERROR_HTMLPARSER_STOPPARSING;
// CancelParsingEvents must be called to avoid leaking the nsParser object
// @see bug 108049
// If NS_PARSER_FLAG_PENDING_CONTINUE_EVENT is set then CancelParsingEvents
// will reset it so DidBuildModel will call DidBuildModel on the DTD. Note:
// The IsComplete() call inside of DidBuildModel looks at the
// pendingContinueEvents flag.
CancelParsingEvents();
// If NS_PARSER_FLAG_PENDING_CONTINUE_EVENT is set then reset it so
// DidBuildModel will call DidBuildModel on the DTD. Note: The IsComplete()
// call inside of DidBuildModel looks at the pendingContinueEvents flag.
if (mFlags & NS_PARSER_FLAG_PENDING_CONTINUE_EVENT) {
NS_ASSERTION(mContinueEvent, "mContinueEvent is null");
// Revoke the pending continue parsing event
mContinueEvent = nullptr;
mFlags &= ~NS_PARSER_FLAG_PENDING_CONTINUE_EVENT;
}
if (mDTD) {
mDTD->Terminate();

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

@ -207,13 +207,6 @@ class nsParser final : public nsIParser,
void SetSinkCharset(NotNull<const Encoding*> aCharset);
/**
* Removes continue parsing events
* @update kmcclusk 5/18/98
*/
NS_IMETHOD CancelParsingEvents() override;
/**
* Return true.
*/

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

@ -80,8 +80,6 @@ class PrototypeDocumentParser final : public nsIParser,
NS_IMETHOD Terminate() override { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD CancelParsingEvents() override { return NS_ERROR_NOT_IMPLEMENTED; }
virtual bool IsInsertionPointDefined() override { return false; }
void IncrementScriptNestingLevel() final {}