Bug 58338

Summary: ToObject should throw a TypeError on null and undefined
Product: WebKit Reporter: Erik Arvidsson <arv>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: barraclough, erights, kangax, oliver
Priority: P2 Keywords: ES5
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Erik Arvidsson
Reported 2011-04-12 09:41:01 PDT
The following code snippet should throw a TypeError exception but it returns the global object instead. ({}).valueOf.call(null) 15.2.4.4 Object.prototype.valueOf ( ) ... 1. Let O be the result of calling ToObject passing the this value as the argument. 9.9 ToObject ... Argument Type Result Undefined Throw a TypeError exception. Null Throw a TypeError exception. The same problem occurs in other places like Array.prototype.slice.call(undefined) etc.
Attachments
Mark S. Miller
Comment 1 2011-06-08 10:41:14 PDT
Gavin Barraclough
Comment 2 2011-07-20 19:19:01 PDT
*** This bug has been marked as a duplicate of bug 64250 ***
Note You need to log in before you can comment on or make changes to this bug.