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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28389</bug_id>
          
          <creation_ts>2015-04-01 11:58:57 +0000</creation_ts>
          <short_desc>Allow error objects to be structured-clonable</short_desc>
          <delta_ts>2016-03-16 14:00:04 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jake Archibald">jaffathecake</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>adamk</cc>
    
    <cc>annevk</cc>
    
    <cc>bugs</cc>
    
    <cc>d</cc>
    
    <cc>ian</cc>
    
    <cc>jaffathecake</cc>
    
    <cc>mike</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>119172</commentid>
    <comment_count>0</comment_count>
    <who name="Jake Archibald">jaffathecake</who>
    <bug_when>2015-04-01 11:58:57 +0000</bug_when>
    <thetext>Use case: A page postMessages a worker to request a particular task be completed. That tasks fails, the worker wishes to post back the error.

The cloned error could be constructed using the message of the original.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119328</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2015-04-07 22:38:05 +0000</bug_when>
    <thetext>The concern is that Error objects could include sensitive data (like a stack trace). But in principle I don&apos;t disagree. IIRC the JS spec is going to eventually define structure cloning, so maybe I&apos;ll punt til that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119348</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2015-04-08 10:27:52 +0000</bug_when>
    <thetext>We don&apos;t protect any sensitive data by not supporting cloning of Errors, since you can just create a new plain object with the properties copied from the Error, and send that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119412</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2015-04-09 20:19:29 +0000</bug_when>
    <thetext>It&apos;s more accidental transfers that I would be concerned about. Obviously if someone is just sending the data across intentionally there&apos;s not much we can do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125292</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-02-29 10:19:39 +0000</bug_when>
    <thetext>Adam, Olli, opinions?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125293</commentid>
    <comment_count>5</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-02-29 13:04:00 +0000</bug_when>
    <thetext>I would like to do a TC39 proposal to make Error objects completely non-exotic (by removing the almost-entirely-unused [[ErrorData]] object). If that happens then they should become automatically structured-clonable.

That doesn&apos;t really impact DOMException though, which is exotic in its own ways.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125297</commentid>
    <comment_count>6</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-02-29 19:47:19 +0000</bug_when>
    <thetext>I submitted a PR to TC39 for discussion here to make Error objects non-exotic: https://github.com/tc39/ecma262/pull/438

However, I realized this approach might actually be counterproductive to our purposes here. See discussion in that thread.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125331</commentid>
    <comment_count>7</comment_count>
    <who name="Adam Klein">adamk</who>
    <bug_when>2016-03-03 01:52:21 +0000</bug_when>
    <thetext>I don&apos;t feel like I have a horse in this race; I can&apos;t say I really understand the hazard here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125427</commentid>
    <comment_count>8</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2016-03-10 10:24:44 +0000</bug_when>
    <thetext>This feels like an edge case. Would someone really pass error object to the other side of postMessage? (that is I guess really the only even vaguely reasonable use case for error in sc. Storing it in history state or notification or elsewhere doesn&apos;t make much sense.)

I agree with Hixie&apos;s comment 1 and comment 3.
I&apos;m a bit worried about accidentally passing sensitive data.
And really, is there a proper use case for this?

But I don&apos;t strongly object making error object structured-clonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125428</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-03-10 10:30:08 +0000</bug_when>
    <thetext>FWIW, I tried to work through how this would work in terms of ECMAScript and couldn&apos;t quite figure it out. As far as I can tell there&apos;s no reliable way to get the name of a constructor of an Error object in ECMAScript so it&apos;s not quite clear to me how to clone it without making changes to ECMAScript proper.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125520</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-03-16 14:00:04 +0000</bug_when>
    <thetext>Closing this since I don&apos;t really have a good idea as to how this could work and nobody seems super compelled to have a go at it. Please don&apos;t hesitate to file a GitHub issue with a concrete proposal though. Or let me know if you think I&apos;m wrong here.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>