Skip to main content
Topic: nasty JS bug (Read 1721 times)

nasty JS bug

this bug needed separate topic, as Emdek wanted it like that so others can comment and suggest fixes

the bug or a flaw is caused by simple title-bar-content refresh
what it does is, constant reading-writing to hard-disk and choking of Otter in performance
mind you, I only tested this on my "windows 7" (32bit)

code in question is this:

Code: [Select]

<script language="JavaScript" type="text/javascript">
var txt="stupid rotating title - IT ROTATES AND CHOKES OTTER";
var wait=200;
var refresh=null;
function rotate_title() {
document.title=txt;
txt=txt.substring(1,txt.length)+txt.charAt(0);
refresh=setTimeout("rotate_title()",wait);}
rotate_title();
</script>


here is plain example within clean HTML file if you want to try:

Code: [Select]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="JavaScript" type="text/javascript">
var txt="stupid rotating title - IT ROTATES AND CHOKES OTTER";
var wait=200;
var refresh=null;
function rotate_title() {
document.title=txt;
txt=txt.substring(1,txt.length)+txt.charAt(0);
refresh=setTimeout("rotate_title()",wait);}
rotate_title();
</script>
</head>
<body>
</body>
</html>





Re: nasty JS bug

Reply #1
Nobody's commenting?

My test on Manjaro Linux.

I created an HTML file with the JS content and opened the file in Otter. The stupid rotating title began rotating. Then I opened two more tabs to log in to forums and begin typing. I am typing this text during the test with the stupid rotating title rotating in the neighbouring tab.

There is some audible and visible slowdown in Otter, but the netbook I'm using is feeble itself, other browsers, such as Seamonkey, perform slower here, so I am used to occasional slowdowns.

As I keep typing here, the situation does not seem to be worsening. CPU1/2 run at max %9/%9. RAM has not been increasing. Not out of the ordinary as far as I can tell.  

Re: nasty JS bug

Reply #2
Hi,
for what is it worth, I just checked the sample page with rotating title text via javascript.
On windows 7 I don't see Otter crash or become sluggish while running this script (within about an hour I tested it),
However there is some regular increase in disk activity. I is audible, but not noticebly invasive in any way.
The procesor usage of Otter is between 0-2,5 % with this rotating title; for comparison - scrolling a simple static web page up and down shows about 5 %, for the Gmail inbox such scrolling needs some 15 % processor usage,
regards,
   vbr

Re: nasty JS bug

Reply #3
@ersi, @vbr, the main issue is that changes of title cause regeneration of session file, the bigger session file is, the more disk activity and bigger resources usage...

It might be hard to detect these stupid scripts and we shouldn't simply ignore all requests to update title. :-/
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.

Re: nasty JS bug

Reply #4
Title changes cause issues with session file? I think this is related: I used to have serious problems with the way Otter handled history. It didn't slow down, it didn't increase memory usage, but it could have increased disk activity (which was something I was not watching) and made history and session files quickly fat, and then Otter stalled and failed to start. The solution was to delete history files and session files.

Now I deliberately minimise my history usage. I'd like to use it more.