Bug 21959 - modifications to arguments object not respected by Function.prototype.apply
Summary: modifications to arguments object not respected by Function.prototype.apply
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-29 15:45 PDT by Ben Newman
Modified: 2009-06-09 17:48 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Newman 2008-10-29 15:45:27 PDT
Modifying |arguments| with [].splice is broken:

function argc() { return arguments.length }

function test() {
    [].splice.call(arguments, 0, 0, 1);
    return [
        arguments.length,
        argc.apply(null, arguments)
    ];
}

test() // [1, 0]
test(1) // [2, 1]
test(1,2) // [3, 2]
test(1,2,3) // [4, 3]
Comment 1 Ben Newman 2009-06-09 17:47:21 PDT
This works now, hey!