Bug 94688

Summary: Layout test fast/js/toString-overrides.html should expect TypeError when toLocaleString is overwritten
Product: WebKit Reporter: Ulan Degenbaev <ulan>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: barraclough, oliver, porten
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 4147    
Bug Blocks:    

Ulan Degenbaev
Reported 2012-08-22 03:51:55 PDT
Layout test fast/js/toString-overrides.html has the following test cases: > Number.prototype.toLocaleString = "invalid"; > shouldBe("[1].toLocaleString()", "'1'"); > RegExp.prototype.toLocaleString = "invalid"; > shouldBe("[/r/].toLocaleString()", "'toString2'"); According to ECMA 262/15.4.4.3, both calls to "toLocaleString()" should throw TypeError because steps 8.a, 8.b of the spec algorithm state: > 8.a Let func be the result of calling the [[Get]] internal method of elementObj with argument "toLocaleString". > 8.b If IsCallable(func) is false, throw a TypeError exception. String "invalid" is not callable. Both Chrome and Firefox throw TypeError in these cases: > FAIL [1].toLocaleString() should be 1. Threw exception TypeError: Property 'toLocaleString' of object toString is not a function > FAIL [/r/].toLocaleString() should be toString2. Threw exception TypeError: Property 'toLocaleString' of object toString2 is not a function
Attachments
Note You need to log in before you can comment on or make changes to this bug.