[Greasemonkey] Greasemonkey scripts crashing FF when viewing Gmail

Tom Lee thomas.j.lee at gmail.com
Tue Apr 4 12:15:58 EDT 2006


Hi Tod,

I'm the author of the script in question, and am aware of the problem --
particularly since switching to FF on OSX.  Maybe others on the list can
help us determine the next steps necessary to fix the script.

I don't know what causes the crashing, but feel pretty confident that it's
largely out of my hands.  Frankly, I'm not an advanced enough JS programmer
to do anything that should be sufficiently complex to crash the browser.
Whatever the underlying bug is, I think it's exacerbated by the frequency
with which the script runs and the complexity of gmail.

I have been working on resolving the problem, in particular by overriding
gmail's AJAX handlers and inserting callbacks to the colorization function
into it so that the colorization routine has to run less often.  So far it
looks promising, but remains incomplete.

The problem is that Gmail redraws the screen in a number of ways, and I only
have documentation on the F() function that handles communication.  I'm
trying to trap the other events that ought to prompt a redraw (in such a way
that the colorization class attributes are lost from the list of emails).
At this point, it looks like the archive button and the checkboxes are the
biggest offenders.  I have a couple of questions for the list along those
lines:

1. I can't access the checkboxes' onClick properties for some reason,
although using addEventListener to add a click handler works fine.  But I'm
running into problems with adding multiple instances of the same listener.
Is there any way to check for this?  Does anyone know why I can't access the
onClick property?  (I suspect it's b/c these checkboxes don't have IDs; I'm
getting them through xpath)

2. I'm not having much luck adding a listener to the archive button's
onclick event -- it seems to get erased and redrawn whenever you click
through to an individual email.  I could set up an interval to look for it
and add the event listener, but I'd like to avoid more recurring loops,
since that's what cause the crash problems in the first place (I think).

3. What would be ideal would be to find gmail's screen-redrawing function
and just override that.  But I don't know how to track those functions down;
it's easy to identify AJAX handlers using firebug or similar tools (esp.
since someone else did the work in locating F()), but I don't know how to
begin digging further into gmail's morass of compressed JS.  Suggestions
would be very welcome.

Tom


On 4/4/06, Tod Beardsley <todb at planb-security.net> wrote:
>
> If I have any Greasemonkey scripts enabled while I'm on Gmail, sooner
> or later, Firefox crashes. Version info:
>
> Firefox:
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1)
> Gecko/20060111 Firefox/1.5.0.1
>
> Greasemonkey: v. 0.6.4, current as of 04-04-2006.
>
> Best crashy gmail script (seems to crash the fastest, average about an
> hour, but really anything will crash eventually):
>
> Gmail Colorizer, from http://www.metamonkey.net/gmailcolorizer (no
> version # available)
>
> Since it's not immediate, I imagine there's some race condition in
> play, but I'm quite novice when it comes to troubleshooting this sort
> of complex interaction.
>
> I'll paw through Mozilla bugs next to see if anyone's reported it
> there, but I wanted to troll this list first to see if there's any
> known gotchas about GM'ing with Gmail.
>
> --
> planb-security.net | ICQ: 335082155 | Note: Due to Google's privacy
> policy <http://tinyurl.com/5xbtl> and the United States' policy on
> electronic surveillance <http://tinyurl.com/muuyl>, please do not
> IM/e-mail me anything you wish to remain secret or private.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list