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 519172 29a5999a6eb11702dafbd85b17ddc979e54bc79e
parent 519171 db60e08e38e92b2cb23e0209007f123cda0e8e7a
child 519173 0390eb5bdf53561523d61429d7ffbf268ad1429a
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [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>