Bug 1228975 - Remove Array generics usage from Places code. r=mak
authorsimplyblue <bmanojkumar24@gmail.com>
Tue, 01 Dec 2015 15:40:30 +0530
changeset 309200 69ac60b9dec25d993075037eb1efd5e740cbf127
parent 309199 d254257e02b0935d70d7149f1c70a459ad1367f4
child 309201 3f9f28b75272f42902fded3239820f4f9a202c8c
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1228975
milestone45.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 1228975 - Remove Array generics usage from Places code. r=mak
addon-sdk/source/test/addons/places/lib/test-places-bookmarks.js
addon-sdk/source/test/addons/places/lib/test-places-events.js
addon-sdk/source/test/addons/places/lib/test-places-history.js
browser/components/places/content/browserPlacesViews.js
browser/components/places/content/treeView.js
browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul
toolkit/components/places/PlacesUtils.jsm
--- a/addon-sdk/source/test/addons/places/lib/test-places-bookmarks.js
+++ b/addon-sdk/source/test/addons/places/lib/test-places-bookmarks.js
@@ -935,14 +935,14 @@ exports.testCheckSaveOrder = function (a
         'correct ordering of bookmark results');
   }).then(done).catch(assert.fail);
 };
 
 before(exports, (name, assert, done) => resetPlaces(done));
 after(exports, (name, assert, done) => resetPlaces(done));
 
 function saveP () {
-  return promisedEmitter(save.apply(null, Array.slice(arguments)));
+  return promisedEmitter(save.apply(null, Array.prototype.slice.call(arguments)));
 }
 
 function searchP () {
-  return promisedEmitter(search.apply(null, Array.slice(arguments)));
+  return promisedEmitter(search.apply(null, Array.prototype.slice.call(arguments)));
 }
