Re: libseed-list scoped include



You can already to that

var ctx = new imports.sandbox.Context;
ctx.add_globals();
ctx.eval('Seed.scoped_include(' + JSON.stringify(somefile) +');');

or this might work...

var ctx = new imports.sandbox.Context;
ctx.add_globals();
ctx.get_global_object().Seed.scoped_include.call(
         ctx.get_global_object(), somefile
);

or even use imports on them.

>From what I remember though the Sandboxing is not 100% safe, I do remember importing files into a sandbox, that where also imported into the parent process, and the engine re-used the cached import, rather than re-importing. Leading to variables in the sandbox affecting the parent process. - It would probably be a good idea to do a test case on that.

Regards
Alan



 --- On 18/Jun/2010, Jonatan Liljedahl wrote: 
> It would be nice if Seed.scoped_include() can take an optional global 
> obj as input, then one could prepare sandboxes with:
> 
> ctx = new sandbox.Context;
> Seed.scoped_include(somefile,ctx.global);
> 
> /Jonatan
> _______________________________________________
> libseed-list mailing list
> libseed-list gnome org
> http://mail.gnome.org/mailman/listinfo/libseed-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]