<?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>23417</bug_id>
          
          <creation_ts>2013-10-02 01:38:39 +0000</creation_ts>
          <short_desc>Structured clone should check neutered for all types</short_desc>
          <delta_ts>2013-11-22 20:19:12 +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>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          <dependson>23416</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Glenn Maynard">glenn</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94139</commentid>
    <comment_count>0</comment_count>
    <who name="Glenn Maynard">glenn</who>
    <bug_when>2013-10-02 01:38:39 +0000</bug_when>
    <thetext>Currently, the check to throw DataCloneError is performed in the individual types that use it.  This caused an oversight: cloning a Blob which has been neutered should throw DataCloneError, but currently doesn&apos;t per spec.

I&apos;d suggest moving the neutered check out of the type list, and doing it near the top of http://www.whatwg.org/specs/web-apps/current-work/#internal-structured-cloning-algorithm.  Otherwise, the neutered check needs to be added to the Blob and File cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94339</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-04 21:50:41 +0000</bug_when>
    <thetext>This doesn&apos;t make sense. Only Transferable objects can be neutered, and, with the exception of ArrayBuffer which can be both transfered and copied, Transferable objects can&apos;t be copied. There&apos;d be no other type to apply this to.

Separate from this, Blob and File objects can be &quot;neutered through the close method&quot;. This has nothing to do with Transferable objects being neutered. If a Blob that has been &quot;neutered through the close method&quot; can&apos;t be cloned, I&apos;m happy to add something that says as much. Is that the case?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94343</commentid>
    <comment_count>2</comment_count>
    <who name="Glenn Maynard">glenn</who>
    <bug_when>2013-10-04 21:57:03 +0000</bug_when>
    <thetext>(I&apos;ll defer replying to this one, since it&apos;ll probably mirror the discussion in #23416.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96258</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-13 22:09:00 +0000</bug_when>
    <thetext>Bug 23416 is resolved now; what remains here? Should disabled Blobs not be cloneable? Or should they just be cloned in the disabled state? Do I need to say anything explicitly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96340</commentid>
    <comment_count>4</comment_count>
    <who name="Glenn Maynard">glenn</who>
    <bug_when>2013-11-14 15:53:28 +0000</bug_when>
    <thetext>I just think we should avoid having some dead objects throw when cloned and others not.  If cloning a dead ArrayBuffer throws, it seems like cloning a dead Blob should too.  Alternatively, not throwing at all makes sense: if you post a dead ArrayBuffer, the other side receives an equally dead object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96676</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-21 23:35:11 +0000</bug_when>
    <thetext>You can&apos;t make an ArrayBuffer go dead, can you? I mean, short of Transferring it, but that&apos;s a special case (the rule that applies in that case is just &quot;you can&apos;t Transfer an object twice&quot;, not &quot;you can&apos;t transfer a dead object&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96682</commentid>
    <comment_count>6</comment_count>
    <who name="Glenn Maynard">glenn</who>
    <bug_when>2013-11-22 01:53:13 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #5)
&gt; You can&apos;t make an ArrayBuffer go dead, can you? I mean, short of
&gt; Transferring it, but that&apos;s a special case (the rule that applies in that
&gt; case is just &quot;you can&apos;t Transfer an object twice&quot;, not &quot;you can&apos;t transfer a
&gt; dead object&quot;).

You can&apos;t clone (even without transfer) an ArrayBuffer that&apos;s been transferred.  If that&apos;s going to be the general rule--&quot;you can&apos;t clone an object that&apos;s been transferred&quot;--then I think you shouldn&apos;t be able to clone a Blob that&apos;s been closed, either.

We have objects that can become inaccessible due to being transferred (ArrayBuffer) and objects that can become inaccessible due to being explicitly killed (Blob.close).  I think it&apos;s inevitable that we&apos;ll have objects that are both, and it seems sucky to have two different ways a single object might be dead, with different effects.  (If ArrayBuffer gets a .close() method like Blob, it would become one of those.)

So, either 1: yes, cloning a disabled Blob should throw, or 2: ArrayBuffer should no longer throw if cloned while neutered.

I lean towards #2.  It&apos;s simpler, and throwing could be annoying.  If you have a big, complex structure you want to hand off, and part of the structure is dead ArrayBuffers or Blobs, it&apos;d force the developer to remove the dead objects, even if they have no other need to remove them.  I think throwing an exception when you try to actually access a dead object is enough, and structured clone (and probably transfer, too) should just give the receiver an equally dead object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96701</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-22 18:05:46 +0000</bug_when>
    <thetext>&gt; You can&apos;t clone (even without transfer) an ArrayBuffer that&apos;s been
&gt; transferred.

Hm, that&apos;s an interesting point.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96724</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-11-22 20:18:53 +0000</bug_when>
    <thetext>Ok, I&apos;ve made dead blobs throw as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96725</commentid>
    <comment_count>9</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-11-22 20:19:12 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8310.
Check-in comment: Prevent dead Blobs and Files from being cloned
http://html5.org/tools/web-apps-tracker?from=8309&amp;to=8310</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>