Cloning WeakSet/WeakMap

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Cloning WeakSet/WeakMap

Michał Wadas
Hi.

I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation?

Michał Wadas 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Cloning WeakSet/WeakMap

David Bruant-5
Hi,

My understanding is that cloning a WeakSet into a Set would remove all its properties related to security and garbage collection.

The properties related to security and garbage collection of WeakSet are based on the fact that its elements are not enumerable by someone who would only be holding a reference to the WeakSet. If you want to "clone" a WeakSet into a Set it means you have an expectation that the set of elements are deterministically enumerable.

WeakSets and Sets, despite there close name and API, are used in different circumstances.

David


2018-02-09 9:53 GMT-05:00 Michał Wadas <[hidden email]>:
Hi.

I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation?

Michał Wadas 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Cloning WeakSet/WeakMap

Thomas Grainger
I think this is referring to cloning a WeakSet into another WeakSet

Thomas Grainger

On 9 February 2018 at 15:01, David Bruant <[hidden email]> wrote:
Hi,

My understanding is that cloning a WeakSet into a Set would remove all its properties related to security and garbage collection.

The properties related to security and garbage collection of WeakSet are based on the fact that its elements are not enumerable by someone who would only be holding a reference to the WeakSet. If you want to "clone" a WeakSet into a Set it means you have an expectation that the set of elements are deterministically enumerable.

WeakSets and Sets, despite there close name and API, are used in different circumstances.

David


2018-02-09 9:53 GMT-05:00 Michał Wadas <[hidden email]>:
Hi.

I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation?

Michał Wadas 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Cloning WeakSet/WeakMap

Michał Wadas
In reply to this post by David Bruant-5
English isn't my native language, so I probably made a mistake.

I was asked to add WeakSet.prototype.union(iterable) creating new WeakSet instance including data from both iterable and original WeakSet.



On 9 Feb 2018 4:01 pm, "David Bruant" <[hidden email]> wrote:
Hi,

My understanding is that cloning a WeakSet into a Set would remove all its properties related to security and garbage collection.

The properties related to security and garbage collection of WeakSet are based on the fact that its elements are not enumerable by someone who would only be holding a reference to the WeakSet. If you want to "clone" a WeakSet into a Set it means you have an expectation that the set of elements are deterministically enumerable.

WeakSets and Sets, despite there close name and API, are used in different circumstances.

David


2018-02-09 9:53 GMT-05:00 Michał Wadas <[hidden email]>:
Hi.

I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation?

Michał Wadas 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Cloning WeakSet/WeakMap

David Bruant-5
2018-02-09 10:05 GMT-05:00 Michał Wadas <[hidden email]>:
English isn't my native language, so I probably made a mistake.
oh ok, sorry for my misinterpretation
 
I was asked to add WeakSet.prototype.union(iterable) creating new WeakSet instance including data from both iterable and original WeakSet.
ok, I don't have an opinion on this idea

David
 



On 9 Feb 2018 4:01 pm, "David Bruant" <[hidden email]> wrote:
Hi,

My understanding is that cloning a WeakSet into a Set would remove all its properties related to security and garbage collection.

The properties related to security and garbage collection of WeakSet are based on the fact that its elements are not enumerable by someone who would only be holding a reference to the WeakSet. If you want to "clone" a WeakSet into a Set it means you have an expectation that the set of elements are deterministically enumerable.

WeakSets and Sets, despite there close name and API, are used in different circumstances.

David


2018-02-09 9:53 GMT-05:00 Michał Wadas <[hidden email]>:
Hi.

I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation?

Michał Wadas 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Cloning WeakSet/WeakMap

Michael Rosefield
In reply to this post by Michał Wadas
Possibly a silly question, but...

What happens re garbage collection if you have two WeakSets referencing the same object? Do they each block that object's removal?

On Fri, 9 Feb 2018 at 15:05 Michał Wadas <[hidden email]> wrote:
English isn't my native language, so I probably made a mistake.

I was asked to add WeakSet.prototype.union(iterable) creating new WeakSet instance including data from both iterable and original WeakSet.



On 9 Feb 2018 4:01 pm, "David Bruant" <[hidden email]> wrote:
Hi,

My understanding is that cloning a WeakSet into a Set would remove all its properties related to security and garbage collection.

The properties related to security and garbage collection of WeakSet are based on the fact that its elements are not enumerable by someone who would only be holding a reference to the WeakSet. If you want to "clone" a WeakSet into a Set it means you have an expectation that the set of elements are deterministically enumerable.

WeakSets and Sets, despite there close name and API, are used in different circumstances.

David


2018-02-09 9:53 GMT-05:00 Michał Wadas <[hidden email]>:
Hi.

I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation?

Michał Wadas 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Cloning WeakSet/WeakMap

Michał Wadas
Why would they? You can put single object in infinite amount of WeakSets and it won't prevent it's garbage collection. 

On 9 Feb 2018 4:11 pm, "Michael Luder-Rosefield" <[hidden email]> wrote:
Possibly a silly question, but...

What happens re garbage collection if you have two WeakSets referencing the same object? Do they each block that object's removal?

On Fri, 9 Feb 2018 at 15:05 Michał Wadas <[hidden email]> wrote:
English isn't my native language, so I probably made a mistake.

I was asked to add WeakSet.prototype.union(iterable) creating new WeakSet instance including data from both iterable and original WeakSet.



On 9 Feb 2018 4:01 pm, "David Bruant" <[hidden email]> wrote:
Hi,

My understanding is that cloning a WeakSet into a Set would remove all its properties related to security and garbage collection.

The properties related to security and garbage collection of WeakSet are based on the fact that its elements are not enumerable by someone who would only be holding a reference to the WeakSet. If you want to "clone" a WeakSet into a Set it means you have an expectation that the set of elements are deterministically enumerable.

WeakSets and Sets, despite there close name and API, are used in different circumstances.

David


2018-02-09 9:53 GMT-05:00 Michał Wadas <[hidden email]>:
Hi.

I was asked to include a way to clone WeakSet in Set builtins proposal. Is there any consensus on security of such operation?

Michał Wadas 

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss