<?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>115087</bug_id>
          
          <creation_ts>2013-04-23 22:16:03 -0700</creation_ts>
          <short_desc>Web Inspector: WebCore::reportException should not evaluate JavaScript handling exceptions</short_desc>
          <delta_ts>2016-12-13 15:40:29 -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>Web Inspector</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Chris Curtis">chris_curtis</assigned_to>
          <cc>chris_curtis</cc>
    
    <cc>ggaren</cc>
    
    <cc>inspector-bugzilla-changes</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>880324</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2013-04-23 22:16:03 -0700</bug_when>
    <thetext>Currently WebCore::reportException can evaluate JavaScript when handling exceptions. The JS evaluation can itself throw an exception if running code in the page.

For example:

    function MyError() {
        this.name = &quot;MyErrorName&quot;;
        this.message = &quot;MyErrorMessage&quot;;
    }
    MyError.prototype.toString = function() {
        throw &quot;oops&quot;;
    }

    function produceError() {
        throw new MyError();
    }

    produceError();

WebCore::reportException call&apos;s this toString, and can potentially get values with hooks in valueOf as well. We should avoid running JS that can trigger its own exceptions if possible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>909009</commentid>
    <comment_count>1</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-07-16 14:05:01 -0700</bug_when>
    <thetext>Chris is working on similar bugs in JSC, so reassigning to him.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>966632</commentid>
    <comment_count>2</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2014-01-10 15:37:13 -0800</bug_when>
    <thetext>Moving to the right component.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>966646</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2014-01-10 15:37:41 -0800</bug_when>
    <thetext>&lt;rdar://problem/15796841&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>982543</commentid>
    <comment_count>4</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2014-02-19 14:20:02 -0800</bug_when>
    <thetext>Oliver had a suggestion on IRC:

    - if the exception object is a builtin Exception/Error object =&gt; directly get &quot;message&quot; property
    - if the exception object is a primitive =&gt; toString
    - otherwise, send the exception object to the inspector frontend like a console.log (RemoteObject)

I think that is a good idea. This would nicely handle these cases:

    - SyntaxError / ReferenceError
    - throw 1, throw &quot;test&quot;, ...
    - throw {a:1,b:2}, throw [1,2,3], throw new MyError()</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>