Bug 460437 - 'innerHtml doesn't update DOM when Html markup goes from Invalid to Valid'. r+sr=mrbkap.

This commit is contained in:
Ben Turner 2008-12-07 16:15:52 -08:00
parent a3f1dfd7b3
commit f08f233265
3 changed files with 47 additions and 0 deletions

View File

@ -794,6 +794,7 @@ nsParser::Initialize(PRBool aConstructor)
// nsCOMPtrs
mObserver = nsnull;
mParserFilter = nsnull;
mUnusedInput.Truncate();
}
mContinueEvent = nsnull;
@ -3014,6 +3015,8 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk)
mParserContext->mNumConsumed = 0;
PRBool killSink = PR_FALSE;
WillTokenize(aIsFinalChunk);
while (NS_SUCCEEDED(result)) {
mParserContext->mNumConsumed += mParserContext->mScanner->Mark();
@ -3025,6 +3028,7 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk)
break;
}
if (NS_ERROR_HTMLPARSER_STOPPARSING == result) {
killSink = PR_TRUE;
result = Terminate();
break;
}
@ -3040,6 +3044,10 @@ nsresult nsParser::Tokenize(PRBool aIsFinalChunk)
DidTokenize(aIsFinalChunk);
MOZ_TIMER_STOP(mTokenizeTime);
if (killSink) {
mSink = nsnull;
}
} else {
result = mInternalState = NS_ERROR_HTMLPARSER_BADTOKENIZER;
}

View File

@ -55,6 +55,7 @@ _TEST_FILES = parser_datreader.js \
test_bug358797.html \
test_bug396568.html \
test_bug418464.html \
test_bug460437.xhtml \
test_compatmode.html \
regressions.txt \
$(NULL)

View File

@ -0,0 +1,38 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=460437
-->
<head>
<title>Test for Bug 460437</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=460437">Mozilla Bug 460437</a>
<p id="display"><b id="test460437">orig</b></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
<![CDATA[
/** Test for Bug 460437 **/
var s = '<i>invalid</i';
try {
document.getElementById('test460437').innerHTML = s;
} catch (e) {
}
is(document.getElementById('test460437').innerHTML, "", "setting invalid innerHTML should clear it");
s = '<i>valid</i>';
document.getElementById('test460437').innerHTML = s;
is(document.getElementById('test460437').innerHTML, "<i xmlns=\"http://www.w3.org/1999/xhtml\">valid</i>", "failed to set valid innerHTML");
]]>
</script>
</pre>
</body>
</html>