Bug 1613534 - Stop using String.prototype.replaceAll in tests because it's not available on beta. rs=bustage-fix
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 10 Mar 2020 11:28:32 +1300
changeset 38462 e52ae9ddfabc26cbb823402d1fee4c41e328a6d0
parent 38461 934bb23485cf34ad49ed3a4a5be763bc9b98c1d8
child 38463 05c780359ee8c86f765a2d9e3e3e86774aecd8a2
push id400
push userclokep@gmail.com
push dateMon, 04 May 2020 18:56:09 +0000
reviewersbustage-fix
bugs1613534
Bug 1613534 - Stop using String.prototype.replaceAll in tests because it's not available on beta. rs=bustage-fix
mail/components/extensions/test/browser/browser_ext_compose_begin.js
mail/components/extensions/test/browser/browser_ext_compose_details.js
mail/components/extensions/test/browser/browser_ext_compose_onBeforeSend.js
--- a/mail/components/extensions/test/browser/browser_ext_compose_begin.js
+++ b/mail/components/extensions/test/browser/browser_ext_compose_begin.js
@@ -309,20 +309,20 @@ add_task(async function testBody() {
     let composeWindows = [...Services.wm.getEnumerator("msgcompose")];
     is(composeWindows.length, 1);
     await new Promise(resolve => composeWindows[0].setTimeout(resolve));
 
     is(composeWindows[0].IsHTMLEditor(), expected.isHTML, "composition mode");
 
     let editor = composeWindows[0].GetCurrentEditor();
     // Get the actual message body. Fold Windows line-endings \r\n to \n.
-    let actualHTML = editor.outputToString("text/html", 0).replaceAll("\r", "");
+    let actualHTML = editor.outputToString("text/html", 0).replace(/\r/g, "");
     let actualPlainText = editor
       .outputToString("text/plain", 0)
-      .replaceAll("\r", "");
+      .replace(/\r/g, "");
     if ("htmlIncludes" in expected) {
       info(actualHTML);
       ok(actualHTML.includes(expected.htmlIncludes), "HTML content is correct");
     }
     if ("plainTextIs" in expected) {
       is(actualPlainText, expected.plainTextIs, "plainText content is correct");
     }
 
--- a/mail/components/extensions/test/browser/browser_ext_compose_details.js
+++ b/mail/components/extensions/test/browser/browser_ext_compose_details.js
@@ -360,17 +360,17 @@ add_task(async function testBody() {
         plainTextDetails.body.includes(
           plainTextBodyTag +
             "This is some plain text.<br>Indeed, it is plain.</body>"
         )
       );
       browser.test.assertEq(
         "This is some plain text.\nIndeed, it is plain.",
         // Fold Windows line-endings \r\n to \n.
-        plainTextDetails.plainTextBody.replaceAll("\r", "")
+        plainTextDetails.plainTextBody.replace(/\r/g, "")
       );
 
       // Some things that should fail.
 
       try {
         await browser.compose.setComposeDetails(plainTextTabId, {
           body: "Trying to set HTML in a plain text message",
         });
--- a/mail/components/extensions/test/browser/browser_ext_compose_onBeforeSend.js
+++ b/mail/components/extensions/test/browser/browser_ext_compose_onBeforeSend.js
@@ -351,34 +351,34 @@ add_task(async function testChangeDetail
   is(sentMessage5.subject, "Changed by listener5", "subject was changed");
   is(sentMessage5.recipients, "to@test5.invalid", "to was changed");
   is(sentMessage5.ccList, "cc@test5.invalid", "cc was changed");
 
   await new Promise(resolve => {
     window.MsgHdrToMimeMessage(sentMessage5, null, (msgHdr, mimeMessage) => {
       is(
         // Fold Windows line-endings \r\n to \n.
-        mimeMessage.parts[0].body.replaceAll("\r", ""),
+        mimeMessage.parts[0].body.replace(/\r/g, ""),
         "New body from listener5.\n"
       );
       resolve();
     });
   });
 
   ok(outboxMessages.hasMoreElements());
   let sentMessage6 = outboxMessages.getNext();
   is(sentMessage6.subject, "Changed by listener6", "subject was changed");
   is(sentMessage6.recipients, "to@test6.invalid", "to was changed");
   is(sentMessage6.ccList, "cc@test6.invalid", "cc was changed");
 
   await new Promise(resolve => {
     window.MsgHdrToMimeMessage(sentMessage6, null, (msgHdr, mimeMessage) => {
       is(
         // Fold Windows line-endings \r\n to \n.
-        mimeMessage.parts[0].body.replaceAll("\r", ""),
+        mimeMessage.parts[0].body.replace(/\r/g, ""),
         "New body from listener6.\n"
       );
       resolve();
     });
   });
 
   ok(!outboxMessages.hasMoreElements());