--- a/addon-sdk/source/test/addons/places/lib/test-places-events.js
+++ b/addon-sdk/source/test/addons/places/lib/test-places-events.js
@@ -311,17 +311,17 @@ exports['test history-delete-visits'] = 
 // while constructing the bookmark item requires subsequent calls to that bookmark item.
 // If we destroy the underlying bookmark immediately, these calls will fail.
 //
 // The places SDK abstraction around this alleviates it, but these are low level events.
 after(exports, (name, assert, done) => setTimeout(() => resetPlaces(done), 1));
 before(exports, (name, assert, done) => resetPlaces(done));
 
 function saveP () {
-  return promisedEmitter(save.apply(null, Array.slice(arguments)));
+  return promisedEmitter(save.apply(null, Array.prototype.slice.call(arguments)));
 }
 
 function makeCompleted (done, countTo) {
   let count = 0;
   countTo = countTo || 2;
   return function () {
     if (++count === countTo) done();
   };
--- a/addon-sdk/source/test/addons/places/lib/test-places-history.js
+++ b/addon-sdk/source/test/addons/places/lib/test-places-history.js
@@ -232,13 +232,13 @@ function toBeWithin (range) {
   range = range || 2000;
   var current = new Date() * 1000; // convert to microseconds
   return compared => {
     return compared - current < range;
   };
 }
 
 function searchP () {
-  return promisedEmitter(search.apply(null, Array.slice(arguments)));
+  return promisedEmitter(search.apply(null, Array.prototype.slice.call(arguments)));
 }
 
 before(exports, (name, assert, done) => resetPlaces(done));
 after(exports, (name, assert, done) => resetPlaces(done));
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -628,17 +628,17 @@ PlacesViewBase.prototype = {
   batching: function() { },
 
   nodeInserted:
   function PVB_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
     if (!parentElt._built)
       return;
 
-    let index = Array.indexOf(parentElt.childNodes, parentElt._startMarker) +
+    let index = Array.prototype.indexOf.call(parentElt.childNodes, parentElt._startMarker) +
                 aIndex + 1;
     this._insertNewItemToPopup(aPlacesNode, parentElt,
                                parentElt.childNodes[index]);
     this._setEmptyPopupStatus(parentElt, false);
   },
 
   nodeMoved:
   function PBV_nodeMoved(aPlacesNode,
@@ -658,17 +658,17 @@ PlacesViewBase.prototype = {
     // we need to do in that case.
     if (elt == this._rootElt)
       return;
 
     let parentElt = this._getDOMNodeForPlacesNode(aNewParentPlacesNode);
     if (parentElt._built) {
       // Move the node.
       parentElt.removeChild(elt);
-      let index = Array.indexOf(parentElt.childNodes, parentElt._startMarker) +
+      let index = Array.prototype.indexOf.call(parentElt.childNodes, parentElt._startMarker) +
                   aNewIndex + 1;
       parentElt.insertBefore(elt, parentElt.childNodes[index]);
     }
   },
 
   containerStateChanged:
   function PVB_containerStateChanged(aPlacesNode, aOldState, aNewState) {
     if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED ||
@@ -1406,17 +1406,17 @@ PlacesToolbar.prototype = {
     if (!PlacesUtils.nodeIsFolder(this._resultNode))
       return null;
 
     let dropPoint = { ip: null, beforeIndex: null, folderElt: null };
     let elt = aEvent.target;
     if (elt._placesNode && elt != this._rootElt &&
         elt.localName != "menupopup") {
       let eltRect = elt.getBoundingClientRect();
-      let eltIndex = Array.indexOf(this._rootElt.childNodes, elt);
+      let eltIndex = Array.prototype.indexOf.call(this._rootElt.childNodes, elt);
       if (PlacesUtils.nodeIsFolder(elt._placesNode) &&
           !PlacesUIUtils.isContentsReadOnly(elt._placesNode)) {
         // This is a folder.
         // If we are in the middle of it, drop inside it.
         // Otherwise, drop before it, with regards to RTL mode.
         let threshold = eltRect.width * 0.25;
         if (this.isRTL ? (aEvent.clientX > eltRect.right - threshold)
                        : (aEvent.clientX < eltRect.left + threshold)) {
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -274,17 +274,17 @@ PlacesTreeView.prototype = {
   _buildVisibleSection:
   function PTV__buildVisibleSection(aContainer, aFirstChildRow, aToOpen)
   {
     // There's nothing to do if the container is closed.
     if (!aContainer.containerOpen)
       return 0;
 
     // Inserting the new elements into the rows array in one shot (by
-    // Array.concat) is faster than resizing the array (by splice) on each loop
+    // Array.prototype.concat) is faster than resizing the array (by splice) on each loop
     // iteration.
     let cc = aContainer.childCount;
     let newElements = new Array(cc);
     this._rows = this._rows.splice(0, aFirstChildRow)
                      .concat(newElements, this._rows);
 
     if (this._isPlainContainer(aContainer))
       return cc;
--- a/browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul
+++ b/browser/components/places/tests/chrome/test_editBookmarkOverlay_tags_liveUpdate.xul
@@ -37,17 +37,17 @@
     function checkTagsSelector(aAvailableTags, aCheckedTags) {
       is(PlacesUtils.tagging.allTags.length, aAvailableTags.length,
          "tagging service is in sync.");
       let tagsSelector = document.getElementById("editBMPanel_tagsSelector");
       let children = tagsSelector.childNodes;
       is(children.length, aAvailableTags.length,
           "Found expected number of tags in the tags selector");
 
-      Array.forEach(children, function (aChild) {
+      Array.prototype.forEach.call(children, function (aChild) {
         let tag = aChild.getAttribute("label");
         ok(true, "Found tag '" + tag + "' in the selector");
         ok(aAvailableTags.includes(tag), "Found expected tag");
         let checked = aChild.getAttribute("checked") == "true";
         is(checked, aCheckedTags.includes(tag),
            "Tag is correctly marked");
       });
     }
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -2573,17 +2573,17 @@ TransactionItemCache.prototype = {
   },
   set annotations(v) {
     this._annotations = Array.isArray(v) ? Cu.cloneInto(v, {}) : null;
   },
   get annotations() {
     return this._annotations || null;
   },
   set tags(v) {
-    this._tags = (v && Array.isArray(v) ? Array.slice(v) : null);
+    this._tags = (v && Array.isArray(v) ? Array.prototype.slice.call(v) : null);
   },
   get tags() {
     return this._tags || null;
   },
 };
 
 
 /**
@@ -2593,17 +2593,17 @@ TransactionItemCache.prototype = {
  */
 function BaseTransaction()
 {
 }
 
 BaseTransaction.prototype = {
   name: null,
   set childTransactions(v) {
-    this._childTransactions = (Array.isArray(v) ? Array.slice(v) : null);
+    this._childTransactions = (Array.isArray(v) ? Array.prototype.slice.call(v) : null);
   },
   get childTransactions() {
     return this._childTransactions || null;
   },
   doTransaction: function BTXN_doTransaction() {},
   redoTransaction: function BTXN_redoTransaction() {
     return this.doTransaction();
   },