asvd / jailed

execute untrusted code with custom permissions
MIT License
1.01k stars 69 forks source link

Tell Jailed to use a Specific iFrame declared in the HTML DOM? #32

Open swordmaster2k opened 8 years ago

swordmaster2k commented 8 years ago

Hi,

This is more or less a question, I'm wondering rather than creating a new iFrame every time a Jailed plugin is executed is it possible to use one that is already declared in the DOM? I noticed that every time this code executes an iFrame is created then removed from the DOM:

var program = new jailed.Plugin(host + "/" + filename, this.rpgcodeApi.api);
 program.whenConnected(function () {
    rpgtoolkit.craftyPlayer.disableControl();
 });
 program.whenDisconnected(function () {
    rpgtoolkit.craftyPlayer.enableControl();
 });

By the way I'm using Jailed to execute custom user programs in a Javascript game engine. It is working fine so far but creating iFrames is a bit of a performance overhead for me, since accessing the DOM is an expensive operation.

It is an awesome library by the way.

iliakan commented 8 years ago

I guess that's made to keep the environment clean before each execution.