Bug 94681
Summary: | Layout test fast/js/array-functions-non-arrays.html should not expect Array.prototype.toLocaleString.call({}) to throw | ||
---|---|---|---|
Product: | WebKit | Reporter: | Ulan Degenbaev <ulan> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | antonm, barraclough, oliver |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Ulan Degenbaev
Layout test "fast/js/array-functions-non-arrays.html" has a test case that seems to be incorrect:
> shouldThrow("Array.prototype.toLocaleString.call({})");
The correct case would be
> shouldBe("Array.prototype.toLocaleString.call({})", "");
ECMA 262/15.4.4.3 states that "The toLocaleString function is intentionally generic; it does not require that its this value be an Array object."
Following the algorithm in the spec for {}, we get:
1. O = {}
2. arrayLen = O.length = undefined
3. len = ToUint32(arrayLen) = 0
4. set separator from locale
5. If len is zero, return the empty String.
At the moment JSC throws 'TypeError' when evaluating 'Array.prototype.toLocaleString.call({})'. Chrome and Firefox return empty string.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |