Index: Source/devtools/front_end/utilities.js |
diff --git a/Source/devtools/front_end/utilities.js b/Source/devtools/front_end/utilities.js |
index 66d9aacc83b5ff9f4aacce4c3fe94eda9bf9612e..c3a2d04d245f3b31feaf5846221e2fcc5ed66ddb 100644 |
--- a/Source/devtools/front_end/utilities.js |
+++ b/Source/devtools/front_end/utilities.js |
@@ -374,13 +374,13 @@ Object.defineProperty(Array.prototype, "remove", |
{ |
/** |
* @param {!T} value |
- * @param {boolean=} onlyFirst |
+ * @param {boolean=} firstOnly |
* @this {Array.<!T>} |
* @template T |
*/ |
- value: function(value, onlyFirst) |
+ value: function(value, firstOnly) |
{ |
- if (onlyFirst) { |
+ if (firstOnly) { |
var index = this.indexOf(value); |
if (index !== -1) |
this.splice(index, 1); |
@@ -390,7 +390,7 @@ Object.defineProperty(Array.prototype, "remove", |
var length = this.length; |
for (var i = 0; i < length; ++i) { |
if (this[i] === value) |
- this.splice(i, 1); |
+ this.splice(i--, 1); |
aandrey
2014/03/25 07:42:07
FYI: the "length" is no longer valid after this. I
alph
2014/03/25 11:43:41
Good catch!
Rewrote the code to do a single splice
|
} |
} |
}); |