Bug 509672 - Make HTML5 parser not fire mutation events when adding attributes to root or body elements. r=jonas

This commit is contained in:
Henri Sivonen 2009-08-13 10:45:24 +03:00
Родитель 79c13aad66
Коммит f1a8715a61
9 изменённых файлов: 1369 добавлений и 871 удалений

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

@ -39,9 +39,14 @@
* ***** END LICENSE BLOCK ***** */
#include "nsHtml5TreeOperation.h"
#include "nsContentUtils.h"
#include "nsNodeUtils.h"
#include "nsAttrName.h"
#include "nsHtml5TreeBuilder.h"
#include "nsIDOMMutationEvent.h"
#include "mozAutoDocUpdate.h"
#include "nsBindingManager.h"
#include "nsXBLBinding.h"
nsHtml5TreeOperation::nsHtml5TreeOperation()
: mOpCode(eTreeOpAppend)
@ -117,6 +122,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeBuilder* aBuilder)
}
case eTreeOpAddAttributes: {
// mNode holds the new attributes and mParent is the target
nsIDocument* document = mParent->GetCurrentDoc();
PRUint32 len = mNode->GetAttrCount();
for (PRUint32 i = 0; i < len; ++i) {
const nsAttrName* attrName = mNode->GetAttrNameAt(i);
@ -125,8 +132,38 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeBuilder* aBuilder)
if (!mParent->HasAttr(nsuri, localName)) {
nsAutoString value;
mNode->GetAttr(nsuri, localName, value);
mParent->SetAttr(nsuri, localName, attrName->GetPrefix(), value, PR_TRUE);
// XXX should not fire mutation event here
// the manual notification code is based on nsGenericElement
PRUint32 stateMask = PRUint32(mParent->IntrinsicState());
nsNodeUtils::AttributeWillChange(mParent,
nsuri,
localName,
static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION));
mParent->SetAttr(nsuri, localName, attrName->GetPrefix(), value, PR_FALSE);
if (document || mParent->HasFlag(NODE_FORCE_XBL_BINDINGS)) {
nsIDocument* ownerDoc = mParent->GetOwnerDoc();
if (ownerDoc) {
nsRefPtr<nsXBLBinding> binding =
ownerDoc->BindingManager()->GetBinding(mParent);
if (binding) {
binding->AttributeChanged(localName, nsuri, PR_FALSE, PR_FALSE);
}
}
}
stateMask = stateMask ^ PRUint32(mParent->IntrinsicState());
if (stateMask && document) {
MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
document->ContentStatesChanged(mParent, nsnull, stateMask);
}
nsNodeUtils::AttributeChanged(mParent,
nsuri,
localName,
static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION),
stateMask);
}
}
return rv;

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

