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.

4 Answers
4

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.

I don't think that the message id would be in the message created (in fact all the headers would be absent). My guess is that they are entered on the server side by Google before dispatching the message.

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.