Bug 1319936 - Remove String generics uses in dom. r=billm
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 24 Nov 2016 13:17:00 -0800
changeset 324753 1e6c0d61f55400a54d4f889817c77584af6a92ef
parent 324752 8361e025e4c796b90027fe7c88018780b4c2a4ee
child 324754 a42ceecb226008ea2b33701ebfd8986e05521b7d
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbillm
bugs1319936
milestone53.0a1
Bug 1319936 - Remove String generics uses in dom. r=billm
dom/bindings/test/test_interfaceToString.html
dom/encoding/test/test_TextEncoder.js
dom/security/test/cors/test_CrossSiteXHR.html
dom/tests/mochitest/fetch/test_fetch_cors.js
--- a/dom/bindings/test/test_interfaceToString.html
+++ b/dom/bindings/test/test_interfaceToString.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 742156 **/
 
-var nativeToString = ("" + String.replace).replace("replace", "EventTarget");
+var nativeToString = ("" + String).replace("String", "EventTarget");
 try {
     var eventTargetToString = "" + EventTarget;
     is(eventTargetToString, nativeToString,
        "Stringifying a DOM interface object should return the same string" +
        "as stringifying a native function.");
 }
 catch (e) {
     ok(false, "Stringifying a DOM interface object shouldn't throw.");
--- a/dom/encoding/test/test_TextEncoder.js
+++ b/dom/encoding/test/test_TextEncoder.js
@@ -177,17 +177,17 @@ function testStreamingOptions()
   testArrayOfStrings({array: [
     {input: data[0], stream: true, expected: expected[0]},
     {input: data[1], expected: expected[1]},
     {input: data[2], expected: expected[2]},
   ], msg: "streaming test two."});
 }
 
 function arrayFromString(s) {
-  return s.split('').map(function(c){return String.charCodeAt(c)});
+  return s.split('').map(function(c){return c.charCodeAt(0)});
 }
 
 function testArrayOfStrings(test)
 {
   var encoder;
   try {
     encoder = new TextEncoder();
   } catch (e) {
--- a/dom/security/test/cors/test_CrossSiteXHR.html
+++ b/dom/security/test/cors/test_CrossSiteXHR.html
@@ -668,17 +668,17 @@ function runTest() {
                  "multipart/form-data",
                  "application/x-www-form-urlencoded"]
                    .indexOf(test.headers[name].toLowerCase()) == -1);
       }
       req.url += "&headers=" + escape(test.headers.toSource());
       reqHeaders =
         escape(Object.keys(test.headers)
                .filter(isUnsafeHeader)
-               .map(String.toLowerCase)
+               .map(s => s.toLowerCase())
                .sort()
                .join(","));
       req.url += reqHeaders ? "&requestHeaders=" + reqHeaders : "";
     }
     if ("allowHeaders" in test)
       req.url += "&allowHeaders=" + escape(test.allowHeaders);
     if ("allowMethods" in test)
       req.url += "&allowMethods=" + escape(test.allowMethods);
--- a/dom/tests/mochitest/fetch/test_fetch_cors.js
+++ b/dom/tests/mochitest/fetch/test_fetch_cors.js
@@ -754,17 +754,17 @@ function testModeCors() {
                  "multipart/form-data",
                  "application/x-www-form-urlencoded"]
                    .indexOf(test.headers[name].toLowerCase()) == -1);
       }
       req.url += "&headers=" + escape(test.headers.toSource());
       reqHeaders =
         escape(Object.keys(test.headers)
                .filter(isUnsafeHeader)
-               .map(String.toLowerCase)
+               .map(s => s.toLowerCase())
                .sort()
                .join(","));
       req.url += reqHeaders ? "&requestHeaders=" + reqHeaders : "";
     }
     if ("allowHeaders" in test)
       req.url += "&allowHeaders=" + escape(test.allowHeaders);
     if ("allowMethods" in test)
       req.url += "&allowMethods=" + escape(test.allowMethods);