Index: Source/devtools/front_end/utilities.js |
diff --git a/Source/devtools/front_end/utilities.js b/Source/devtools/front_end/utilities.js |
index bd98244bd26729eb527f1aa6795b0a2a6a4da7af..74616b5f1404ee93e9dec708913f7972c86bec3a 100644 |
--- a/Source/devtools/front_end/utilities.js |
+++ b/Source/devtools/front_end/utilities.js |
@@ -380,17 +380,18 @@ Object.defineProperty(Array.prototype, "remove", |
*/ |
value: function(value, firstOnly) |
{ |
+ var index = this.indexOf(value); |
+ if (index === -1) |
+ return; |
if (firstOnly) { |
- var index = this.indexOf(value); |
- if (index !== -1) |
- this.splice(index, 1); |
+ this.splice(index, 1); |
return; |
} |
- |
- for (var i = 0; i < this.length; ++i) { |
- if (this[i] === value) |
- this.splice(i--, 1); |
+ for (var i = index + 1, n = this.length; i < n; ++i) { |
+ if (this[i] !== value) |
+ this[index++] = this[i]; |
} |
+ this.length = index; |
} |
}); |