[Greasemonkey] Re: Problems with 0.5.1
Aaron Boodman
zboogs at gmail.com
Thu Sep 1 11:08:45 EDT 2005
On 9/1/05, Nikolas Coukouma <lists at atrus.org> wrote:
> There's a small race condition here; the document may load between the
> time that the if statement is evaluated and before the listener is
> added. This is unavoidable because JavaScript lacks synchronization. I
> would suggest firing a load event, but then in-page scripts would see
> two load events and that might screw with things.
No, there isn't. JavaScript is single-threaded. The document may
indeed finish loading, but the notification that it happened into
javascript (onload) -- cannot preempt javascript that's already
running.
Actually in mozilla, amazing but true, there is basically one thread
for everything. Even rendering and JS are on the same thread. The only
things that are on separate threads are pretty obscure things like dns
resolution, etc.
--
Aaron
More information about the Greasemonkey
mailing list