Bug 1438833: fix web platform tests for XMLSerializer r=bz

This was a regression introduced by the fix for bug 169521.

MozReview-Commit-ID: CaUayY0bnqu

--HG--
extra : rebase_source : 71389463ccfe99626d758d4303e61d47bffe3774
This commit is contained in:
Ashish Kulkarni 2018-02-16 19:32:37 +05:30
parent 9e616d15ed
commit a9009a94da

View File

@ -42,10 +42,17 @@ test(function() {
test(function() {
var serializer = new XMLSerializer();
var root = createXmlDoc().documentElement;
root.firstChild.setAttribute('attr1', 'value1\tvalue2\r\n');
var xmlString = serializer.serializeToString(root);
assert_equals(xmlString, '<root><child1 attr1="value1&#9;value2&#xD;&#xA;">value1</child1></root>');
var parser = new DOMParser();
var root = parser.parseFromString('<root />', 'text/xml').documentElement;
root.setAttribute('attr', '\t');
assert_in_array(serializer.serializeToString(root), [
'<root attr="&#9;"/>', '<root attr="&#x9;"/>']);
root.setAttribute('attr', '\n');
assert_in_array(serializer.serializeToString(root), [
'<root attr="&#xA;"/>', '<root attr="&#10;"/>']);
root.setAttribute('attr', '\r');
assert_in_array(serializer.serializeToString(root), [
'<root attr="&#xD;"/>', '<root attr="&#13;"/>']);
}, 'check XMLSerializer.serializeToString escapes attribute values for roundtripping');
</script>