# HG changeset patch # User Henri Sivonen # Date 1337331538 -10800 # Node ID 98253603f95e7e11d0aa2a153319b9bde1f361fd # Parent b7b7c790cc5e4dd05f498808c370d2fc5437dd1e Bug 753278 - Make document.open() after aborting a non-script-created parser a no-op. r=NOT_REVIEWED. diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -574,16 +574,17 @@ include $(topsrcdir)/config/rules.mk test_bug650386_redirect_303.html \ test_bug650386_redirect_307.html \ file_bug650386_content.sjs \ file_bug650386_report.sjs \ test_bug719533.html \ test_bug737087.html \ test_bug433662.html \ test_bug749367.html \ + test_bug753278.html \ $(NULL) _CHROME_FILES = \ test_bug357450.js \ $(NULL) # This test fails on the Mac for some reason ifneq (,$(filter gtk2 windows,$(MOZ_WIDGET_TOOLKIT))) diff --git a/content/base/test/test_bug753278.html b/content/base/test/test_bug753278.html new file mode 100644 --- /dev/null +++ b/content/base/test/test_bug753278.html @@ -0,0 +1,46 @@ + + + + + + Test for Bug 753278 + + + + +Mozilla Bug 753278 +

+ +
+
+
+ + diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -1349,17 +1349,26 @@ nsHTMLDocument::Open(const nsAString& aC NS_ParseContentType(NS_ConvertUTF16toUTF8(type), actualType, dummy); if (!actualType.EqualsLiteral("text/html") && !type.EqualsLiteral("replace")) { contentType.AssignLiteral("text/plain"); } } // If we already have a parser we ignore the document.open call. - if (mParser) { + if (mParser || mParserAborted) { + // The WHATWG spec says: "If the document has an active parser that isn't + // a script-created parser, and the insertion point associated with that + // parser's input stream is not undefined (that is, it does point to + // somewhere in the input stream), then the method does nothing. Abort + // these steps and return the Document object on which the method was + // invoked." + // Note that aborting a parser leaves the parser "active" with its + // insertion point "not undefined". We track this using mParserAborted, + // because aborting a parser nulls out mParser. return NS_OK; } // No calling document.open() without a script global object if (!mScriptGlobalObject) { return NS_OK; }