Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 269 return chunkb.length - chunka.length; | 269 return chunkb.length - chunka.length; |
| 270 } | 270 } |
| 271 } else if (chunka !== chunkb) | 271 } else if (chunka !== chunkb) |
| 272 return (chunka < chunkb) ? -1 : 1; | 272 return (chunka < chunkb) ? -1 : 1; |
| 273 a = a.substring(chunka.length); | 273 a = a.substring(chunka.length); |
| 274 b = b.substring(chunkb.length); | 274 b = b.substring(chunkb.length); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 /** | 278 /** |
| 279 * @param {string} name | |
| 280 * @param {number=} arrayLength | |
| 281 * @return {boolean} | |
| 282 */ | |
| 283 String.isArrayIndexPropertyName = function(name, arrayLength) | |
|
pfeldman
2014/01/23 16:19:02
We define these on prototype.
aandrey
2014/01/24 06:22:04
Didn't work in this case. Because:
typeof name ==
| |
| 284 { | |
| 285 // Array index check according to the ES5-15.4. | |
| 286 var index = name >>> 0; | |
| 287 return String(index) === name && index !== 0xffffffff && (typeof arrayLength === "undefined" || index < arrayLength); | |
| 288 } | |
| 289 | |
| 290 /** | |
| 279 * @param {number} num | 291 * @param {number} num |
| 280 * @param {number} min | 292 * @param {number} min |
| 281 * @param {number} max | 293 * @param {number} max |
| 282 * @return {number} | 294 * @return {number} |
| 283 */ | 295 */ |
| 284 Number.constrain = function(num, min, max) | 296 Number.constrain = function(num, min, max) |
| 285 { | 297 { |
| 286 if (num < min) | 298 if (num < min) |
| 287 num = min; | 299 num = min; |
| 288 else if (num > max) | 300 else if (num > max) |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1485 { | 1497 { |
| 1486 console.assert(this._pendingIncomingCallbacksCount > 0); | 1498 console.assert(this._pendingIncomingCallbacksCount > 0); |
| 1487 if (userCallback) { | 1499 if (userCallback) { |
| 1488 var args = Array.prototype.slice.call(arguments, 1); | 1500 var args = Array.prototype.slice.call(arguments, 1); |
| 1489 userCallback.apply(null, args); | 1501 userCallback.apply(null, args); |
| 1490 } | 1502 } |
| 1491 if (!--this._pendingIncomingCallbacksCount && this._outgoingCallback) | 1503 if (!--this._pendingIncomingCallbacksCount && this._outgoingCallback) |
| 1492 this._outgoingCallback(); | 1504 this._outgoingCallback(); |
| 1493 } | 1505 } |
| 1494 } | 1506 } |
| OLD | NEW |