mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 424359. Fix OutputBodyOnly to not output a stray </html> and fix newline stuff for doctypes, comments, and the entire XML serializer. Now with even better passing tests. Third time is the charm! r=smaug, sr=bzbarsky
This commit is contained in:
parent
0e765dd76c
commit
c2fdb371f9
43
content/base/test/file_htmlserializer_1.html
Normal file
43
content/base/test/file_htmlserializer_1.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong> adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body>
|
||||
</html>
|
38
content/base/test/file_htmlserializer_1_bodyonly.html
Normal file
38
content/base/test/file_htmlserializer_1_bodyonly.html
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
<body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body>
|
47
content/base/test/file_htmlserializer_1_format.html
Normal file
47
content/base/test/file_htmlserializer_1_format.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Hello world</p>
|
||||
<p> Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu
|
||||
ad litora</span> torquent <a href="file_htmlserializer_1_result1.html">per
|
||||
conubia</a> nostra, per inceptos hymenaeos. </p>
|
||||
<ul>
|
||||
<li>Nam tellus massa,éàèçù</li>
|
||||
<li> fringilla aliquam,</li>
|
||||
<li> fermentum sit amet,</li>
|
||||
<li>posuere ac,</li>
|
||||
<li> est.</li>
|
||||
</ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
<ol>
|
||||
<li>Fusce a ipsum</li>
|
||||
<li> non lacus posuere aliquet.</li>
|
||||
<li> Sed fermentum posuere nulla</li>
|
||||
<li> Donec tempor.</li>
|
||||
</ol>
|
||||
Donec sollicitudin tortor<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body>
|
||||
</html>
|
44
content/base/test/file_htmlserializer_1_linebreak.html
Normal file
44
content/base/test/file_htmlserializer_1_linebreak.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body></html>
|
44
content/base/test/file_htmlserializer_1_links.html
Normal file
44
content/base/test/file_htmlserializer_1_links.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="http://localhost:8888/tests/content/base/test/file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body></html>
|
44
content/base/test/file_htmlserializer_1_nested_body.html
Normal file
44
content/base/test/file_htmlserializer_1_nested_body.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
<body><p>this is an other body element</p></body></body></html>
|
8
content/base/test/file_htmlserializer_1_no_body.html
Normal file
8
content/base/test/file_htmlserializer_1_no_body.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head></html>
|
44
content/base/test/file_htmlserializer_1_noflag.html
Normal file
44
content/base/test/file_htmlserializer_1_noflag.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body></html>
|
48
content/base/test/file_htmlserializer_1_noformatpre.html
Normal file
48
content/base/test/file_htmlserializer_1_noformatpre.html
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.
|
||||
|
||||
Cras quis
|
||||
|
||||
nisi at odio
|
||||
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
|
||||
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body></html>
|
42
content/base/test/file_htmlserializer_1_raw.html
Normal file
42
content/base/test/file_htmlserializer_1_raw.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong> adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body></html>
|
44
content/base/test/file_htmlserializer_1_sibling_body.html
Normal file
44
content/base/test/file_htmlserializer_1_sibling_body.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>Test for html serializer</title>
|
||||
|
||||
</head><body><p>this is an other body element</p></body><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body></html>
|
@ -0,0 +1,38 @@
|
||||
|
||||
<body><p>this is an other body element</p></body><body>
|
||||
<p>Hello world</p> <p>
|
||||
|
||||
Lorem ipsum dolor sit amet, <strong>consectetuer</strong>
|
||||
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
|
||||
Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti <span>sociosqu ad
|
||||
litora</span> torquent <a href="file_htmlserializer_1_result1.html">per conubia</a>
|
||||
nostra, per inceptos hymenaeos. </p>
|
||||
|
||||
|
||||
<ul><li>Nam tellus massa,éàèçù</li><li>
|
||||
fringilla
|
||||
aliquam,</li><li> fermentum sit amet,</li><li>posuere ac,</li><li> est.</li></ul>
|
||||
<div> Duis tristique egestas ligula. Mauris quis felis. </div>
|
||||
<script type="text/javascript">
|
||||
// a script which does nothing
|
||||
|
||||
function nothing() {
|
||||
var hey="hello";
|
||||
var aLongLine="consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<ol><li>Fusce
|
||||
a ipsum</li><li> non lacus posuere aliquet.</li><li> Sed fermentum posuere nulla</li><li> Donec tempor.</li></ol>
|
||||
Donec sollicitudin tortor
|
||||
<!-- test on
|
||||
comments -->
|
||||
<pre>lacinia <em>libero</em> ullamcorper laoreet.<br>
|
||||
Cras quis<br>
|
||||
nisi at odio<br>
|
||||
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum, <br>
|
||||
lacus risus pulvinar ante.
|
||||
</pre>
|
||||
ut gravida eros leo ut libero
|
||||
</body>
|
29
content/base/test/file_htmlserializer_2.html
Normal file
29
content/base/test/file_htmlserializer_2.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for html serializer with entities</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>The basic set is just & < > " for interoperability with older products that don't support α and friends.</p>
|
||||
|
||||
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´
|
||||
µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ
|
||||
Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø
|
||||
Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê
|
||||
ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý
|
||||
þ ÿ </p>
|
||||
<p>symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ
|
||||
Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς
|
||||
σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ⁄ ℘ ℑ ℜ
|
||||
™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
|
||||
∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥
|
||||
⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ ⟨ ⟩ ◊ ♠ ♣ ♥ ♦
|
||||
</p>
|
||||
<p> others
|
||||
Œ œ Š š Ÿ ˆ ˜       ‌ ‍ ‎ ‏–— ‘ ’
|
||||
‚“ ” „ † ‡ ‰ ‹ › €
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
29
content/base/test/file_htmlserializer_2_basic.html
Normal file
29
content/base/test/file_htmlserializer_2_basic.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=">
|
||||
|
||||
|
||||
<title>Test for html serializer with entities</title>
|
||||
</head><body>
|
||||
|
||||
<p>The basic set is just & < > " for interoperability with older products that don't support α and friends.</p>
|
||||
|
||||
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´
|
||||
µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ
|
||||
Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø
|
||||
Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê
|
||||
ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý
|
||||
þ ÿ </p>
|
||||
<p>symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ
|
||||
Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς
|
||||
σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ⁄ ℘ ℑ ℜ
|
||||
™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
|
||||
∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥
|
||||
⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦
|
||||
</p>
|
||||
<p> others
|
||||
Œ œ Š š Ÿ ˆ ˜ –— ‘ ’
|
||||
‚“ ” „ † ‡ ‰ ‹ › €
|
||||
</p>
|
||||
|
||||
</body></html>
|
50
content/base/test/file_htmlserializer_2_enthtml.html
Normal file
50
content/base/test/file_htmlserializer_2_enthtml.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=">
|
||||
|
||||
|
||||
<title>Test for html serializer with entities</title>
|
||||
</head><body>
|
||||
|
||||
<p>The basic set is just & < > " for interoperability with older products that don't support α and friends.</p>
|
||||
|
||||
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨
|
||||
© ª « ¬ ­ ® ¯ ° ± ²
|
||||
³ ´ µ ¶ · ¸ ¹ º »
|
||||
¼ ½ ¾ ¿ À Á Â Ã
|
||||
Ä Å Æ
|
||||
Ç È É Ê Ë Ì Í Î
|
||||
Ï Ð Ñ Ò Ó Ô Õ Ö ×
|
||||
Ø
|
||||
Ù Ú Û Ü Ý Þ ß à
|
||||
á â ã ä å æ ç è
|
||||
é ê ë ì í î ï ð ñ
|
||||
ò ó ô õ ö ÷ ø ù
|
||||
ú û ü ý þ ÿ </p>
|
||||
<p>symbols, math.. ƒ Α Β Γ Δ Ε
|
||||
Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο
|
||||
Π Ρ Σ Τ Υ
|
||||
Φ Χ Ψ Ω α β γ δ ε
|
||||
ζ η θ ι κ λ μ ν ξ ο
|
||||
π ρ ς
|
||||
σ τ υ φ χ ψ ω ϑ ϒ
|
||||
ϖ • … ′ ″ ‾ ⁄ ℘ ℑ
|
||||
ℜ
|
||||
™ ℵ ← ↑ → ↓ ↔ ↵ ⇐
|
||||
⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇
|
||||
∈ ∉
|
||||
∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧
|
||||
∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤
|
||||
≥
|
||||
⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈
|
||||
⌉ ⌊ ⌋ ⟨ ⟩ ◊ ♠ ♣ ♥
|
||||
♦
|
||||
</p>
|
||||
<p> others
|
||||
Œ œ Š š Ÿ ˆ ˜    
|
||||
  ‌ ‍ ‎ ‏–— ‘ ’
|
||||
‚“ ” „ † ‡ ‰ ‹
|
||||
› €
|
||||
</p>
|
||||
|
||||
</body></html>
|
50
content/base/test/file_htmlserializer_2_entw3c.html
Normal file
50
content/base/test/file_htmlserializer_2_entw3c.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=">
|
||||
|
||||
|
||||
<title>Test for html serializer with entities</title>
|
||||
</head><body>
|
||||
|
||||
<p>The basic set is just & < > " for interoperability with older products that don't support α and friends.</p>
|
||||
|
||||
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨
|
||||
© ª « ¬ ­ ® ¯ ° ± ²
|
||||
³ ´ µ ¶ · ¸ ¹ º »
|
||||
¼ ½ ¾ ¿ À Á Â Ã
|
||||
Ä Å Æ
|
||||
Ç È É Ê Ë Ì Í Î
|
||||
Ï Ð Ñ Ò Ó Ô Õ Ö ×
|
||||
Ø
|
||||
Ù Ú Û Ü Ý Þ ß à
|
||||
á â ã ä å æ ç è
|
||||
é ê ë ì í î ï ð ñ
|
||||
ò ó ô õ ö ÷ ø ù
|
||||
ú û ü ý þ ÿ </p>
|
||||
<p>symbols, math.. ƒ Α Β Γ Δ Ε
|
||||
Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο
|
||||
Π Ρ Σ Τ Υ
|
||||
Φ Χ Ψ Ω α β γ δ ε
|
||||
ζ η θ ι κ λ μ ν ξ ο
|
||||
π ρ ς
|
||||
σ τ υ φ χ ψ ω ϑ ϒ
|
||||
ϖ • … ′ ″ ‾ ⁄ ℘ ℑ
|
||||
ℜ
|
||||
™ ℵ ← ↑ → ↓ ↔ ↵ ⇐
|
||||
⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇
|
||||
∈ ∉
|
||||
∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧
|
||||
∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤
|
||||
≥
|
||||
⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈
|
||||
⌉ ⌊ ⌋ ⟨ ⟩ ◊ ♠ ♣ ♥
|
||||
♦
|
||||
</p>
|
||||
<p> others
|
||||
Œ œ Š š Ÿ ˆ ˜    
|
||||
  ‌ ‍ ‎ ‏–— ‘ ’
|
||||
‚“ ” „ † ‡ ‰ ‹
|
||||
› €
|
||||
</p>
|
||||
|
||||
</body></html>
|
36
content/base/test/file_htmlserializer_2_latin1.html
Normal file
36
content/base/test/file_htmlserializer_2_latin1.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=">
|
||||
|
||||
|
||||
<title>Test for html serializer with entities</title>
|
||||
</head><body>
|
||||
|
||||
<p>The basic set is just & < > " for interoperability with older products that don't support α and friends.</p>
|
||||
|
||||
<p>latin1 ¡ ¢ £ ¤ ¥ ¦ § ¨
|
||||
© ª « ¬ ­ ® ¯ ° ± ²
|
||||
³ ´ µ ¶ · ¸ ¹ º »
|
||||
¼ ½ ¾ ¿ À Á Â Ã
|
||||
Ä Å Æ
|
||||
Ç È É Ê Ë Ì Í Î
|
||||
Ï Ð Ñ Ò Ó Ô Õ Ö ×
|
||||
Ø
|
||||
Ù Ú Û Ü Ý Þ ß à
|
||||
á â ã ä å æ ç è
|
||||
é ê ë ì í î ï ð ñ
|
||||
ò ó ô õ ö ÷ ø ù
|
||||
ú û ü ý þ ÿ </p>
|
||||
<p>symbols, math.. ƒ Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ
|
||||
Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς
|
||||
σ τ υ φ χ ψ ω ϑ ϒ ϖ • … ′ ″ ‾ ⁄ ℘ ℑ ℜ
|
||||
™ ℵ ← ↑ → ↓ ↔ ↵ ⇐ ⇑ ⇒ ⇓ ⇔ ∀ ∂ ∃ ∅ ∇ ∈ ∉
|
||||
∋ ∏ ∑ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥
|
||||
⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ⌈ ⌉ ⌊ ⌋ 〈 〉 ◊ ♠ ♣ ♥ ♦
|
||||
</p>
|
||||
<p> others
|
||||
Œ œ Š š Ÿ ˆ ˜ –— ‘ ’
|
||||
‚“ ” „ † ‡ ‰ ‹ › €
|
||||
</p>
|
||||
|
||||
</body></html>
|
201
content/base/test/test_bug424359-1.html
Normal file
201
content/base/test/test_bug424359-1.html
Normal file
@ -0,0 +1,201 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
-->
|
||||
<head>
|
||||
<title>Test for HTML serializer</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=424359">Mozilla Bug </a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="testframe" src="file_htmlserializer_1.html">
|
||||
</iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
|
||||
function loadFileContent(aFile, aCharset) {
|
||||
//if(aAsIso == undefined) aAsIso = false;
|
||||
if(aCharset == undefined)
|
||||
aCharset = 'UTF-8';
|
||||
|
||||
var baseUri = Components.classes['@mozilla.org/network/standard-url;1']
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
baseUri.spec = window.location.href;
|
||||
|
||||
var ios = Components.classes['@mozilla.org/network/io-service;1']
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chann = ios.newChannel(aFile, aCharset, baseUri);
|
||||
|
||||
var cis = Components.interfaces.nsIConverterInputStream;
|
||||
|
||||
var inputStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
|
||||
.createInstance(cis);
|
||||
inputStream.init(chann.open(), aCharset, 1024, cis.DEFAULT_REPLACEMENT_CHARACTER);
|
||||
var str = {}, content = '';
|
||||
while (inputStream.readString(4096, str) != 0) {
|
||||
content += str.value;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
function testHtmlSerializer_1 () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const de = Components.interfaces.nsIDocumentEncoder
|
||||
var encoder = Components.classes["@mozilla.org/layout/documentEncoder;1?type=text/html"]
|
||||
.createInstance(Components.interfaces.nsIDocumentEncoder);
|
||||
|
||||
var doc = $("testframe").contentDocument;
|
||||
var out, expected;
|
||||
|
||||
// in the following tests, we must use the OutputLFLineBreak flag, to avoid
|
||||
// to have the default line break of the platform in the result, so the test
|
||||
// can pass on all platform
|
||||
|
||||
//------------ no flags
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak);
|
||||
encoder.setCharset("UTF-8");
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_noflag.html");
|
||||
is(out, expected, "test no flags");
|
||||
|
||||
//------------- unsupported flags
|
||||
// since the following flags are not supported, we should
|
||||
// have a result like the one without flag
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputPreformatted);
|
||||
out = encoder.encodeToString();
|
||||
is(out, expected, "test OutputPreformatted");
|
||||
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputWrap);
|
||||
out = encoder.encodeToString();
|
||||
is(out, expected, "test OutputWrap");
|
||||
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputFormatFlowed);
|
||||
out = encoder.encodeToString();
|
||||
is(out, expected, "test OutputFormatFlowed");
|
||||
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputNoScriptContent);
|
||||
out = encoder.encodeToString();
|
||||
is(out, expected, "test OutputNoScriptContent");
|
||||
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputNoFramesContent);
|
||||
out = encoder.encodeToString();
|
||||
is(out, expected, "test OutputNoFramesContent");
|
||||
|
||||
|
||||
//------------ OutputFormatted
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputFormatted);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_format.html");
|
||||
is(out, expected, "test OutputFormatted");
|
||||
|
||||
//------------ OutputRaw
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputRaw);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_raw.html");
|
||||
is(out, expected, "test OutputRaw");
|
||||
|
||||
//------------ OutputBodyOnly
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputBodyOnly);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_bodyonly.html");
|
||||
is(out, expected, "test OutputBodyOnly");
|
||||
|
||||
|
||||
|
||||
//------------ OutputAbsoluteLinks
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputAbsoluteLinks);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_links.html");
|
||||
is(out, expected, "test OutputAbsoluteLinks");
|
||||
|
||||
//------------ OutputLFLineBreak
|
||||
encoder.init(doc, "text/html",de.OutputLFLineBreak);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_linebreak.html");
|
||||
is(out, expected, "test OutputLFLineBreak");
|
||||
|
||||
//------------ OutputCRLineBreak
|
||||
encoder.init(doc, "text/html",de.OutputCRLineBreak);
|
||||
out = encoder.encodeToString();
|
||||
expected = expected.replace(/\n/mg, "\r");
|
||||
is(out, expected, "test OutputCRLineBreak");
|
||||
|
||||
//------------ OutputLFLineBreak + OutputCRLineBreak
|
||||
encoder.init(doc, "text/html",de.OutputLFLineBreak | de.OutputCRLineBreak);
|
||||
out = encoder.encodeToString();
|
||||
expected = expected.replace(/\r/mg, "\r\n");
|
||||
is(out, expected, "test OutputLFLineBreak + OutputCRLineBreak");
|
||||
|
||||
//------------ OutputNoFormattingInPre
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputNoFormattingInPre);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_noformatpre.html");
|
||||
is(out, expected, "test OutputNoFormattingInPre");
|
||||
|
||||
// ------------- nested body elements
|
||||
var body2 = doc.createElement('body');
|
||||
var p = doc.createElement('p');
|
||||
p.appendChild(doc.createTextNode("this is an other body element"));
|
||||
body2.appendChild(p);
|
||||
var body = doc.getElementsByTagName('body')[0];
|
||||
body.appendChild(body2);
|
||||
|
||||
is(doc.getElementsByTagName('body').length, 2); // to be sure we have two body elements
|
||||
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak);
|
||||
encoder.setCharset("UTF-8");
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_nested_body.html");
|
||||
is(out, expected, "test with two nested body elements");
|
||||
|
||||
// ------------- two body elements
|
||||
body.parentNode.insertBefore(body2, body);
|
||||
|
||||
is(doc.getElementsByTagName('body').length, 2); // to be sure we have two body elements
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak);
|
||||
encoder.setCharset("UTF-8");
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_sibling_body.html");
|
||||
is(out, expected, "test with two body elements");
|
||||
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputBodyOnly);
|
||||
encoder.setCharset("UTF-8");
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_sibling_body_only_body.html");
|
||||
is(out, expected, "test with two body elements, and output body only");
|
||||
|
||||
// --------------- no body element
|
||||
doc.documentElement.removeChild(body);
|
||||
doc.documentElement.removeChild(body2);
|
||||
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak);
|
||||
encoder.setCharset("UTF-8");
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_1_no_body.html");
|
||||
is(out, expected, "test with no body element");
|
||||
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(testHtmlSerializer_1);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
<!--<h1>1</h1><h2>result</h2><textarea id="t1" cols="80" rows="20"></textarea>
|
||||
<h2>expected</h2><textarea id="t1e" cols="80" rows="20"></textarea>-->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
96
content/base/test/test_bug424359-2.html
Normal file
96
content/base/test/test_bug424359-2.html
Normal file
@ -0,0 +1,96 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
-->
|
||||
<head>
|
||||
<title>Test HTML serializer with entities</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=424359">Mozilla Bug </a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="testframe" src="file_htmlserializer_2.html">
|
||||
</iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
|
||||
function loadFileContent(aFile, aCharset) {
|
||||
//if(aAsIso == undefined) aAsIso = false;
|
||||
if(aCharset == undefined)
|
||||
aCharset = 'UTF-8';
|
||||
|
||||
var baseUri = Components.classes['@mozilla.org/network/standard-url;1']
|
||||
.createInstance(Components.interfaces.nsIURI);
|
||||
baseUri.spec = window.location.href;
|
||||
|
||||
var ios = Components.classes['@mozilla.org/network/io-service;1']
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chann = ios.newChannel(aFile, aCharset, baseUri);
|
||||
|
||||
var cis = Components.interfaces.nsIConverterInputStream;
|
||||
|
||||
var inputStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
|
||||
.createInstance(cis);
|
||||
inputStream.init(chann.open(), aCharset, 1024, cis.DEFAULT_REPLACEMENT_CHARACTER);
|
||||
var str = {}, content = '';
|
||||
while (inputStream.readString(4096, str) != 0) {
|
||||
content += str.value;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
function testHtmlSerializer_1 () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const de = Components.interfaces.nsIDocumentEncoder
|
||||
var encoder = Components.classes["@mozilla.org/layout/documentEncoder;1?type=text/html"]
|
||||
.createInstance(Components.interfaces.nsIDocumentEncoder);
|
||||
|
||||
var doc = $("testframe").contentDocument;
|
||||
var out, expected;
|
||||
|
||||
// in the following tests, we must use the OutputLFLineBreak flag, to avoid
|
||||
// to have the default line break of the platform in the result, so the test
|
||||
// can pass on all platform
|
||||
|
||||
//------------ OutputEncodeW3CEntities
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputEncodeW3CEntities);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_2_entw3c.html");
|
||||
is(out, expected, "test OutputEncodeW3CEntities");
|
||||
|
||||
//------------ OutputEncodeBasicEntities
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputEncodeBasicEntities);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_2_basic.html");
|
||||
is(out, expected, "test OutputEncodeBasicEntities");
|
||||
|
||||
//------------ OutputEncodeLatin1Entities
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputEncodeLatin1Entities);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_2_latin1.html");
|
||||
is(out, expected, "test OutputEncodeLatin1Entities");
|
||||
|
||||
//------------ OutputEncodeHTMLEntities
|
||||
encoder.init(doc, "text/html", de.OutputLFLineBreak | de.OutputEncodeHTMLEntities);
|
||||
out = encoder.encodeToString();
|
||||
expected = loadFileContent("file_htmlserializer_2_enthtml.html");
|
||||
is(out, expected, "test OutputEncodeHTMLEntities");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(testHtmlSerializer_1);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
3
content/base/test/unit/1_original.xml
Normal file
3
content/base/test/unit/1_original.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<foo /> <!-- é -->
|
3
content/base/test/unit/1_result.xml
Normal file
3
content/base/test/unit/1_result.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo/>
|
||||
<!-- é -->
|
16
content/base/test/unit/2_original.xml
Normal file
16
content/base/test/unit/2_original.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE whatever PUBLIC
|
||||
"-//MOZ//WHATEVER//EN"
|
||||
"http://mozilla.org/ns/foo">
|
||||
<foo xmln="htp://mozilla.org/ns">
|
||||
<baz /> <!-- a comment -->
|
||||
<bar> <robots> & <aliens>
|
||||
<mozilla> a a a a a éèàùûî</mozilla>
|
||||
<firefox>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam tellus massa, fringilla aliquam, fermentum sit amet, posuere ac, est. Duis tristique egestas ligula. Mauris quis felis. Fusce a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla. Donec tempor. Donec sollicitudin tortor lacinia libero ullamcorper laoreet. Cras quis nisi at odio consectetuer molestie.</firefox>
|
||||
<?xml-foo "hey" ?>
|
||||
</bar>
|
||||
<!-- a comment
|
||||
on several lines-->
|
||||
<?xml-foo "another pi on two lines"
|
||||
example="hello"?>
|
||||
</foo>
|
14
content/base/test/unit/2_result_1.xml
Normal file
14
content/base/test/unit/2_result_1.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE whatever PUBLIC "-//MOZ//WHATEVER//EN" "http://mozilla.org/ns/foo">
|
||||
<foo xmln="htp://mozilla.org/ns">
|
||||
<baz/> <!-- a comment -->
|
||||
<bar> <robots> & <aliens>
|
||||
<mozilla> a a a a a éèàùûî</mozilla>
|
||||
<firefox>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam tellus massa, fringilla aliquam, fermentum sit amet, posuere ac, est. Duis tristique egestas ligula. Mauris quis felis. Fusce a ipsum non lacus posuere aliquet. Sed fermentum posuere nulla. Donec tempor. Donec sollicitudin tortor lacinia libero ullamcorper laoreet. Cras quis nisi at odio consectetuer molestie.</firefox>
|
||||
<?xml-foo "hey" ?>
|
||||
</bar>
|
||||
<!-- a comment
|
||||
on several lines-->
|
||||
<?xml-foo "another pi on two lines"
|
||||
example="hello"?>
|
||||
</foo>
|
68
content/base/test/unit/head_utilities.js
Normal file
68
content/base/test/unit/head_utilities.js
Normal file
@ -0,0 +1,68 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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
|
||||
*
|
||||
* The Initial Developer of the Original Code is Disruptive Innovations.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Laurent Jouanneau <laurent.jouanneau@disruptive-innovations.com>, Original author
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
const gBasePath = "content/base/test/unit/";
|
||||
const nsIDocumentEncoder = Components.interfaces.nsIDocumentEncoder;
|
||||
const replacementChar = Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER;
|
||||
|
||||
function loadContentFile(aFile, aCharset) {
|
||||
//if(aAsIso == undefined) aAsIso = false;
|
||||
if(aCharset == undefined)
|
||||
aCharset = 'UTF-8';
|
||||
|
||||
var file = do_get_file(gBasePath+aFile);
|
||||
var ios = Components.classes['@mozilla.org/network/io-service;1']
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var chann = ios.newChannelFromURI ( ios.newFileURI (file) );
|
||||
chann.contentCharset = aCharset;
|
||||
|
||||
/*var inputStream = Components.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.createInstance(Components.interfaces.nsIScriptableInputStream);
|
||||
inputStream.init(chann.open());
|
||||
return inputStream.read(file.fileSize);
|
||||
*/
|
||||
|
||||
var inputStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIConverterInputStream);
|
||||
inputStream.init(chann.open(), aCharset, 1024, replacementChar);
|
||||
var str = {}, content = '';
|
||||
while (inputStream.readString(4096, str) != 0) {
|
||||
content += str.value;
|
||||
}
|
||||
return content;
|
||||
}
|
75
content/base/test/unit/test_xmlserializer.js
Normal file
75
content/base/test/unit/test_xmlserializer.js
Normal file
@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Disruptive Innovations.
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Laurent Jouanneau <laurent.jouanneau@disruptive-innovations.com>, Original author
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
function xmlEncode(aFile, aFlags, aCharset) {
|
||||
if(aFlags == undefined) aFlags = 0;
|
||||
if(aCharset == undefined) aCharset = "UTF-8";
|
||||
|
||||
var doc = do_parse_document(gBasePath+aFile, "text/xml");
|
||||
|
||||
var encoder = Components.classes["@mozilla.org/layout/documentEncoder;1?type=text/xml"]
|
||||
.createInstance(nsIDocumentEncoder);
|
||||
encoder.setCharset(aCharset);
|
||||
encoder.init(doc, "text/xml", aFlags);
|
||||
return encoder.encodeToString();
|
||||
}
|
||||
|
||||
function run_test()
|
||||
{
|
||||
var result, expected;
|
||||
const de = Components.interfaces.nsIDocumentEncoder;
|
||||
|
||||
result = xmlEncode("1_original.xml", de.OutputLFLineBreak);
|
||||
expected =loadContentFile("1_result.xml");
|
||||
do_check_eq(expected, result);
|
||||
|
||||
result = xmlEncode("2_original.xml", de.OutputLFLineBreak);
|
||||
expected = loadContentFile("2_result_1.xml");
|
||||
do_check_eq(expected, result);
|
||||
|
||||
result = xmlEncode("2_original.xml", de.OutputLFLineBreak);
|
||||
do_check_eq(expected, result);
|
||||
|
||||
result = xmlEncode("2_original.xml", de.OutputCRLineBreak);
|
||||
expected = expected.replace(/\n/g, "\r");
|
||||
do_check_eq(expected, result);
|
||||
|
||||
result = xmlEncode("2_original.xml", de.OutputLFLineBreak | de.OutputCRLineBreak);
|
||||
expected = expected.replace(/\r/mg, "\r\n");
|
||||
do_check_eq(expected, result);
|
||||
}
|
Loading…
Reference in New Issue
Block a user