Standard modules?

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jan 21 08:49:14 PST 2014


On Jan 20, 2014, at 2:16 PM, Kevin Reid wrote:

> On Sun, Jan 19, 2014 at 7:21 PM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> It isn't clear that there much need for a global name for GeneratorFunction.  If you really eed to access it can always get it via:
> 
>    (function *() {}).constructor
> 
> (as the always helful generator UMO diagram at http://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorfunction-objects tells us)
> 
> SES needs to visit every 'primordial' / 'singleton' object to ensure they're made immutable and harmless. (Other 'meta' code might also benefit though I don't know of any examples offhand.)
> 
> This job is easier if all such objects are reachable via traversing data properties.
> 
> ES5 contains only one object which this is not true of: [[ThrowTypeError]]. This would have been fine since [[ThrowTypeError]] as specified is immutable and harmless, but in practice many implementations have bugs or extensions which make it mutable. We had to add a special case for it to ensure that it was traversed.
> https://code.google.com/p/google-caja/issues/detail?id=1661
> https://codereview.appspot.com/8093043/diff/19001/src/com/google/caja/ses/repairES5.js
> 
> It would be nice if there was some way in ES6 to make sure SES doesn't miss any objects — either that every primordial object is reachable via data properties (more precisely: that there are no preexisting objects which are reachable only by way of executing some program construct; e.g. Array is reachable by [].constructor, but is also named Array in the standard environment), or there is some other way to enumerate them.

In ES6 there are more things like [[ThrowTypeError]] including a number lintroduced in support of promises and modules. I'm seriously thinking that they should be defined as being immutable.

All intrinsics (the ES6 term for "primordials") are/will be enumerated  in the ES6 spec. 

I assume that in the ES6 context that SES would use Realms and module loaders to implement its sandbox so you should probably follow those spec. to make sure they do what you need.

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140121/10018a0b/attachment.html>


More information about the es-discuss mailing list