- From: <bugzilla@jessica.w3.org>
- Date: Wed, 02 Mar 2011 18:35:39 +0000
- To: public-html@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=12221 Summary: Should Structured Clone preserve property descriptors? Product: HTML WG Version: unspecified Platform: PC OS/Version: Windows NT Status: NEW Severity: normal Priority: P2 Component: HTML5 spec (editor: Ian Hickson) AssignedTo: ian@hixie.ch ReportedBy: travil@microsoft.com QAContact: public-html-bugzilla@w3.org CC: mike@w3.org, public-html-wg-issue-tracking@w3.org, public-html@w3.org, travil@microsoft.com I propose that when cloning properties, the cloned properties be "fresh" 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'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 "input" argument and memory as the "memory" argument. The order of the properties in the input and output objects must be the same. The key phrase of interest is: "add a corresponding property to output having the same name" In the world of ECMAScript 5, properties have additional "property descriptors" such as configurable, writable, getters and setters. The question I have is when the algorithm says to "add a corresponding property" 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't expect to preserve the getter and setter functions as those functions shouldn't be allowed through the cloning process--also there's a pre-existing bug on a potential recursion issue in bug: http://www.w3.org/Bugs/Public/show_bug.cgi?id=12101 -- Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
Received on Wednesday, 2 March 2011 18:35:41 UTC