<?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>12221</bug_id>
          
          <creation_ts>2011-03-02 18:35:39 +0000</creation_ts>
          <short_desc>Should Structured Clone preserve property descriptors?</short_desc>
          <delta_ts>2011-08-04 05:11:43 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>CLOSED</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>LC</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Travis Leithead [MSFT]">travil</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ayg</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>travil</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>46189</commentid>
    <comment_count>0</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2011-03-02 18:35:39 +0000</bug_when>
    <thetext>I propose that when cloning properties, the cloned properties be &quot;fresh&quot; properties such that previous modifications to the ECMAScript 5 property descriptors are not preserved (just take the defaults). I take this approach because it seems simpler, but I&apos;m open to other points of view.


In step 5 of the internal structured clone algorithm, we have the following text:

5.If input is an Array object or an Object object, then, for each enumerable property in input, add a corresponding property to output having the same name, and having a value created from invoking the internal structured cloning algorithm recursively with the value of the property as the &quot;input&quot; argument and memory as the &quot;memory&quot; argument. The order of the properties in the input and output objects must be the same.

The key phrase of interest is: &quot;add a corresponding property to output having the same name&quot;

In the world of ECMAScript 5, properties have additional &quot;property descriptors&quot; such as configurable, writable, getters and setters. The question I have is when the algorithm says to &quot;add a corresponding property&quot; does it expect to preserve the property descriptors of the source property?

For example, I wonder whether a source property with configurable: false, and writable: false attributes would be created on the cloned object with those same attributes, or whether they would default back to configurable: true and writable: true?

The algorithm is specific about the enumerable attribute--only enumerable: true properties are considered for the clone.

Finally, I wouldn&apos;t expect to preserve the getter and setter functions as those functions shouldn&apos;t be allowed through the cloning process--also there&apos;s a pre-existing bug on a potential recursion issue in bug: http://www.w3.org/Bugs/Public/show_bug.cgi?id=12101</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48106</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-05-05 21:31:28 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: I&apos;ve replaced the word &quot;corresponding&quot; with &quot;new&quot; to remove the ambiguity, and added a non-normative paragraph that explains this. Hopefully that&apos;s ok.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48107</commentid>
    <comment_count>2</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-05-05 21:32:11 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6085.
Check-in comment: clarification
http://html5.org/tools/web-apps-tracker?from=6084&amp;to=6085</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53231</commentid>
    <comment_count>3</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:11:43 +0000</bug_when>
    <thetext>mass-move component to LC1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>