Bug 58338 - ToObject should throw a TypeError on null and undefined
Summary: ToObject should throw a TypeError on null and undefined
Status: RESOLVED DUPLICATE of bug 64250
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Keywords: ES5
Depends on:
Reported: 2011-04-12 09:41 PDT by Erik Arvidsson
Modified: 2011-07-20 19:19 PDT (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 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) 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.
Comment 1 Mark S. Miller 2011-06-08 10:41:14 PDT
Should this be merged with https://bugs.webkit.org/show_bug.cgi?id=51097 ?
Comment 2 Gavin Barraclough 2011-07-20 19:19:01 PDT

*** This bug has been marked as a duplicate of bug 64250 ***