Commit 470c69ad authored by Peter Van der Beken's avatar Peter Van der Beken
Browse files

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

parent ec144630
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -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);
+0 −5
Original line number Diff line number Diff line
@@ -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.
   */
+0 −12
Original line number Diff line number Diff line
@@ -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.
   */
+9 −17
Original line number Diff line number Diff line
@@ -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();
+0 −7
Original line number Diff line number Diff line
@@ -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.
   */
Loading