mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 817844 - Fix WebIDL signature of serializeToStream/parseFromStream. r=bz
This commit is contained in:
parent
63b95d95ed
commit
9e9d0a9573
@ -98,11 +98,14 @@ function runTest(parser, serializer) {
|
|||||||
"parseFromString test for " + t.type);
|
"parseFromString test for " + t.type);
|
||||||
|
|
||||||
let ostream = {
|
let ostream = {
|
||||||
data: "",
|
|
||||||
write: function(buf, count) { this.data += buf; return count; }
|
write: function(buf, count) { this.data += buf; return count; }
|
||||||
};
|
};
|
||||||
serializer.serializeToStream(parser.parseFromString(t.input, t.type), ostream, "UTF-8");
|
for (let charset of [null, "UTF-8"]) {
|
||||||
is(ostream.data, t.expected, "serializeToStream test for " + t.type);
|
ostream.data = "";
|
||||||
|
serializer.serializeToStream(parser.parseFromString(t.input, t.type), ostream, charset);
|
||||||
|
is(ostream.data, t.expected,
|
||||||
|
"serializeToStream test for " + t.type + ", charset=" + charset);
|
||||||
|
}
|
||||||
|
|
||||||
if (t.type === "text/html") {
|
if (t.type === "text/html") {
|
||||||
// parseFromBuffer and parseFromStream don't support "text/html".
|
// parseFromBuffer and parseFromStream don't support "text/html".
|
||||||
@ -126,10 +129,12 @@ function runTest(parser, serializer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let istream = Cc["@mozilla.org/io/string-input-stream;1"].
|
let istream = Cc["@mozilla.org/io/string-input-stream;1"].
|
||||||
createInstance(Ci.nsIStringInputStream);
|
createInstance(Ci.nsIStringInputStream);
|
||||||
istream.setData(t.input, -1);
|
for (let charset of [null, "UTF-8"]) {
|
||||||
is(serializer.serializeToString(parser.parseFromStream(istream, null, array.length, t.type)),
|
istream.setData(t.input, -1);
|
||||||
t.expected, "parseFromStream test for " + t.type);
|
is(serializer.serializeToString(parser.parseFromStream(istream, charset, t.input.length, t.type)),
|
||||||
|
t.expected, "parseFromStream test for " + t.type + ", charset=" + charset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throws(function() {
|
throws(function() {
|
||||||
parser.parseFromString("<xml></xml>", "foo/bar");
|
parser.parseFromString("<xml></xml>", "foo/bar");
|
||||||
|
@ -36,7 +36,7 @@ interface DOMParser {
|
|||||||
Document parseFromBuffer(Uint8Array buf, unsigned long bufLen,
|
Document parseFromBuffer(Uint8Array buf, unsigned long bufLen,
|
||||||
SupportedType type);
|
SupportedType type);
|
||||||
[Creator, Throws, ChromeOnly]
|
[Creator, Throws, ChromeOnly]
|
||||||
Document parseFromStream(InputStream stream, DOMString charset,
|
Document parseFromStream(InputStream stream, DOMString? charset,
|
||||||
long contentLength, SupportedType type);
|
long contentLength, SupportedType type);
|
||||||
[Throws, ChromeOnly]
|
[Throws, ChromeOnly]
|
||||||
void init(optional Principal? principal = null,
|
void init(optional Principal? principal = null,
|
||||||
|
@ -15,6 +15,6 @@ interface XMLSerializer {
|
|||||||
|
|
||||||
// Mozilla-specific stuff
|
// Mozilla-specific stuff
|
||||||
[Throws, ChromeOnly]
|
[Throws, ChromeOnly]
|
||||||
void serializeToStream(Node root, OutputStream stream, DOMString charset);
|
void serializeToStream(Node root, OutputStream stream, DOMString? charset);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user