Execute arbitrary javascript in a custom global context
<p>My only requirement for executing this arbitrary js code is that certain global variables/functions (e.g. <code>setInterval</code>) are not exposed.</p>

<p>My current strategy involves parsing through the js code and making a <code>var</code> declaration (at the beginning of the enclosing closure) for every global reference.</p>

<p>I'm wondering if there's any other obvious way to solving this. </p>

<p>Also just to clarify, this arbitrary code is not being run with things like <code>eval</code>. Rather, it's being wrapped inside a closure and appended to the base code.</p>
