Bug 366936. Run WHATWG/html5lib tests on HTML parser. r=mrbkap
git-svn-id: svn://10.0.0.236/trunk@221716 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -44,7 +44,14 @@ relativesrcdir = parser/htmlparser/tests/mochitest
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = test_bug339350.xhtml \
|
||||
_TEST_FILES = parser_datreader.js \
|
||||
parser_web_testrunner.js \
|
||||
html5lib_tree_dat1.txt \
|
||||
html5lib_tree_dat2.txt \
|
||||
html5lib_tree_dat3.txt \
|
||||
html5_tree_construction_exceptions.js \
|
||||
test_html5_tree_construction.html \
|
||||
test_bug339350.xhtml \
|
||||
test_bug358797.html \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/* these are the tests we don't pass */
|
||||
var html5Exceptions = {
|
||||
"<b><table><td><i></table>": true,
|
||||
"<b><table><td></b><i></table>X": true,
|
||||
"<p><b><div><marquee></p></b></div>X": true,
|
||||
"<!--><div>--<!-->": true,
|
||||
"<p><hr></p>": true,
|
||||
"<select><b><option><select><option></b></select>X": true,
|
||||
"<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y": true,
|
||||
"<!-----><font><div>hello<table>excite!<b>me!<th><i>please!</tr><!--X-->": true,
|
||||
"<!DOCTYPE HTML><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->": true,
|
||||
"<!DOCTYPE HTML>A<option>B<optgroup>C<select>D</option>E": true,
|
||||
"</#": true,
|
||||
"<?": true,
|
||||
"<?#": true,
|
||||
"<!": true,
|
||||
"<!#": true,
|
||||
"<?COMMENT?>": true,
|
||||
"<!COMMENT>": true,
|
||||
"</ COMMENT >": true,
|
||||
"<?COM--MENT?>": true,
|
||||
"<!COM--MENT>": true,
|
||||
"</ COM--MENT >": true,
|
||||
"<p id=a><b><p id=b></b>TEST": true,
|
||||
"<b id=a><p><b id=b></p></b>TEST": true,
|
||||
"<b>A<cite>B<div>C": true,
|
||||
"<b>A<cite>B<div>C</cite>D": true,
|
||||
"<cite><b><cite><i><cite><i><cite><i><div>X</b>TEST": true,
|
||||
"<DIV> abc <B> def <I> ghi <P>": true,
|
||||
"<DIV> abc <B> def <I> ghi <P> jkl": true,
|
||||
"<DIV> abc <B> def <I> ghi <P> jkl </B>": true,
|
||||
"<DIV> abc <B> def <I> ghi <P> jkl </B> mno": true,
|
||||
"<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I>": true,
|
||||
"<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr": true,
|
||||
"<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P>": true,
|
||||
"<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P> stu": true,
|
||||
"<a href=\"blah\">aba<table><a href=\"foo\">br<tr><td></td></tr>x</table>aoe": true,
|
||||
"<a href=\"blah\">aba<table><tr><td><a href=\"foo\">br</td></tr>x</table>aoe": true,
|
||||
"<table><a href=\"blah\">aba<tr><td><a href=\"foo\">br</td></tr>x</table>aoe": true,
|
||||
"<a href=a>aa<marquee>aa<a href=b>bb</marquee>aa": true,
|
||||
"<a><table><a></table><p><a><div><a>": true,
|
||||
"<head></p><meta><p>": true,
|
||||
"<b><table><td></b><i></table>": true,
|
||||
"<a><p><a></a></p></a>": true,
|
||||
"<p><b><div><marquee></p></b></div>": true,
|
||||
"<select><b><option><select><option></b></select>": true,
|
||||
"<a><table><td><a><table></table><a></tr><a></table><a>": true,
|
||||
"<ul><li></li><div><li></div><li><li><div><li><address><li><b><em></b><li></ul>": true,
|
||||
"<table><col><tbody><col><tr><col><td><col></table><col>": true,
|
||||
"</strong></b></em></i></u></strike></s></blink></tt></pre></big></small></font></select></h1></h2></h3></h4></h5></h6></body></br></a></img></title></span></style></script></table></th></td></tr></frame></area></link></param></hr></input></col></base></meta></basefont></bgsound></embed></spacer></p></dd></dt></caption></colgroup></tbody></tfoot></thead></address></blockquote></center></dir></div></dl></fieldset></listing></menu></ol></ul></li></nobr></wbr></form></button></marquee></object></html></frameset></head></iframe></image></isindex></noembed></noframes></noscript></optgroup></option></plaintext></textarea>": true,
|
||||
"<table><tr></strong></b></em></i></u></strike></s></blink></tt></pre></big></small></font></select></h1></h2></h3></h4></h5></h6></body></br></a></img></title></span></style></script></table></th></td></tr></frame></area></link></param></hr></input></col></base></meta></basefont></bgsound></embed></spacer></p></dd></dt></caption></colgroup></tbody></tfoot></thead></address></blockquote></center></dir></div></dl></fieldset></listing></menu></ol></ul></li></nobr></wbr></form></button></marquee></object></html></frameset></head></iframe></image></isindex></noembed></noframes></noscript></optgroup></option></plaintext></textarea>": true,
|
||||
"<!DOCTYPE htmL><dt><div><dd>": true,
|
||||
"<!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt": true,
|
||||
"&#X": true,
|
||||
"&#x": true,
|
||||
"<!doctype html><p><b><i><u></p> <p>X": true,
|
||||
"<!doctype html><!-- X": true,
|
||||
"<!doctype html><select><optgroup><option></optgroup><option><select><option>": true,
|
||||
"<!DoctypE html><!-- XXX - XXX -->": true,
|
||||
"<!DoctypE html><!-- XXX - XXX": true,
|
||||
"<!DoctypE html><!-- XXX - XXX - XXX -->": true,
|
||||
"<isindex test=x name=x>": true,
|
||||
"<!doctype html><body><title>X</title><meta name=z><link rel=foo><style>\nx { content:\"</style\" } </style>": true,
|
||||
" \n ": true,
|
||||
"<!doctype html> <html>": true,
|
||||
"<!doctype html><!--x--": true,
|
||||
"<head></head><!-- --><style></style><!-- --><script></script>": true,
|
||||
"<head></head><!-- -->x<style></style><!-- --><script></script>": true,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
Test data files prefixed with "html5lib" are from the html5lib project.
|
||||
<http://code.google.com/p/html5lib/>
|
||||
|
||||
html5lib test cases are licensed as follows:
|
||||
|
||||
---------------
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2006 The Authors
|
||||
|
||||
Contributers:
|
||||
James Graham - jg307@cam.ac.uk
|
||||
Anne van Kesteren - annevankesteren@gmail.com
|
||||
Lachlan Hunt - lachlan.hunt@lachy.id.au
|
||||
Matt McDonald - kanashii@kanashii.ca
|
||||
Sam Ruby - rubys@intertwingly.net
|
||||
Ian Hickson (Google) - ian@hixie.ch
|
||||
Thomas Broyer - t.broyer@gmail.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
1929
mozilla/parser/htmlparser/tests/mochitest/html5lib_tree_dat1.txt
Normal file
1929
mozilla/parser/htmlparser/tests/mochitest/html5lib_tree_dat1.txt
Normal file
File diff suppressed because it is too large
Load Diff
768
mozilla/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt
Normal file
768
mozilla/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt
Normal file
@@ -0,0 +1,768 @@
|
||||
#data
|
||||
<!doctype html>Test
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "Test"
|
||||
|
||||
#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.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <textarea>
|
||||
| "test</div>test"
|
||||
|
||||
#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.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <table>
|
||||
| <tbody>
|
||||
| <tr>
|
||||
| <td>
|
||||
|
||||
#data
|
||||
<table><td>test</tbody></table>
|
||||
#errors
|
||||
missing document type declarattion
|
||||
Unexpected and of file
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <table>
|
||||
| <tbody>
|
||||
| <tr>
|
||||
| <td>
|
||||
| "test"
|
||||
|
||||
#data
|
||||
<frame>test
|
||||
#errors
|
||||
missing document type declaration
|
||||
frame element can't occur here
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "test"
|
||||
|
||||
#data
|
||||
<!doctype html><frameset>test
|
||||
#errors
|
||||
frameset can't contain text
|
||||
Unexpected end of file
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <frameset>
|
||||
|
||||
#data
|
||||
<!doctype html><frameset><!doctype html>
|
||||
#errors
|
||||
document type declaration can only occur at the start of a document
|
||||
Expected end tag </frameset>
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <frameset>
|
||||
|
||||
#data
|
||||
<!doctype html><font><p><b>test</font>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <font>
|
||||
| <p>
|
||||
| <font>
|
||||
| <b>
|
||||
| "test"
|
||||
|
||||
#data
|
||||
<!DOCTYPE htmL><dt><div><dd>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <dt>
|
||||
| <div>
|
||||
| <dd>
|
||||
|
||||
#data
|
||||
<script></x
|
||||
#errors
|
||||
no document type
|
||||
</ in script
|
||||
Unexpected end of file. Expected </script> end tag.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <script>
|
||||
| "</x"
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<table><plaintext><td>
|
||||
#errors
|
||||
no document type
|
||||
<plaintext> directly inside table
|
||||
Characters inside table.
|
||||
Unexpected end of file.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <plaintext>
|
||||
| "<td>"
|
||||
| <table>
|
||||
|
||||
#data
|
||||
<plaintext></plaintext>
|
||||
#errors
|
||||
No DOCTYPE seen.
|
||||
Unexpected end of file.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <plaintext>
|
||||
| "</plaintext>"
|
||||
|
||||
#data
|
||||
<!doctype html><table><tr>TEST
|
||||
#errors
|
||||
TEST can't occur in <tr>
|
||||
Unexpected end of file.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "TEST"
|
||||
| <table>
|
||||
| <tbody>
|
||||
| <tr>
|
||||
|
||||
#data
|
||||
<!doctype html><body t1=1><body t2=2><body t3=3 t4=4>
|
||||
#errors
|
||||
Unexpected start tag "body"
|
||||
Unexpected start tag "body"
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| t4="4"
|
||||
| t2="2"
|
||||
| t3="3"
|
||||
| t1="1"
|
||||
|
||||
#data
|
||||
</b test
|
||||
#errors
|
||||
Unexpected EOF in attribute
|
||||
Unexpected attribute in end tag.
|
||||
No doctype.
|
||||
Unexpected end tag.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!doctype HtML></b test<b &=&>X
|
||||
#errors
|
||||
Unexpected < in attribute
|
||||
End tag contains attributes.
|
||||
Unexpected end tag.
|
||||
Named entity didn't end with ;
|
||||
Unexpected EOF. Missing closing tag.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <b>
|
||||
| &="&"
|
||||
| "X"
|
||||
|
||||
#data
|
||||
<!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt
|
||||
#errors
|
||||
No space after literal DOCTYPE.
|
||||
Unexpected EOF in (end) tag name
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <script>
|
||||
| type="text/x-foobar;baz"
|
||||
| "X"
|
||||
| <body>
|
||||
|
||||
#data
|
||||
&
|
||||
#errors
|
||||
No doctype.
|
||||
Unfinished entity.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "&"
|
||||
|
||||
#data
|
||||
&#
|
||||
#errors
|
||||
No doctype.
|
||||
Unfinished numeric entity.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "&#"
|
||||
|
||||
#data
|
||||
&#X
|
||||
#errors
|
||||
No doctype.
|
||||
Unfinished hexadecimal entity.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "&#X"
|
||||
|
||||
#data
|
||||
&#x
|
||||
#errors
|
||||
No doctype.
|
||||
Unfinished hexadecimal entity.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "&#x"
|
||||
|
||||
#data
|
||||
-
|
||||
#errors
|
||||
No doctype.
|
||||
Numeric entity didn't end with ;
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "-"
|
||||
|
||||
#data
|
||||
&x-test
|
||||
#errors
|
||||
No doctype.
|
||||
Unfinished named entity.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "&x-test"
|
||||
|
||||
#data
|
||||
<!doctypehtml><p><li>
|
||||
#errors
|
||||
No space after literal DOCTYPE.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <p>
|
||||
| <li>
|
||||
|
||||
#data
|
||||
<!doctypehtml><p><dt>
|
||||
#errors
|
||||
No space after literal DOCTYPE.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <p>
|
||||
| <dt>
|
||||
|
||||
#data
|
||||
<!doctypehtml><p><dd>
|
||||
#errors
|
||||
No space after literal DOCTYPE.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <p>
|
||||
| <dd>
|
||||
|
||||
#data
|
||||
<!doctypehtml><p><form>
|
||||
#errors
|
||||
No space after literal DOCTYPE.
|
||||
Unexpected EOF.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <p>
|
||||
| <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
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <p>
|
||||
| "X"
|
||||
|
||||
#data
|
||||
&
|
||||
#errors
|
||||
No doctype.
|
||||
No closing ; for the entity.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "&"
|
||||
|
||||
#data
|
||||
&AMp;
|
||||
#errors
|
||||
No doctype.
|
||||
Invalid entity.
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "&AMp;"
|
||||
|
||||
#data
|
||||
<!doctype html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>
|
||||
#errors
|
||||
Unexpected end of file.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly>
|
||||
|
||||
#data
|
||||
<!doctype html>X</body>X
|
||||
#errors
|
||||
Unexpected non-space characters in the after body phase.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "XX"
|
||||
|
||||
#data
|
||||
<!doctype html><!-- X
|
||||
#errors
|
||||
Unexpected end of file in comment.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <!-- X -->
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!doctype html><table><caption>test TEST</caption><td>test
|
||||
#errors
|
||||
Unexpected <td> in table body phase.
|
||||
Unexpected end of file.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <table>
|
||||
| <caption>
|
||||
| "test TEST"
|
||||
| <tbody>
|
||||
| <tr>
|
||||
| <td>
|
||||
| "test"
|
||||
|
||||
#data
|
||||
<!doctype html><select><option><optgroup>
|
||||
#errors
|
||||
Unexpected end of file. Missing closing tags.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <select>
|
||||
| <option>
|
||||
| <optgroup>
|
||||
|
||||
#data
|
||||
<!doctype html><select><optgroup><option></optgroup><option><select><option>
|
||||
#errors
|
||||
Unexpected start tag <select> in <select>.
|
||||
Unexpected start tag <option>.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <select>
|
||||
| <optgroup>
|
||||
| <option>
|
||||
| <option>
|
||||
|
||||
#data
|
||||
<!doctype html><select><optgroup><option><optgroup>
|
||||
#errors
|
||||
Unexpected end of file. Missing closing tags.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <select>
|
||||
| <optgroup>
|
||||
| <option>
|
||||
| <optgroup>
|
||||
|
||||
#data
|
||||
<!doctype html><font><input><input></font>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <font>
|
||||
| <input>
|
||||
| <input>
|
||||
|
||||
#data
|
||||
<!DoctypE html><!-- XXX - XXX -->
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <!-- XXX - XXX -->
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!DoctypE html><!-- XXX - XXX
|
||||
#errors
|
||||
Unexpected EOF in comment.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <!-- XXX - XXX -->
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!DoctypE html><!-- XXX - XXX - XXX -->
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <!-- XXX - XXX - XXX -->
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<isindex test=x name=x>
|
||||
#errors
|
||||
No doctype
|
||||
<isindex> is not ok!
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <form>
|
||||
| <hr>
|
||||
| <p>
|
||||
| <label>
|
||||
| "This is a searchable index. Insert your search keywords here:"
|
||||
| <input>
|
||||
| test="x"
|
||||
| name="isindex"
|
||||
| <hr>
|
||||
|
||||
#data
|
||||
test
|
||||
test
|
||||
#errors
|
||||
No doctype
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "test
|
||||
test"
|
||||
|
||||
#data
|
||||
<p><b><i><u></p>
|
||||
<p>X
|
||||
#errors
|
||||
No doctype
|
||||
Unexpected end tag p.
|
||||
Unexpected EOF.
|
||||
#document
|
||||
| <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>
|
||||
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>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <select>
|
||||
| <optgroup>
|
||||
|
||||
#data
|
||||
|
||||
|
||||
#errors
|
||||
No doctype.
|
||||
#document
|
||||
| "
|
||||
"
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!doctype html> <html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| " "
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!doctype html><script>
|
||||
</script> <title>x</title> </head>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <script>
|
||||
| "
|
||||
"
|
||||
| " "
|
||||
| <title>
|
||||
| "x"
|
||||
| " "
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!doctype html><html><body><html id=x>
|
||||
#errors
|
||||
duplicate html start tag
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| id="x"
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!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.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| id="x"
|
||||
| <head>
|
||||
| <body>
|
||||
| "X"
|
||||
|
||||
#data
|
||||
<!doctype html><head><html id=x>
|
||||
#errors
|
||||
html start tag too late
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| id="x"
|
||||
| <head>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<!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.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "XX"
|
||||
|
||||
#data
|
||||
<!doctype html>X</html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "X "
|
||||
|
||||
#data
|
||||
<!doctype html>X</html><p>X
|
||||
#errors
|
||||
Unexpected start tag <p> in trailing end phase.
|
||||
Unexpected start tag <p> in after body phase.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "X"
|
||||
| <p>
|
||||
| "X"
|
||||
|
||||
#data
|
||||
<!doctype html>X<p/x/y/z>
|
||||
#errors
|
||||
Solidus (/) incorrectly placed.
|
||||
Solidus (/) incorrectly placed.
|
||||
Solidus (/) incorrectly placed.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| "X"
|
||||
| <p>
|
||||
| y=""
|
||||
| x=""
|
||||
| z=""
|
||||
|
||||
#data
|
||||
<!doctype html><!--x--
|
||||
#errors
|
||||
Unexpected end of file in comment.
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <!-- x -->
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
132
mozilla/parser/htmlparser/tests/mochitest/html5lib_tree_dat3.txt
Normal file
132
mozilla/parser/htmlparser/tests/mochitest/html5lib_tree_dat3.txt
Normal file
@@ -0,0 +1,132 @@
|
||||
#data
|
||||
<head></head><style></style>
|
||||
#errors
|
||||
No DOCTYPE
|
||||
<style> in after-head mode
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <style>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<head></head><script></script>
|
||||
#errors
|
||||
No DOCTYPE
|
||||
<script> in after-head mode
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <script>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<head></head><!-- --><style></style><!-- --><script></script>
|
||||
#errors
|
||||
No DOCTYPE
|
||||
<style> in after-head mode
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <style>
|
||||
| <script>
|
||||
| <!-- -->
|
||||
| <!-- -->
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<head></head><!-- -->x<style></style><!-- --><script></script>
|
||||
#errors
|
||||
No DOCTYPE
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <!-- -->
|
||||
| <body>
|
||||
| "x"
|
||||
| <style>
|
||||
| <!-- -->
|
||||
| <script>
|
||||
|
||||
#data
|
||||
<!DOCTYPE html><html><head></head><body><pre>
|
||||
</pre></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <pre>
|
||||
|
||||
#data
|
||||
<!DOCTYPE html><html><head></head><body><pre>
|
||||
|
||||
foo</pre></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <pre>
|
||||
| "foo"
|
||||
|
||||
|
||||
#data
|
||||
<!DOCTYPE html><html><head></head><body><pre>
|
||||
|
||||
foo
|
||||
</pre></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <pre>
|
||||
| "foo
|
||||
"
|
||||
|
||||
#data
|
||||
<!DOCTYPE html><html><head></head><body><pre>x</pre><span>
|
||||
</span></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <pre>
|
||||
| "x"
|
||||
| <span>
|
||||
| "
|
||||
"
|
||||
|
||||
#data
|
||||
<!DOCTYPE html><html><head></head><body><pre>x
|
||||
y</pre></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <pre>
|
||||
| "x
|
||||
y"
|
||||
|
||||
#data
|
||||
<!DOCTYPE html><html><head></head><body><pre>x<div>
|
||||
y</pre></body></html>
|
||||
#errors
|
||||
#document
|
||||
| <!DOCTYPE HTML>
|
||||
| <html>
|
||||
| <head>
|
||||
| <body>
|
||||
| <pre>
|
||||
| "x"
|
||||
| <div>
|
||||
| "
|
||||
| y"
|
||||
229
mozilla/parser/htmlparser/tests/mochitest/parser_datreader.js
Normal file
229
mozilla/parser/htmlparser/tests/mochitest/parser_datreader.js
Normal file
@@ -0,0 +1,229 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert Sayre <sayrer@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****/
|
||||
|
||||
/**
|
||||
* A test suite that runs WHATWG HTML parser tests.
|
||||
* The tests are from html5lib.
|
||||
*
|
||||
* http://html5lib.googlecode.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* A few utility functions.
|
||||
*/
|
||||
function log(entry) {
|
||||
|
||||
}
|
||||
|
||||
function startsWith(s, s2) {
|
||||
return s.indexOf(s2)==0;
|
||||
}
|
||||
|
||||
function trimString(s) {
|
||||
return(s.replace(/^\s+/,'').replace(/\s+$/,''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an individual testcase into an array containing the input
|
||||
* string, a string representing the expected tree (DOM), and a list
|
||||
* of error messages.
|
||||
*
|
||||
* @param A string containing a single testcase
|
||||
*/
|
||||
function parseTestcase(testcase) {
|
||||
var lines = testcase.split("\n");
|
||||
if (lines[0] != "#data") {
|
||||
log(lines);
|
||||
throw "Unknown test format."
|
||||
}
|
||||
var input = [];
|
||||
var output = [];
|
||||
var errors = [];
|
||||
var currentList = input;
|
||||
for each (var line in lines) {
|
||||
if (line && !(startsWith(line, "#error") ||
|
||||
startsWith(line, "#document") ||
|
||||
startsWith(line, "#data"))) {
|
||||
if (currentList == output && startsWith(line, "|")) {
|
||||
currentList.push(line.substring(2));
|
||||
} else {
|
||||
currentList.push(line);
|
||||
}
|
||||
} else if (line == "#errors") {
|
||||
currentList = errors;
|
||||
} else if (line == "#document") {
|
||||
currentList = output;
|
||||
}
|
||||
}
|
||||
//logger.log(input.length, output.length, errors.length);
|
||||
return [input.join("\n"), output.join("\n"), errors];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sometimes the test output will depend on attribute order.
|
||||
* This function fixes up that output to match, if possible.
|
||||
*
|
||||
* @param output The string generated from walking the DOM
|
||||
* @param expected The expected output from the test case
|
||||
*/
|
||||
function reorderToMatchExpected(output, expected) {
|
||||
var outputLines = output.split("\n");
|
||||
var expectedLines = expected.split("\n");
|
||||
|
||||
// if the line count is different, they don't match anyway
|
||||
if (expectedLines.length != outputLines.length)
|
||||
return output;
|
||||
|
||||
var fixedOutput = [];
|
||||
var outputAtts = {};
|
||||
var expectedAtts = [];
|
||||
printAtts = function() {
|
||||
for each (var expectedAtt in expectedAtts) {
|
||||
if (outputAtts.hasOwnProperty(expectedAtt)) {
|
||||
fixedOutput.push(outputAtts[expectedAtt]);
|
||||
} else {
|
||||
// found a missing attribute
|
||||
return false;
|
||||
}
|
||||
}
|
||||
outputAtts = {};
|
||||
expectedAtts = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
for (var i=0; i < outputLines.length; i++) {
|
||||
var outputLine = outputLines[i];
|
||||
var expectedLine = expectedLines[i];
|
||||
var inAttrList = false;
|
||||
if (isAttributeLine(outputLine)) {
|
||||
// attribute mismatch, return original
|
||||
if (!isAttributeLine(expectedLine)) {
|
||||
return output; // mismatch, return original
|
||||
}
|
||||
// stick these in a dictionary
|
||||
inAttrList = true;
|
||||
outputAtts[attName(outputLine)] = outputLine;
|
||||
expectedAtts.push(attName(expectedLine));
|
||||
} else {
|
||||
if (inAttrList && !printAtts()) {
|
||||
return output; // mismatch, return original
|
||||
}
|
||||
inAttrList = false;
|
||||
fixedOutput.push(outputLine);
|
||||
}
|
||||
}
|
||||
|
||||
if (inAttrList && !printAtts()) {
|
||||
return output; // mismatch, return original
|
||||
}
|
||||
|
||||
return fixedOutput.join("\n");
|
||||
}
|
||||
|
||||
function attName(line) {
|
||||
var str = trimString(line);
|
||||
return str.substring(0, str.indexOf("=\""));
|
||||
}
|
||||
|
||||
function isAttributeLine(line) {
|
||||
var str = trimString(line);
|
||||
return (!startsWith(str, "<") && !startsWith(str, "\"") &&
|
||||
(str.indexOf("=\"") > 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a DOM document to a string matching the format in
|
||||
* the test cases.
|
||||
*
|
||||
* @param the DOM document
|
||||
*/
|
||||
function docToTestOutput(doc) {
|
||||
var walker = doc.createTreeWalker(doc, NodeFilter.SHOW_ALL, null, true);
|
||||
return addLevels(walker, "", "").slice(0,-1); // remove the last newline
|
||||
}
|
||||
|
||||
function addLevels(walker, buf, indent) {
|
||||
if(walker.firstChild()) {
|
||||
do {
|
||||
buf += indent;
|
||||
switch (walker.currentNode.nodeType) {
|
||||
case Node.ELEMENT_NODE:
|
||||
buf += "<" + walker.currentNode.tagName.toLowerCase() + ">";
|
||||
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 +"\"";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Node.DOCUMENT_TYPE_NODE:
|
||||
buf += "<!DOCTYPE " + walker.currentNode.name + ">";
|
||||
break;
|
||||
case Node.COMMENT_NODE:
|
||||
buf += "<!-- " + walker.currentNode.nodeValue + " -->";
|
||||
break;
|
||||
case Node.TEXT_NODE:
|
||||
buf += "\"" + walker.currentNode.nodeValue + "\"";
|
||||
break;
|
||||
}
|
||||
buf += "\n";
|
||||
buf = addLevels(walker, buf, indent + " ");
|
||||
} while(walker.nextSibling());
|
||||
walker.parentNode();
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Robert Sayre <sayrer@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****/
|
||||
|
||||
/**
|
||||
* Runs html5lib-formatted test cases in the browser. Requires SimpleTest.
|
||||
*
|
||||
* Define an array named parserDatFiles before loading this script,
|
||||
* and it will load each of those dat files into an array, then run
|
||||
* the test parser on each and run the tests by assigning the input
|
||||
* data to an iframe's url.
|
||||
*
|
||||
* Your test document should have an element with id "display" and
|
||||
* an iframe with id "testframe".
|
||||
*/
|
||||
|
||||
function writeErrorSummary(input, expected, got, isTodo) {
|
||||
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"),
|
||||
HR()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
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.");
|
||||
} else {
|
||||
var reorderedDOM = reorderToMatchExpected(domAsString, expected);
|
||||
if (html5Exceptions[input]) {
|
||||
todo(reorderedDOM == expected, "HTML5 expected failure.");
|
||||
writeErrorSummary(input, expected, reorderedDOM, true);
|
||||
} else {
|
||||
is(reorderedDOM, expected, "HTML5 unexpected failure.");
|
||||
if (reorderedDOM != expected) {
|
||||
writeErrorSummary(input, expected, reorderedDOM, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
nextTest(e.target);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
testframe.src = dataURL;
|
||||
} catch (err if err instanceof StopIteration) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
var framesLoaded = [];
|
||||
function frameLoaded(e) {
|
||||
framesLoaded.push(e.target);
|
||||
if (framesLoaded.length == parserDatFiles.length) {
|
||||
var tests = [scrapeText(ifr.contentDocument)
|
||||
for each (ifr in framesLoaded)];
|
||||
testcases = test_parser(tests);
|
||||
nextTest($("testframe"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
appendChildNodes($("display"), BR(), "Results: ", HR());
|
||||
}
|
||||
|
||||
addLoadEvent(makeIFrames);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=366936
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 366936</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript;version=1.7"
|
||||
src="parser_datreader.js"></script>
|
||||
<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",
|
||||
"html5lib_tree_dat2.txt",
|
||||
"html5lib_tree_dat3.txt"];
|
||||
</script>
|
||||
<script type="application/javascript;version=1.7"
|
||||
src="parser_web_testrunner.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=366936"
|
||||
target="_blank">Mozilla Bug 366936</a>
|
||||
<div id="content">
|
||||
<iframe src="" id="testframe"></iframe>
|
||||
</div>
|
||||
See html5lib.googlecode.com for original test data<br>
|
||||
<div id="display">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user