Closed Bug 517577 Opened 15 years ago Closed 3 years ago

'setTimeout()' doesn't recall for global functions in Firefox.

Categories

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

x86
macOS
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ashsechler, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.2 Safari/530.19
Build Identifier: 3.5.3

The following code works fine in Safari, but never in Firefox. 

<html>
<body onload="start();">
<script language="javascript" type="text/javascript">

var boxWidth = 0;
function start(){
document.write('<div class="box" style="position:absolute;top:10px;left:10px;height:400px;background-color:#000000;z-index:0;"></div>');
expandBox();

}
function expandBox() {
boxWidth += 20;
document.getElementsByClassName('box')[0].style.width = boxWidth + 'px';
if(boxWidth < 600) {
window.setTimeout("expandBox()", 42);
}
}
</script>
</body>
</html>

Reproducible: Always

Steps to Reproduce:
1. copy code
2. paste in html file
3. test in any browser
Actual Results:  
setTimeout() doesn't recall the function.

Expected Results:  
 black box expands to 680px width.

Not the first time I've encountered it, Firefox is almost useless when animating with setTimeout().
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.4pre) Gecko/20090915 Shiretoko/3.5.4pre

With Firefox 3.5 I see no black box and with latest trunk and Namoroko I do see a box but a small one.

Only Google Chrome shows a wider box.
Component: General → DOM: Core & HTML
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
What happens if you call it with setTimeout(expandBox, 42) instead of the eval syntax? Does it still not call?
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5

Marking this as Resolved > Worksforme since it cannot be reproduced anymore on the latest versions of Firefox Nightly 96.0a1 (2021-11-10) , beta 95.0b5 or release 94.0.1 on Windows 10 and MacOS 11.6.
If anyone can still reproduce this issue please re-open the bug or file a new one.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.