<?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>28849</bug_id>
          
          <creation_ts>2015-06-24 23:39:41 +0000</creation_ts>
          <short_desc>Cloning steps for ES Map/Set should copy [[MapData]]/[[SetData]] list before recursing</short_desc>
          <delta_ts>2015-09-01 03:54:54 +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>MOVED</resolution>
          
          
          <bug_file_loc>https://html.spec.whatwg.org/#safe-passing-of-structured-data</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>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>adamk</cc>
    
    <cc>annevk</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>121468</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2015-06-24 23:39:41 +0000</bug_when>
    <thetext>Specification: https://html.spec.whatwg.org/multipage/infrastructure.html
Multipage: https://html.spec.whatwg.org/multipage/#safe-passing-of-structured-data
Complete: https://html.spec.whatwg.org/#safe-passing-of-structured-data
Referrer: https://html.spec.whatwg.org/multipage/

Comment:
Cloning steps for ES Map/Set should copy [[MapData]]/[[SetData]] list before
recursing

Posted from: 72.14.229.81
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121469</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Klein">adamk</who>
    <bug_when>2015-06-24 23:47:06 +0000</bug_when>
    <thetext>The spec as currently-written says:

&quot;1. Let source be the List that is the value of input&apos;s [[SetData]] internal slot, if any.&quot;

Consider the following code:


var set = new Set;
var mutator = { get val() { set.add(&apos;mutator was here&apos;) } };
set.add(mutator);
onmessage = function(e) {
  console.log(e.data.size);
};
postMessage(set, &apos;*&apos;)


What should be printed to the console? In Firefox, this example prints &apos;1&apos; (Chrome will print 1, soon, once it supports cloning Maps and Sets). But the spec suggests that it should print &apos;2&apos;, since step 7.3.1 invokes the clone algorithm on |mutator| and thus adds another item to set&apos;s [[SetData]] List.

I&apos;d recommend that the spec change to explicitly make a copy of [[SetData]] (and [[MapData]], for maps) before attempting to clone anything contained in those lists. This will match the existing implementation, and should be easier to implement in general.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122875</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-08-28 17:01:33 +0000</bug_when>
    <thetext>Adam, would you be willing to provide a pull request for https://github.com/whatwg/html?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122934</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Klein">adamk</who>
    <bug_when>2015-08-31 21:50:22 +0000</bug_when>
    <thetext>(In reply to Anne from comment #2)
&gt; Adam, would you be willing to provide a pull request for
&gt; https://github.com/whatwg/html?

https://github.com/whatwg/html/pull/64</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122935</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-09-01 03:54:54 +0000</bug_when>
    <thetext>Thank you!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>