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

Side by Side 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: Turned back to a simple version. 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/inspector/utilities-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 leadZero(this.getDate()) + "T" + 367 leadZero(this.getDate()) + "T" +
368 leadZero(this.getHours()) + 368 leadZero(this.getHours()) +
369 leadZero(this.getMinutes()) + 369 leadZero(this.getMinutes()) +
370 leadZero(this.getSeconds()); 370 leadZero(this.getSeconds());
371 } 371 }
372 372
373 Object.defineProperty(Array.prototype, "remove", 373 Object.defineProperty(Array.prototype, "remove",
374 { 374 {
375 /** 375 /**
376 * @param {!T} value 376 * @param {!T} value
377 * @param {boolean=} onlyFirst 377 * @param {boolean=} firstOnly
378 * @this {Array.<!T>} 378 * @this {Array.<!T>}
379 * @template T 379 * @template T
380 */ 380 */
381 value: function(value, onlyFirst) 381 value: function(value, firstOnly)
382 { 382 {
383 if (onlyFirst) { 383 if (firstOnly) {
384 var index = this.indexOf(value); 384 var index = this.indexOf(value);
385 if (index !== -1) 385 if (index !== -1)
386 this.splice(index, 1); 386 this.splice(index, 1);
387 return; 387 return;
388 } 388 }
389 389
390 var length = this.length; 390 for (var i = 0; i < this.length; ++i) {
391 for (var i = 0; i < length; ++i) {
392 if (this[i] === value) 391 if (this[i] === value)
393 this.splice(i, 1); 392 this.splice(i--, 1);
394 } 393 }
395 } 394 }
396 }); 395 });
397 396
398 Object.defineProperty(Array.prototype, "keySet", 397 Object.defineProperty(Array.prototype, "keySet",
399 { 398 {
400 /** 399 /**
401 * @return {!Object.<string, boolean>} 400 * @return {!Object.<string, boolean>}
402 * @this {Array.<*>} 401 * @this {Array.<*>}
403 */ 402 */
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 this._outgoingCallback(); 1527 this._outgoingCallback();
1529 } 1528 }
1530 } 1529 }
1531 1530
1532 /** 1531 /**
1533 * @param {*} value 1532 * @param {*} value
1534 */ 1533 */
1535 function suppressUnused(value) 1534 function suppressUnused(value)
1536 { 1535 {
1537 } 1536 }
OLDNEW
« 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