Changeset 47292 in webkit for trunk/JavaScriptCore/tests


Ignore:
Timestamp:
Aug 14, 2009, 1:18:09 PM (16 years ago)
Author:
[email protected]
Message:

[ES5] Arguments object should inherit from Array
https://bugs.webkit.org/show_bug.cgi?id=28298

Reviewed by Gavin Barraclough

Make the Arguments object conform to the behaviour specified in ES5.
The simple portion of this is to make Arguments use Array.prototype
as its prototype rather than Object.prototype.

The spec then requires us to set instance.constructor to the pristine
Object constructor, and instance.toString and instance.toLocaleString
to the pristine versions from Object.prototype. To do this we now
make the ObjectPrototype constructor return its toString and
toLocaleString functions (similar to the call and apply functions
from FunctionPrototype).

Oddly enough this reports itself as a slight win, but given the code
isn't hit in the tests that claim to have improved I put this down to
code motion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/tests/mozilla/ecma_3/Function/arguments-001.js

    r11995 r47292  
    5050
    5151actual = a instanceof Array;
    52 expect = false;
     52expect = true;
    5353addThis();
    5454
    5555actual = a.length;
    56 expect = undefined;
     56expect = 0;
    5757addThis();
    5858
     
    6666
    6767actual = a instanceof Array;
    68 expect = false;
     68expect = true;
    6969addThis();
    7070
    7171actual = a.length;
    72 expect = undefined;
     72expect = 0;
    7373addThis();
    7474
Note: See TracChangeset for help on using the changeset viewer.