@ -46,11 +46,39 @@ include $(topsrcdir)/config/rules.mk
_TEST_FILES = parser_datreader.js \
parser_web_testrunner.js \
tokenizer_file_server.sjs \
html5lib_tokenizer_entities.test \
html5lib_tokenizer_numeric_entities.test \
html5lib_tokenizer_unicode_chars.test \
html5lib_tokenizer_test1.test \
html5lib_tokenizer_test2.test \
html5lib_tokenizer_test3.test \
html5lib_tokenizer_test4.test \
html5lib_tokenizer_test5.test \
html5lib_tree_dat1.txt \
html5lib_tree_dat2.txt \
html5lib_tree_dat3.txt \
html5lib_tree_dat5.txt \
html5lib_tree_dat6.txt \
html5lib_tree_dat7.txt \
html5lib_tree_dat8.txt \
html5lib_tree_dat9.txt \
html5lib_tree_dat10.txt \
html5lib_tree_dat11.txt \
html5lib_tree_dat12.txt \
html5lib_tree_dat14.txt \
html5_tree_construction_exceptions.js \
nu.validator.htmlparser.HtmlParser.nocache.js \
test_html5_tokenizer_entities.html \
test_html5_tokenizer_numeric_entities.html \
test_html5_tokenizer_test1.html \
test_html5_tokenizer_test2.html \
test_html5_tokenizer_test3.html \
test_html5_tokenizer_test4.html \
test_html5_tokenizer_test5.html \
test_html5_tokenizer_unicode_chars.html \
test_html5_tree_construction.html \
test_html5_tree_construction_js_compare.html \
test_bug174351.html \
test_bug339350.xhtml \
test_bug358797.html \

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,8 +1,8 @@
#data
<!doctype html>Test
<!DOCTYPE html>Test
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -11,9 +11,8 @@
#data
<textarea>test</div>test
#errors
10: missing document type declaration.
17: unescaped '</' in CDATA or RCDATA block.
25: unexpected end of file while parsing CDATA section for element textarea.
Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
Line: 1 Col: 24 Expected closing tag. Unexpected end of file.
#document
| <html>
| <head>
@ -24,9 +23,9 @@
#data
<table><td>
#errors
7: missing document type declaration.
11: required tr element start tag implied by unexpected td element start tag.
12: unexpected end of file implied table element end tag.
Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
Line: 1 Col: 11 Unexpected table cell start tag (td) in the table body phase.
Line: 1 Col: 11 Expected closing tag. Unexpected end of file.
#document
| <html>
| <head>
@ -39,8 +38,8 @@
#data
<table><td>test</tbody></table>
#errors
missing document type declarattion
Unexpected and of file
Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
Line: 1 Col: 11 Unexpected table cell start tag (td) in the table body phase.
#document
| <html>
| <head>
@ -54,8 +53,8 @@ Unexpected and of file
#data
<frame>test
#errors
missing document type declaration
frame element can't occur here
Line: 1 Col: 7 Unexpected start tag (frame). Expected DOCTYPE.
Line: 1 Col: 7 Unexpected start tag frame. Ignored.
#document
| <html>
| <head>
@ -63,32 +62,34 @@ frame element can't occur here
| "test"
#data
<!doctype html><frameset>test
<!DOCTYPE html><frameset>test
#errors
frameset can't contain text
Unexpected end of file
Line: 1 Col: 29 Unepxected characters in the frameset phase. Characters ignored.
Line: 1 Col: 29 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>
#data
<!doctype html><frameset><!doctype html>
<!DOCTYPE html><frameset><!DOCTYPE html>
#errors
document type declaration can only occur at the start of a document
Expected end tag </frameset>
Line: 1 Col: 40 Unexpected DOCTYPE. Ignored.
Line: 1 Col: 40 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>
#data
<!doctype html><font><p><b>test</font>
<!DOCTYPE html><font><p><b>test</font>
#errors
Line: 1 Col: 38 End tag (font) violates step 1, paragraph 3 of the adoption agency algorithm.
Line: 1 Col: 38 End tag (font) violates step 1, paragraph 3 of the adoption agency algorithm.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -99,10 +100,11 @@ Expected end tag </frameset>
| "test"
#data
<!DOCTYPE htmL><dt><div><dd>
<!DOCTYPE html><dt><div><dd>
#errors
Line: 1 Col: 28 Missing end tag (div, dt).
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -113,9 +115,8 @@ Expected end tag </frameset>
#data
<script></x
#errors
no document type
</ in script
Unexpected end of file. Expected </script> end tag.
Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
Line: 1 Col: 11 Unexpected end of file. Expected end tag (script).
#document
| <html>
| <head>
@ -126,10 +127,9 @@ Unexpected end of file. Expected </script> end tag.
#data
<table><plaintext><td>
#errors
no document type
<plaintext> directly inside table
Characters inside table.
Unexpected end of file.
Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
Line: 1 Col: 18 Unexpected start tag (plaintext) in table context caused voodoo mode.
Line: 1 Col: 22 Unexpected end of file. Expected table content.
#document
| <html>
| <head>
@ -141,8 +141,8 @@ Unexpected end of file.
#data
<plaintext></plaintext>
#errors
No DOCTYPE seen.
Unexpected end of file.
Line: 1 Col: 11 Unexpected start tag (plaintext). Expected DOCTYPE.
Line: 1 Col: 23 Expected closing tag. Unexpected end of file.
#document
| <html>
| <head>
@ -151,12 +151,12 @@ Unexpected end of file.
| "</plaintext>"
#data
<!doctype html><table><tr>TEST
<!DOCTYPE html><table><tr>TEST
#errors
TEST can't occur in <tr>
Unexpected end of file.
Line: 1 Col: 30 Unexpected non-space characters in table context caused voodoo mode.
Line: 1 Col: 30 Unexpected end of file. Expected table content.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -166,56 +166,52 @@ Unexpected end of file.
| <tr>
#data
<!doctype html><body t1=1><body t2=2><body t3=3 t4=4>
<!DOCTYPE html><body t1=1><body t2=2><body t3=3 t4=4>
#errors
Unexpected start tag "body"
Unexpected start tag "body"
Line: 1 Col: 37 Unexpected start tag (body).
Line: 1 Col: 53 Unexpected start tag (body).
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| t4="4"
| t1="1"
| t2="2"
| t3="3"
| t1="1"
| t4="4"
#data
</b test
#errors
Unexpected EOF in attribute
Unexpected attribute in end tag.
No doctype.
Unexpected end tag.
Line: 1 Col: 8 Unexpected end of file in attribute name.
Line: 1 Col: 8 End tag contains unexpected attributes.
Line: 1 Col: 8 Unexpected end tag (b). Expected DOCTYPE.
Line: 1 Col: 8 Unexpected end tag (b) after the (implied) root element.
#document
| <html>
| <head>
| <body>
#data
<!doctype HtML></b test<b &=&amp>X
<!DOCTYPE html></b test<b &=&amp>X
#errors
Unexpected < in attribute
End tag contains attributes.
Unexpected end tag.
Named entity didn't end with ;
Unexpected EOF. Missing closing tag.
Line: 1 Col: 32 Named entity didn't end with ';'.
Line: 1 Col: 33 End tag contains unexpected attributes.
Line: 1 Col: 33 Unexpected end tag (b) after the (implied) root element.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <b>
| &="&"
| "X"
| "X"
#data
<!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt
#errors
No space after literal DOCTYPE.
Unexpected EOF in (end) tag name
Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
Line: 1 Col: 54 Unexpected end of file in the tag name.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <script>
@ -226,8 +222,7 @@ Unexpected EOF in (end) tag name
#data
&
#errors
No doctype.
Unfinished entity.
Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -237,8 +232,8 @@ Unfinished entity.
#data
&#
#errors
No doctype.
Unfinished numeric entity.
Line: 1 Col: 1 Numeric entity expected. Got end of file instead.
Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -248,8 +243,8 @@ Unfinished numeric entity.
#data
&#X
#errors
No doctype.
Unfinished hexadecimal entity.
Line: 1 Col: 3 Numeric entity expected but none found.
Line: 1 Col: 3 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -259,8 +254,8 @@ Unfinished hexadecimal entity.
#data
&#x
#errors
No doctype.
Unfinished hexadecimal entity.
Line: 1 Col: 3 Numeric entity expected but none found.
Line: 1 Col: 3 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -270,8 +265,8 @@ Unfinished hexadecimal entity.
#data
&#45
#errors
No doctype.
Numeric entity didn't end with ;
Line: 1 Col: 4 Numeric entity didn't end with ';'.
Line: 1 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -281,8 +276,8 @@ Numeric entity didn't end with ;
#data
&x-test
#errors
No doctype.
Unfinished named entity.
Line: 1 Col: 1 Named entity expected. Got none.
Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -292,9 +287,9 @@ Unfinished named entity.
#data
<!doctypehtml><p><li>
#errors
No space after literal DOCTYPE.
Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -304,9 +299,9 @@ No space after literal DOCTYPE.
#data
<!doctypehtml><p><dt>
#errors
No space after literal DOCTYPE.
Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -316,9 +311,9 @@ No space after literal DOCTYPE.
#data
<!doctypehtml><p><dd>
#errors
No space after literal DOCTYPE.
Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -328,10 +323,10 @@ No space after literal DOCTYPE.
#data
<!doctypehtml><p><form>
#errors
No space after literal DOCTYPE.
Unexpected EOF.
Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
Line: 1 Col: 23 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -339,31 +334,10 @@ Unexpected EOF.
| <form>
#data
<!doctype html><p><b><i><u></p> <p>X
#errors
Unexpected end tag </p>.
Unexpected end EOF. Missing closing tags.
#document
| <!DOCTYPE HTML>
| <html>
| <head>
| <body>
| <p>
| <b>
| <i>
| <u>
| " "
| <p>
| <b>
| <i>
| <u>
| "X"
#data
<!doctype html><p></P>X
<!DOCTYPE html><p></P>X
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -373,8 +347,8 @@ Unexpected end EOF. Missing closing tags.
#data
&AMP
#errors
No doctype.
No closing ; for the entity.
Line: 1 Col: 4 Named entity didn't end with ';'.
Line: 1 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -384,8 +358,8 @@ No closing ; for the entity.
#data
&AMp;
#errors
No doctype.
Invalid entity.
Line: 1 Col: 1 Named entity expected. Got none.
Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -393,45 +367,45 @@ Invalid entity.
| "&AMp;"
#data
<!doctype html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>
<!DOCTYPE html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>
#errors
Unexpected end of file.
Line: 1 Col: 110 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly>
#data
<!doctype html>X</body>X
<!DOCTYPE html>X</body>X
#errors
Unexpected non-space characters in the after body phase.
Line: 1 Col: 24 Unexpected non-space characters in the after body phase.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| "XX"
#data
<!doctype html><!-- X
<!DOCTYPE html><!-- X
#errors
Unexpected end of file in comment.
Line: 1 Col: 21 Unexpected end of file in comment.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <!-- X -->
| <html>
| <head>
| <body>
#data
<!doctype html><table><caption>test TEST</caption><td>test
<!DOCTYPE html><table><caption>test TEST</caption><td>test
#errors
Unexpected <td> in table body phase.
Unexpected end of file.
Line: 1 Col: 54 Unexpected table cell start tag (td) in the table body phase.
Line: 1 Col: 58 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -444,11 +418,11 @@ Unexpected end of file.
| "test"
#data
<!doctype html><select><option><optgroup>
<!DOCTYPE html><select><option><optgroup>
#errors
Unexpected end of file. Missing closing tags.
Line: 1 Col: 41 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -457,12 +431,12 @@ Unexpected end of file. Missing closing tags.
| <optgroup>
#data
<!doctype html><select><optgroup><option></optgroup><option><select><option>
<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>
#errors
Unexpected start tag <select> in <select>.
Unexpected start tag <option>.
Line: 1 Col: 68 Unexpected select start tag in the select phase treated as select end tag.
Line: 1 Col: 76 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -470,13 +444,14 @@ Unexpected start tag <option>.
| <optgroup>
| <option>
| <option>
| <option>
#data
<!doctype html><select><optgroup><option><optgroup>
<!DOCTYPE html><select><optgroup><option><optgroup>
#errors
Unexpected end of file. Missing closing tags.
Line: 1 Col: 51 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -486,10 +461,10 @@ Unexpected end of file. Missing closing tags.
| <optgroup>
#data
<!doctype html><font><input><input></font>
<!DOCTYPE html><font><input><input></font>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -498,31 +473,31 @@ Unexpected end of file. Missing closing tags.
| <input>
#data
<!DoctypE html><!-- XXX - XXX -->
<!DOCTYPE html><!-- XXX - XXX -->
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <!-- XXX - XXX -->
| <html>
| <head>
| <body>
#data
<!DoctypE html><!-- XXX - XXX
<!DOCTYPE html><!-- XXX - XXX
#errors
Unexpected EOF in comment.
Line: 1 Col: 29 Unexpected end of file in comment (-)
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <!-- XXX - XXX -->
| <html>
| <head>
| <body>
#data
<!DoctypE html><!-- XXX - XXX - XXX -->
<!DOCTYPE html><!-- XXX - XXX - XXX -->
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <!-- XXX - XXX - XXX -->
| <html>
| <head>
@ -531,27 +506,26 @@ Unexpected EOF in comment.
#data
<isindex test=x name=x>
#errors
No doctype
<isindex> is not ok!
Line: 1 Col: 23 Unexpected start tag (isindex). Expected DOCTYPE.
Line: 1 Col: 23 Unexpected start tag isindex. Don't use it!
#document
| <html>
| <head>
| <body>
| <form>
| <hr>
| <p>
| <label>
| "This is a searchable index. Insert your search keywords here:"
| <input>
| test="x"
| name="isindex"
| <label>
| "This is a searchable index. Insert your search keywords here: "
| <input>
| name="isindex"
| test="x"
| <hr>
#data
test
test
#errors
No doctype
Line: 2 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -560,69 +534,40 @@ No doctype
test"
#data
<p><b><i><u></p>
<p>X
<!DOCTYPE html><body><title>test</body></title>
#errors
No doctype
Unexpected end tag p.
Unexpected EOF.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <p>
| <b>
| <i>
| <u>
| "
"
| <p>
| <b>
| <i>
| <u>
| "X"
#data
<!doctype html><body><title>test</body></title>
#errors
Unexpected start tag that belongs in the head.
Expected closing tag after </.
#document
| <!DOCTYPE HTML>
| <html>
| <head>
| <title>
| "test</body>"
| <body>
#data
<!doctype html><body><title>X</title><meta name=z><link rel=foo><style>
<!DOCTYPE html><body><title>X</title><meta name=z><link rel=foo><style>
x { content:"</style" } </style>
#errors
Unexpected start tag that belongs in head.
Unexpected start tag that belongs in head.
Unexpected start tag that belongs in head.
Expected closing tag after </.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <title>
| "X"
| <meta>
| name="z"
| <link>
| rel="foo"
| <body>
| <style>
| "
x { content:"</style" } "
#data
<!doctype html><select><optgroup></optgroup></select>
<!DOCTYPE html><select><optgroup></optgroup></select>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -633,30 +578,27 @@ x { content:"</style" } "
#errors
No doctype.
Line: 2 Col: 1 Unexpected End of file. Expected DOCTYPE.
#document
| "
"
| <html>
| <head>
| <body>
#data
<!doctype html> <html>
<!DOCTYPE html> <html>
#errors
#document
| <!DOCTYPE HTML>
| " "
| <!DOCTYPE html>
| <html>
| <head>
| <body>
#data
<!doctype html><script>
<!DOCTYPE html><script>
</script> <title>x</title> </head>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <script>
@ -669,23 +611,23 @@ No doctype.
| <body>
#data
<!doctype html><html><body><html id=x>
<!DOCTYPE html><html><body><html id=x>
#errors
duplicate html start tag
Line: 1 Col: 38 html needs to be the first start tag.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| id="x"
| <head>
| <body>
#data
<!doctype html>X</body><html id="x">
<!DOCTYPE html>X</body><html id="x">
#errors
Unexpected html start tag in the after body phase.
html needs to be the first start tag.
Line: 1 Col: 36 Unexpected start tag token (html) in the after body phase.
Line: 1 Col: 36 html needs to be the first start tag.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| id="x"
| <head>
@ -693,45 +635,43 @@ html needs to be the first start tag.
| "X"
#data
<!doctype html><head><html id=x>
<!DOCTYPE html><head><html id=x>
#errors
html start tag too late
Line: 1 Col: 32 html needs to be the first start tag.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| id="x"
| <head>
| <body>
#data
<!doctype html>X</html>X
<!DOCTYPE html>X</html>X
#errors
Unexpected non-space characters. Expected end of file.
Unexpected non-space characters in after body phase. Expected end of file.
Line: 1 Col: 24 Unexpected non-space characters in the after body phase.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| "XX"
#data
<!doctype html>X</html>
<!DOCTYPE html>X</html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| "X "
#data
<!doctype html>X</html><p>X
<!DOCTYPE html>X</html><p>X
#errors
Unexpected start tag <p> in trailing end phase.
Unexpected start tag <p> in after body phase.
Line: 1 Col: 26 Unexpected start tag (p).
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -740,29 +680,59 @@ Unexpected start tag <p> in after body phase.
| "X"
#data
<!doctype html>X<p/x/y/z>
<!DOCTYPE html>X<p/x/y/z>
#errors
Solidus (/) incorrectly placed.
Solidus (/) incorrectly placed.
Solidus (/) incorrectly placed.
Line: 1 Col: 19 Expected a > after the /.
Line: 1 Col: 21 Solidus (/) incorrectly placed in tag.
Line: 1 Col: 23 Solidus (/) incorrectly placed in tag.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| "X"
| <p>
| y=""
| x=""
| y=""
| z=""
#data
<!doctype html><!--x--
<!DOCTYPE html><!--x--
#errors
Unexpected end of file in comment.
Line: 1 Col: 22 Unexpected end of file in comment (--).
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <!-- x -->
| <html>
| <head>
| <body>
#data
<!DOCTYPE html><table><tr><td></p></table>
#errors
Line: 1 Col: 34 Unexpected end tag (p). Ignored.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <table>
| <tbody>
| <tr>
| <td>
| <p>
#data
<!DOCTYPE <!DOCTYPE HTML>><!--<!--x-->-->
#errors
Line: 1 Col: 20 Expected space or '>'. Got ''
Line: 1 Col: 25 Erroneous DOCTYPE.
Line: 1 Col: 35 Unexpected character in comment found.
#document
| <!DOCTYPE <!doctype>
| <html>
| <head>
| <body>
| ">"
| <!-- <!--x -->
| "-->"

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

