On 08/10/11 01:31, John Nagle wrote:
...
Mozilla Bug 332176 (broken since 2006) says
...
However, in "greasemonkey.js", there's a reference to Mozilla bug 307984
(broken since 2005) ... This seems to be roughly the same bug,
Yes. Same bug. Bugs that live for 6+ years sometimes get duped =)
The error message says the script hung at line 506 or 511 of
"greasemonkey.js". So how do I calculate the line number in my code?
[snip]
Indeed, it's difficult.
I can easily describe the simple steps I would take, were I working on
this problem myself, though:
1) Comment out the bodies of every function.
2) Load the page (i.e. run the script).
3) Did everything work? If so, go to step 4, otherwise stop: bug found.
4) Pick the commented-out function that you feel is least likely to
contain the bug, and un-comment its body.
5) Go to step 2.
Once you pop out, you've found the function that contains the bug.
Re-comment it, and start un-commenting small sections. Then you know
where the bug is. It's almost definitely a loop of some kind. It would
be best to verify by then re-starting with the pristine script, and only
that function commented -- the problem should still be fixed, with only
that change.
You could also do this in reverse, commenting out one more at a time,
until the problem goes away. In this case of course, waiting for the
script to be interrupted each time could be a pain.
This can be sped up by operating on more than one function at a time,
but then it gets difficult to keep track of and isolate the real change.
Almost every problem in programming can, with the appropriate
viewpoint, be solved with the same sort of divide-and-conquer technique.
Just turn big unsolvable problems into many small solvable ones.
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.