On Oct 2, 2012, at 10:18 AM, Kevin Smith wrote:
>
> private @FooBrand;
> class Foo {
> constructor() {
> /* establish the internal Fooness of the instance */
> this.@FooBrand = true;
> }
> }
> Foo.isFoo = function (obj) {return !!obj.@FooBrand};
>
> Using this strategy, will isFoo not fail, if the specified object came from a
> different global context (frame)?
>
> Kevin
>
Indeed it would, but why shouldn't it? Foo in another frame is a different
class. If you need to do cross-frame brand, that seems like an additional
requirement would require additional mechanism.
Wouldn't a WeakMap branding scheme has similar issues. You would need to share
via some means a common WeakMap among constructors in different frames. Just
like to make symbol based branding work for this requirement you would have to
share a private symbol between frames.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss