Bug 1544834 - Replace deprecated generics in test code r=evilpie
authorRob Wu <rob@robwu.nl>
Wed, 17 Apr 2019 19:03:19 +0000
changeset 470064 edb8832eafa11ea93d652b277ac192f7ae0a2c19
parent 470063 0d59dd598e5eb0b7b4618d68d6884c947eb658d6
child 470065 9dafc71a1f375a6865521e7e26073394b0c8cd0b
push id35888
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:47:45 +0000
treeherdermozilla-central@0160424142d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1544834, 563243, 618853, 830967, 656753, 415540, 355497
milestone68.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 1544834 - Replace deprecated generics in test code r=evilpie - `Array.map` becomes `Array.from` - Array copying via `Array.slice` becomes `Array.from`. - `Array.forEach` that did not rely on closures becomes `for`-`of` loops. - Anything else: `Array.X` becomes `Array.prototype.X`. Complex cases: dom/bindings/test/TestInterfaceJS.js and dom/bindings/test/test_exception_options_from_jsimplemented.html use `Array.indexOf` to generate an error with a specific error message. Switched to `Array.prototype.forEach` to generate the same error. js/src/jit-test/tests/basic/exception-column-number.js In this test `Array.indexOf()` is used to generate an error. Since the exact message doesn't matter, I switched to `Array.from()`. Intentionally not changed: editor/libeditor/tests/browserscope/lib/richtext/richtext/js/range.js Did not modify because this is 3rd-party code and the code uses feature detection as a fall back when Array generics are not used. testing/talos/talos/tests/dromaeo/lib/mootools.js Did not modify because mootools adds the `Array.slice` method to the `Array` object. Not changed because they check the implementation of Array generics: js/src/jit-test/tests/basic/arrayNatives.js js/src/jit-test/tests/basic/bug563243.js js/src/jit-test/tests/basic/bug618853.js js/src/jit-test/tests/basic/bug830967.js js/src/jit-test/tests/jaeger/recompile/bug656753.js js/src/jit-test/tests/self-hosting/alternate-static-and-instance-array-extras.js js/src/tests/non262/Array/generics.js js/src/tests/non262/Array/regress-415540.js js/src/tests/non262/extensions/regress-355497.js js/src/tests/non262/extensions/typedarray-set-neutering.js Depends on D27802 Differential Revision: https://phabricator.services.mozilla.com/D27803
accessible/tests/mochitest/editabletext/editabletext.js
browser/base/content/test/general/browser_bug406216.js
browser/base/content/test/general/browser_bug533232.js
browser/base/content/test/general/browser_duplicateIDs.js
browser/base/content/test/general/browser_page_style_menu.js
browser/base/content/test/general/browser_relatedTabs.js
browser/base/content/test/general/browser_visibleTabs.js
browser/base/content/test/general/browser_visibleTabs_bookmarkAllPages.js
browser/base/content/test/pageActions/browser_page_action_menu.js
browser/base/content/test/pageActions/browser_page_action_menu_add_search_engine.js
browser/base/content/test/popupNotifications/head.js
browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
browser/base/content/test/siteIdentity/head.js
browser/base/content/test/tabs/browser_pinnedTabs.js
browser/base/content/test/tabs/browser_pinnedTabs_clickOpen.js
browser/components/aboutconfig/test/browser/head.js
browser/components/extensions/test/browser/browser_ext_menus.js
browser/components/search/test/browser/browser_426329.js
browser/components/search/test/browser/browser_private_search_perwindowpb.js
browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
browser/components/sessionstore/test/browser_579879.js
browser/components/sessionstore/test/browser_607016.js
browser/components/sessionstore/test/content-forms.js
browser/components/sessionstore/test/content.js
browser/modules/test/browser/browser_PageActions.js
devtools/client/performance/test/browser_perf-marker-details.js
devtools/client/performance/test/browser_perf-tree-view-03.js
devtools/client/performance/test/browser_timeline-waterfall-rerender.js
devtools/client/performance/test/browser_timeline-waterfall-sidebar.js
dom/base/test/chrome/test_domparsing.xul
dom/bindings/test/TestInterfaceJS.js
dom/bindings/test/test_exception_options_from_jsimplemented.html
dom/browser-element/mochitest/browserElementTestHelpers.js
dom/events/test/bug426082.html
dom/events/test/bug656379-1.html
dom/media/tests/mochitest/head.js
dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
dom/tests/browser/browser_ConsoleAPITests.js
js/src/jit-test/tests/auto-regress/bug499169.js
js/src/jit-test/tests/basic/exception-column-number.js
js/src/jit-test/tests/collections/Map-surfaces-2.js
js/src/jit-test/tests/collections/Set-surfaces-2.js
js/src/tests/non262/Array/regress-474529.js
layout/style/test/test_animations_omta.html
layout/style/test/test_bug635286.html
layout/style/test/test_transitions_cancel_near_end.html
layout/xul/test/window_resizer.xul
services/common/tests/unit/head_helpers.js
services/crypto/tests/unit/head_helpers.js
services/sync/tests/unit/test_clients_escape.js
services/sync/tests/unit/test_utils_makeGUID.js
toolkit/components/contentprefs/tests/unit_cps2/head.js
toolkit/components/extensions/test/xpcshell/test_MatchPattern.js
toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js
toolkit/content/tests/chrome/test_popup_coords.xul
toolkit/mozapps/downloads/tests/unit/test_lowMinutes.js
xpcom/tests/unit/test_streams.js
--- a/accessible/tests/mochitest/editabletext/editabletext.js
+++ b/accessible/tests/mochitest/editabletext/editabletext.js
@@ -27,22 +27,22 @@ function editableTextTestRun() {
 /**
  * Used to test nsIEditableTextAccessible methods.
  */
 function editableTextTest(aID) {
   /**
    * Schedule a test, the given function with its arguments will be executed
    * when preceding test is complete.
    */
-  this.scheduleTest = function scheduleTest(aFunc) {
+  this.scheduleTest = function scheduleTest(aFunc, ...aFuncArgs) {
     // A data container acts like a dummy invoker, it's never invoked but
     // it's used to generate real invoker when previous invoker was handled.
     var dataContainer = {
       func: aFunc,
-      funcArgs: Array.slice(arguments, 1),
+      funcArgs: aFuncArgs,
     };
     this.mEventQueue.push(dataContainer);
 
     if (!this.mEventQueueReady) {
       this.unwrapNextTest();
       this.mEventQueueReady = true;
     }
   };
--- a/browser/base/content/test/general/browser_bug406216.js
+++ b/browser/base/content/test/general/browser_bug406216.js
@@ -32,17 +32,17 @@ function addTab(aURI, aIndex) {
 
 function doTabsTest() {
   is(gBrowser.tabs.length, URIS.length, "Correctly opened all expected tabs");
 
   // sample of "close related tabs" feature
   gBrowser.tabContainer.addEventListener("TabClose", function(event) {
     var closedTab = event.originalTarget;
     var scheme = closedTab.linkedBrowser.currentURI.scheme;
-    Array.slice(gBrowser.tabs).forEach(function(aTab) {
+    Array.from(gBrowser.tabs).forEach(function(aTab) {
       if (aTab != closedTab && aTab.linkedBrowser.currentURI.scheme == scheme)
         gBrowser.removeTab(aTab, {skipPermitUnload: true});
     });
   }, {capture: true, once: true});
 
   gBrowser.removeTab(gBrowser.tabs[0], {skipPermitUnload: true});
   is(gBrowser.tabs.length, 1, "Related tabs are not closed unexpectedly");
 
--- a/browser/base/content/test/general/browser_bug533232.js
+++ b/browser/base/content/test/general/browser_bug533232.js
@@ -27,10 +27,10 @@ function test() {
   gBrowser.removeTab(gBrowser.selectedTab, { skipPermitUnload: true });
   is(idx(gBrowser.selectedTab), idx(tab2),
      "closing the last tab in a set of child tabs doesn't go back to the parent");
 
   gBrowser.removeTab(tab2, { skipPermitUnload: true });
 }
 
 function idx(tab) {
-  return Array.indexOf(gBrowser.tabs, tab);
+  return Array.prototype.indexOf.call(gBrowser.tabs, tab);
 }
--- a/browser/base/content/test/general/browser_duplicateIDs.js
+++ b/browser/base/content/test/general/browser_duplicateIDs.js
@@ -1,8 +1,8 @@
 function test() {
   var ids = {};
-  Array.forEach(document.querySelectorAll("[id]"), function(node) {
+  Array.prototype.forEach.call(document.querySelectorAll("[id]"), function(node) {
     var id = node.id;
     ok(!(id in ids), id + " should be unique");
     ids[id] = null;
   });
 }
--- a/browser/base/content/test/general/browser_page_style_menu.js
+++ b/browser/base/content/test/general/browser_page_style_menu.js
@@ -24,17 +24,17 @@ add_task(async function() {
 
   items = items.map(el => ({
     label: el.getAttribute("label"),
     checked: el.getAttribute("checked") == "true",
   }));
 
   let validLinks = await ContentTask.spawn(gBrowser.selectedBrowser, items, function(contentItems) {
     let contentValidLinks = 0;
-    Array.forEach(content.document.querySelectorAll("link, style"), function(el) {
+    Array.prototype.forEach.call(content.document.querySelectorAll("link, style"), function(el) {
       var title = el.getAttribute("title");
       var rel = el.getAttribute("rel");
       var media = el.getAttribute("media");
       var idstring = el.nodeName + " " + (title ? title : "without title and") +
                      " with rel=\"" + rel + "\"" +
                      (media ? " and media=\"" + media + "\"" : "");
 
       var item = contentItems.filter(aItem => aItem.label == title);
--- a/browser/base/content/test/general/browser_relatedTabs.js
+++ b/browser/base/content/test/general/browser_relatedTabs.js
@@ -35,17 +35,17 @@ add_task(async function() {
   gBrowser.removeTab(tabs.pop());
   await addTab("about:blank", gBrowser.currentURI);
   gBrowser.moveTabTo(gBrowser.selectedTab, 1);
   await addTab("http://mochi.test:8888/#6", gBrowser.currentURI);
   await addTab();
   await addTab("http://mochi.test:8888/#7");
 
   function testPosition(tabNum, expectedPosition, msg) {
-    is(Array.indexOf(gBrowser.tabs, tabs[tabNum]), expectedPosition, msg);
+    is(Array.prototype.indexOf.call(gBrowser.tabs, tabs[tabNum]), expectedPosition, msg);
   }
 
   testPosition(0, 3, "tab without referrer was opened to the far right");
   testPosition(1, 7, "tab without referrer was opened to the far right");
   testPosition(2, 5, "tab with referrer opened immediately to the right");
   testPosition(3, 1, "next tab with referrer opened further to the right");
   testPosition(4, 4, "tab selection changed, tab opens immediately to the right");
   testPosition(5, 6, "blank tab with referrer opens to the right of 3rd original tab where removed tab was");
--- a/browser/base/content/test/general/browser_visibleTabs.js
+++ b/browser/base/content/test/general/browser_visibleTabs.js
@@ -60,17 +60,17 @@ add_task(async function() {
   gBrowser.tabContainer.advanceSelectedTab(-1, true);
   is(gBrowser.selectedTab, testTab, "going backwards to last tab");
   gBrowser.tabContainer.advanceSelectedTab(-1, true);
   is(gBrowser.selectedTab, pinned, "next to pinned");
   gBrowser.tabContainer.advanceSelectedTab(-1, true);
   is(gBrowser.selectedTab, testTab, "next to test tab again");
 
   // Try showing all tabs
-  gBrowser.showOnlyTheseTabs(Array.slice(gBrowser.tabs));
+  gBrowser.showOnlyTheseTabs(Array.from(gBrowser.tabs));
   is(gBrowser.visibleTabs.length, 3, "all 3 tabs are visible again");
 
   // Select the pinned tab and show the testTab to make sure selection updates
   gBrowser.selectedTab = pinned;
   gBrowser.showOnlyTheseTabs([testTab]);
   is(gBrowser.tabs[1], origTab, "make sure origTab is in the middle");
   is(origTab.hidden, true, "make sure it's hidden");
   gBrowser.removeTab(pinned);
--- a/browser/base/content/test/general/browser_visibleTabs_bookmarkAllPages.js
+++ b/browser/base/content/test/general/browser_visibleTabs_bookmarkAllPages.js
@@ -17,15 +17,15 @@ function test() {
 
     let uris = PlacesCommandHook.uniqueCurrentPages;
     is(uris.length, 1, "Only one uri is returned");
 
     is(uris[0].uri.spec, tabTwo.linkedBrowser.currentURI.spec, "It's the correct URI");
 
     gBrowser.removeTab(tabOne);
     gBrowser.removeTab(tabTwo);
-    Array.forEach(gBrowser.tabs, function(tab) {
+    for (let tab of gBrowser.tabs) {
       gBrowser.showTab(tab);
-    });
+    }
 
     finish();
   });
 }
--- a/browser/base/content/test/pageActions/browser_page_action_menu.js
+++ b/browser/base/content/test/pageActions/browser_page_action_menu.js
@@ -896,12 +896,12 @@ function checkSendToDeviceItems(expected
         Assert.equal(attrVal, expected.attrs[name]);
       }
     }
   }
 }
 
 function collectContextMenuItems() {
   let contextMenu = document.getElementById("pageActionContextMenu");
-  return Array.filter(contextMenu.children, node => {
+  return Array.prototype.filter.call(contextMenu.children, node => {
     return window.getComputedStyle(node).visibility == "visible";
   });
 }
--- a/browser/base/content/test/pageActions/browser_page_action_menu_add_search_engine.js
+++ b/browser/base/content/test/pageActions/browser_page_action_menu_add_search_engine.js
@@ -113,17 +113,17 @@ add_task(async function many() {
     EventUtils.synthesizeMouseAtCenter(button, {});
     let view = await viewPromise;
     let viewID =
        BrowserPageActions._panelViewNodeIDForActionID("addSearchEngine", false);
     Assert.equal(view.id, viewID, "View ID");
     let bodyID = viewID + "-body";
     let body = document.getElementById(bodyID);
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_0",
         "page_action_menu_add_search_engine_1",
         "page_action_menu_add_search_engine_2",
       ],
       "Subview children"
     );
 
@@ -142,17 +142,17 @@ add_task(async function many() {
 
     // Open the panel and show the subview again.  The installed engine should
     // be gone.
     await promisePageActionPanelOpen();
     viewPromise = promisePageActionViewShown();
     EventUtils.synthesizeMouseAtCenter(button, {});
     await viewPromise;
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_1",
         "page_action_menu_add_search_engine_2",
       ],
       "Subview children"
     );
 
     // Click the next engine to install it.
@@ -245,17 +245,17 @@ add_task(async function many() {
     Assert.equal(button.label, expectedTitle, "Button label");
     Assert.equal(button.classList.contains("subviewbutton-nav"), true,
                  "Button should expand into a subview");
     viewPromise = promisePageActionViewShown();
     EventUtils.synthesizeMouseAtCenter(button, {});
     await viewPromise;
     body = document.getElementById(bodyID);
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_0",
         "page_action_menu_add_search_engine_1",
       ],
       "Subview children"
     );
     EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
     await promisePageActionPanelHidden();
@@ -267,17 +267,17 @@ add_task(async function many() {
     await enginePromise;
 
     // Open the panel again and check the subview.
     await promisePageActionPanelOpen();
     viewPromise = promisePageActionViewShown();
     EventUtils.synthesizeMouseAtCenter(button, {});
     await viewPromise;
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_0",
         "page_action_menu_add_search_engine_1",
         "page_action_menu_add_search_engine_2",
       ],
       "Subview children"
     );
     EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
@@ -363,17 +363,17 @@ add_task(async function urlbarMany() {
     // it should contain the addSearchEngine subview.
     EventUtils.synthesizeMouseAtCenter(button, {});
     let view = await waitForActivatedActionPanel();
     let viewID =
        BrowserPageActions._panelViewNodeIDForActionID("addSearchEngine", true);
     Assert.equal(view.id, viewID, "View ID");
     let body = view.firstElementChild;
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_0",
         "page_action_menu_add_search_engine_1",
         "page_action_menu_add_search_engine_2",
       ],
       "Subview children"
     );
 
@@ -391,17 +391,17 @@ add_task(async function urlbarMany() {
     let feedbackText = await feedbackPromise;
     Assert.equal(feedbackText, "Search engine added!", "Feedback text");
 
     // Open the panel again.  The installed engine should be gone.
     EventUtils.synthesizeMouseAtCenter(button, {});
     view = await waitForActivatedActionPanel();
     body = view.firstElementChild;
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_1",
         "page_action_menu_add_search_engine_2",
       ],
       "Subview children"
     );
 
     // Click the next engine to install it.
@@ -456,17 +456,17 @@ add_task(async function urlbarMany() {
     await enginePromise;
 
     // Open the panel again and check the subview.  The subview should be
     // present now that there are two offered engines again.
     EventUtils.synthesizeMouseAtCenter(button, {});
     view = await waitForActivatedActionPanel();
     body = view.firstElementChild;
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_0",
         "page_action_menu_add_search_engine_1",
       ],
       "Subview children"
     );
 
     // Hide the panel.
@@ -481,17 +481,17 @@ add_task(async function urlbarMany() {
     await Services.search.removeEngine(engines.shift());
     await enginePromise;
 
     // Open the panel again and check the subview.
     EventUtils.synthesizeMouseAtCenter(button, {});
     view = await waitForActivatedActionPanel();
     body = view.firstElementChild;
     Assert.deepEqual(
-      Array.map(body.children, n => n.label),
+      Array.from(body.children, n => n.label),
       [
         "page_action_menu_add_search_engine_0",
         "page_action_menu_add_search_engine_1",
         "page_action_menu_add_search_engine_2",
       ],
       "Subview children"
     );
 
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -212,17 +212,17 @@ function checkPopup(popup, notifyObj) {
     let secondaryAction = notifyObj.secondaryActions[0];
     is(notification.getAttribute("secondarybuttonlabel"), secondaryAction.label,
        "secondary action label matches");
     is(notification.getAttribute("secondarybuttonaccesskey"),
        secondaryAction.accessKey, "secondary action accesskey matches");
   }
   // Additional secondary actions appear as menu items.
   let actualExtraSecondaryActions =
-    Array.filter(notification.menupopup.childNodes, child => child.nodeName == "menuitem");
+    Array.prototype.filter.call(notification.menupopup.childNodes, child => child.nodeName == "menuitem");
   let extraSecondaryActions = notifyObj.secondaryActions ? notifyObj.secondaryActions.slice(1) : [];
   is(actualExtraSecondaryActions.length, extraSecondaryActions.length,
      "number of extra secondary actions matches");
   extraSecondaryActions.forEach(function(a, i) {
     is(actualExtraSecondaryActions[i].getAttribute("label"), a.label,
        "label for extra secondary action " + i + " matches");
     is(actualExtraSecondaryActions[i].getAttribute("accesskey"), a.accessKey,
        "accessKey for extra secondary action " + i + " matches");
--- a/browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
+++ b/browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
@@ -42,19 +42,19 @@ add_task(async function test_simple() {
 
     let { gIdentityHandler } = gBrowser.ownerGlobal;
     let promisePanelOpen = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
     gIdentityHandler._identityBox.click();
     await promisePanelOpen;
 
     // Messages should be visible when the scheme is HTTP, and invisible when
     // the scheme is HTTPS.
-    is(Array.every(document.getElementById("identity-popup-mainView")
-                           .querySelectorAll("[when-loginforms=insecure]"),
-                   element => !BrowserTestUtils.is_hidden(element)),
+    is(Array.prototype.every.call(document.getElementById("identity-popup-mainView")
+                                          .querySelectorAll("[when-loginforms=insecure]"),
+                                  element => !BrowserTestUtils.is_hidden(element)),
        expectWarning,
        "The relevant messages should be visible or hidden in the main view.");
 
     let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
     document.getElementById("identity-popup-security-expander").click();
     await promiseViewShown;
 
     if (expectWarning) {
@@ -80,19 +80,19 @@ add_task(async function test_simple() {
          "url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
          "Using expected icon image in the Control Center subview");
       ok(!BrowserTestUtils.is_hidden(document.getElementById("identity-popup-insecure-login-forms-learn-more")),
          "The 'Learn more' link should be visible.");
     }
 
     // Messages should be visible when the scheme is HTTP, and invisible when
     // the scheme is HTTPS.
-    is(Array.every(document.getElementById("identity-popup-securityView")
-                           .querySelectorAll("[when-loginforms=insecure]"),
-                   element => !BrowserTestUtils.is_hidden(element)),
+    is(Array.prototype.every.call(document.getElementById("identity-popup-securityView")
+                                          .querySelectorAll("[when-loginforms=insecure]"),
+                                  element => !BrowserTestUtils.is_hidden(element)),
        expectWarning,
        "The relevant messages should be visible or hidden in the security view.");
 
     if (gIdentityHandler._identityPopup.state != "closed") {
       let hideEvent = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
       info("hiding popup");
       gIdentityHandler._identityPopup.hidePopup();
       await hideEvent;
@@ -156,19 +156,19 @@ add_task(async function test_ignoring_wi
     await stateChangePromise;
 
     // Open the identity popup.
     let { gIdentityHandler } = gBrowser.ownerGlobal;
     let promisePanelOpen = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
     gIdentityHandler._identityBox.click();
     await promisePanelOpen;
 
-    ok(Array.every(document.getElementById("identity-popup-mainView")
-                           .querySelectorAll("[when-loginforms=insecure]"),
-                   element => BrowserTestUtils.is_hidden(element)),
+    ok(Array.prototype.every.call(document.getElementById("identity-popup-mainView")
+                                          .querySelectorAll("[when-loginforms=insecure]"),
+                                  element => BrowserTestUtils.is_hidden(element)),
        "All messages should be hidden in the main view.");
 
     let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
     document.getElementById("identity-popup-security-expander").click();
     await promiseViewShown;
 
     ok(BrowserTestUtils.is_visible(document.getElementById("connection-icon")),
        "Connection icon is visible");
@@ -190,19 +190,19 @@ add_task(async function test_ignoring_wi
        "Using expected icon image in the identity block");
     is(securityViewBG,
        "url(\"chrome://browser/skin/controlcenter/connection.svg\")",
        "Using expected icon image in the Control Center main view");
     is(securityContentBG,
        "url(\"chrome://browser/skin/controlcenter/connection.svg\")",
        "Using expected icon image in the Control Center subview");
 
-    ok(Array.every(document.getElementById("identity-popup-securityView")
-                           .querySelectorAll("[when-loginforms=insecure]"),
-                   element => BrowserTestUtils.is_hidden(element)),
+    ok(Array.prototype.every.call(document.getElementById("identity-popup-securityView")
+                                          .querySelectorAll("[when-loginforms=insecure]"),
+                                  element => BrowserTestUtils.is_hidden(element)),
        "All messages should be hidden in the security view.");
 
     if (gIdentityHandler._identityPopup.state != "closed") {
       info("hiding popup");
       let hideEvent = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
       gIdentityHandler._identityPopup.hidePopup();
       await hideEvent;
     }
--- a/browser/base/content/test/siteIdentity/head.js
+++ b/browser/base/content/test/siteIdentity/head.js
@@ -221,19 +221,19 @@ async function assertMixedContentBlockin
         "CC using degraded icon");
     }
   }
 
   if (activeLoaded || activeBlocked || passiveLoaded) {
     let promiseViewShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "ViewShown");
     doc.getElementById("identity-popup-security-expander").click();
     await promiseViewShown;
-    is(Array.filter(doc.getElementById("identity-popup-securityView")
-                       .querySelectorAll(".identity-popup-mcb-learn-more"),
-                    element => !BrowserTestUtils.is_hidden(element)).length, 1,
+    is(Array.prototype.filter.call(doc.getElementById("identity-popup-securityView")
+                                      .querySelectorAll(".identity-popup-mcb-learn-more"),
+                                   element => !BrowserTestUtils.is_hidden(element)).length, 1,
        "The 'Learn more' link should be visible once.");
   }
 
   if (gIdentityHandler._identityPopup.state != "closed") {
     let hideEvent = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
     info("Hiding identity popup");
     gIdentityHandler._identityPopup.hidePopup();
     await hideEvent;
--- a/browser/base/content/test/tabs/browser_pinnedTabs.js
+++ b/browser/base/content/test/tabs/browser_pinnedTabs.js
@@ -1,12 +1,12 @@
 var tabs;
 
 function index(tab) {
-  return Array.indexOf(gBrowser.tabs, tab);
+  return Array.prototype.indexOf.call(gBrowser.tabs, tab);
 }
 
 function indexTest(tab, expectedIndex, msg) {
   var diag = "tab " + tab + " should be at index " + expectedIndex;
   if (msg)
     msg = msg + " (" + diag + ")";
   else
     msg = diag;
--- a/browser/base/content/test/tabs/browser_pinnedTabs_clickOpen.js
+++ b/browser/base/content/test/tabs/browser_pinnedTabs_clickOpen.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 function index(tab) {
-  return Array.indexOf(gBrowser.tabs, tab);
+  return Array.prototype.indexOf.call(gBrowser.tabs, tab);
 }
 
 async function testNewTabPosition(expectedPosition, modifiers = {}) {
   let opening = BrowserTestUtils.waitForNewTab(gBrowser, "http://mochi.test:8888/");
   BrowserTestUtils.synthesizeMouseAtCenter("#link", modifiers, gBrowser.selectedBrowser);
   let newtab = await opening;
   is(index(newtab), expectedPosition, "clicked tab is in correct position");
   return newtab;
--- a/browser/components/aboutconfig/test/browser/head.js
+++ b/browser/components/aboutconfig/test/browser/head.js
@@ -118,17 +118,17 @@ class AboutConfigTest {
     return this.document.getElementById("prefs");
   }
 
   /**
    * Array of AboutConfigRowTest objects, one for each row in the main table.
    */
   get rows() {
     let elements = this.prefsTable.querySelectorAll("tr:not(.hidden)");
-    return Array.map(elements, element => new AboutConfigRowTest(element));
+    return Array.from(elements, element => new AboutConfigRowTest(element));
   }
 
   /**
    * Returns the AboutConfigRowTest object for the row in the main table which
    * corresponds to the given preference name, or undefined if none is present.
    */
   getRow(name) {
     return this.rows.find(row => row.name == name);
--- a/browser/components/extensions/test/browser/browser_ext_menus.js
+++ b/browser/components/extensions/test/browser/browser_ext_menus.js
@@ -141,17 +141,17 @@ add_task(async function test_hiddenPageA
 
   const extension = ExtensionTestUtils.loadExtension({manifest, background});
   const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
 
   await extension.startup();
   await extension.awaitMessage("ready");
 
   const menu = await openContextMenuInPageActionPanel(extension);
-  const menuItems = Array.filter(menu.children, node => {
+  const menuItems = Array.prototype.filter.call(menu.children, node => {
     return window.getComputedStyle(node).visibility == "visible";
   });
 
   is(menuItems.length, 3, "Correct number of children");
   const [dontShowItem, separator, manageItem] = menuItems;
 
   is(dontShowItem.label, "Remove from Address Bar", "Correct first child");
   is(separator.tagName, "menuseparator", "Correct second child");
--- a/browser/components/search/test/browser/browser_426329.js
+++ b/browser/components/search/test/browser/browser_426329.js
@@ -28,18 +28,18 @@ function checkMenuEntries(expectedValues
   is(actualValues.length, expectedValues.length, "Checking length of expected menu");
   for (let i = 0; i < expectedValues.length; i++)
     is(actualValues[i], expectedValues[i], "Checking menu entry #" + i);
 }
 
 function getMenuEntries() {
   // Could perhaps pull values directly from the controller, but it seems
   // more reliable to test the values that are actually in the richlistbox?
-  return Array.map(searchBar.textbox.popup.richlistbox.itemChildren,
-                   item => item.getAttribute("ac-value"));
+  return Array.from(searchBar.textbox.popup.richlistbox.itemChildren,
+                    item => item.getAttribute("ac-value"));
 }
 
 function countEntries(name, value) {
   return new Promise(resolve => {
     let count = 0;
     let obj = name && value ? {fieldname: name, value} : {};
     FormHistory.count(obj,
                       { handleResult(result) { count = result; },
--- a/browser/components/search/test/browser/browser_private_search_perwindowpb.js
+++ b/browser/components/search/test/browser/browser_private_search_perwindowpb.js
@@ -63,11 +63,11 @@ add_task(async function() {
   windowsToClose.forEach(function(win) {
     win.close();
   });
 });
 
 function getMenuEntries(searchBar) {
   // Could perhaps pull values directly from the controller, but it seems
   // more reliable to test the values that are actually in the richlistbox?
-  return Array.map(searchBar.textbox.popup.richlistbox.itemChildren,
-                   item => item.getAttribute("ac-value"));
+  return Array.from(searchBar.textbox.popup.richlistbox.itemChildren,
+                    item => item.getAttribute("ac-value"));
 }
--- a/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
+++ b/browser/components/sessionstore/test/browser_248970_b_perwindowpb.js
@@ -49,32 +49,32 @@ function test() {
     let node = getElementByXPath(aTab, aQuery);
     if (typeof aValue == "string")
       node.value = aValue;
     else if (typeof aValue == "boolean")
       node.checked = aValue;
     else if (typeof aValue == "number")
       node.selectedIndex = aValue;
     else
-      Array.forEach(node.options, (aOpt, aIx) =>
+      Array.prototype.forEach.call(node.options, (aOpt, aIx) =>
         (aOpt.selected = aValue.indexOf(aIx) > -1));
   }
 
   function compareFormValue(aTab, aQuery, aValue) {
     let node = getElementByXPath(aTab, aQuery);
     if (!node)
       return false;
     if (ChromeUtils.getClassName(node) === "HTMLInputElement")
       return aValue == (node.type == "checkbox" || node.type == "radio" ?
                        node.checked : node.value);
     if (ChromeUtils.getClassName(node) === "HTMLTextAreaElement")
       return aValue == node.value;
     if (!node.multiple)
       return aValue == node.selectedIndex;
-    return Array.every(node.options, (aOpt, aIx) =>
+    return Array.prototype.every.call(node.options, (aOpt, aIx) =>
             (aValue.indexOf(aIx) > -1) == aOpt.selected);
   }
 
   /**
    * Test (B) : Session data restoration between windows
    */
 
   let rootDir = getRootDirectory(gTestPath);
--- a/browser/components/sessionstore/test/browser_579879.js
+++ b/browser/components/sessionstore/test/browser_579879.js
@@ -3,18 +3,18 @@
 add_task(async function() {
   let tab1 = BrowserTestUtils.addTab(gBrowser, "data:text/plain;charset=utf-8,foo");
   gBrowser.pinTab(tab1);
 
   await promiseBrowserLoaded(tab1.linkedBrowser);
   let tab2 = BrowserTestUtils.addTab(gBrowser);
   gBrowser.pinTab(tab2);
 
-  is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 is at the first position");
+  is(Array.prototype.indexOf.call(gBrowser.tabs, tab1), 0, "pinned tab 1 is at the first position");
   await promiseRemoveTabAndSessionState(tab1);
 
   tab1 = undoCloseTab();
   ok(tab1.pinned, "pinned tab 1 has been restored as a pinned tab");
-  is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 has been restored to the first position");
+  is(Array.prototype.indexOf.call(gBrowser.tabs, tab1), 0, "pinned tab 1 has been restored to the first position");
 
   BrowserTestUtils.removeTab(tab1);
   BrowserTestUtils.removeTab(tab2);
 });
--- a/browser/components/sessionstore/test/browser_607016.js
+++ b/browser/components/sessionstore/test/browser_607016.js
@@ -80,17 +80,17 @@ add_task(async function() {
       BrowserTestUtils.removeTab(gBrowser.tabs[1]);
     }
   }
 
   // Set the test state.
   await setBrowserState(state);
 
   // Wait until the selected tab is restored and all others are pending.
-  await Promise.all(Array.map(gBrowser.tabs, tab => {
+  await Promise.all(Array.from(gBrowser.tabs, tab => {
     return (tab == gBrowser.selectedTab) ?
       promiseTabRestored(tab) : promiseTabRestoring(tab);
   }));
 
   // Kick off the actual tests.
   await progressCallback();
 
   // Cleanup.
--- a/browser/components/sessionstore/test/content-forms.js
+++ b/browser/components/sessionstore/test/content-forms.js
@@ -83,23 +83,23 @@ defineListener("getSelectedIndex", funct
 defineListener("setSelectedIndex", function(data) {
   let input = queryElement(data);
   input.selectedIndex = data.index;
   dispatchUIEvent(input, "input");
 });
 
 defineListener("getMultipleSelected", function(data) {
   let input = queryElement(data);
-  return Array.map(input.options, (opt, idx) => idx)
+  return Array.from(input.options, (opt, idx) => idx)
               .filter(idx => input.options[idx].selected);
 });
 
 defineListener("setMultipleSelected", function(data) {
   let input = queryElement(data);
-  Array.forEach(input.options, (opt, idx) => opt.selected = data.indices.indexOf(idx) > -1);
+  Array.prototype.forEach.call(input.options, (opt, idx) => opt.selected = data.indices.indexOf(idx) > -1);
   dispatchUIEvent(input, "input");
 });
 
 defineListener("getFileNameArray", function(data) {
   return queryElement(data).mozGetFileNameArray();
 });
 
 defineListener("setFileNameArray", function(data) {
--- a/browser/components/sessionstore/test/content.js
+++ b/browser/components/sessionstore/test/content.js
@@ -49,17 +49,17 @@ if (sessionHistory) {
  */
 
 addEventListener("hashchange", function() {
   sendAsyncMessage("ss-test:hashchange");
 });
 
 addMessageListener("ss-test:getStyleSheets", function(msg) {
   let sheets = content.document.styleSheets;
-  let titles = Array.map(sheets, ss => [ss.title, ss.disabled]);
+  let titles = Array.from(sheets, ss => [ss.title, ss.disabled]);
   sendSyncMessage("ss-test:getStyleSheets", titles);
 });
 
 addMessageListener("ss-test:enableStyleSheetsForSet", function(msg) {
   let sheets = content.document.styleSheets;
   let change = false;
   for (let i = 0; i < sheets.length; i++) {
     if (sheets[i].disabled != (!msg.data.includes(sheets[i].title))) {
--- a/browser/modules/test/browser/browser_PageActions.js
+++ b/browser/modules/test/browser/browser_PageActions.js
@@ -786,17 +786,17 @@ add_task(async function nonBuiltFirst() 
   Assert.deepEqual(PageActions._nonBuiltInActions.map(a => a.id), [action.id],
                    "Action should be in PageActions._nonBuiltInActions");
 
   // Check the panel.
   await promiseOpenPageActionPanel();
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     [BrowserPageActions.panelButtonNodeIDForActionID(action.id)],
     "Action should be in panel"
   );
 
   // Now add back all the actions.
   for (let a of initialActions) {
     PageActions.addAction(a);
   }
@@ -828,17 +828,17 @@ add_task(async function nonBuiltFirst() 
     PageActions.actionsInPanel(window).map(a => a.id),
     initialActionsInPanel.map(a => a.id).concat(
       [PageActions.ACTION_ID_BUILT_IN_SEPARATOR],
       [action.id]
     ),
     "All actions should be in PageActions.actionsInPanel()"
   );
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel.map(a => a.id).concat(
       [PageActions.ACTION_ID_BUILT_IN_SEPARATOR],
       [action.id]
     ).map(id => BrowserPageActions.panelButtonNodeIDForActionID(id)),
     "Panel should contain all actions"
   );
 
   // Remove the test action.
@@ -866,17 +866,17 @@ add_task(async function nonBuiltFirst() 
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
     PageActions.actionsInPanel(window).map(a => a.id),
     initialActionsInPanel.map(a => a.id),
     "Action should no longer be in PageActions.actionsInPanel()"
   );
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel.map(a => BrowserPageActions.panelButtonNodeIDForActionID(a.id)),
     "Action should no longer be in panel"
   );
 });
 
 
 // Makes sure that urlbar nodes appear in the correct order in a new window.
 add_task(async function urlbarOrderNewWindow() {
@@ -1504,17 +1504,17 @@ add_task(async function transient() {
     "PageActions.actionsInPanel() should be updated"
   );
 
   // Check the panel.
   await promiseOpenPageActionPanel();
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel.map(a => a.id).concat([
       PageActions.ACTION_ID_TRANSIENT_SEPARATOR,
       action.id,
     ]).map(id => BrowserPageActions.panelButtonNodeIDForActionID(id)),
     "Actions in panel should be correct"
   );
 
   Assert.equal(onPlacedInPanelCount, 1,
@@ -1531,17 +1531,17 @@ add_task(async function transient() {
     "PageActions.actionsInPanel() should revert to initial"
   );
 
   // Check the panel.
   await promiseOpenPageActionPanel();
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel
       .map(a => BrowserPageActions.panelButtonNodeIDForActionID(a.id)),
     "Actions in panel should be correct"
   );
 
   // Enable the action.  It should be added back to the panel.
   action.setDisabled(false, window);
 
@@ -1554,17 +1554,17 @@ add_task(async function transient() {
     "PageActions.actionsInPanel() should be updated"
   );
 
   // Check the panel.
   await promiseOpenPageActionPanel();
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel.map(a => a.id).concat([
       PageActions.ACTION_ID_TRANSIENT_SEPARATOR,
       action.id,
     ]).map(id => BrowserPageActions.panelButtonNodeIDForActionID(id)),
     "Actions in panel should be correct"
   );
 
   Assert.equal(onPlacedInPanelCount, 2,
@@ -1589,17 +1589,17 @@ add_task(async function transient() {
     "PageActions.actionsInPanel() should be updated"
   );
 
   // Check the panel.
   await promiseOpenPageActionPanel();
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel.map(a => a.id).concat([
       PageActions.ACTION_ID_BUILT_IN_SEPARATOR,
       otherAction.id,
       PageActions.ACTION_ID_TRANSIENT_SEPARATOR,
       action.id,
     ]).map(id => BrowserPageActions.panelButtonNodeIDForActionID(id)),
     "Actions in panel should be correct"
   );
@@ -1621,17 +1621,17 @@ add_task(async function transient() {
     "PageActions.actionsInPanel() should be updated"
   );
 
   // Check the panel.
   await promiseOpenPageActionPanel();
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel.map(a => a.id).concat([
       PageActions.ACTION_ID_BUILT_IN_SEPARATOR,
       otherAction.id,
     ]).map(id => BrowserPageActions.panelButtonNodeIDForActionID(id)),
     "Actions in panel should be correct"
   );
 
   // Enable the action again.  It should be added back to the panel.
@@ -1648,17 +1648,17 @@ add_task(async function transient() {
     "PageActions.actionsInPanel() should be updated"
   );
 
   // Check the panel.
   await promiseOpenPageActionPanel();
   EventUtils.synthesizeMouseAtCenter(BrowserPageActions.mainButtonNode, {});
   await promisePageActionPanelHidden();
   Assert.deepEqual(
-    Array.map(BrowserPageActions.mainViewBodyNode.children, n => n.id),
+    Array.from(BrowserPageActions.mainViewBodyNode.children, n => n.id),
     initialActionsInPanel.map(a => a.id).concat([
       PageActions.ACTION_ID_BUILT_IN_SEPARATOR,
       otherAction.id,
       PageActions.ACTION_ID_TRANSIENT_SEPARATOR,
       action.id,
     ]).map(id => BrowserPageActions.panelButtonNodeIDForActionID(id)),
     "Actions in panel should be correct"
   );
@@ -1784,12 +1784,12 @@ function promisePageActionViewChildrenVi
       }
     }
     return false;
   });
 }
 
 function collectContextMenuItems() {
   let contextMenu = document.getElementById("pageActionContextMenu");
-  return Array.filter(contextMenu.children, node => {
+  return Array.prototype.filter.call(contextMenu.children, node => {
     return window.getComputedStyle(node).visibility == "visible";
   });
 }
--- a/devtools/client/performance/test/browser_perf-marker-details.js
+++ b/devtools/client/performance/test/browser_perf-marker-details.js
@@ -39,18 +39,18 @@ async function spawnTest() {
   info("All the markers should be displayed by default.");
 
   let bars = Array.prototype.filter.call($$(".waterfall-marker-bar"),
              (bar) => MARKER_TYPES.includes(bar.getAttribute("type")));
   let markers = PerformanceController.getCurrentRecording().getMarkers()
                 .filter(m => MARKER_TYPES.includes(m.name));
 
   info(`Got ${bars.length} bars and ${markers.length} markers.`);
-  info("Markers types from datasrc: " + Array.map(markers, e => e.name));
-  info("Markers names from sidebar: " + Array.map(bars, e => e.parentNode.parentNode.querySelector(".waterfall-marker-name").getAttribute("value")));
+  info("Markers types from datasrc: " + Array.from(markers, e => e.name));
+  info("Markers names from sidebar: " + Array.from(bars, e => e.parentNode.parentNode.querySelector(".waterfall-marker-name").getAttribute("value")));
 
   ok(bars.length >= MARKER_TYPES.length, `Got at least ${MARKER_TYPES.length} markers (1)`);
   ok(markers.length >= MARKER_TYPES.length, `Got at least ${MARKER_TYPES.length} markers (2)`);
 
   // Sanity check that markers are in chronologically ascending order
   markers.reduce((previous, m) => {
     if (m.start <= previous) {
       ok(false, "Markers are not in order");
--- a/devtools/client/performance/test/browser_perf-tree-view-03.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-03.js
@@ -24,17 +24,18 @@ add_task(function() {
 
   const $$fun = i => container.querySelectorAll(".call-tree-cell[type=function]")[i];
   const $$nam = i => container.querySelectorAll(
     ".call-tree-cell[type=function] > .call-tree-name")[i];
   const $$dur = i => container.querySelectorAll(".call-tree-cell[type=duration]")[i];
 
   is(container.childNodes.length, 7,
     "The container node should have all children available.");
-  is(Array.filter(container.childNodes, e => e.className != "call-tree-item").length, 0,
+  is(Array.from(container.childNodes).filter(e => e.className != "call-tree-item").length,
+     0,
     "All item nodes in the tree have the correct class name.");
 
   is($$fun(0).style.marginInlineStart, "0px",
     "The root node's function cell has the correct indentation.");
   is($$fun(1).style.marginInlineStart, "16px",
     "The .A node's function cell has the correct indentation.");
   is($$fun(2).style.marginInlineStart, "32px",
     "The .A.B node's function cell has the correct indentation.");
--- a/devtools/client/performance/test/browser_timeline-waterfall-rerender.js
+++ b/devtools/client/performance/test/browser_timeline-waterfall-rerender.js
@@ -45,32 +45,32 @@ async function spawnTest() {
   // Focus the second item in the tree.
   WaterfallView._markersRoot.getChild(1).focus();
 
   let beforeResizeBarsCount = $$(".waterfall-marker-bar").length;
   info("Before resize bars count: " + beforeResizeBarsCount);
   ok(beforeResizeBarsCount < initialBarsCount,
     "A subset of the total markers was selected.");
 
-  is(Array.indexOf($$(".waterfall-tree-item"), $(".waterfall-tree-item:focus")), 2,
+  is(Array.prototype.indexOf.call($$(".waterfall-tree-item"), $(".waterfall-tree-item:focus")), 2,
     "The correct item was focused in the tree.");
   ok(!$("#waterfall-details").hidden,
     "The waterfall sidebar is now visible.");
 
   // Simulate a resize on the marker details.
   rerendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED);
   EventUtils.sendMouseEvent({ type: "mouseup" }, WaterfallView.detailsSplitter);
   await rerendered;
 
   let afterResizeBarsCount = $$(".waterfall-marker-bar").length;
   info("After resize bars count: " + afterResizeBarsCount);
   is(afterResizeBarsCount, beforeResizeBarsCount,
     "The same subset of the total markers remained visible.");
 
-  is(Array.indexOf($$(".waterfall-tree-item"), $(".waterfall-tree-item:focus")), 2,
+  is(Array.prototype.indexOf.call($$(".waterfall-tree-item"), $(".waterfall-tree-item:focus")), 2,
     "The correct item is still focused in the tree.");
   ok(!$("#waterfall-details").hidden,
     "The waterfall sidebar is still visible.");
 
   await teardown(panel);
   finish();
 }
 /* eslint-enable */
--- a/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js
+++ b/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js
@@ -35,18 +35,18 @@ async function spawnTest() {
 
   info("No need to select everything in the timeline.");
   info("All the markers should be displayed by default.");
 
   let bars = $$(".waterfall-marker-bar");
   let markers = PerformanceController.getCurrentRecording().getMarkers();
 
   info(`Got ${bars.length} bars and ${markers.length} markers.`);
-  info("Markers types from datasrc: " + Array.map(markers, e => e.name));
-  info("Markers names from sidebar: " + Array.map(bars, e => e.parentNode.parentNode.querySelector(".waterfall-marker-name").getAttribute("value")));
+  info("Markers types from datasrc: " + Array.from(markers, e => e.name));
+  info("Markers names from sidebar: " + Array.from(bars, e => e.parentNode.parentNode.querySelector(".waterfall-marker-name").getAttribute("value")));
 
   ok(bars.length > 2, "Got at least 3 markers (1)");
   ok(markers.length > 2, "Got at least 3 markers (2)");
 
   let toMs = ms => L10N.getFormatStrWithNumbers("timeline.tick", ms);
 
   for (let i = 0; i < bars.length; i++) {
     let bar = bars[i];
--- a/dom/base/test/chrome/test_domparsing.xul
+++ b/dom/base/test/chrome/test_domparsing.xul
@@ -77,17 +77,17 @@ function runTest(parser, serializer) {
          "serializeToStream test for " + t.type + ", charset=" + charset);
     }
 
     if (t.type === "text/html") {
       // parseFromBuffer and parseFromStream don't support "text/html".
       continue;
     }
 
-    let array = Array.map(t.input, function(c) { return c.charCodeAt(c); });
+    let array = Array.from(t.input, function(c) { return c.charCodeAt(c); });
     let inputs = [
       {array: array, name: "parseFromBuffer (array)"},
       {array: new Uint8Array(array), name: "parseFromBuffer (Uint8Array)"},
     ];
     for (let input of inputs) {
       let a = input.array;
       is(serializer.serializeToString(parser.parseFromBuffer(a, t.type)), t.expected,
          input.name + " test for " + t.type);
--- a/dom/bindings/test/TestInterfaceJS.js
+++ b/dom/bindings/test/TestInterfaceJS.js
@@ -80,21 +80,21 @@ TestInterfaceJS.prototype = {
     Services.netUtils.notImplemented();
   },
 
   testThrowCallbackError(callback) {
     callback();
   },
 
   testThrowXraySelfHosted() {
-    this._win.Array.indexOf();
+    this._win.Array.prototype.forEach();
   },
 
   testThrowSelfHosted() {
-    Array.indexOf();
+    Array.prototype.forEach();
   },
 
   testPromiseWithThrowingChromePromiseInit() {
     return new this._win.Promise(function() {
       noSuchMethodExistsYo1();
     });
   },
 
--- a/dom/bindings/test/test_exception_options_from_jsimplemented.html
+++ b/dom/bindings/test/test_exception_options_from_jsimplemented.html
@@ -84,34 +84,34 @@ https://bugzilla.mozilla.org/show_bug.cg
       is(e.fileName,
          file,
          "Should still have the right file name for TypeError");
       is(e.lineNumber, 72, "Should still have the right line number for TypeError");
       is(e.columnNumber, 9, "Should have the right column number for TypeError");
     }
 
     try {
-      t.testThrowCallbackError(function() { Array.indexOf(); });
+      t.testThrowCallbackError(function() { Array.prototype.forEach(); });
     } catch (e) {
       ok(e instanceof TypeError, "Should have a TypeError here (3)");
       ok(!(e instanceof DOMException), "Should not have DOMException here (3)");
       ok(!("code" in e), "Should not have a 'code' property (3)");
       is(e.name, "TypeError", "Should be named TypeError (3)");
-      is(e.message, "missing argument 0 when calling function Array.indexOf",
+      is(e.message, "missing argument 0 when calling function Array.prototype.forEach",
          "Should also have the right message (3)");
       is(e.stack,
-         `doTest/<@${file}:92:51
+         `doTest/<@${file}:92:61
 doTest@${file}:92:9
 ${asyncFrame}`,
          "Exception stack for TypeError should only show our code (3)");
       is(e.fileName,
          file,
          "Should still have the right file name for TypeError (3)");
       is(e.lineNumber, 92, "Should still have the right line number for TypeError (3)");
-      is(e.columnNumber, 51, "Should have the right column number for TypeError (3)");
+      is(e.columnNumber, 61, "Should have the right column number for TypeError (3)");
     }
 
     try {
       t.testThrowXraySelfHosted();
     } catch (e) {
       ok(!(e instanceof Error), "Should have an Exception here (4)");
       ok(!(e instanceof DOMException), "Should not have DOMException here (4)");
       ok(!("code" in e), "Should not have a 'code' property (4)");
--- a/dom/browser-element/mochitest/browserElementTestHelpers.js
+++ b/dom/browser-element/mochitest/browserElementTestHelpers.js
@@ -28,17 +28,17 @@ const browserElementTestHelpers = {
       SpecialPowers.pushPrefEnv({"set": [[pref, value]]}, this.unlockTestReady.bind(this));
     } else {
       SpecialPowers.pushPrefEnv({"clear": [[pref]]}, this.unlockTestReady.bind(this));
     }
   },
 
   _setPrefs() {
     this.lockTestReady();
-    SpecialPowers.pushPrefEnv({"set": Array.slice(arguments)}, this.unlockTestReady.bind(this));
+    SpecialPowers.pushPrefEnv({"set": Array.from(arguments)}, this.unlockTestReady.bind(this));
   },
 
   _testReadyLockCount: 0,
   _firedTestReady: false,
   lockTestReady() {
     this._testReadyLockCount++;
   },
 
--- a/dom/events/test/bug426082.html
+++ b/dom/events/test/bug426082.html
@@ -37,17 +37,17 @@ function runTests() {
   label = $("label");
   outside = $("outside");
   SimpleTest.executeSoon(executeTests);
 }
 
 SimpleTest.waitForFocus(runTests);
 
 function isRectContainedInRectFromRegion(rect, region) {
-  return Array.some(region, function (r) {
+  return Array.prototype.some.call(region, function (r) {
     return rect.left >= r.left &&
            rect.top >= r.top &&
            rect.right <= r.right &&
            rect.bottom <= r.bottom;
   });
 }
 
 function paintListener(e) {
--- a/dom/events/test/bug656379-1.html
+++ b/dom/events/test/bug656379-1.html
@@ -53,17 +53,17 @@ function runTests() {
   label = $("label");
   outside = $("outside");
   SimpleTest.executeSoon(executeTests);
 }
 
 SimpleTest.waitForFocus(runTests);
 
 function isRectContainedInRectFromRegion(rect, region) {
-  return Array.some(region, function (r) {
+  return Array.prototype.some.call(region, function (r) {
     return rect.left >= r.left &&
            rect.top >= r.top &&
            rect.right <= r.right &&
            rect.bottom <= r.bottom;
   });
 }
 
 function paintListener(e) {
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -1089,18 +1089,18 @@ class VideoStreamHelper {
     this._helper = new CaptureStreamTestHelper2D(50,50);
   }
 
   async checkHasFrame(video, { offsetX, offsetY, threshold } = {}) {
     const h = this._helper;
     await h.waitForPixel(video, px => {
       let result = h.isOpaquePixelNot(px, h.black, threshold);
       info("Checking that we have a frame, got [" +
-           Array.slice(px) + "]. Ref=[" +
-           Array.slice(h.black.data) + "]. Threshold=" + threshold +
+           Array.from(px) + "]. Ref=[" +
+           Array.from(h.black.data) + "]. Threshold=" + threshold +
            ". Pass=" + result);
       return result;
     }, { offsetX, offsetY });
   }
 
   async checkVideoPlaying(video, { offsetX = 10, offsetY = 10,
                                    threshold = 16,
                                  } = {}) {
@@ -1108,17 +1108,17 @@ class VideoStreamHelper {
     await this.checkHasFrame(video, { offsetX, offsetY, threshold });
     let startPixel = {
       data: h.getPixel(video, offsetX, offsetY),
       name: "startcolor",
     };
     await h.waitForPixel(video, px => {
       let result = h.isPixelNot(px, startPixel, threshold);
       info("Checking playing, [" +
-           Array.slice(px) + "] vs [" + Array.slice(startPixel.data) +
+           Array.from(px) + "] vs [" + Array.from(startPixel.data) +
            "]. Threshold=" + threshold + " Pass=" + result);
       return result;
     }, { offsetX, offsetY });
   }
 
   async checkVideoPaused(video, { offsetX = 10, offsetY = 10,
                                   threshold = 16, time = 5000,
                                 }={}) {
@@ -1127,17 +1127,17 @@ class VideoStreamHelper {
     let startPixel = {
       data: h.getPixel(video, offsetX, offsetY),
       name: "startcolor",
     };
     try {
       await h.waitForPixel(video, px => {
           let result = h.isOpaquePixelNot(px, startPixel, threshold);
           info("Checking paused, [" +
-               Array.slice(px) + "] vs [" + Array.slice(startPixel.data) +
+               Array.from(px) + "] vs [" + Array.from(startPixel.data) +
                "]. Threshold=" + threshold + " Pass=" + result);
           return result;
         }, { offsetX, offsetY, cancel: wait(time, "timeout") });
       ok(false, "Frame changed within " + time/1000 + " seconds");
     } catch (e) {
       is(e, "timeout", "Frame shouldn't change for " + time/1000 + " seconds");
     }
   }
--- a/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
@@ -36,17 +36,17 @@
         let x = offsetX + dx + internalX;
         let y = offsetY + dy + internalY;
         info("Checking screen coordinate (" + [x,y] + ") of total resolution "
           + video.videoWidth + "x" + video.videoHeight
           + " against " + color.name + ".");
         await helper.waitForPixel(video, px => {
           let result = helper.isPixel(px, color, 16);
           info("Checking pixel against " + color.name + ". Got ["
-            + Array.slice(px) + "] (" + (result ? "YES" : "NO") + ")");
+            + Array.from(px) + "] (" + (result ? "YES" : "NO") + ")");
           return result;
         }, {offsetX: x, offsetY: y});
       }
     };
 
     let screenSizeSq = Math.min(video.videoWidth, video.videoHeight);
 
     info("Waiting for upper left quadrant to become " + upleft.name);
--- a/dom/tests/browser/browser_ConsoleAPITests.js
+++ b/dom/tests/browser/browser_ConsoleAPITests.js
@@ -33,17 +33,17 @@ function spawnWithObserver(browser, obse
     // initialization can be yeilded on before yeilding on the conclusion of the
     // test.
     "content._promise = new Promise(_resolve => {",
     // These are variables which are used by the test runner to communicate
     // state to the observer.
     "  let gLevel, gArgs, gStyle;",
     "  let expect = function(level) {",
     "    gLevel = level;",
-    "    gArgs = Array.slice(arguments, 1);",
+    "    gArgs = Array.prototype.slice.call(arguments, 1);",
     "  }",
     // To ease the transition to the new format, content.window is avaliable as gWindow
     // in the content.
     "  let gWindow = content.window;",
     // This method is called rather than _resolve such that the observer is removed
     // before exiting the test
     "  let resolve = () => {",
     "    Services.obs.removeObserver(ConsoleObserver, 'console-api-log-event');",
--- a/js/src/jit-test/tests/auto-regress/bug499169.js
+++ b/js/src/jit-test/tests/auto-regress/bug499169.js
@@ -26,17 +26,17 @@ var Native = function(k) {
     for (var h in a) {
         new Native({
             initialize: a[h],
         });
     }
 } ());
 Array.alias("forEach", "each");
 function $merge() {
-    var a = Array.slice(arguments);
+    var a = Array.prototype.slice.call(arguments);
     a.unshift({});
     return $mixin.apply(null, a);
 }
 function $mixin(e) {
     for (var d = 1, a = arguments.length; d < a; d++) {
         var b = arguments[d];
         for (var c in b) {
             var g = b[c],
--- a/js/src/jit-test/tests/basic/exception-column-number.js
+++ b/js/src/jit-test/tests/basic/exception-column-number.js
@@ -1,10 +1,10 @@
 try {
-    Array.indexOf();
+    Array.from();
 } catch (e) {
     assertEq(e.columnNumber, 11);
     // Filter the filename from the stack, since we have no clue what
     // to expect there.  Search for ':' from the end, because the file
     // path may contain ':' in it.
     var lastColon = e.stack.lastIndexOf(':');
     var afterPath = e.stack.lastIndexOf(':', lastColon - 1);
     assertEq(e.stack.substring(afterPath), ":2:11\n");
--- a/js/src/jit-test/tests/collections/Map-surfaces-2.js
+++ b/js/src/jit-test/tests/collections/Map-surfaces-2.js
@@ -1,15 +1,14 @@
 // Map methods throw when passed a this-value that isn't a Map.
 
 load(libdir + "asserts.js");
 
-function testcase(obj, fn) {
+function testcase(obj, fn, ...args) {
     assertEq(typeof fn, "function");
-    var args = Array.slice(arguments, 2);
     assertThrowsInstanceOf(function () { fn.apply(obj, args); }, TypeError);
 }
 
 var Map_size_getter = Object.getOwnPropertyDescriptor(Map.prototype, "size").get;
 
 function test(obj) {
     testcase(obj, Map.prototype.get, "x");
     testcase(obj, Map.prototype.has, "x");
--- a/js/src/jit-test/tests/collections/Set-surfaces-2.js
+++ b/js/src/jit-test/tests/collections/Set-surfaces-2.js
@@ -1,15 +1,14 @@
 // Set methods throw when passed a this-value that isn't a Set.
 
 load(libdir + "asserts.js");
 
-function testcase(obj, fn) {
+function testcase(obj, fn, ...args) {
     assertEq(typeof fn, "function");
-    var args = Array.slice(arguments, 2);
     assertThrowsInstanceOf(function () { fn.apply(obj, args); }, TypeError);
 }
 
 var Set_size_getter = Object.getOwnPropertyDescriptor(Set.prototype, "size").get;
 
 function test(obj) {
     testcase(obj, Set.prototype.has, 12);
     testcase(obj, Set.prototype.add, 12);
--- a/js/src/tests/non262/Array/regress-474529.js
+++ b/js/src/tests/non262/Array/regress-474529.js
@@ -24,17 +24,17 @@ function test()
     function timeit(N, buildArrayString) {
       return Function("N",
                       "var d1 = +new Date;" +
                       "while (N--) var x = " + buildArrayString +
                       "; return +new Date - d1")(N);
     }
 
     function reportResults(size, N, literalMs, newArrayMs, arrayMs) {
-      print(Array.join(arguments, "\t"));
+      print(Array.prototype.join.call(arguments, "\t"));
     }
 
     var repetitions = [ 9000, 7000, 4000, 2000, 2000, 2000, 800, 800, 800, 300, 100, 100 ]
       for (var zeros = "0, ", i = 0; i < repetitions.length; ++i) {
         var N = repetitions[i];
         reportResults((1 << i) + 1, N,
                       timeit(N, "[" + zeros + " 0 ]"),
                       timeit(N, "new Array(" + zeros + " 0)"),
--- a/layout/style/test/test_animations_omta.html
+++ b/layout/style/test/test_animations_omta.html
@@ -185,17 +185,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 var gDisplay = document.getElementById("display")
   , gDiv     = null;
 
 // Shortcut omta_is and friends by filling in the initial 'elem' argument
 // with gDiv.
 [ 'omta_is', 'omta_todo_is', 'omta_is_approx' ].forEach(function(fn) {
   var origFn = window[fn];
   window[fn] = function() {
-    var args = Array.slice(arguments);
+    var args = Array.from(arguments);
     if (!(args[0] instanceof Element)) {
       args.unshift(gDiv);
     }
     return origFn.apply(window, args);
   };
 });
 
 // Shortcut new_div and done_div to update gDiv
--- a/layout/style/test/test_bug635286.html
+++ b/layout/style/test/test_bug635286.html
@@ -23,17 +23,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="case3" class="before">case3, :not() in :-moz-any()</div>
 <div id="case4" class="before">case4, :-moz-any() in :not()</div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 635286 **/
 
 window.addEventListener("load", function() {
-  var cases = Array.slice(document.getElementsByTagName("div"));
+  var cases = Array.from(document.getElementsByTagName("div"));
   cases.forEach(function(aCase, aIndex) {
     aCase.className = "after";
   });
   window.setTimeout(function() {
     cases.forEach(function(aCase, aIndex) {
       is(window.getComputedStyle(aCase)
            .getPropertyValue("background-color"),
          "rgba(0, 0, 0, 0)",
--- a/layout/style/test/test_transitions_cancel_near_end.html
+++ b/layout/style/test/test_transitions_cancel_near_end.html
@@ -34,17 +34,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 613888: that we don't cancel transitions when they're
     about to end (current interpolated value rounds to ending value) and
     they get an unrelated style change.  **/
 
 var count_remaining = 6;
 
 window.addEventListener('load', function() {
-  var cases = Array.slice(document.querySelectorAll('#animated-elements-container > span'));
+  var cases = Array.from(document.querySelectorAll('#animated-elements-container > span'));
 
   cases.forEach(function(aTarget) {
     aTarget.addEventListener('transitionend', function(aEvent) {
       if (aTarget.hasAttribute('should-restyle'))
         aTarget.style.outline = '1px solid';
       var attr = 'transitionend-' + aEvent.propertyName;
       if (aTarget.hasAttribute(attr)) {
         // It's possible, given bad timers, that we might get a
--- a/layout/xul/test/window_resizer.xul
+++ b/layout/xul/test/window_resizer.xul
@@ -68,26 +68,26 @@ function doTest() {
   testResizer(-1, 1);
   testResizer(0, -1);
   testResizer(0, 1);
   testResizer(1, -1);
   testResizer(1, 0);
   testResizer(1, 1);
 
   var resizers = document.getElementsByTagName("resizer");
-  Array.forEach(resizers, function (element) {
+  Array.prototype.forEach.call(resizers, function (element) {
     is(getComputedStyle(element, "").cursor,
        element.getAttribute("expectedcursor"),
        "cursor for " + element.dir);
   });
 
   // now check the cursors in rtl. The bottomend resizer
   // should be reversed
   document.documentElement.setAttribute("localedir", "rtl");
-  Array.forEach(resizers, function (element) {
+  Array.prototype.forEach.call(resizers, function (element) {
     is(getComputedStyle(element, "").cursor,
        element.dir == "bottomend" ? "sw-resize" :
          element.getAttribute("expectedcursor"),
        "cursor for " + element.dir);
   });
 
   window.close();
   window.opener.lastResizerTest();
--- a/services/common/tests/unit/head_helpers.js
+++ b/services/common/tests/unit/head_helpers.js
@@ -53,17 +53,17 @@ function do_check_throws_message(aFunc, 
  * separated by spaces.
  *
  * @param [arg0, arg1, arg2, ...]
  *        Any number of arguments to print out
  * @usage _("Hello World") -> prints "Hello World"
  * @usage _(1, 2, 3) -> prints "1 2 3"
  */
 var _ = function(some, debug, text, to) {
-  print(Array.slice(arguments).join(" "));
+  print(Array.from(arguments).join(" "));
 };
 
 function httpd_setup(handlers, port = -1) {
   let server = new HttpServer();
   for (let path in handlers) {
     server.registerPathHandler(path, handlers[path]);
   }
   try {
--- a/services/crypto/tests/unit/head_helpers.js
+++ b/services/crypto/tests/unit/head_helpers.js
@@ -64,10 +64,10 @@ addResourceAlias();
  * separated by spaces.
  *
  * @param [arg0, arg1, arg2, ...]
  *        Any number of arguments to print out
  * @usage _("Hello World") -> prints "Hello World"
  * @usage _(1, 2, 3) -> prints "1 2 3"
  */
 var _ = function(some, debug, text, to) {
-  print(Array.slice(arguments).join(" "));
+  print(Array.from(arguments).join(" "));
 };
--- a/services/sync/tests/unit/test_clients_escape.js
+++ b/services/sync/tests/unit/test_clients_escape.js
@@ -23,22 +23,22 @@ add_task(async function test_clients_esc
 
     _("Encrypting record...");
     await record.encrypt(keyBundle);
     _("Encrypted.");
 
     let serialized = JSON.stringify(record);
     let checkCount = 0;
     _("Checking for all ASCII:", serialized);
-    Array.forEach(serialized, function(ch) {
+    for (let ch of serialized) {
       let code = ch.charCodeAt(0);
       _("Checking asciiness of '", ch, "'=", code);
       Assert.ok(code < 128);
       checkCount++;
-    });
+    }
 
     _("Processed", checkCount, "characters out of", serialized.length);
     Assert.equal(checkCount, serialized.length);
 
     _("Making sure the record still looks like it did before");
     await record.decrypt(keyBundle);
     Assert.equal(record.id, "ascii");
     Assert.equal(record.name, "wéävê");
--- a/services/sync/tests/unit/test_utils_makeGUID.js
+++ b/services/sync/tests/unit/test_utils_makeGUID.js
@@ -10,17 +10,17 @@ function run_test() {
     let newGuid = Utils.makeGUID();
     _("Generated " + newGuid);
 
     // Verify that the GUID's length is correct, even when it's URL encoded.
     Assert.equal(newGuid.length, 12);
     Assert.equal(encodeURIComponent(newGuid).length, 12);
 
     // Verify that the GUID only contains base64url characters
-    Assert.ok(Array.every(newGuid, function(chr) {
+    Assert.ok(Array.prototype.every.call(newGuid, function(chr) {
       return base64url.includes(chr);
     }));
 
     // Verify that Utils.checkGUID() correctly identifies them as valid.
     Assert.ok(Utils.checkGUID(newGuid));
 
     // Verify uniqueness within our sample of 1000. This could cause random
     // failures, but they should be extremely rare. Otherwise we'd have a
--- a/toolkit/components/contentprefs/tests/unit_cps2/head.js
+++ b/toolkit/components/contentprefs/tests/unit_cps2/head.js
@@ -274,17 +274,17 @@ function onEx(event, names, dontRemove) 
   let triggered = false;
 
   names.forEach(function(name) {
     let obs = {};
     ["onContentPrefSet", "onContentPrefRemoved"].forEach(function(meth) {
       obs[meth] = () => do_throw(meth + " should not be called for " + name);
     });
     obs["onContentPref" + event] = function() {
-      args[name].push(Array.slice(arguments));
+      args[name].push(Array.from(arguments));
 
       if (!triggered) {
         triggered = true;
         executeSoon(function() {
           if (!dontRemove)
             names.forEach(n => cps.removeObserverForName(n, observers[n]));
           deferred.resolve(args);
         });
--- a/toolkit/components/extensions/test/xpcshell/test_MatchPattern.js
+++ b/toolkit/components/extensions/test/xpcshell/test_MatchPattern.js
@@ -1,18 +1,18 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 add_task(async function test_MatchPattern_matches() {
   function test(url, pattern, normalized = pattern, options = {}, explicit) {
     let uri = Services.io.newURI(url);
 
-    pattern = Array.concat(pattern);
-    normalized = Array.concat(normalized);
+    pattern = Array.prototype.concat.call(pattern);
+    normalized = Array.prototype.concat.call(normalized);
 
     let patterns = pattern.map(pat => new MatchPattern(pat, options));
 
     let set = new MatchPatternSet(pattern, options);
     let set2 = new MatchPatternSet(patterns, options);
 
     deepEqual(set2.patterns, patterns, "Patterns in set should equal the input patterns");
 
@@ -167,19 +167,19 @@ add_task(async function test_MatchPatter
   // Before fixing Bug 1529230, the only way to match a specific IPv6 url is by droping the brackets in pattern,
   // thus we keep this pattern valid for the sake of backward compatibility
   pass({url: "http://[::1]/", pattern: ["http://::1/"]});
   pass({url: "http://[2a03:4000:6:310e:216:3eff:fe53:99b]/", pattern: ["http://2a03:4000:6:310e:216:3eff:fe53:99b/"]});
 });
 
 add_task(async function test_MatchPattern_overlaps() {
   function test(filter, hosts, optional) {
-    filter = Array.concat(filter);
-    hosts = Array.concat(hosts);
-    optional = Array.concat(optional);
+    filter = Array.prototype.concat.call(filter);
+    hosts = Array.prototype.concat.call(hosts);
+    optional = Array.prototype.concat.call(optional);
 
     const set = new MatchPatternSet([...hosts, ...optional]);
     const pat = new MatchPatternSet(filter);
     return set.overlapsAll(pat);
   }
 
   function pass({filter = [], hosts = [], optional = []}) {
     ok(test(filter, hosts, optional), `Expected overlap: ${filter}, ${hosts} (${optional})`);
--- a/toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js
+++ b/toolkit/components/viewsource/test/browser/browser_viewsourceprefs.js
@@ -133,15 +133,15 @@ var checkStyle = async function(browser,
     return style.getPropertyValue(styleProperty);
   });
   is(value, expected, "Correct value of " + styleProperty);
 };
 
 var checkHighlight = async function(browser, expected) {
   let highlighted = await ContentTask.spawn(browser, {}, async function() {
     let spans = content.document.getElementsByTagName("span");
-    return Array.some(spans, (span) => {
+    return Array.prototype.some.call(spans, (span) => {
       let style = content.getComputedStyle(span);
       return style.getPropertyValue("color") !== "rgb(0, 0, 0)";
     });
   });
   is(highlighted, expected, "Syntax highlighting " + (expected ? "on" : "off"));
 };
--- a/toolkit/content/tests/chrome/test_popup_coords.xul
+++ b/toolkit/content/tests/chrome/test_popup_coords.xul
@@ -64,17 +64,17 @@ function popupShowingEventOccurred(event
   var trigger = document.getElementById(event.target.id == "outerpopup" ? "outer" : "inner");
   var rect = trigger.getBoundingClientRect();
   is(event.clientX, Math.round(rect.left + 4), testname + "clientX");
   is(event.clientY, Math.round(rect.top + 5), testname + "clientY");
   // rangeOffset should be just after the trigger element. As rangeOffset
   // considers the zeroth position to be before the first element, the value
   // should be one higher than its index within its parent.
   is(event.rangeParent, trigger.parentNode, testname + "rangeParent");
-  is(event.rangeOffset, Array.indexOf(trigger.parentNode.childNodes, trigger) + 1, testname + "rangeOffset");
+  is(event.rangeOffset, Array.prototype.indexOf.call(trigger.parentNode.childNodes, trigger) + 1, testname + "rangeOffset");
 
   var popuprect = event.target.getBoundingClientRect();
   is(Math.round(popuprect.left), Math.round(rect.left + 4), "popup left");
   is(Math.round(popuprect.top), Math.round(rect.top + 5), "popup top");
   ok(popuprect.width > 0, "popup width");
   ok(popuprect.height > 0, "popup height");
 }
 </script>
--- a/toolkit/mozapps/downloads/tests/unit/test_lowMinutes.js
+++ b/toolkit/mozapps/downloads/tests/unit/test_lowMinutes.js
@@ -14,17 +14,17 @@ const {DownloadUtils} = ChromeUtils.impo
  * separated by spaces.
  *
  * @param [arg0, arg1, arg2, ...]
  *        Any number of arguments to print out
  * @usage _("Hello World") -> prints "Hello World"
  * @usage _(1, 2, 3) -> prints "1 2 3"
  */
 var _ = function(some, debug, text, to) {
-  print(Array.slice(arguments).join(" "));
+  print(Array.from(arguments).join(" "));
 };
 
 _("Make an array of time lefts and expected string to be shown for that time");
 var expectedTimes = [
   [1.1, "A few seconds left", "under 4sec -> few"],
   [2.5, "A few seconds left", "under 4sec -> few"],
   [3.9, "A few seconds left", "under 4sec -> few"],
   [5.3, "5s left", "truncate seconds"],
--- a/xpcom/tests/unit/test_streams.js
+++ b/xpcom/tests/unit/test_streams.js
@@ -20,17 +20,17 @@ function test_binary_streams() {
 
   p = new Pipe(false, false, 1024, 1, null);
   is = new BinaryInput(p.inputStream);
   os = new BinaryOutput(p.outputStream);
 
   const LargeNum = Math.pow(2, 18) + Math.pow(2, 12) + 1;
   const HugeNum = Math.pow(2, 62);
   const HelloStr = "Hello World";
-  const HelloArray = Array.map(HelloStr, function(c) { return c.charCodeAt(0); });
+  const HelloArray = Array.from(HelloStr, function(c) { return c.charCodeAt(0); });
   var countObj = {};
   var msg = {};
   var buffer = new ArrayBuffer(HelloArray.length);
 
   // Test reading immediately after writing.
   os.writeBoolean(true);
   Assert.equal(is.readBoolean(), true);
   os.write8(4);