<?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>62897</bug_id>
          
          <creation_ts>2011-06-17 11:58:33 -0700</creation_ts>
          <short_desc>Using &quot;throw&quot; with a string doesn&apos;t result in url and line number being set in the exception.</short_desc>
          <delta_ts>2012-09-07 00:39:57 -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>18855</dup_id>
          
          <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>1</everconfirmed>
          <reporter name="David Levin">levin</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>barraclough</cc>
    
    <cc>ggaren</cc>
    
    <cc>levin</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>422804</commentid>
    <comment_count>0</comment_count>
    <who name="David Levin">levin</who>
    <bug_when>2011-06-17 11:58:33 -0700</bug_when>
    <thetext>I guess that there is a missing call to addErrorInfo somewhere.


Here&apos;s a test case:

&lt;html&gt;
&lt;body&gt;
This should result in a one line of output with a message, url and line number.
&lt;div id=result&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
if (window.layoutTestController) {
    layoutTestController.dumpAsText();
    layoutTestController.waitUntilDone();
}

function log(message)
{
    document.getElementById(&quot;result&quot;).innerHTML += message + &quot;&lt;br&gt;&quot;;
}

window.onerror = function(msg, url, line) {
    // Clean up url here to remove path.
    log( &quot;msg &quot; + msg + &quot; url &quot; + url + &quot; line &quot; + line );
    if (window.layoutTestController)
        layoutTestController.notifyDone();
}

throw &quot;Test Error&quot;;
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422811</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2011-06-17 12:07:03 -0700</bug_when>
    <thetext>(In reply to comment #0)
&gt; I guess that there is a missing call to addErrorInfo somewhere.
&gt; 

Nope, you can&apos;t add properties to a string - strings aren&apos;t objects.  This is a known (and sad making limitation in JSC, and there is a bug about it, but i can&apos;t find it :-/ )</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422812</commentid>
    <comment_count>2</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2011-06-17 12:08:43 -0700</bug_when>
    <thetext>Seems like we could replace a thrown string with a string object, or a generic error object used to wrap primitive values.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422824</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2011-06-17 12:20:22 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Seems like we could replace a thrown string with a string object, or a generic error object used to wrap primitive values.

That would be behavioural bug -- if you throw a string, the caught value remains a string.  We really just need to have an out of band mechanism for reporting where an exception came from.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422832</commentid>
    <comment_count>4</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2011-06-17 12:45:54 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; Seems like we could replace a thrown string with a string object, or a generic error object used to wrap primitive values.
&gt; 
&gt; That would be behavioural bug -- if you throw a string, the caught value remains a string.  We really just need to have an out of band mechanism for reporting where an exception came from.

We can distinguish between the value we pass to a catch block and the value we propagate as an exception. For example, in the generic error object design, we would unwrap the wrapped exception before running a catch block.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>714218</commentid>
    <comment_count>5</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-09-07 00:39:57 -0700</bug_when>
    <thetext>

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

    </bug>

</bugzilla>