[Greasemonkey] bug 11423

Aaron Boodman zboogs at gmail.com
Tue Aug 30 14:26:17 EDT 2005


The interference I was referring to was messing with the APIs of the
other scripts -- either accessing, deleting, or changing them. I'm not
sure how using setTimeout solves this.

-- 
Aaron


On 8/30/05, Lenny Domnitser <ldrhcp at gmail.com> wrote:
> > To compensate for the slowness, I will concatenate all the user scripts for a
> > given page together into one mega script to execute all at once. This means that
> > malicious user scripts could interfere with one another on 1.0.x, but I feel
> > that this is acceptable.
> 
> Scripts will interfere with each other if simple concatenation is
> used, but not if the setTimeout hack is used, like so:
> 
> // Let's assume the variable "scripts" is an array of script strings,
> // and the variable "chunkToExecute" is a string.
> // Obvioulsy this can be adapted to the real var names.
> for(var c = 0; c < scripts.length; c++) {
>   // do not do this: chunckToExecute += scripts[c] + '\n';
>   // this is good:
>   chunckToExecute += 'setTimeout(function(){' + scripts[c] + '\n},0);';
> }
> 
> Don't forget the \n, in case a script ends in a comment.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list