This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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
The spec as currently-written says: "1. Let source be the List that is the value of input's [[SetData]] internal slot, if any." Consider the following code: var set = new Set; var mutator = { get val() { set.add('mutator was here') } }; set.add(mutator); onmessage = function(e) { console.log(e.data.size); }; postMessage(set, '*') What should be printed to the console? In Firefox, this example prints '1' (Chrome will print 1, soon, once it supports cloning Maps and Sets). But the spec suggests that it should print '2', since step 7.3.1 invokes the clone algorithm on |mutator| and thus adds another item to set's [[SetData]] List. I'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.
Adam, would you be willing to provide a pull request for https://github.com/whatwg/html?
(In reply to Anne from comment #2) > Adam, would you be willing to provide a pull request for > https://github.com/whatwg/html? https://github.com/whatwg/html/pull/64
Thank you!