@ -1,8 +1,8 @@
#data
<head></head><style></style>
#errors
No DOCTYPE
<style> in after-head mode
Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
Line: 1 Col: 20 Unexpected start tag (style) that can be in head. Moved.
#document
| <html>
| <head>
@ -12,8 +12,8 @@ No DOCTYPE
#data
<head></head><script></script>
#errors
No DOCTYPE
<script> in after-head mode
Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
Line: 1 Col: 21 Unexpected start tag (script) that can be in head. Moved.
#document
| <html>
| <head>
@ -23,8 +23,8 @@ No DOCTYPE
#data
<head></head><!-- --><style></style><!-- --><script></script>
#errors
No DOCTYPE
<style> in after-head mode
Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
Line: 1 Col: 28 Unexpected start tag (style) that can be in head. Moved.
#document
| <html>
| <head>
@ -37,7 +37,7 @@ No DOCTYPE
#data
<head></head><!-- -->x<style></style><!-- --><script></script>
#errors
No DOCTYPE
Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
#document
| <html>
| <head>
@ -53,7 +53,7 @@ No DOCTYPE
</pre></body></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -61,31 +61,42 @@ No DOCTYPE
#data
<!DOCTYPE html><html><head></head><body><pre>
foo</pre></body></html>
foo2</pre></body></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <pre>
| "foo"
| "foo2"
#data
<!DOCTYPE html><html><head></head><body><pre>
foo
foo3</pre></body></html>
#errors
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <pre>
| "
foo3"
#data
<!DOCTYPE html><html><head></head><body><pre>
foo4
</pre></body></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <pre>
| "foo
| "foo4
"
#data
@ -93,7 +104,7 @@ foo
</span></body></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -108,7 +119,7 @@ foo
y</pre></body></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -120,8 +131,9 @@ y"
<!DOCTYPE html><html><head></head><body><pre>x<div>
y</pre></body></html>
#errors
Line: 2 Col: 7 End tag (pre) seen too early. Expected other end tag.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -129,4 +141,153 @@ y</pre></body></html>
| "x"
| <div>
| "
| y"
y"
#data
<!DOCTYPE html><HTML><META><HEAD></HEAD></HTML>
#errors
Line: 1 Col: 33 Unexpected start tag head in existing head. Ignored.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <meta>
| <body>
#data
<!DOCTYPE html><HTML><HEAD><head></HEAD></HTML>
#errors
Line: 1 Col: 33 Unexpected start tag head in existing head. Ignored.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
#data
<textarea>foo<span>bar</span><i>baz
#errors
Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
Line: 1 Col: 35 Expected closing tag. Unexpected end of file.
#document
| <html>
| <head>
| <body>
| <textarea>
| "foo<span>bar</span><i>baz"
#data
<title>foo<span>bar</em><i>baz
#errors
Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
Line: 1 Col: 30 Unexpected end of file. Expected end tag (title).
#document
| <html>
| <head>
| <title>
| "foo<span>bar</em><i>baz"
| <body>
#data
<!DOCTYPE html><textarea>
</textarea>
#errors
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <textarea>
#data
<!DOCTYPE html><textarea>
foo</textarea>
#errors
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <textarea>
| "foo"
#data
<!DOCTYPE html><textarea>
foo</textarea>
#errors
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <textarea>
| "
foo"
#data
<!DOCTYPE html><html><head></head><body><ul><li><div><p><li></ul></body></html>
#errors
Line: 1 Col: 60 Missing end tag (div, li).
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <ul>
| <li>
| <div>
| <p>
| <li>
#data
<!doctype html><nobr><nobr><nobr>
#errors
Line: 1 Col: 27 Unexpected start tag (nobr) implies end tag (nobr).
Line: 1 Col: 33 Unexpected start tag (nobr) implies end tag (nobr).
Line: 1 Col: 33 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <nobr>
| <nobr>
| <nobr>
#data
<!doctype html><nobr><nobr></nobr><nobr>
#errors
Line: 1 Col: 27 Unexpected start tag (nobr) implies end tag (nobr).
Line: 1 Col: 40 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <nobr>
| <nobr>
| <nobr>
#data
<!doctype html><html><body><p><table></table></body></html>
#errors
Not known
#document
| <!DOCTYPE html>
| <html>
| <head>
| <body>
| <p>
| <table>
#data
<p><table></table>
#errors
Not known
#document
| <html>
| <head>
| <body>
| <p>
| <table>

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

