OK, so the script contains a bug which causes the outer loop to
continue indefinitely. The loop is included below:
while(i>=0)
{
//alert("Mythmonger Tools 5");
try
{
var localBlock=content.getElementsByClassName("content")
[i];
var j=0;
while(j>=0)
{
alert(i+"\t"+j)
try{
questparts['name'][count]
=localBlock.getElementsByTagName("a")[j].innerHTML;
questparts['title'][count]
=content.getElementsByTagName("h3")[i].innerHTML;
}
catch(ex)
{
j=-2; //gets incremented to -1, our magic value.
}
j++;
count++;
}
}
catch(ex)
{
i=-2; //gets incremented to -1, our magic value.
}
i++;
}
Fixing the code is definitely outside the scope of this mailing list:
I will be fine sorting this myself. The problem I am reporting is that
this loop, (without the alert statement) doesn't produce firefox's
"This script is running slowly... Abort? dialog. Make of it what you
will, but it is my belief that this is a bug and that a userscript
should not be privileged enough to essentially run Denial of Service
on the user: if my script ran in global scope I could have "taken
down" firefox for the novice user who doesn't know to run firefox
without addons and fix it.
I'm not sayng this is a major security issue (userscripts are
predominantly based on trust anyway) but the fact remains that, due to
some fault in a script's coding it is possible to cause quite a lot of
hassle on the user.
I'll be fixing the script bug myself from here-on but the link to the
script above is static, so anyone with access to facebook (and/or
knows what's going on here) ma want to check this out.
On 11 Jan, 17:19, Gigitrix <[email protected]> wrote:
> Hmm....
> I'm in the process of figuring out with alert statements where the
> error is (restarting did nothing) but there's a peculiarity: sometimes
> the site i'm using this on displays a CAPTCHA instead of the normal
> page (which is perfectly fine: i'm not trying to automate anything and
> I don't violate their TOS, but other greasemonkey scripts would try
> and "play for you"). The script works on these pages, most likely
> because it simply try{}s and fails somewhere down the line.
>
> I'll let you know how my alert tracing goes.
>
> On 11 Jan, 00:45, RodMcguire <[email protected]> wrote:
>
>
>
> > Since I'm not on face book I can't test your script, but I did look
> > briefly at it.
>
> > 1) I didn't see the script peppered with alerts so you can tell how
> > far it gets before crashing FF.
> > Surely if you put "alert('starting')" at the top of script that will
> > do something.
>
> > 2) Have you run Windows Task Manager (or whatever it is called in W7)
> > to see if FF is rapidly eating up and running out of memory? That can
> > cause unexplained crashes..
>
> > 3) Have you tried rebooting? Sometimes XP/Vista/W7 gets screwed up
> > such that FF behaves badly even after reloading but works fine after a
> > reboot.
>
> > On Jan 10, 7:09 pm, Gigitrix <[email protected]> wrote:
>
> > > Hi there, I'm essentially reporting what *may* be a bug at this point.
> > > I'm working on my first userscript (I'm predominantly PHP/MySQL, and
> > > hate javascript with a passion but it must be done ;) ) And it seems
> > > that everytime my script runs on a particular page, firefox
> > > immediately crashes.
>
> > > Here is my
> > > script.http://userscripts.org/scripts/version/64902/162079.user.js
>
> > > The script runs fine on any page of Mythmonger (http://
> > > apps.facebook.com/mythmonger/*), even on the
> > > pagehttp://apps.facebook.com/mythmonger/turn.php, but as soon as it
> > > hitshttp://apps.facebook.com/mythmonger/archive.phpthepageappears to
> > > physically load, then firefox crashes. None of the visible effects
> > > from my script (e.g. alert() statements) are visible.
>
> > > I get that there are probably errors in my code: that's not the
> > > problem here. The issue I have is that the errors shouldn't be able to
> > > bring down ff: even infinite loops are caught by the browser itself,
> > > and I would at least see SOMETHING going on there... Clearly
> > > greasemonkey "denial of service" attacks aren't viable, but it's not a
> > > good thing...
>
> > > I can't check the error console as there is no way to get to it (FF
> > > completely locks up and must be force-quit) but I tried disabling all
> > > extensions and the result still stands. If I turn greasemonkey off
> > > (grey monkey) it loads absolutely fine. Other greasemonkey scripts, as
> > > well as this one on other pages, have worked like a charm.
>
> > > To summarise, using the script seen above and visiting archive.php of
> > > that facebook app, firefox crashes to desktop. I wish I could provide
> > > a simpler test case but javascript really isn't my area and i've
> > > stumbled across this while trying to develop my application. I am very
> > > willing to provide additional details as I would love to find out
> > > what's at the root of this problem.
>
> > > --Toby Pinder
>
> > > Environment Details:
>
> > > Windows 7 Professional
> > > Firefox 3.5.7
> > > Greasemonkey 0.8.20091209.4
--
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.