Sanitize url refs in SVG attributes

Add some tests.
Sync with latest HTML5lib (includes above sanitization improvements).
This commit is contained in:
Jacques Distler 2007-10-27 17:34:29 -05:00
parent ae82f1be49
commit 5208bbf0af
28 changed files with 1277 additions and 735 deletions

View file

@ -11,8 +11,8 @@
#data
<textarea>test</div>test
#errors
10: missing document type declaration.
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>
@ -23,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>
@ -38,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>
@ -53,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>
@ -64,8 +64,8 @@ frame element can't occur here
#data
<!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>
| <html>
@ -75,8 +75,8 @@ Unexpected end of file
#data
<!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>
| <html>
@ -86,8 +86,8 @@ Expected end tag </frameset>
#data
<!DOCTYPE HTML><font><p><b>test</font>
#errors
AAA violation. </font>
AAA violation. </font>
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>
| <html>
@ -102,7 +102,7 @@ AAA violation. </font>
#data
<!DOCTYPE HTML><dt><div><dd>
#errors
Missing end tag for <div>.
Line: 1 Col: 28 Missing end tag (div, dt).
#document
| <!DOCTYPE HTML>
| <html>
@ -115,8 +115,8 @@ Missing end tag for <div>.
#data
<script></x
#errors
no document type
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>
@ -127,11 +127,11 @@ Unexpected end of file. Expected </script> end tag.
#data
<table><plaintext><td>
#errors
no document type
<plaintext> directly inside table
Characters inside table.
Characters inside table. (XXX?)
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: 21 Unexpected non-space characters in table context caused voodoo mode.
Line: 1 Col: 22 Unexpected non-space characters in table context caused voodoo mode.
Line: 1 Col: 22 Expected closing tag. Unexpected end of file.
#document
| <html>
| <head>
@ -143,8 +143,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>
@ -155,8 +155,8 @@ Unexpected end of file.
#data
<!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 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <html>
@ -170,8 +170,8 @@ Unexpected end of file.
#data
<!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>
| <html>
@ -185,10 +185,10 @@ Unexpected start tag "body"
#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>
@ -197,9 +197,9 @@ Unexpected end tag.
#data
<!DOCTYPE HTML></b test<b &=&amp>X
#errors
End tag contains attributes.
Unexpected end tag.
Named entity didn't end with ;
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>
| <html>
@ -210,8 +210,8 @@ Named entity didn't end with ;
#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>
| <html>
@ -224,7 +224,7 @@ Unexpected EOF in (end) tag name
#data
&
#errors
No doctype.
Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -234,8 +234,8 @@ No doctype.
#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>
@ -245,8 +245,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>
@ -256,8 +256,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>
@ -267,8 +267,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>
@ -278,8 +278,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>
@ -289,7 +289,7 @@ 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>
| <html>
@ -301,7 +301,7 @@ 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>
| <html>
@ -313,7 +313,7 @@ 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>
| <html>
@ -325,8 +325,8 @@ 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>
| <html>
@ -338,8 +338,8 @@ Unexpected EOF.
#data
<!DOCTYPE HTML><p><b><i><u></p> <p>X
#errors
Unexpected end tag </p>.
Unexpected end EOF. Missing closing tags.
Line: 1 Col: 31 Unexpected end tag (p). Ignored.
Line: 1 Col: 36 Expected closing tag. Unexpected end of file.
#document
| <!DOCTYPE HTML>
| <html>
@ -370,8 +370,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>
@ -381,8 +381,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>
@ -392,7 +392,7 @@ Invalid entity.
#data
<!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>
| <html>
@ -403,7 +403,7 @@ Unexpected end of file.
#data
<!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>
| <html>
@ -414,7 +414,7 @@ Unexpected non-space characters in the after body phase.
#data
<!DOCTYPE HTML><!-- X
#errors
Unexpected end of file in comment.
Line: 1 Col: 21 Unexpected end of file in comment.
#document
| <!DOCTYPE HTML>
| <!-- X -->
@ -425,8 +425,8 @@ Unexpected end of file in comment.
#data
<!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>
| <html>
@ -443,7 +443,7 @@ Unexpected end of file.
#data
<!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>
| <html>
@ -456,8 +456,8 @@ Unexpected end of file. Missing closing tags.
#data
<!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 implies select start tag.
Line: 1 Col: 76 Unexpected start tag option. Ignored.
#document
| <!DOCTYPE HTML>
| <html>
@ -471,7 +471,7 @@ Unexpected start tag <option>.
#data
<!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>
| <html>
@ -507,7 +507,7 @@ Unexpected end of file. Missing closing tags.
#data
<!DOCTYPE HTML><!-- XXX - XXX
#errors
Unexpected EOF in comment.
Line: 1 Col: 29 Unexpected end of file in comment (-)
#document
| <!DOCTYPE HTML>
| <!-- XXX - XXX -->
@ -528,8 +528,8 @@ 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>
@ -548,7 +548,7 @@ No doctype
test
test
#errors
No doctype
Line: 2 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
#document
| <html>
| <head>
@ -560,9 +560,9 @@ test"
<p><b><i><u></p>
<p>X
#errors
No doctype
Unexpected end tag p.
Unexpected EOF.
Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE.
Line: 1 Col: 16 Unexpected end tag (p). Ignored.
Line: 2 Col: 4 Expected closing tag. Unexpected end of file.
#document
| <html>
| <head>
@ -582,7 +582,7 @@ Unexpected EOF.
#data
<!DOCTYPE HTML><body><title>test</body></title>
#errors
Unexpected start tag that belongs in the head.
Line: 1 Col: 28 Unexpected start tag (title) that can be in head. Moved.
#document
| <!DOCTYPE HTML>
| <html>
@ -595,7 +595,7 @@ Unexpected start tag that belongs in the head.
<!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. <title>
Line: 1 Col: 28 Unexpected start tag (title) that can be in head. Moved.
#document
| <!DOCTYPE HTML>
| <html>
@ -626,7 +626,7 @@ x { content:"</style" } "
#errors
No doctype.
Line: 2 Col: 1 Unexpected End of file. Expected DOCTYPE.
#document
| <html>
| <head>
@ -661,7 +661,7 @@ No doctype.
#data
<!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>
| <html>
@ -672,8 +672,8 @@ duplicate html start tag
#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.
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>
| <html>
@ -685,7 +685,7 @@ html needs to be the first start tag.
#data
<!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>
| <html>
@ -696,8 +696,8 @@ html start tag too late
#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.
Line: 1 Col: 24 Unexpected non-space characters. Expected end of file.
Line: 1 Col: 24 Unexpected non-space characters in the after body phase.
#document
| <!DOCTYPE HTML>
| <html>
@ -718,8 +718,8 @@ Unexpected non-space characters in after body phase. Expected end of file.
#data
<!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). Expected end of file.
Line: 1 Col: 26 Unexpected start tag token (p) in the after body phase.
#document
| <!DOCTYPE HTML>
| <html>
@ -732,9 +732,9 @@ Unexpected start tag <p> in after body phase.
#data
<!DOCTYPE HTML>X<p/x/y/z>
#errors
Solidus (/) incorrectly placed.
Solidus (/) incorrectly placed.
Solidus (/) incorrectly placed.
Line: 1 Col: 19 Solidus (/) incorrectly placed in tag.
Line: 1 Col: 21 Solidus (/) incorrectly placed in tag.
Line: 1 Col: 23 Solidus (/) incorrectly placed in tag.
#document
| <!DOCTYPE HTML>
| <html>
@ -749,7 +749,7 @@ Solidus (/) incorrectly placed.
#data
<!DOCTYPE HTML><!--x--
#errors
Unexpected end of file in comment.
Line: 1 Col: 22 Unexpected end of file in comment (--).
#document
| <!DOCTYPE HTML>
| <!-- x -->
@ -760,7 +760,7 @@ Unexpected end of file in comment.
#data
<!DOCTYPE HTML><table><tr><td></p></table>
#errors
Unexpected </p> end tag.
Line: 1 Col: 34 Unexpected end tag (p). Ignored.
#document
| <!DOCTYPE HTML>
| <html>