Bug 58338
| Summary: | ToObject should throw a TypeError on null and undefined | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Erik Arvidsson <arv> |
| Component: | JavaScriptCore | Assignee: | 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
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Mark S. Miller
Should this be merged with https://bugs.webkit.org/show_bug.cgi?id=51097 ?
Gavin Barraclough
*** This bug has been marked as a duplicate of bug 64250 ***