views:

396

answers:

4

i'm working on a greasemonkey script for gmail in which it'd be very useful to know what function call is made when the "send" button is clicked. (i was unable to find this using firebug, but am relatively new to javascript debugging.) it seems that one should be able to detect this, i just don't know what tool(s) to use.

thanks very much for any help.

p.s. ultimately the goal here is to be able to extract a unique message i.d. for outgoing gmail messages, which i figured would be present in this javascript call -- so if there's an alternate way to do this, that would work just as well.

+2  A: 

Gmail's Javascript code is obfuscated to avoid this type of inspection (and also to reduce code size). It is very unlikely you'll be able to make heads or tails of it even if you manage to get Firebug to breakpoint in the code properly.

levik
A: 

All objects in JavaScript has got a toString() method. If you can find the button then you can find it's associated events. You can then toString() those events in the FireBug console--but as levik wrote; all of the code if obfuscated, so you might just end up toString()'ing gibberish.

Here's a little pseudo-code to get you started:

document.getElementById("...").onclick.toString()



Update

It seems like it's not possible to access events added with attachEvent() and addEventListener() if you have no control over the code you want to debug.

roosteronacid
What if the event is added as a listener?
Daniel X Moore
I'm blank. Added http://stackoverflow.com/questions/681120/access-events-added-with-attachevent-addeventlistener-in-javascript
roosteronacid
A: 

As a sidenote, one would assume that the unique id gets assigned in the server, not in the javascript...

kkyy