Backout rev 58f91861b1f1. Accidental changes included.

This commit is contained in:
Henri Sivonen 2009-08-13 10:48:13 +03:00
Родитель f1a8715a61
Коммит 40f7e75207
9 изменённых файлов: 873 добавлений и 1371 удалений

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

@ -39,14 +39,9 @@
* ***** 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)
@ -122,8 +117,6 @@ 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);
@ -132,38 +125,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeBuilder* aBuilder)
if (!mParent->HasAttr(nsuri, localName)) {
nsAutoString value;
mNode->GetAttr(nsuri, localName, value);
// 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);
mParent->SetAttr(nsuri, localName, attrName->GetPrefix(), value, PR_TRUE);
// XXX should not fire mutation event here
}
}
return rv;

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

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

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

@ -58,137 +58,6 @@ 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
@ -197,7 +66,6 @@ function parseJsonTestcase(testcase) {
* @param A string containing a single testcase
*/
function parseTestcase(testcase) {
var documentFragmentTest = false;
var lines = testcase.split("\n");
if (lines[0] != "#data") {
log(lines);
@ -206,15 +74,10 @@ function parseTestcase(testcase) {
var input = [];
var output = [];
var errors = [];
var description = undefined;
var expectedTokenizerOutput = undefined;
var currentList = input;
for each (var line in lines) {
// allow blank lines in input
if ((line || currentList == input) && !(startsWith(line, "#errors") ||
if (line && !(startsWith(line, "#error") ||
startsWith(line, "#document") ||
startsWith(line, "#description") ||
startsWith(line, "#expected") ||
startsWith(line, "#data"))) {
if (currentList == output && startsWith(line, "|")) {
currentList.push(line.substring(2));
@ -225,20 +88,10 @@ 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, description,
expectedTokenizerOutput];
return [input.join("\n"), output.join("\n"), errors];
}
/**
@ -314,29 +167,18 @@ function isAttributeLine(line) {
}
/**
* A generator function that accepts a list of tests. Each list
* A generator function that accepts a list of strings. Each list
* member corresponds to the contents of a ".dat" file from the
* html5lib test suite, or an array of decoded JSON tests,
* in the case of tokenizer "*.test" tests.
* html5lib test suite.
*
* @param The list of strings
*/
function test_parser(testlist) {
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);
}
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);
}
}
}
@ -355,61 +197,29 @@ function docToTestOutput(doc) {
function addLevels(walker, buf, indent) {
if(walker.firstChild()) {
do {
buf += indent;
switch (walker.currentNode.nodeType) {
case Node.ELEMENT_NODE:
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";
}
buf += "<" + walker.currentNode.tagName.toLowerCase() + ">";
if (walker.currentNode.hasAttributes()) {
var attrs = walker.currentNode.attributes;
for (var i=0; i < attrs.length; ++i) {
// 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";
}
buf += "\n" + indent + " " + attrs[i].name +
"=\"" + attrs[i].value +"\"";
}
}
break;
case Node.DOCUMENT_TYPE_NODE:
if (!gJSCompatibilityMode) {
buf += indent + "<!DOCTYPE " + walker.currentNode.name + ">\n";
}
buf += "<!DOCTYPE " + walker.currentNode.name + ">";
break;
case Node.COMMENT_NODE:
if (!gJSCompatibilityMode) {
buf += indent + "<!-- " + walker.currentNode.nodeValue + " -->\n";
}
buf += "<!-- " + walker.currentNode.nodeValue + " -->";
break;
case Node.TEXT_NODE:
// 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";
buf += "\"" + walker.currentNode.nodeValue + "\"";
break;
}
buf += "\n";
buf = addLevels(walker, buf, indent + " ");
} while(walker.nextSibling());
walker.parentNode();

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

@ -48,126 +48,58 @@
* an iframe with id "testframe".
*/
function writeErrorSummary(input, expected, got, isTodo, description,
expectedTokenizerOutput) {
function writeErrorSummary(input, expected, got, isTodo) {
if (!isTodo) {
appendChildNodes($("display"), H2("Unexpected Failure:"));
}
appendChildNodes(
$("display"), BR(),
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"),
SPAN("Matched: "), "" + (expected == got),
P("Input: " + input),
PRE("Expected:\n|" + expected +"|", "\n-\n",
"Output:\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, description,
expectedTokenizerOutput) {
function makeTestChecker(input, expected, errors) {
return function (e) {
if (!gJSCompatibilityMode) {
checkTests(input, expected, errors, description,
expectedTokenizerOutput, e.target.contentDocument);
nextTest(e.target);
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());
}
}
}
else {
window.parseHtmlDocument(input, $("jsframe").contentDocument,
function() {
expected = docToTestOutput($("jsframe").contentDocument);
checkTests(input, expected, errors, description,
expectedTokenizerOutput, e.target.contentDocument);
nextTest(e.target);
}, null);
}
}
nextTest(e.target);
}
}
var testcases;
function nextTest(testframe) {
var test = 0;
try {
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);
var [input, output, errors] = testcases.next();
dataURL = "data:text/html;base64," + btoa(input);
testframe.onload = makeTestChecker(input, output, errors);
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();
}
}
@ -189,36 +121,14 @@ function frameLoaded(e) {
* Create an iframe for each dat file
*/
function makeIFrames() {
// 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());
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());
}
// 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,12 +411,11 @@ 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,28 +15,10 @@ 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",
"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);
"regressions.txt"];
</script>
<script type="application/javascript;version=1.7"
src="parser_web_testrunner.js"></script>