<?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>18855</bug_id>
          
          <creation_ts>2008-05-02 14:42:28 -0700</creation_ts>
          <short_desc>Mechanism for storing line numbers and source URLs in JavaScript exceptions needs improvement</short_desc>
          <delta_ts>2014-12-17 16:52:44 -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>JavaScriptCore</component>
          <version>523.x (Safari 3)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>burg</cc>
    
    <cc>ggaren</cc>
    
    <cc>joepeck</cc>
    
    <cc>levin</cc>
    
    <cc>oliver</cc>
    
    <cc>pmuellr</cc>
    
    <cc>rik</cc>
    
    <cc>zwarich</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>79485</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-05-02 14:42:28 -0700</bug_when>
    <thetext>* SUMMARY
The mechanism for storing line numbers and source URLs for JavaScript exceptions fails to work in the following cases:

- Throwing any non-object (like a string or a number)
- Throwing any object with a property named &quot;line&quot; or a property named &quot;sourceURL&quot;

What JavaScriptCore does now (in KJS::Node::handleException()) is to *modify* the exception object to add the &quot;line&quot; and &quot;sourceURL&quot; properties (but only if neither currently exist).  It seems wrong to modify a JavaScript object simply to store metadata and obviously doesn&apos;t work if the exception is not an object.

* STEPS TO REPRODUCE
1. Launch Safari/WebKit.
2. Open the Web Inspector.
3. Open one of the attached test cases.

* RESULTS
No line number or source URL is provided for the exceptions thrown in the test cases.

* REGRESSION
I don&apos;t think this is a regression.  The code to set the &quot;line&quot; and &quot;sourceURL&quot; properties on the exception object existed as far back as r9352 in nodes.cpp.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79490</commentid>
    <comment_count>1</comment_count>
      <attachid>20932</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-05-02 14:59:37 -0700</bug_when>
    <thetext>Created attachment 20932
Test cases

Additional fun facts:

- Throwing an exception inside a function body from an onclick handler results in &quot;undefined&quot; for the description--always.

- Throwing an object with just a &quot;sourceURL&quot; line will cause that URL to be printed in the Web Inspector.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79499</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2008-05-02 15:27:55 -0700</bug_when>
    <thetext>&lt;rdar://problem/5908160&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>168772</commentid>
    <comment_count>3</comment_count>
    <who name="Patrick Mueller">pmuellr</who>
    <bug_when>2009-12-04 08:15:11 -0800</bug_when>
    <thetext>It would be good to provide a set of tests to run across browsers to capture what everyone is doing here.  Basically, something like Dave&apos;s tests that just run and produce results.  But also include some of the existing &apos;built-in&apos; exceptions, both thrown by existing internal code, as well as cons&apos;d up by the user (eg, someone write&apos;s code that does a &quot;throw new Error()&quot;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>714219</commentid>
    <comment_count>4</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-09-07 00:39:57 -0700</bug_when>
    <thetext>*** Bug 62897 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>878254</commentid>
    <comment_count>5</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2013-04-18 23:20:02 -0700</bug_when>
    <thetext>The regular object and the primitive cases should work now.  I think we are still deliberately deferring to properties on objects if there&apos;s a lineNo property</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>20932</attachid>
            <date>2008-05-02 14:59:37 -0700</date>
            <delta_ts>2008-05-02 14:59:37 -0700</delta_ts>
            <desc>Test cases</desc>
            <filename>bug-18855-test.html</filename>
            <type>text/html</type>
            <size>1007</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">PGh0bWw+CjxoZWFkPgo8c2NyaXB0PgpmdW5jdGlvbiB0ZXN0MCgpIHsKICAgIHRocm93KG5ldyBP
YmplY3QoKSk7Cn0KZnVuY3Rpb24gdGVzdDEoKSB7CiAgICB0aHJvdyg0NSk7Cn0KZnVuY3Rpb24g
dGVzdDIoKSB7CiAgICB0aHJvdygiTXlFeGNlcHRpb24iKTsKfQpmdW5jdGlvbiB0ZXN0MygpIHsK
ICAgIEZvbyA9IGZ1bmN0aW9uKCkgewogICAgICAgIHRoaXMubGluZSA9IDk5OTsKICAgIH0KICAg
IHRocm93KG5ldyBGb28oKSk7Cn0KZnVuY3Rpb24gdGVzdDQoKSB7CiAgICBGb28gPSBmdW5jdGlv
bigpIHsKICAgICAgICB0aGlzLnNvdXJjZVVSTCA9ICJkYXRhOnRleHQvaHRtbCwlM2NiJTNlSGkl
M2MvYiUzZSI7CiAgICB9CiAgICB0aHJvdyhuZXcgRm9vKCkpOwp9CmZ1bmN0aW9uIHRlc3Q1KCkg
ewogICAgRm9vID0gZnVuY3Rpb24oKSB7CiAgICAgICAgdGhpcy5saW5lID0gOTk5OwogICAgICAg
IHRoaXMuc291cmNlVVJMID0gImRhdGE6dGV4dC9odG1sLCUzY2IlM2VIaSUzYy9iJTNlIjsKICAg
IH0KICAgIHRocm93KG5ldyBGb28oKSk7Cn0KPC9zY3JpcHQ+CjwvaGVhZD4KPGJvZHk+CjxidXR0
b24gb25jbGljaz0idGVzdDAoKSI+VGhyb3cgYW4gb2JqZWN0ICh3b3Jrcyk8L2J1dHRvbj48YnI+
CjxidXR0b24gb25jbGljaz0idGVzdDEoKSI+VGhyb3cgYSBudW1iZXI8L2J1dHRvbj48YnI+Cjxi
dXR0b24gb25jbGljaz0idGVzdDIoKSI+VGhyb3cgYSBzdHJpbmc8L2J1dHRvbj48YnI+CjxidXR0
b24gb25jbGljaz0idGVzdDMoKSI+VGhyb3cgYW4gb2JqZWN0IHdpdGggYSAibGluZSIgcHJvcGVy
dHk8L2J1dHRvbj48YnI+CjxidXR0b24gb25jbGljaz0idGVzdDQoKSI+VGhyb3cgYW4gb2JqZWN0
IHdpdGggYSAic291cmNlVVJMIiBwcm9wZXJ0eTwvYnV0dG9uPjxicj4KPGJ1dHRvbiBvbmNsaWNr
PSJ0ZXN0MygpIj5UaHJvdyBhbiBvYmplY3Qgd2l0aCAibGluZSIgYW5kICJzb3VyY2VVUkwiIHBy
b3BlcnRpZXM8L2J1dHRvbj48YnI+CjwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>