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

Unified Diff: src/arraybuffer.js

Issue 17572009: Update typed arrays behavior to match ES6 rev 15. Remove TO_POSITIVE_INTEGER and throw on negative … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « no previous file | src/macros.py » ('j') | src/typedarray.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arraybuffer.js
diff --git a/src/arraybuffer.js b/src/arraybuffer.js
index 2b0c3dd85b1107bc2f5a98d355a24ad7a974e9fe..1ad470079d64b0e8faa4af0790c82beacaaeb235 100644
--- a/src/arraybuffer.js
+++ b/src/arraybuffer.js
@@ -31,12 +31,14 @@ var $ArrayBuffer = global.ArrayBuffer;
// -------------------------------------------------------------------
-function ArrayBufferConstructor(byteLength) { // length = 1
+function ArrayBufferConstructor(length) { // length = 1
if (%_IsConstructCall()) {
- var l = TO_POSITIVE_INTEGER(byteLength);
- %ArrayBufferInitialize(this, l);
+ var byteLength = IS_UNDEFINED(length) ? 0 : TO_INTEGER(length);
rossberg 2013/06/24 12:36:03 Doesn't TO_INTEGER(undefined) yield 0 anyway?
+ if (byteLength < 0)
+ throw MakeRangeError("invalid_array_buffer_length");
+ %ArrayBufferInitialize(this, byteLength);
} else {
- return new $ArrayBuffer(byteLength);
+ return new $ArrayBuffer(length);
}
}
« no previous file with comments | « no previous file | src/macros.py » ('j') | src/typedarray.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698