Is there a way of retrieving the specific lines of code for some sort of callback function?
<p>I am in the middle of a project which basically allows other users to install "add-ons" for my script. In general it will be something like the following:</p>

<pre><code>function widget () {
   this.addControl = function (type,control) {
     control.call({ Object With Some Un-thoughtout Vars });
   }
}
</code></pre>

<p><em>Very basic example with pretty much everything removed</em></p>

<p>The users who will be using this trust myself fully. Now I want to make sure any scripts other people make will be ran with limited permissions. So they can't hijack sessions or redirect the user or upright steal their passwords/keystrokes. </p>

<p>I looked at a few results on Google and they basically suggest that you shouldn't really do this as its more trouble than its worth. But in my opinion I'd much rather limiting it than someone installing a widget that takes their information (which they more than likely will). So does anyone know of a way of breaking down the callback function into individual lines of code so I can check everything's fine before allowing it to run? </p>

<p>Or will I have to go down some horrid string then <code>eval</code> method?</p>
