Bug 1526595 [wpt PR 15260] - XMLSerializer: Fix prefix generation algorithm, a=testonly
authorKent Tamura <tkent@chromium.org>
Mon, 18 Feb 2019 19:25:00 +0000
changeset 461290 29a5999a6eb11702dafbd85b17ddc979e54bc79e
parent 461289 db60e08e38e92b2cb23e0209007f123cda0e8e7a
child 461291 0390eb5bdf53561523d61429d7ffbf268ad1429a
push id35622
push userncsoregi@mozilla.com
push dateWed, 27 Feb 2019 04:32:15 +0000
treeherdermozilla-central@5b8896aa3f69 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1526595, 15260, 928639, 1454070, 629490
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1526595 [wpt PR 15260] - XMLSerializer: Fix prefix generation algorithm, a=testonly Automatic update from web-platform-tests XMLSerializer: Fix prefix generation algorithm Fix it in order to match to DOM Parsing and Serialization specification. We should not expose hash values of strings. Bug: 928639 Change-Id: I589572d87715805961f2931c6808c1bd38acade6 Reviewed-on: https://chromium-review.googlesource.com/c/1454070 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Yoshifumi Inoue <yosin@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#629490} -- wpt-commits: d2c49d8610185244a31e04ef32aae70da0dd35f7 wpt-pr: 15260
testing/web-platform/tests/domparsing/XMLSerializer-serializeToString.html
--- a/testing/web-platform/tests/domparsing/XMLSerializer-serializeToString.html
+++ b/testing/web-platform/tests/domparsing/XMLSerializer-serializeToString.html
@@ -50,11 +50,21 @@ test(function() {
   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');
 
+test(function() {
+  const input = '<root><child1/><child2/></root>';
+  const root = (new DOMParser()).parseFromString(input, 'text/xml').documentElement;
+  root.firstChild.setAttributeNS('uri1', 'attr1', 'value1');
+  root.firstChild.setAttributeNS('uri2', 'attr2', 'value2');
+  root.lastChild.setAttributeNS('uri3', 'attr3', 'value3');
+  const xmlString = (new XMLSerializer()).serializeToString(root);
+  assert_equals(xmlString, '<root><child1 xmlns:ns1="uri1" ns1:attr1="value1" xmlns:ns2="uri2" ns2:attr2="value2"/><child2 xmlns:ns3="uri3" ns3:attr3="value3"/></root>');
+}, 'Check if generated prefixes match to "ns${index}".');
+
 </script>
  </body>
 </html>