我正在为gmail编写一个greasemonkey脚本,其中知道单击“发送”按钮时进行了哪些函数调用非常有用。(我无法使用 firebug 找到它,但我对 javascript 调试相对较新。)似乎应该能够检测到这一点,我只是不知道要使用什么工具。
非常感谢您的帮助。
ps 最终的目标是能够为传出的 gmail 消息提取一个唯一的消息 id,我认为它会出现在这个 javascript 调用中——所以如果有另一种方法可以做到这一点,那也可以。
我正在为gmail编写一个greasemonkey脚本,其中知道单击“发送”按钮时进行了哪些函数调用非常有用。(我无法使用 firebug 找到它,但我对 javascript 调试相对较新。)似乎应该能够检测到这一点,我只是不知道要使用什么工具。
非常感谢您的帮助。
ps 最终的目标是能够为传出的 gmail 消息提取一个唯一的消息 id,我认为它会出现在这个 javascript 调用中——所以如果有另一种方法可以做到这一点,那也可以。
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.
我不认为消息 id 会在创建的消息中(实际上所有标题都将不存在)。我的猜测是它们是在发送消息之前由 Google 在服务器端输入的。
As a sidenote, one would assume that the unique id gets assigned in the server, not in the javascript...
JavaScript 中的所有对象都有一个toString()
方法。如果您可以找到该按钮,那么您可以找到它的关联事件。然后,您可以toString()
在 FireBug 控制台中处理这些事件——但正如levik所写的那样;如果混淆了所有代码,那么您最终可能会toString()
胡言乱语。
这里有一些伪代码可以帮助您入门:
document.getElementById("...").onclick.toString()
更新
如果您无法控制要调试的代码,似乎无法访问添加的事件。attachEvent()
addEventListener()