Closed Bug 31293 Opened 25 years ago Closed 24 years ago

crash on entering function loop

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED WONTFIX

People

(Reporter: jonathanbaron7, Assigned: jst)

References

()

Details

(Keywords: crash)

From Bugzilla Helper:
User-Agent: Mozilla/4.7 [en] (X11; I; Linux 2.2.12-20 i686)
BuildID:    2000022916

Program crashes (won't stop, won't respond to mouse
clicks) when it enters a timing loop.  Although the
loop is poor programming (I'm sure) it works on previous
versions.

Reproducible: Always
Steps to Reproduce:
1. Click on ready button.



Actual Results:  Nothing happens.

Expected Results:  A word should be presented every 2 sec., for 75 sec.

The critical part is here (omitting the rest of the
presentwords() function).  Again, I'm sure this is
bad programming, but I couldn't figure out how to use
setTimeout(), and this DID work in previous Netscape
versions (but not in Internet Explorer).

function wait(x)
{
x+=new Date().getTime()
while (new Date().getTime() < x) {r=r}
return
}

function presentwords()
{
if (done==1)
 {
 document.wordform.word.value=" "+c[1+Math.floor(testitem/2)][testitem%2]
 done=2
 return
 }
Confirmed using W95 20000318. Bounce to JavaScript Engine.

Gerv
Assignee: cbegle → rogerl
Component: Browser-General → Javascript Engine
QA Contact: asadotzler → rginda
Duplicated with NT debug build from 4/17. Seems to hang when going back to the 
DOM for some property. Inserted an alert() call into the driving loop which got 
things running fine.

for (i=1; i <= nsets; i++)
 {
 for (j=1; j<=15; j++)
  {
  document.wordform.word.value=" "+c[iorder[i]][j]
  wait(1500)
  alert("hey");      // <---- with this in place the loop runs fine
  document.wordform.word.value=""
  wait(500)
  }
 }
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: Javascript Engine → DOM Level 0
Ever confirmed: true
QA Contact: rginda → desale
Adding crash keyword.
Keywords: crash
What we really need to solve this if I understand things correctly is the JS
branch callback function, right now we're blocking the main thread while this
script is running so we don't process any events or anything like that, it'll
take a while to get this done. I'll say M17 for now.
Status: NEW → ASSIGNED
Target Milestone: --- → M17
Ok, so the deal here is that the while(...) loop on the page is blocking the
main thread in mozilla and because of that mozilla can't normally handle pain
events and other UI events so while the loop is running it appears as if mozilla
had locked up, but the fact is if you let mozilla run until the script is done
mozilla comes back to life and everything went as planned...

Once bug 13350 is fixed mozilla will alert the user about a looping script is
running and the user will be able to cancel the execution of the script.

Oh, and the reason for things looking better if you insert an alert in the loop
is that the code that opens the alert actually processes paint events on the
other windows while the alert is showing...

So there's really not anything we can do about this, the fact is that the script
needs to be redisigned to work in mozilla. Marking WONTFIX.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
Status: RESOLVED → VERIFIED
Agree with Johnney. Marking verified.
You need to log in before you can comment on or make changes to this bug.