Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: Source/devtools/front_end/utilities.js

Issue 199793022: DevTools: Fix a bug in Array.remove (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/inspector/utilities-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
}
});
« no previous file with comments | « LayoutTests/inspector/utilities-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698