mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Adding test for bug 361933
This commit is contained in:
parent
1b93ffb172
commit
744c1ea6a7
@ -167,3 +167,21 @@ function do_check_serialize(dom) {
|
||||
do_check_equiv(dom, roundtrip(dom));
|
||||
}
|
||||
|
||||
function Pipe() {
|
||||
var p = C["@mozilla.org/pipe;1"].createInstance(I.nsIPipe);
|
||||
p.init(false, false, 0, 0xffffffff, null);
|
||||
return p;
|
||||
}
|
||||
|
||||
function ScriptableInput(arg) {
|
||||
if (arg instanceof I.nsIPipe) {
|
||||
arg = arg.inputStream;
|
||||
}
|
||||
|
||||
var str = C["@mozilla.org/scriptableinputstream;1"].
|
||||
createInstance(I.nsIScriptableInputStream);
|
||||
|
||||
str.init(arg);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ var tests = [
|
||||
test5,
|
||||
test6,
|
||||
test7,
|
||||
test8,
|
||||
null
|
||||
];
|
||||
|
||||
@ -259,3 +260,31 @@ function test7() {
|
||||
'<root xmlns="http://www.w3.org/1999/xhtml"><child1 xmlns="">' +
|
||||
'<a0:child2 xmlns:a0="http://www.w3.org/1999/xhtml" xmlns=""/></child1></root>');
|
||||
}
|
||||
|
||||
function test8() {
|
||||
// Test behavior of serializing with a given charset.
|
||||
var str1 = '<?xml version="1.0" encoding="ISO-8859-1"?>\n<root/>';
|
||||
var str2 = '<?xml version="1.0" encoding="UTF8"?>\n<root/>';
|
||||
var doc1 = ParseXML(str1);
|
||||
var doc2 = ParseXML(str2);
|
||||
|
||||
var p = Pipe();
|
||||
DOMSerializer().serializeToStream(doc1, p.outputStream, "ISO-8859-1");
|
||||
p.outputStream.close();
|
||||
do_check_eq(ScriptableInput(p).read(-1), str1);
|
||||
|
||||
p = Pipe();
|
||||
DOMSerializer().serializeToStream(doc2, p.outputStream, "ISO-8859-1");
|
||||
p.outputStream.close();
|
||||
do_check_eq(ScriptableInput(p).read(-1), str1);
|
||||
|
||||
p = Pipe();
|
||||
DOMSerializer().serializeToStream(doc1, p.outputStream, "UTF8");
|
||||
p.outputStream.close();
|
||||
do_check_eq(ScriptableInput(p).read(-1), str2);
|
||||
|
||||
p = Pipe();
|
||||
DOMSerializer().serializeToStream(doc2, p.outputStream, "UTF8");
|
||||
p.outputStream.close();
|
||||
do_check_eq(ScriptableInput(p).read(-1), str2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user