Bug 1371010 - Test to make sure that serializeToString does not percent-encode href attributes. r?jgraham draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 10 Jun 2017 11:57:14 +0900
changeset 592567 da03874b43c4ce27300d6a7b416d9d4d60e574f6
parent 592062 e1b938c477863c49f09f7788f2c75d838fae4d1f
child 632866 a3a4cdf258378b6dbc505ff667ba86a7f7c09c40
push id63437
push userVYV03354@nifty.ne.jp
push dateMon, 12 Jun 2017 13:32:01 +0000
reviewersjgraham
bugs1371010
milestone55.0a1
Bug 1371010 - Test to make sure that serializeToString does not percent-encode href attributes. r?jgraham MozReview-Commit-ID: 2gGhaEXIltr
testing/web-platform/tests/domparsing/xml-serialization.xhtml
--- a/testing/web-platform/tests/domparsing/xml-serialization.xhtml
+++ b/testing/web-platform/tests/domparsing/xml-serialization.xhtml
@@ -63,16 +63,28 @@ test(function() {
 }, "DocumentType: 'QUOTATION MARK' (U+0022)");
 
 test(function() {
   var dt = document.implementation.createDocumentType("html", '"\'', '\'"');
   assert_equals(serialize(dt), '<!DOCTYPE html PUBLIC ""\'" "\'"">');
 }, "DocumentType: 'APOSTROPHE' (U+0027) and 'QUOTATION MARK' (U+0022)");
 
 test(function() {
+  var el = document.createElement("a");
+  el.setAttribute("href", "\u3042\u3044\u3046 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
+  assert_equals(serialize(el), "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"\u3042\u3044\u3046 !&quot;#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\"></a>");
+}, "Element: href attributes are not percent-encoded");
+
+test(function() {
+  var el = document.createElement("a");
+  el.setAttribute("href", "?\u3042\u3044\u3046 !\"$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
+  assert_equals(serialize(el), "<a xmlns=\"http://www.w3.org/1999/xhtml\" href=\"?\u3042\u3044\u3046 !&quot;$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\"></a>");
+}, "Element: query parts in href attributes are not percent-encoded");
+
+test(function() {
   var pi = document.createProcessingInstruction("a", "");
   assert_equals(serialize(pi), "<?a ?>");
 }, "ProcessingInstruction: empty data");
 
 test(function() {
   var pi = document.createProcessingInstruction("a", "b");
   assert_equals(serialize(pi), "<?a b?>");
 }, "ProcessingInstruction: non-empty data");