Closed Bug 109234 Opened 23 years ago Closed 23 years ago

CPU load at 100% just by loading this page.

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
major

Tracking

()

VERIFIED INVALID

People

(Reporter: bugzilla, Assigned: rogerl)

References

()

Details

(Keywords: perf)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5+) Gecko/20011108
BuildID:    2001110815

CPU load goes through the roof when this page is loaded. I'm not sure what else
to say.

Reproducible: Always
Confirming on Linux 2001-11-08-21

->JS Engine for triaging.
Assignee: asa → rogerl
Severity: normal → major
Component: Browser-General → Javascript Engine
Keywords: perf
QA Contact: doronr → pschwartau
The init() function at this site calls a function called instructions()
that does animation. This function calls itself via the setTimeouts below.

The JavaScript Debugger shows the function keeps on calling itself, as
the value of |stopInstructions| never gets set to true unless the user
clicks on the "Hide animation" link toward the upper-left of the page. 


var stopInstructions = false;
function instructions(stage,opacity) {
  if(!stopInstructions) {    
    if(stage==0) { fadeOut = 1; fadeIn = 2; }
    if(stage==1) { fadeOut = 2; fadeIn = 3; }
    if(stage==2) { fadeOut = 3; fadeIn = 4; }
    if(stage==3) { fadeOut = 4; fadeIn = 1; }

    if(browser.ie) objInstruct[fadeOut].css.filter = "alpha (opacity=" +                                                                                                                       
(100-opacity) + ")";
    else objInstruct[fadeOut].css.MozOpacity = (100-opacity) + "%";
    
    if(browser.ie) objInstruct[fadeIn].css.filter = "alpha (opacity=" +                                                                                                                                                                                                
opacity + ")";
    else objInstruct[fadeIn].css.MozOpacity = opacity + "%"; opacity+=10;    

    if(opacity >= 100) {
      stage++;
      opacity=0;

      if(browser.ie) objInstruct[fadeOut].css.filter = "alpha (opacity=0)";
      else objInstruct[fadeOut].css.MozOpacity = "0%";  
    }
    
    if(stage==4) stage=0;
    if(stage==3 && opacity==0) setTimeout("instructions(" + stage + "," 
                                                       + opacity  + ");",1000);  
    else setTimeout("instructions(" + stage + "," + opacity + ");",10);
  

  } else {
    for(i=1;i<=4;i++) objInstruct[i].hide();
  }  
}
bugzilla@samrowe.com: your bug report is accurate, but I have to
mark it as invalid. The setTimeout() that keeps firing above has a
parameter of 10 milliseconds. If the instructions() function is going
to keep calling itself at that interval until the user interacts with the
page, that's going to account for all the CPU.

Note: the JavaScript Debugger is at Tasks | Tools | JavaScript Debugger
in the Mozilla menu. Bring this up first, then load the site. Then you 
can go into the debugger, set a breakpoint in the instructions() function
on the setTimeout, and see the recursion.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Summary: CPU load at 100% just by loading this page. → CPU load at 100% just by loading this page.
Note: IE4 and IE5 don't animate this site at all

Marking Verified - 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.