RESOLVED FIXED 64900
Function.prototype.apply should accept an array-like object as its second argument
https://bugs.webkit.org/show_bug.cgi?id=64900
Summary Function.prototype.apply should accept an array-like object as its second arg...
Kit Cambridge
Reported 2011-07-20 16:05:49 PDT
Overview ======== According to section 15.3.4.3 of the spec, `Function.prototype.apply` should accept an array-like object as its second argument. See steps 2 and 3: > 2. If Type(argArray) is not Object, then throw a TypeError exception. > 3. Let len be the result of calling the [[Get]] internal method of argArray with argument "length". As of the latest WebKit nightly, invocations such as `(function(){}).apply(null, {length: 0})` throw a `TypeError`. This is inconsistent with the above algorithm. Steps to Reproduce ================== 1) Open the Web Inspector. 2) Enter `(function(){ return [].slice.call(arguments); }).apply(null, {0: 1, 1: 2, length: 2})`. Actual Results ============== A `TypeError` is thrown. Expected Results ================ The function should return `[1, 2]`.
Attachments
The patch (8.58 KB, patch)
2011-07-21 11:45 PDT, Gavin Barraclough
sam: review+
Gavin Barraclough
Comment 1 2011-07-21 11:45:40 PDT
Created attachment 101618 [details] The patch
Gavin Barraclough
Comment 2 2011-07-21 11:58:13 PDT
Fixed in r91482
Gavin Barraclough
Comment 3 2011-07-21 11:59:56 PDT
Ooops, r91483
Note You need to log in before you can comment on or make changes to this bug.