Skip to content

Commit

Permalink
Bug 1749935 - Remove nsIParser::ParseFragment/Reset. r=hsivonen
Browse files Browse the repository at this point in the history
  • Loading branch information
petervanderbeken committed Feb 14, 2022
1 parent 15b814c commit ec14463
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 48 deletions.
8 changes: 0 additions & 8 deletions parser/html/nsHtml5Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,20 +476,12 @@ nsHtml5Parser::Terminate() {
return executor->DidBuildModel(true);
}

NS_IMETHODIMP
nsHtml5Parser::ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack) {
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHODIMP
nsHtml5Parser::CancelParsingEvents() {
MOZ_ASSERT_UNREACHABLE("Don't call this!");
return NS_ERROR_NOT_IMPLEMENTED;
}

void nsHtml5Parser::Reset() { MOZ_ASSERT_UNREACHABLE("Don't call this!"); }

bool nsHtml5Parser::IsInsertionPointDefined() {
return !mExecutor->IsFlushing() && !mInsertionPointPermanentlyUndefined &&
(!GetStreamParser() || mScriptNestingLevel != 0);
Expand Down
11 changes: 0 additions & 11 deletions parser/html/nsHtml5Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,11 @@ class nsHtml5Parser final : public nsIParser, public nsSupportsWeakReference {
*/
NS_IMETHOD Terminate() override;

/**
* Don't call. For interface backwards compat only.
*/
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack) override;

/**
* Don't call. For interface compat only.
*/
NS_IMETHOD CancelParsingEvents() override;

/**
* Don't call. For interface compat only.
*/
virtual void Reset() override;

/**
* True if the insertion point (per HTML5) is defined.
*/
Expand Down
2 changes: 1 addition & 1 deletion parser/htmlparser/nsIFragmentContentSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DocumentFragment;

/**
* The fragment sink allows a client to parse a fragment of sink, possibly
* surrounded in context. Also see nsIParser::ParseFragment().
* surrounded in context. Also see nsParser::ParseFragment().
* Note: once you've parsed a fragment, the fragment sink must be re-set on
* the parser in order to parse another fragment.
*/
Expand Down
14 changes: 0 additions & 14 deletions parser/htmlparser/nsIParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,6 @@ class nsIParser : public nsParserBase {

NS_IMETHOD Terminate(void) = 0;

/**
* This method gets called when you want to parse a fragment of HTML or XML
* surrounded by the context |aTagStack|. It requires that the parser have
* been given a fragment content sink.
*
* @param aSourceBuffer The XML or HTML that hasn't been parsed yet.
* @param aTagStack The context of the source buffer.
* @return Success or failure.
*/
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack) = 0;

/**
* Call this method to cancel any pending parsing events.
* Parsing events may be pending if all of the document's content
Expand All @@ -181,8 +169,6 @@ class nsIParser : public nsParserBase {

NS_IMETHOD CancelParsingEvents() = 0;

virtual void Reset() = 0;

/**
* True if the insertion point (per HTML5) is defined.
*/
Expand Down
5 changes: 2 additions & 3 deletions parser/htmlparser/nsParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,8 @@ nsresult nsParser::Parse(const nsAString& aSourceBuffer, bool aLastCall) {
return ResumeParse(false, false, false);
}

NS_IMETHODIMP
nsParser::ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack) {
nsresult nsParser::ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack) {
if (mInternalState == NS_ERROR_OUT_OF_MEMORY) {
// Checking NS_ERROR_OUT_OF_MEMORY instead of NS_FAILED
// to avoid introducing unintentional changes to behavior.
Expand Down
13 changes: 9 additions & 4 deletions parser/htmlparser/nsParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,15 @@ class nsParser final : public nsIParser,
NS_IMETHOD Parse(nsIURI* aURL) override;

/**
* This method needs documentation
* This method gets called when you want to parse a fragment of XML surrounded
* by the context |aTagStack|. It requires that the parser have been given a
* fragment content sink.
*
* @param aSourceBuffer The XML that hasn't been parsed yet.
* @param aTagStack The context of the source buffer.
*/
NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack) override;
nsresult ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack);

NS_IMETHOD ContinueInterruptedParsing() override;
NS_IMETHOD_(void) BlockParser() override;
Expand Down Expand Up @@ -247,7 +252,7 @@ class nsParser final : public nsIParser,
*/
void HandleParserContinueEvent(class nsParserContinueEvent*);

virtual void Reset() override {
void Reset() {
Cleanup();
Initialize();
}
Expand Down
7 changes: 0 additions & 7 deletions parser/prototype/PrototypeDocumentParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,8 @@ class PrototypeDocumentParser final : public nsIParser,

NS_IMETHOD Terminate() override { return NS_ERROR_NOT_IMPLEMENTED; }

NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
nsTArray<nsString>& aTagStack) override {
return NS_ERROR_NOT_IMPLEMENTED;
}

NS_IMETHOD CancelParsingEvents() override { return NS_ERROR_NOT_IMPLEMENTED; }

virtual void Reset() override {}

virtual bool IsInsertionPointDefined() override { return false; }

void IncrementScriptNestingLevel() final {}
Expand Down

0 comments on commit ec14463

Please sign in to comment.