Bug 1383518 - Part 0: Test whitespace cleanup. r=bkelly, a=jcristau
authorAndrew Sutherland <asutherland@asutherland.org>
Wed, 23 Aug 2017 04:18:39 -0400
changeset 666711 2c5b968aba14f53facca0eb4acc43b3d45260a78
parent 666710 3feb092c607a8203ab1506af26415ca42bfb491f
child 666712 10a244c0f835d286d49a571dab59b698d7404e28
push id80488
push userbmo:mkelly@mozilla.com
push dateTue, 19 Sep 2017 04:42:30 +0000
reviewersbkelly, jcristau
bugs1383518
milestone55.0.3
Bug 1383518 - Part 0: Test whitespace cleanup. r=bkelly, a=jcristau This test had trailing whitespace in a number of places, including one spot inside a <textarea> that explicitly had a test expectation against it. Since it's popular to have text editors purge trailing whitespace, this patch converts the one significant piece of trailing whitespace to use an HTML entity to encode a trailing ASCII space character. This keeps that test happy.
dom/html/test/test_formSubmission.html
--- a/dom/html/test/test_formSubmission.html
+++ b/dom/html/test/test_formSubmission.html
@@ -1,16 +1,16 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=523771
 -->
 <head>
   <title>Test for Bug 523771</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=523771">Mozilla Bug 523771</a>
 <p id="display"></p>
 <iframe name="target_iframe" id="target_iframe"></iframe>
 <form action="form_submit_server.sjs" target="target_iframe" id="form"
@@ -249,17 +249,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       <td><input type=email value="v20_5@bar"></td>
       <td><input type=email ></td>
       <td><input type=email name="n20_7_&#13;_&#10;_&#13;&#10;__&quot;"
                  value="v20_7_&#13;_&#10;_&#13;&#10;__&quot;@bar">
           <!-- Put UTF-8 value is the "strange" column. -->
           <input type=email name="n20_8" value="foo@mózillä.órg"></td>
     </tr>
   </table>
-  
+
   <p>
     File input:
     <input type=file name="file_1" class="setfile">
     <input type=file name="file_2">
     <input type=file name="" class="setfile">
     <input type=file name="">
     <input type=file class="setfile">
     <input type=file>
@@ -285,25 +285,25 @@ https://bugzilla.mozilla.org/show_bug.cg
     <textarea>t_4_v</textarea>
     <textarea></textarea>
     <textarea name="t6">
 t_6_v</textarea>
     <textarea name="t7">t_7_v
 </textarea>
     <textarea name="t8">
 
- t_8_v 
+ t_8_v&#0032;
 </textarea>
     <textarea name="t9_&#13;_&#10;_&#13;&#10;_ _&quot;">t_9_&#13;_&#10;_&#13;&#10;_ _&quot;_v</textarea>
     <textarea name="t10" value="t_10_bogus">t_10_v</textarea>
   </p>
 
   <p>
     Select one:
-  
+
     <select name="sel_1"></select>
     <select name="sel_1b"><option></option></select>
     <select name="sel_1c"><option selected></option></select>
 
     <select name="sel_2"><option value="sel_2_v"></option></select>
     <select name="sel_3"><option selected value="sel_3_v"></option></select>
 
     <select name="sel_4"><option value="sel_4_v1"></option><option value="sel_4_v2"></option></select>
@@ -334,17 +334,17 @@ t_6_v</textarea>
     <select><option selected value="sel_17_v1"></option><option value="sel_17_v2"></option></select>
     <select><option value="sel_18_v1"></option><option selected value="sel_18_v2"></option></select>
     <select><option selected>sel_19_v1</option><option>sel_19_v2</option></select>
     <select><option>sel_20_v1</option><option selected>sel_20_v2</option></select>
   </p>
 
   <p>
     Select multiple:
-  
+
     <select multiple name="msel_1"></select>
     <select multiple name="msel_1b"><option></option></select>
     <select multiple name="msel_1c"><option selected></option></select>
 
     <select multiple name="msel_2"><option value="msel_2_v"></option></select>
     <select multiple name="msel_3"><option selected value="msel_3_v"></option></select>
 
     <select multiple name="msel_4"><option value="msel_4_v1"></option><option value="msel_4_v2"></option></select>
@@ -600,21 +600,21 @@ function checkMPSubmission(sub, expected
     return s.replace(/\r\n/g, " ")
             .replace(/\r/g, " ")
             .replace(/\n/g, " ")
             .replace(/\"/g, "\\\"");
   }
 
   is(sub.length, expected.length,
      "Correct number of multipart items in " + test);
-  
+
   if (sub.length != expected.length) {
     alert(JSON.stringify(sub));
   }
-  
+
   var i;
   for (i = 0; i < expected.length; ++i) {
     if (!("fileName" in expected[i])) {
       is(sub[i].headers["Content-Disposition"],
          "form-data; name=\"" + mpquote(expected[i].name) + "\"",
          "Correct name in " + test);
       is (getPropCount(sub[i].headers), 1,
           "Wrong number of headers in " + test);
@@ -657,17 +657,17 @@ function checkURLSubmission(sub, expecte
   for (i = 0; i < expected.length; ++i) {
     let expect = urlEscape(expected[i].name) + "=" +
         urlEscape(("fileName" in expected[i]) ? expected[i].fileName : expected[i].value);
     is (subItems[i], expect, "expected URL part");
   }
 }
 
 function checkPlainSubmission(sub, expected) {
-  
+
   is(sub,
      expected.map(function(v) {
        return v.name + "=" +
               (("fileName" in v) ? v.fileName : v.value) +
               "\r\n";
      }).join(""),
      "Correct submission");
 }
@@ -711,17 +711,16 @@ function* runTest() {
     }
   };
   expectedSub.forEach(fileFixup);
   expectedAugment.forEach(fileFixup);
 
   var form = $("form");
 
   // multipart/form-data
-
   var iframe = $("target_iframe");
   iframe.onload = function() { gen.next(); };
 
   // Make normal submission
   form.submit();
   yield undefined; // Wait for iframe to load as a result of the submission
   var submission = JSON.parse(iframe.contentDocument.documentElement.textContent);
   checkMPSubmission(submission, expectedSub, "normal submission");
@@ -776,25 +775,25 @@ function* runTest() {
 
   // Send form using XHR and FormData
   xhr = new XMLHttpRequest();
   xhr.onload = function() { gen.next(); };
   xhr.open("POST", "form_submit_server.sjs");
   xhr.send(new FormData(form));
   yield undefined; // Wait for XHR load
   checkMPSubmission(JSON.parse(xhr.responseText), expectedSub, "send form using XHR and FormData");
-  
+
   // Send disabled form using XHR and FormData
   setDisabled(document.querySelectorAll("input, select, textarea"), true);
   xhr.open("POST", "form_submit_server.sjs");
   xhr.send(new FormData(form));
   yield undefined;
   checkMPSubmission(JSON.parse(xhr.responseText), [], "send disabled form using XHR and FormData");
   setDisabled(document.querySelectorAll("input, select, textarea"), false);
-  
+
   // Send FormData
   function addToFormData(fd) {
     fd.append("aName", "aValue");
     fd.append("aNameNum", 9.2);
     fd.append("aNameFile1", myFile1);
     fd.append("aNameFile2", myFile2);
   }
   var fd = new FormData();