@ -58,6 +58,137 @@ function trimString(s) {
return(s.replace(/^\s+/,'').replace(/\s+$/,''));
}
function getLastLine(str) {
var str_array = str.split("\n");
let last_line = str_array[str_array.length - 1];
return last_line;
}
/**
* Produces a string containing the expected output of a
* JSON-formatted test, by running the "output" object
* of the test through a serializer.
*
* @param buf string buffer containing the serialized output
* @param obj the object to serialize
* @param indent the current line indent
*/
var gDumpMode;
function dumpTree(buf, obj, indent) {
var buffer = buf;
if (typeof(obj) == "object" && (obj instanceof Array)) {
for each (var item in obj) {
[buffer, indent] = dumpTree(buffer, item, indent);
}
gDumpMode = -1;
}
else {
// Node.* constants are used here for convenience.
switch(obj) {
case "ParseError":
// no-op
break;
case "Character":
gDumpMode = Node.TEXT_NODE;
break;
case "StartTag":
gDumpMode = Node.ELEMENT_NODE;
break;
case "EndTag":
indent = indent.substring(2);
break;
case "Comment":
gDumpMode = Node.COMMENT_NODE;
break;
case "DOCTYPE":
gDumpMode = Node.DOCUMENT_TYPE_NODE;
break;
default:
switch(gDumpMode) {
case Node.DOCUMENT_TYPE_NODE:
buffer += "<!DOCTYPE " + obj + ">\n<html>\n <head>\n <body>";
indent += " "
gDumpMode = -1;
break;
case Node.COMMENT_NODE:
if (buffer.length > 1) {
buffer += "\n";
}
buffer += indent + "<!-- " + obj + " -->";
gDumpMode = -1;
break;
case Node.ATTRIBUTE_NODE:
is(typeof(obj), "object", "obj not an object!");
indent += " ";
for (var key in obj) {
buffer += "\n" + indent + key + "=\"" + obj[key] + "\"";
}
gDumpMode = -1;
break;
case Node.TEXT_NODE:
if (buffer.indexOf("<head>") == -1) {
buffer += "\n<html>\n <head>\n <body>";
indent += " ";
}
// If this text is being appended to some earlier
// text, concatenate the two by chopping off the
// trailing quote before adding new string.
let last_line = trimString(getLastLine(buffer));
if (last_line[0] == "\"" &&
last_line[last_line.length - 1] == "\"") {
buffer = buffer.substring(0, buffer.length - 1);
}
else {
buffer += "\n" + indent + "\"";
}
buffer += obj + "\"";
break;
case Node.ELEMENT_NODE:
buffer += "\n" + indent + "<" + obj + ">";
gDumpMode = Node.ATTRIBUTE_NODE;
break;
default:
// no-op
break;
}
break;
}
}
return [buffer, indent];
}
/**
* Parses an individual testcase in decoded JSON form,
* as for tokenizer tests.
*
* @param An object containing a single testcase
*/
function parseJsonTestcase(testcase) {
gDumpMode = -1;
// If the test begins with something that looks like the
// beginning of a doctype, then don't add a standard doctype,
// otherwise do.
if (testcase["input"].toLowerCase().indexOf("<!doc") == 0) {
var test_output = dumpTree(
"",
testcase["output"],
"");
} else {
var test_output = dumpTree(
"<!DOCTYPE html>\n<html>\n <head>\n <body>",
testcase["output"],
" ");
}
// Add html, head and body elements now if they
// haven't been added already.
if (test_output[0].indexOf("<head>") == -1) {
test_output[0] += "\n<html>\n <head>\n <body>";
}
return [testcase["input"], test_output[0], "",
testcase["description"],
JSON.stringify(testcase["output"])];
}
/**
* Parses an individual testcase into an array containing the input
* string, a string representing the expected tree (DOM), and a list
@ -66,6 +197,7 @@ function trimString(s) {
* @param A string containing a single testcase
*/
function parseTestcase(testcase) {
var documentFragmentTest = false;
var lines = testcase.split("\n");
if (lines[0] != "#data") {
log(lines);
@ -74,10 +206,15 @@ function parseTestcase(testcase) {
var input = [];
var output = [];
var errors = [];
var description = undefined;
var expectedTokenizerOutput = undefined;
var currentList = input;
for each (var line in lines) {
if (line && !(startsWith(line, "#error") ||
// allow blank lines in input
if ((line || currentList == input) && !(startsWith(line, "#errors") ||
startsWith(line, "#document") ||
startsWith(line, "#description") ||
startsWith(line, "#expected") ||
startsWith(line, "#data"))) {
if (currentList == output && startsWith(line, "|")) {
currentList.push(line.substring(2));
@ -88,10 +225,20 @@ function parseTestcase(testcase) {
currentList = errors;
} else if (line == "#document") {
currentList = output;
} else if (line == "#document-fragment") {
documentFragmentTest = true;
}
}
// For #document-fragment tests, erase the output, so that the
// test is skipped in makeTestChecker()...there is no good way
// to run fragment tests without direct access to the parser.
if (documentFragmentTest) {
output = [];
}
//logger.log(input.length, output.length, errors.length);
return [input.join("\n"), output.join("\n"), errors];
return [input.join("\n"), output.join("\n"), errors, description,
expectedTokenizerOutput];
}
/**
@ -167,18 +314,29 @@ function isAttributeLine(line) {
}
/**
* A generator function that accepts a list of strings. Each list
* A generator function that accepts a list of tests. Each list
* member corresponds to the contents of a ".dat" file from the
* html5lib test suite.
* html5lib test suite, or an array of decoded JSON tests,
* in the case of tokenizer "*.test" tests.
*
* @param The list of strings
*/
function test_parser(testlist) {
for each (var testgroup in testlist) {
var tests = testgroup.split("#data\n");
tests = ["#data\n" + test for each(test in tests) if (test)];
for each (var test in tests) {
yield parseTestcase(test);
var index = 1;
if (gTokenizerMode) {
for each (var test in testlist) {
var tmpArray = [index];
yield tmpArray.concat(parseJsonTestcase(test));
index++;
}
}
else {
for each (var testgroup in testlist) {
var tests = testgroup.split("#data\n");
tests = ["#data\n" + test for each(test in tests) if (test)];
for each (var test in tests) {
yield parseTestcase(test);
}
}
}
}
@ -197,29 +355,61 @@ function docToTestOutput(doc) {
function addLevels(walker, buf, indent) {
if(walker.firstChild()) {
do {
buf += indent;
switch (walker.currentNode.nodeType) {
case Node.ELEMENT_NODE:
buf += "<" + walker.currentNode.tagName.toLowerCase() + ">";
buf += indent + "<";
// Prefix MathML element names with "math " to match
// the format of the expected output.
if (walker.currentNode.namespaceURI.toLowerCase().
indexOf("math") != -1) {
buf += "math " + walker.currentNode.tagName.toLowerCase() + ">\n";
}
else if (walker.currentNode.namespaceURI.toLowerCase().
indexOf("svg") != -1) {
buf += "svg " + walker.currentNode.tagName + ">\n";
}
else {
buf += walker.currentNode.tagName.toLowerCase() + ">\n";
}
if (walker.currentNode.hasAttributes()) {
var attrs = walker.currentNode.attributes;
for (var i=0; i < attrs.length; ++i) {
buf += "\n" + indent + " " + attrs[i].name +
"=\"" + attrs[i].value +"\"";
// Ignore the -moz-math-font-style attr, which
// Firefox automatically adds to every math element.
var attrname = attrs[i].name;
if (attrname != "-moz-math-font-style") {
buf += indent + " " + attrname +
"=\"" + attrs[i].value +"\"\n";
}
}
}
break;
case Node.DOCUMENT_TYPE_NODE:
buf += "<!DOCTYPE " + walker.currentNode.name + ">";
if (!gJSCompatibilityMode) {
buf += indent + "<!DOCTYPE " + walker.currentNode.name + ">\n";
}
break;
case Node.COMMENT_NODE:
buf += "<!-- " + walker.currentNode.nodeValue + " -->";
if (!gJSCompatibilityMode) {
buf += indent + "<!-- " + walker.currentNode.nodeValue + " -->\n";
}
break;
case Node.TEXT_NODE:
buf += "\"" + walker.currentNode.nodeValue + "\"";
// If this text is being appended to some earlier
// text at the same indent level, concatenate the two by
// removing the trailing quote before adding new string.
let last_line = getLastLine(
buf.substring(0, buf.length - 1));
if (last_line[indent.length] == "\"" &&
last_line[last_line.length - 1] == "\"") {
buf = buf.substring(0, buf.length - 2);
}
else {
buf += indent + "\"";
}
buf += walker.currentNode.nodeValue + "\"\n";
break;
}
buf += "\n";
buf = addLevels(walker, buf, indent + " ");
} while(walker.nextSibling());
walker.parentNode();

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

@ -48,58 +48,126 @@
* an iframe with id "testframe".
*/
function writeErrorSummary(input, expected, got, isTodo) {
function writeErrorSummary(input, expected, got, isTodo, description,
expectedTokenizerOutput) {
if (!isTodo) {
appendChildNodes($("display"), H2("Unexpected Failure:"));
}
appendChildNodes(
$("display"), BR(),
SPAN("Matched: "), "" + (expected == got),
P("Input: " + input),
PRE("Expected:\n|" + expected +"|", "\n-\n",
"Output:\n|" + got + "|\n\n"),
SPAN("Matched: "), "" + (expected == got)
);
if (typeof(description) != "undefined") {
appendChildNodes(
$("display"), P("Description: " + description)
);
}
appendChildNodes(
$("display"),
PRE("Input: " + input)
);
if (typeof(expectedTokenizerOutput) != "undefined") {
appendChildNodes(
$("display"), P("Expected raw tokenizer output: " +
expectedTokenizerOutput)
);
}
let expectedTitle = "Expected:";
let outputTitle = "Output:";
if (gJSCompatibilityMode) {
outputTitle = "Gecko parser output:";
expectedTitle = "JavaScript parser output:";
}
appendChildNodes(
$("display"),
PRE(expectedTitle + "\n|" + expected +"|", "\n-\n",
outputTitle + "\n|" + got + "|\n\n"),
HR()
);
}
function checkTests(input, expected, errors, description,
expectedTokenizerOutput, testDocument) {
// For fragment tests, the expected output will be empty, so skip
// the test.
if (expected.length > 1) {
var domAsString = docToTestOutput(testDocument);
// It's possible we need to reorder attributes to get these to match
if (expected == domAsString) {
is(domAsString, expected, "HTML5 expected success. " + new Date());
} else {
var reorderedDOM = reorderToMatchExpected(domAsString, expected);
if (!gJSCompatibilityMode && html5Exceptions[input]) {
todo(reorderedDOM == expected, "HTML5 expected failure. " + new Date());
writeErrorSummary(input, expected, reorderedDOM, true, description,
expectedTokenizerOutput);
} else {
if (reorderedDOM != expected) {
is(reorderedDOM, expected, "HTML5 unexpected failure. " + input + " " + new Date());
writeErrorSummary(input, expected, reorderedDOM, false,
description, expectedTokenizerOutput);
} else {
is(reorderedDOM, expected, "HTML5 expected success. " + new Date());
}
}
}
}
}
/**
* Control will bounce back and forth between nextTest() and the
* event handler returned by makeTestChecker() until the 'testcases'
* iterator is spent.
*/
function makeTestChecker(input, expected, errors) {
function makeTestChecker(input, expected, errors, description,
expectedTokenizerOutput) {
return function (e) {
var domAsString = docToTestOutput(e.target.contentDocument);
// It's possible we need to reorder attributes to get these to match
if (expected == domAsString) {
is(domAsString, expected, "HTML5 expected success. " + new Date());
} else {
var reorderedDOM = reorderToMatchExpected(domAsString, expected);
if (html5Exceptions[input]) {
todo(reorderedDOM == expected, "HTML5 expected failure. " + new Date());
writeErrorSummary(input, expected, reorderedDOM, true);
} else {
if (reorderedDOM != expected) {
is(reorderedDOM, expected, "HTML5 unexpected failure. " + input + " " + new Date());
writeErrorSummary(input, expected, reorderedDOM, false);
} else {
is(reorderedDOM, expected, "HTML5 expected success. " + new Date());
}
}
if (!gJSCompatibilityMode) {
checkTests(input, expected, errors, description,
expectedTokenizerOutput, e.target.contentDocument);
nextTest(e.target);
}
nextTest(e.target);
}
else {
window.parseHtmlDocument(input, $("jsframe").contentDocument,
function() {
expected = docToTestOutput($("jsframe").contentDocument);
checkTests(input, expected, errors, description,
expectedTokenizerOutput, e.target.contentDocument);
nextTest(e.target);
}, null);
}
}
}
var testcases;
function nextTest(testframe) {
var test = 0;
try {
var [input, output, errors] = testcases.next();
dataURL = "data:text/html;base64," + btoa(input);
testframe.onload = makeTestChecker(input, output, errors);
if (gTokenizerMode) {
// For tokenizer tests, testcases.next() return an extra paramter,
// the index of the test. The dataURL points to a server-side js
// that returns the test data.
var [index, input, output, errors, description, expectedTokenizerOutput]
= testcases.next();
dataURL = "tokenizer_file_server.sjs?" + index +
"&" + gTokenizerTestFile;
} else {
var [input, output, errors, description, expectedTokenizerOutput] =
testcases.next();
dataURL = "data:text/html;base64," + btoa(input);
}
testframe.onload = makeTestChecker(input, output, errors, description,
expectedTokenizerOutput);
testframe.src = dataURL;
} catch (err if err instanceof StopIteration) {
// restore the original value of html5.enable if it was changed earlier
if (typeof(gOriginalHtml5Pref) == "boolean") {
netscape.security.PrivilegeManager
.enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("html5.enable", gOriginalHtml5Pref);
}
SimpleTest.finish();
}
}
@ -121,14 +189,36 @@ function frameLoaded(e) {
* Create an iframe for each dat file
*/
function makeIFrames() {
for each (var filename in parserDatFiles) {
var datFrame = document.createElement("iframe");
datFrame.onload = frameLoaded;
datFrame.src = filename;
$("display").appendChild(datFrame);
// Set JavaScript compatibility mode if the function
// window.parseHtmlDocument exists.
gJSCompatibilityMode = typeof(window.parseHtmlDocument) != "undefined";
if (gTokenizerMode) {
// For tokenizer tests, no additional frames need to be created.
appendChildNodes($("display"), BR(), "Results: ", HR());
testcases = test_parser(tokenizerTests["tests"]);
nextTest($("testframe"));
}
else {
for each (var filename in parserDatFiles) {
var datFrame = document.createElement("iframe");
datFrame.onload = frameLoaded;
datFrame.src = filename;
$("display").appendChild(datFrame);
}
appendChildNodes($("display"), BR(), "Results: ", HR());
}
appendChildNodes($("display"), BR(), "Results: ", HR());
}
// If gTokenizerMode is undefined, set it to false: this
// isn't a tokenizer test.
if (typeof(gTokenizerMode) == "undefined") {
gTokenizerMode = false;
}
// Global variable indicating whether or not the tests should
// be run in JavaScript compatibility mode.
var gJSCompatibilityMode;
addLoadEvent(makeIFrames);
SimpleTest.waitForExplicitFinish();

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

@ -2,7 +2,7 @@
<!DOCTYPE html><html><head><noscript></noscript><style></style></head><frameset></frameset>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <noscript>
@ -13,7 +13,7 @@
<!DOCTYPE html><html><head><link><body></body></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <link>
@ -23,7 +23,7 @@
<!DOCTYPE html><html><link><body>#</body></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <link>
@ -61,7 +61,7 @@ Unexpected start tag that belongs in head.
Unexpected start tag that belongs in head.
Expected closing tag after </.
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <title>
@ -79,7 +79,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -94,7 +94,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input type="hidden"><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -110,7 +110,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input tYPe=" hiDDen "><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -126,7 +126,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input tYPe=" hiDDen "><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -142,7 +142,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input type="text" type="hidden"><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -158,7 +158,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input type="hidden" type="text"><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -174,7 +174,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input id="one"><input type="hidden"><input id="two"><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -194,7 +194,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tr><td></td><input id="one" type="hidden"><input id="two"><input id="three" type="hidden"><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -216,7 +216,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><input><tr><td></td><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -231,7 +231,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><input type="hidden"><tr><td></td><td></td></tr></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -247,7 +247,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tbody><input><tr><td></td><td></td></tr></tbody></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -262,7 +262,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tbody><input type="hidden"><tr><td></td><td></td></tr></tbody></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -278,7 +278,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><thead><input><tr><td></td><td></td></tr></thead></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -293,7 +293,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><thead><input type="hidden"><tr><td></td><td></td></tr></thead></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -309,7 +309,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tfoot><input><tr><td></td><td></td></tr></tfoot></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -324,7 +324,7 @@ x { content:"</style" } "
<!DOCTYPE html><body><table><tfoot><input type="hidden"><tr><td></td><td></td></tr></tfoot></table></body>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -340,7 +340,7 @@ x { content:"</style" } "
<!DOCTYPE html><html><head></head><form><input></form><frameset rows="*"><frame></frameset></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>
@ -351,7 +351,7 @@ x { content:"</style" } "
<!DOCTYPE html><html><head></head><form><input type="text"></form><frameset rows="*"><frame></frameset></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -363,7 +363,7 @@ x { content:"</style" } "
<!DOCTYPE html><html><head></head><form><input type="hidden"></form><frameset rows="*"><frame></frameset></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>
@ -374,7 +374,7 @@ x { content:"</style" } "
<!DOCTYPE html><html><head></head><form><input tYpE=" HIdDen "></form><frameset rows="*"><frame></frameset></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <frameset>
@ -385,7 +385,7 @@ x { content:"</style" } "
<!DOCTYPE html><html><body><table><link><tr><td>Hi!</td></tr></table></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -400,7 +400,7 @@ x { content:"</style" } "
<!DOCTYPE html><html><body><table><style>td { color: green }</style><tr><td>Hi!</tr></td></table>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>
@ -411,11 +411,12 @@ x { content:"</style" } "
| <tr>
| <td>
| "Hi!"
#data
<!DOCTYPE html><html><head></head><form><input type=" hidden"></form><frameset rows="*"><frame></frameset></html>
#errors
#document
| <!DOCTYPE HTML>
| <!DOCTYPE html>
| <html>
| <head>
| <body>

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

@ -15,10 +15,28 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=366936
<script type="application/javascript"
src="html5_tree_construction_exceptions.js"></script>
<script class="testbody" type="application/javascript;version=1.7">
var parserDatFiles = ["html5lib_tree_dat1.txt",
var parserDatFiles = ["html5lib_tree_dat1.txt",
"html5lib_tree_dat2.txt",
"html5lib_tree_dat3.txt",
"regressions.txt"];
"html5lib_tree_dat5.txt",
"html5lib_tree_dat6.txt",
"html5lib_tree_dat7.txt",
"html5lib_tree_dat8.txt",
"html5lib_tree_dat9.txt",
"html5lib_tree_dat10.txt",
"html5lib_tree_dat11.txt",
"html5lib_tree_dat12.txt",
"html5lib_tree_dat14.txt",
"regressions.txt"
];
netscape.security.PrivilegeManager.
enablePrivilege("UniversalXPConnect");
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gOriginalHtml5Pref = prefs.getBoolPref("html5.enable");
prefs.setBoolPref("html5.enable", true);
</script>
<script type="application/javascript;version=1.7"
src="parser_web_testrunner.js"></script>