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

Unified Diff: src/typedarray.js

Issue 19210002: Throw if first argument to TypedArray.set is a number. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | test/mjsunit/external-array.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typedarray.js
diff --git a/src/typedarray.js b/src/typedarray.js
index ee1fa9d4f1e22aa5b7e7a54604f3e0bf5d465b55..0d14558d4ade594b733c26aedd39d217ce49ab54 100644
--- a/src/typedarray.js
+++ b/src/typedarray.js
@@ -154,6 +154,12 @@ function TypedArraySet(obj, offset) {
var l = obj.length;
if (IS_UNDEFINED(l)) {
+ if (IS_NUMBER(obj))
Benedikt Meurer 2013/07/16 05:39:57 This if is missing { and }.
+ // For number as a first argument, throw TypeError
+ // instead of silently ignoring the call, so that
+ // the user knows (s)he did something wrong.
+ // (Consistent with Firefox and Blink/WebKit)
+ throw MakeTypeError("invalid_argument");
return;
}
if (intOffset + l > this.length) {
« no previous file with comments | « no previous file | test/mjsunit/external-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698