<?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>54337</bug_id>
          
          <creation_ts>2011-02-12 01:31:00 -0800</creation_ts>
          <short_desc>JS: console.log.apply() broken, throws TypeError</short_desc>
          <delta_ts>2011-02-12 14:02:12 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.6</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Richard Connamacher">richardconnamacher</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>ggaren</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>350253</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Connamacher">richardconnamacher</who>
    <bug_when>2011-02-12 01:31:00 -0800</bug_when>
    <thetext>I created a wrapper function &quot;log()&quot; to check if console.log exists before sending messages to it; this allows my code to run without errors on IE and Firefox (when Firebug is disabled). The function passes its arguments on to console.log() by converting the &apos;arguments&apos; object to an array and calling:

console.log.apply(this, argsArray);

On Firefox with Firebug installed this works as intended. In WebKit, however, it raises a TypeError with the unhelpful text description &quot;type error&quot;.

Reproducing this bug is easy. Just open a JavaScript console and enter: 

console.log.apply(this, [&quot;Hello World&quot;]);

This bug effects console.log.call as well. Replacing &apos;this&apos; with any other value yields the same result.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350303</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-02-12 13:25:45 -0800</bug_when>
    <thetext>This is probably a duplicate of bug 20141, although it doesn&apos;t look exactly the same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350311</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Connamacher">richardconnamacher</who>
    <bug_when>2011-02-12 14:02:12 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; This is probably a duplicate of bug 20141, although it doesn&apos;t look exactly the same.

It does look like a duplicate, though on further testing I learned that the bug itself is invalid. The code does work in Firefox, but the code itself had a problem.

I marked it &quot;RESOLVED INVALID&quot;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>