<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>58338</bug_id>
          
          <creation_ts>2011-04-12 09:41:01 -0700</creation_ts>
          <short_desc>ToObject should throw a TypeError on null and undefined</short_desc>
          <delta_ts>2011-07-20 19:19:01 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>64250</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>ES5</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">arv</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>barraclough</cc>
    
    <cc>erights</cc>
    
    <cc>kangax</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>384072</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2011-04-12 09:41:01 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>417339</commentid>
    <comment_count>1</comment_count>
    <who name="Mark S. Miller">erights</who>
    <bug_when>2011-06-08 10:41:14 -0700</bug_when>
    <thetext>Should this be merged with https://bugs.webkit.org/show_bug.cgi?id=51097 ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>440193</commentid>
    <comment_count>2</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2011-07-20 19:19:01 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 64250 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>