Closed
Bug 332759
Opened 19 years ago
Closed 19 years ago
self.setTimeout not executing under Linux, but running well on Windows (Only when illegal millisecond value is specified)
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 337956
People
(Reporter: fibonacci.prower, Unassigned)
References
(Depends on 1 open bug, )
Details
Attachments
(5 files)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.0.1) Gecko/20060313 Fedora/1.5.0.1-9 Firefox/1.5.0.1 pango-text
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.0.1) Gecko/20060313 Fedora/1.5.0.1-9 Firefox/1.5.0.1 pango-text
Firefox for Linux and for Windows are running scripts differently - in particular, self.setTimeout executes without a problem on the Windows version (even under WINE) though not on the Linux version.
Reproducible: Always
Steps to Reproduce:
Download the attached HTML file, and open it with Firefox for Linux.
Actual Results:
The timer is static when viewed on the Linux version.
Expected Results:
The timer should be running down to zero, as it does on the Windows version, and then display a message when it reaches zero.
Comment 2•19 years ago
|
||
To me at least, it's more interesting that it runs on Windows than that it doesn't run on Linux (or OS X, either). Is it intentional that you're doing it backward, calling InitializeTimer() before you define the vars that the things it calls will use? Your testcase runs fine everywhere if you put the call to InitializeTimer() after you've defined things, instead of counting on them being defined before it gets a chance to call anything.
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Version: 1.5.0.x Branch → Trunk
The JavaScript console doesn't complain about it on Windows.
Comment 4•19 years ago
|
||
Fibonacci, I agree with Phil here. The best coding practices suggest to always declare and define javascript functions (and their related variables) *_before_* calling/executing them. That's true for lots of OOP languages.
Also, it is always better, safer, future-proof to execute functions once the document (and its tree of nodes) is fully loaded, completely loaded.
e.g.
<head>
...
<script type="text/javascript">
... variables declarations and initialisations ...
... functions declarations and definitions ...
</script>
</head>
<body onload=""InitializeTimer();>
(In reply to comment #4)
> Fibonacci, I agree with Phil here. The best coding practices suggest to always
> declare and define javascript functions (and their related variables)
> *_before_* calling/executing them.
Maybe, but most webmasters don't follow them (take a look at the URL I posted), and there's nothing I, or any of you, can do about that. If I'm going to have a browser that only supports "best coding practices", I'll be forever isolated from the internet - that's why I don't use Opera anymore. Firefox *does* support non-best coding practices, but alas, only in Windows, which is not good for me since I'm trying to stop using it. And that is why I'm complaining.
Comment 6•19 years ago
|
||
Seeing the same results here. Regardless of what's best to write, this should work on both machines or neither machine.
Comment 7•19 years ago
|
||
(In reply to comment #1)
> HTML testcase
Fibonacci, is this bug's phenomenon timer related or self.setTimeout related or functionDeclaration position related?
(Q1) What will be displayed when "alert(window.InitializeTimer)" is inserted just
before calling InitializeTimer()?
Since "function InitializeTimer()..." is functionDeclaration (ECMA-262), it should be scaned prior to any Script execution, and function object should be generated as direct child of window object before calling it.
This is difference from functionExpression (ECMA-262) and functionStatement (enhancement by JavaScript 1.5).
(Q2) What will be displayed when next alert is inserted as the first statement of "function StartTheTimer()"?
alert(secs+"\n"+document.getElementById("debug").innerHTML) ;
If alert is issued on each timeout, phenomenon is perhaps innerHTML related.
Bug 161888 is one of innerHTML related problems in the past.
(In reply to comment #7)
>
> (Q1) What will be displayed when "alert(window.InitializeTimer)" is inserted
> just
> before calling InitializeTimer()?
>
An alert box containing the full source code of the function InitializeTimer (except for the comment).
>
> (Q2) What will be displayed when next alert is inserted as the first statement
> of "function StartTheTimer()"?
> alert(secs+"\n"+document.getElementById("debug").innerHTML) ;
Nothing. That is, nothing different from what is displayed without that alert.
Comment 9•19 years ago
|
||
(In reply to comment #8)
> Nothing. That is, nothing different from what is displayed without that alert.
Problem when self.setTimeout?
(Q3) What will be displayed on Linux when next alerts are inserted as first step of function InitializeTimer()?
- alert("Window:\n"+window.setTimeout +"\nSelf:\n"+self.setTimeout);
- alert("Window:\n"+window.StartTheTimer+"\nSelf:\n"+self.StartTheTimer);
Reporter | ||
Comment 10•19 years ago
|
||
(In reply to comment #9)
> Problem when self.setTimeout?
> (Q3) What will be displayed on Linux when next alerts are inserted as first
> step of function InitializeTimer()?
> - alert("Window:\n"+window.setTimeout +"\nSelf:\n"+self.setTimeout);
Window:
function setTimeout() {
[native code]
}
Self:
function setTimeout() {
[native code]
}
> - alert("Window:\n"+window.StartTheTimer+"\nSelf:\n"+self.StartTheTimer);
Window:
function StartTheTimer() {
if (secs==0)
{
document.getElementById("debug").innerHTML += "<br>Countdown ran to completion.";
}
else
{
secs = secs - 1;
document.getElementById("debug").innerHTML = secs + " seconds remaining";
timerRunning = true;
timerID = self.setTimeout("StartTheTimer()", delay);
}
}
Self:
function StartTheTimer() {
same thing as before
}
Comment 11•19 years ago
|
||
(In reply to comment #10)
woom... all functions are defined correctly in both window and self (=window.self=window object itself). Why timeout is not kicked when Linux?
(Q4) What will happen when semicolon is added in parameter specified in
setTimeout? ( self.setTimeout("StartTheTimer();", delay); )
(Q5) What will happen when self.setTimeout is changed to window.setTimeout?
(Q6) What will happen when function declaration is moved to top in <script>?
(i.e. function declaration is coded before reference)
- Define StopTheClock, StartTheTimer, and define InitializeTimer which refers
to StopTheClock & StartTheTimer, then issue "InitializeTimer();".
(Q7) What will happen when calling of InitializeTimer() is postponed until load
completion?
- Remove "InitializeTimer();" from <script> in <body>
- Add onLoad="InitializeTimer();" on <body> tag
Note: Please execute "javascript:alert(secs);" at URLbar after each test in order to see whether timeout is kicked or not.
Reporter | ||
Comment 12•19 years ago
|
||
(In reply to comment #11)
>
> (Q4) What will happen when semicolon is added in parameter specified in
> setTimeout? ( self.setTimeout("StartTheTimer();", delay); )
Nothing new. setTimeout does not shoot, the alert displays the same 14 seconds.
> (Q5) What will happen when self.setTimeout is changed to window.setTimeout?
Nothing new. setTimeout does not shoot.
> (Q6) What will happen when function declaration is moved to top in <script>?
> (i.e. function declaration is coded before reference)
> - Define StopTheClock, StartTheTimer, and define InitializeTimer which refers
> to StopTheClock & StartTheTimer, then issue "InitializeTimer();".
Surprise! setTimeout still doesn't shoot.
You meant, I should move *only* the function declarations to the top, right?
> (Q7) What will happen when calling of InitializeTimer() is postponed until load
> completion?
> - Remove "InitializeTimer();" from <script> in <body>
> - Add onLoad="InitializeTimer();" on <body> tag
setTimeout finally shoots, and the timer runs down to completion.
Comment 13•19 years ago
|
||
(In reply to comment #12)
> > (Q7) What will happen when calling of InitializeTimer() is postponed until
> > load completion?
>
> setTimeout finally shoots, and the timer runs down to completion.
Last question on current test case.
(Q8) What will happen when changing of innerHTML before load completion is
disabled?
1) Comment-out or remove next line in function StartTheTimer.
document.getElementById("debug").innerHTML=secs+" seconds remaining";
2) See javascript:alert(secs) to see whether timeout is invoked or not
Reporter | ||
Comment 14•19 years ago
|
||
(In reply to comment #13)
> Last question on current test case.
> (Q8) What will happen when changing of innerHTML before load completion is
> disabled?
> 1) Comment-out or remove next line in function StartTheTimer.
> document.getElementById("debug").innerHTML=secs+" seconds remaining";
> 2) See javascript:alert(secs) to see whether timeout is invoked or not
Not invoked.
Comment 15•19 years ago
|
||
Difference from original test case.
1. All global variable definitions & function declarations are moved to <head>
2. No HTML modification by JavaScript. Only "alert" is used.
3. setTimeout is specified as window.setTimeout.
4. Number of timeouts is reduced to 2 for ease of test.
5. "setTimeout after load" case is added.
6. "<input type=button>"s are added to start test case and view test result.
7. <script> is not last element of <body>.
(<h3> and <input type=button>s are placed after <script> in <body>)
Test procedure.
1-1. Load the page.
StartTheTimer_1 is kicked => alert
1-2. Click "View result 1" button => alert
2-1. Click "Start timeout loop" button
StartTheTimer_2 is kicked => alert
2-2. Click "View result 2" button => alert
Comment 16•19 years ago
|
||
Fibonacci, will timeout be fired on Linux at step 1-1 of my modified case?
(Major difference from your original is 1 and 7.)
Reporter | ||
Comment 17•19 years ago
|
||
(In reply to comment #16)
> Fibonacci, will timeout be fired on Linux at step 1-1 of my modified case?
> (Major difference from your original is 1 and 7.)
>
It does, apparently. Both alerts with "timeout loop ended" are shown.
Comment 18•19 years ago
|
||
Difference from first case.
1. <script> in <body> is moved to last of <body>
2. All script logic is moved from <head> to <body>
(then no <script> element in <head>)
Fibonacci, how about this case when Linux?
Reporter | ||
Comment 19•19 years ago
|
||
(In reply to comment #18)
> Created an attachment (id=218140) [edit]
> Modified HTML test case No.2
>
> Difference from first case.
> 1. <script> in <body> is moved to last of <body>
> 2. All script logic is moved from <head> to <body>
> (then no <script> element in <head>)
>
> Fibonacci, how about this case when Linux?
>
The same as the last one.
Comment 20•19 years ago
|
||
Variables are tracked by Script.
Modification on original:
1. Global/Local variables are tracked, and saved in an array variable.
2. <input type=button> & functions are added to see traced data.
3. innerHTML setting in StartTheTimer is commented out.
4. Number of loop is reduced to 2.
Comment 21•19 years ago
|
||
I guess difference between Linux & Win is :
When Linux: Global variable of secs is NOT set when secs=15(secs=2 in my case)
is executed in InitializeTime().
When Win : Global variable of secs is also set when secs=15(secs=2 in my case)
is executed in InitializeTime(). (I observed this.)
I believe behaviour when Linux is correct, and I guess begaviour when MS Win is "Quirks" for many many IE based sites.
Fibonacci, can you check difference?
(Load the page, wait for a moment, then click the button.)
Comment 22•19 years ago
|
||
Another possibility :
- Difference on handling of timer value of "undefined" when setTimeout
Since gobal variable of delay is set after first setTimeout call in your test case, window.delay is "undefined" when first call of setTimeout.
It seems that this undefined timer value is accepted when MS Win but is not accepted when Linux.
Reporter | ||
Comment 23•19 years ago
|
||
(In reply to comment #21)
> I guess difference between Linux & Win is :
> When Linux: Global variable of secs is NOT set when secs=15(secs=2 in my case)
> is executed in InitializeTime().
> When Win : Global variable of secs is also set when secs=15(secs=2 in my
> case)
> is executed in InitializeTime(). (I observed this.)
> I believe behaviour when Linux is correct, and I guess begaviour when MS Win is
> "Quirks" for many many IE based sites.
However, we're talking about Firefox here, not IE. Again, this should work on both OSes or neither OS.
> Fibonacci, can you check difference?
> (Load the page, wait for a moment, then click the button.)
>
1. Main(1,1) : window.secs=undefined
2. Main(1,2) : window.timerID=undefined
3. Main(1,3) : window.timerRunning=undefined
4. Main(1,4) : window.delay=undefined
5. InitializeTimer(1,1) : window.secs=undefined
6. InitializeTimer(1,2) : window.timerID=undefined
7. InitializeTimer(1,3) : window.timerRunning=undefined
8. InitializeTimer(1,4) : window.delay=undefined
9. InitializeTimer(2,1) : LOCAL-secs=undefined
10. InitializeTimer(2,2) : LOCAL-timerID=undefined
11. InitializeTimer(2,3) : LOCAL-timerRunning=undefined
12. InitializeTimer(2,4) : LOCAL-delay=undefined
13. InitializeTimer(3,1) : window.secs=2
14. InitializeTimer(3,2) : window.timerID=undefined
15. InitializeTimer(3,3) : window.timerRunning=undefined
16. InitializeTimer(3,4) : window.delay=undefined
17. InitializeTimer(4,1) : LOCAL-secs=2
18. InitializeTimer(4,2) : LOCAL-timerID=undefined
19. InitializeTimer(4,3) : LOCAL-timerRunning=undefined
20. InitializeTimer(4,4) : LOCAL-delay=undefined
21. StopTheClock(1,1) : window.secs=2
22. StopTheClock(1,2) : window.timerID=undefined
23. StopTheClock(1,3) : window.timerRunning=undefined
24. StopTheClock(1,4) : window.delay=undefined
25. StopTheClock(2,1) : LOCAL-secs=2
26. StopTheClock(2,2) : LOCAL-timerID=undefined
27. StopTheClock(2,3) : LOCAL-timerRunning=undefined
28. StopTheClock(2,4) : LOCAL-delay=undefined
29. InitializeTimer(5,1) : window.secs=2
30. InitializeTimer(5,2) : window.timerID=undefined
31. InitializeTimer(5,3) : window.timerRunning=undefined
32. InitializeTimer(5,4) : window.delay=undefined
33. InitializeTimer(6,1) : LOCAL-secs=2
34. InitializeTimer(6,2) : LOCAL-timerID=undefined
35. InitializeTimer(6,3) : LOCAL-timerRunning=undefined
36. InitializeTimer(6,4) : LOCAL-delay=undefined
37. StartTheTimer(1,1) : window.secs=2
38. StartTheTimer(1,2) : window.timerID=undefined
39. StartTheTimer(1,3) : window.timerRunning=undefined
40. StartTheTimer(1,4) : window.delay=undefined
41. StartTheTimer(2,1) : LOCAL-secs=2
42. StartTheTimer(2,2) : LOCAL-timerID=undefined
43. StartTheTimer(2,3) : LOCAL-timerRunning=undefined
44. StartTheTimer(2,4) : LOCAL-delay=undefined
45. StartTheTimer(3,1) : window.secs=1
46. StartTheTimer(3,2) : window.timerID=2
47. StartTheTimer(3,3) : window.timerRunning=true
48. StartTheTimer(3,4) : window.delay=undefined
49. StartTheTimer(4,1) : LOCAL-secs=1
50. StartTheTimer(4,2) : LOCAL-timerID=2
51. StartTheTimer(4,3) : LOCAL-timerRunning=true
52. StartTheTimer(4,4) : LOCAL-delay=undefined
53. InitializeTimer(7,1) : window.secs=1
54. InitializeTimer(7,2) : window.timerID=2
55. InitializeTimer(7,3) : window.timerRunning=true
56. InitializeTimer(7,4) : window.delay=undefined
57. InitializeTimer(8,1) : LOCAL-secs=1
58. InitializeTimer(8,2) : LOCAL-timerID=2
59. InitializeTimer(8,3) : LOCAL-timerRunning=true
60. InitializeTimer(8,4) : LOCAL-delay=undefined
61. Main(2,1) : window.secs=1
62. Main(2,2) : window.timerID=2
63. Main(2,3) : window.timerRunning=true
64. Main(2,4) : window.delay=undefined
65. Main(3,1) : window.secs=1
66. Main(3,2) : window.timerID=null
67. Main(3,3) : window.timerRunning=false
68. Main(3,4) : window.delay=1000
Comment 24•19 years ago
|
||
(In reply to comment #23)
My comment #21 was incorrect.
Since "secs=2;" instead of "var secs=2;" in InitializeTimer(), local variable of "secs" is not defined, and variable of higher scope is searched.
But, because no decalaration of "secs"(var secs;) is executed before call of InitializeTimer(), variable of "secs" is not found, then "secs" is defined in highest scope(=window.secs, Global variable).
This was same on Linux and Win, and has no relation to this bug's phenomenon.
What happens in your test case was :
- If millisecond value(second parameter of setTimeout call, "delay" in your
test case) is "undefined",
(A) When MS Win, timerID of 2 is returned, and timeout fires.
(B) When Linux, timeout will not fire, even though timerID(2 when first call
of setTimeout in your case) is returned with no error.
"undefined" of variable of "delay" itself is user error, and I believe no clear specification exists for "undefined" of millisecond value for setTimeout.
Do you know what number will be used by Firefox when setTimeout(xxx,"undefined")?
How about IE?
Can you test next script? Will timeout fire? Diffrent from MS Win when Linux?
<script>
// delay is not declared -> "undefined"
var timerID=window.setTimeout("alert(String(timerID));",delay);
</script>
(I think this is minimum test case for this bug.)
But inconsistency in user error handling between Linux and Win apparently exists as you and other comment posters say. Which is correct behaviour do you think?
Since timerID of 2 is returned with no error on Linux too, I think timeout should fire on Linux too. If "no timeout will fire" is correct behaviour, I think generation of script error is needed(at least warning message).
Reporter | ||
Comment 25•19 years ago
|
||
(In reply to comment #24)
>
> Can you test next script? Will timeout fire? Diffrent from MS Win when Linux?
> <script>
> // delay is not declared -> "undefined"
> var timerID=window.setTimeout("alert(String(timerID));",delay);
> </script>
> (I think this is minimum test case for this bug.)
>
Timeout does not fire.
Javascript:alert(String(timerID));
undefined
Javascript:alert(delay);
No alert is displayed.
Comment 26•19 years ago
|
||
(In reply to comment #25)
> Timeout does not fire.
> Javascript:alert(String(timerID)); => undefined
> Javascript:alert(delay); => No alert is displayed.
Woom... That was not minimum case...
Is there any error message on JavaScript Console?
Can you check difference among next 4 cases?
1. Open new tab(CTRL+T)
2. setTimeout call
2-1. javascript:
var timerID=setTimeout("alert(String(timerID));",delay);
2-2. javascript:
var delay;var timerID=setTimeout("alert(String(timerID));",delay);
2-3. javascript:
var timerID=setTimeout("alert(String(timerID);",delay);var delay;
2-4. javascript:
var timerID=setTimeout("alert(String(timerID);",delay);var delay=1000;
(This is your test case)
3. javascript:alert(timerID)
Following is my test result with Seamonkey on MS Win.
2-1. (no "var delay")
JavaScript error of "delay is not defined", and timerID is undefined.
(This means setTimeout call fails. Same result as your comment #25)
2-2 & 2-3 & 2-4. ("var delay" is coded)
Timeout fired.
Variable of "undefined" has at least two different meanings : "Undeclared" and "Declared but uninitialized". And setTimeout(xxx,delay) seems to generate JavaScript error if "delay" is "Undeclared" but no error if "delay" is "Declared but uninitialized". And "delay" seems to become "Declared but uninitialized" even when case 2-3 and 2-4. And "the accepted timeout will fire or not" depends on OS.
What will happen when "var delay=1000;" after InitializeTimer() is removed from your test case?
Reporter | ||
Comment 27•19 years ago
|
||
(In reply to comment #26)
> Woom... That was not minimum case...
> Is there any error message on JavaScript Console?
Yes: "delay is not defined".
> Can you check difference among next 4 cases?
> 1. Open new tab(CTRL+T)
> 2. setTimeout call
> 2-1. javascript:
> var timerID=setTimeout("alert(String(timerID));",delay);
Javascript error: delay is not defined
Alert box: undefined
> 2-2. javascript:
> var delay;var timerID=setTimeout("alert(String(timerID));",delay);
No Javascript errors.
Alert box: 2
> 2-3. javascript:
> var timerID=setTimeout("alert(String(timerID);",delay);var delay;
No Javascript errors.
Alert box: 2
> 2-4. javascript:
> var timerID=setTimeout("alert(String(timerID);",delay);var delay=1000;
> (This is your test case)
No Javascript errors.
Alert box: 2
And in no case did Timeout fire.
> Variable of "undefined" has at least two different meanings : "Undeclared" and
> "Declared but uninitialized". And setTimeout(xxx,delay) seems to generate
> JavaScript error if "delay" is "Undeclared" but no error if "delay" is
> "Declared but uninitialized". And "delay" seems to become "Declared but
> uninitialized" even when case 2-3 and 2-4. And "the accepted timeout will fire
> or not" depends on OS.
Which shouldn't.
>
> What will happen when "var delay=1000;" after InitializeTimer() is removed from
> your test case?
>
Javascript error: delay is not defined
Otherwise, the same as before.
Comment 28•19 years ago
|
||
(In reply to comment #26)
> Which shouldn't.
I dont't know, but I think nexts on this bug's issue.
(1)"delay" becomes "Declared but uninitialized" even when case 2-3 and 2-4.
I think this is probably current "design".
Try next javascript after CTRL+T. (merge to single line)
javascript:
var obj=window;var x;var txt=new Array();ug's issue
txt[txt.lengh]="<"+"p>";
for(x in window){txt[txt.length]="<"+"br>"+x;}
txt[txt.length]="<"+"/p>";
var w=window.open("","");
w.document.open();w.document.write(txt.join("\n"));w.document.close();
Although decralation of "var w" is after "for(x in obj)", window.w is
already defined when execution of "(for x in obj).
This indicates global variable by var(window.<variable_name>) is generated
at compile stage or syntax check stage.
(2)setTimeout(...,delay) is executed with no error, even when delay is
"undefined" due to "Declared but uninitialized".
I think it's better to generate "delay is undefined" error as done
when delay is "Undeclared".
But I think also "JavaScript Error by JavaScript engine" may be difficult,
since "alert(delay);var delay;" displays "undefined" with no error
although "alert(delay);" generates "delay is not defined" error.
So I think setTimeout function is better to reject "undefined" of
millisecond value parameter(second parameter).
(3)"the accepted timeout will fire or not" depends on OS.
If "setTimeout(xxx,<Decalred but uninitialized variable>);" is accepted,
it should fire even when Linux.
If it will be rejected, it should be rejected both when MS Win and Linux.
Behaviour should be consistent among OS'es.
Reporter | ||
Comment 29•19 years ago
|
||
(In reply to comment #28)
>
> (1)"delay" becomes "Declared but uninitialized" even when case 2-3 and 2-4.
>
> I think this is probably current "design".
> Try next javascript after CTRL+T. (merge to single line)
> javascript:
> var obj=window;var x;var txt=new Array();ug's issue
> txt[txt.lengh]="<"+"p>";
> for(x in window){txt[txt.length]="<"+"br>"+x;}
> txt[txt.length]="<"+"/p>";
> var w=window.open("","");
> w.document.open();w.document.write(txt.join("\n"));w.document.close();
window
w
txt
x
obj
navigator
document
Packages
sun
java
netscape
XPCNativeWrapper
Components
length
parent
top
scrollbars
name
scrollX
scrollY
scrollTo
scrollBy
getSelection
scrollByLines
scrollByPages
sizeToContent
dump
setTimeout
setInterval
clearTimeout
clearInterval
setResizable
captureEvents
releaseEvents
routeEvent
enableExternalCapture
disableExternalCapture
prompt
open
openDialog
frames
find
self
screen
history
content
menubar
toolbar
locationbar
personalbar
statusbar
directories
closed
crypto
pkcs11
controllers
opener
status
defaultStatus
innerWidth
innerHeight
outerWidth
outerHeight
screenX
screenY
pageXOffset
pageYOffset
scrollMaxX
scrollMaxY
fullScreen
alert
confirm
focus
blur
back
forward
home
stop
print
moveTo
moveBy
resizeTo
resizeBy
scroll
close
updateCommands
atob
btoa
frameElement
removeEventListener
dispatchEvent
getComputedStyle
Reporter | ||
Comment 30•19 years ago
|
||
I've just checked, and the bug is still present on version 1.5.0.2.
Comment 31•19 years ago
|
||
Confirming based on test result of comment #6, and many additional tests I requested by Fibonacci. Sorry for late confirming(I don't have Linux...).
I tested additional cases:
(0) var delay=0; timerID=setTimeout("alert('?');",delay); // Valid
(1) var delay; timerID=setTimeout("alert('?');",delay);
(2) var delay=-1; timerID=setTimeout("alert('?');",delay);
(3) var delay=null; timerID=setTimeout("alert('?');",delay);
(4) var delay=NaN; timerID=setTimeout("alert('?');",delay);
(5) var delay=-Infinity; timerID=setTimeout("alert('?');",delay);
(6) var delay=Infinity; timerID=setTimeout("alert('?');",delay); // Valid?
With Seamonkey on MS Win, alert is issued just after setTimeout execution when case (0) thru (5), but no alert when case (6).
This indicates "Invalid millisecond value is treated as ZERO" when MS Win.
I don't know about "Infinity", whether very large millisecond value is used or really Infinity, i.e. timeout will never fire.
What will happen when delay=0, delay=NaN and delay=Infinity(=0/0) when Linux?
Difference between MS Win and Linux is possibly difference between "ZERO" or "Infinity" when invalid millisecond value in setTimeout request.
Is there any way to know what value is really used by setTimeout when illegal miliisecond value is specified?
Is there any way to know what timer value is really used when timer event request to OS by Firefox?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•19 years ago
|
Summary: self.setTimeout not executing under Linux, but running well on Windows → self.setTimeout not executing under Linux, but running well on Windows (Only when illegal millisecond value is specified)
Reporter | ||
Comment 32•19 years ago
|
||
(In reply to comment #31)
>
> I tested additional cases:
How, exactly? Javascript:yourcode in the URL bar?
> (0) var delay=0; timerID=setTimeout("alert('?');",delay); // Valid
> (1) var delay; timerID=setTimeout("alert('?');",delay);
> (2) var delay=-1; timerID=setTimeout("alert('?');",delay);
> (3) var delay=null; timerID=setTimeout("alert('?');",delay);
> (4) var delay=NaN; timerID=setTimeout("alert('?');",delay);
> (5) var delay=-Infinity; timerID=setTimeout("alert('?');",delay);
> (6) var delay=Infinity; timerID=setTimeout("alert('?');",delay); // Valid?
>
All cases produce exactly the same result: a '2' printed in the document, and no alert box.
Does this have anything to do with the fact that I'm now using 1.5.0.2? None of the tests that produced alert boxes before do so now...
Comment 33•19 years ago
|
||
(In reply to comment #32)
> How, exactly? Javascript:yourcode in the URL bar?
Yes.
javascript:var delay=xxx;timerID=setTimeout("alert('?');",delay);
(xxx varies. Exeption: when case (1), no "=xxx" portion.)
And javascript:alert(timerID); after test, if required.
> All cases produce exactly the same result: a '2' printed in the document, and
> no alert box.
Is it true even when case (0)? (setTimeout(...,0) case)
If yes, this bug's problem may be one of nexts;
If invalid millisecond value or ZERO millisecond value,
(a) Large value or Inifinity is used when Linux.
(b) Timeout won't fire due to some internal errors.
(c) ZERO of timer call of Linux means "no timeout fire", or Linux ignores,
or Linux returns error code.
How about "no millisecond value" case?
javascript:timerID=setTimeout("alert('?');");
(Invalid request, and ZERO is probably used when MS Win, )
(then timeout fires just after setTimeout call when MS Win.)
How about "1 millisecond value" case? (Apparently correct script case)
javascript:timerID=setTimeout("alert('?');",1);
If assumption of "ZERO is used" is right, solution can be defaulting to 1 or more millisecond value instead of ZERO, when invalid/no millisecond value or ZERO millisecond value. I believe there is no need to support ZERO millisecond value for setTimeout and setInterval call.
Reporter | ||
Comment 34•19 years ago
|
||
(In reply to comment #33)
> (In reply to comment #32)
> > How, exactly? Javascript:yourcode in the URL bar?
> Yes.
> javascript:var delay=xxx;timerID=setTimeout("alert('?');",delay);
> (xxx varies. Exeption: when case (1), no "=xxx" portion.)
> And javascript:alert(timerID); after test, if required.
>
> > All cases produce exactly the same result: a '2' printed in the document, and
> > no alert box.
>
> Is it true even when case (0)? (setTimeout(...,0) case)
Yes, even in that case.
> If yes, this bug's problem may be one of nexts;
> If invalid millisecond value or ZERO millisecond value,
> (a) Large value or Inifinity is used when Linux.
> (b) Timeout won't fire due to some internal errors.
> (c) ZERO of timer call of Linux means "no timeout fire", or Linux ignores,
> or Linux returns error code.
That, however, does not explain the printed "2", or the fact that Javascript:var delay;var timerID=setTimeout("alert(String(timerID));",delay); which used to produce an alert box on 1.5.0.1, does not do so now (in Linux; it's still working in Windows).
> How about "no millisecond value" case?
> javascript:timerID=setTimeout("alert('?');");
An alert box containing a '?' appears, and a '2' is printed in the document afterwards.
> (Invalid request, and ZERO is probably used when MS Win, )
> (then timeout fires just after setTimeout call when MS Win.)
> How about "1 millisecond value" case? (Apparently correct script case)
> javascript:timerID=setTimeout("alert('?');",1);
Same result as before.
Comment 35•19 years ago
|
||
(In reply to comment #34)
> That, however, does not explain the printed "2", or the fact that
> Javascript:var delay;var timerID=setTimeout("alert(String(timerID));",delay);
> which used to produce an alert box on 1.5.0.1, does not do so now (in Linux;
> it's still working in Windows).
Fx 1.5.0.1 on Linux really produced alert box on Linux when this case?
Next two cases are same, from point of view of existence of window.delay when execution of setTimeout.
(A) var timerID=setTimeout("alert('?');",delay); var delay; // Your case
(B) var delay;var timerID=setTimeout("alert('?');",delay);
Only difference is:
When (A) : window.delay is created at compile stage.
When (B) : window.delay is initialized to null by execution of "var delay;",
after creation of window.delay at compile stage.
And your commet #0 sounds "(A) doesn't produce alert" when Fx 1.5.0.1.
Different result between (A) and (B) when Firefox 1.5.0.1 on Linux?
What versions of Fx "used to produce" alert in your test case or (B)?
> > Is it true even when case (0)? (setTimeout(...,0) case)
> Yes, even in that case.
Sounds root issue is "timeout won't fire when setTimeout(...,0) when Linux", since ZERO seems to be used when invalid millisecond value.
Fibonacci, open new bug for "0 millisecond" issue, after cheking whether problem is recreatable with Fx 1.0.x or not.
If "0 millisecond" issue will be resolved, I think this bug will varnish.
Reporter | ||
Comment 36•19 years ago
|
||
(In reply to comment #35)
> (In reply to comment #34)
> > That, however, does not explain the printed "2", or the fact that
> > Javascript:var delay;var timerID=setTimeout("alert(String(timerID));",delay);
> > which used to produce an alert box on 1.5.0.1, does not do so now (in Linux;
> > it's still working in Windows).
>
> Fx 1.5.0.1 on Linux really produced alert box on Linux when this case?
Yes, it did.
> Next two cases are same, from point of view of existence of window.delay when
> execution of setTimeout.
> (A) var timerID=setTimeout("alert('?');",delay); var delay; // Your case
> (B) var delay;var timerID=setTimeout("alert('?');",delay);
> Only difference is:
> When (A) : window.delay is created at compile stage.
> When (B) : window.delay is initialized to null by execution of "var delay;",
> after creation of window.delay at compile stage.
> And your commet #0 sounds "(A) doesn't produce alert" when Fx 1.5.0.1.
> Different result between (A) and (B) when Firefox 1.5.0.1 on Linux?
> What versions of Fx "used to produce" alert in your test case or (B)?
I'd have to reinstall an old version. Where can I get it?
>
> > > Is it true even when case (0)? (setTimeout(...,0) case)
> > Yes, even in that case.
>
> Sounds root issue is "timeout won't fire when setTimeout(...,0) when Linux",
> since ZERO seems to be used when invalid millisecond value.
> Fibonacci, open new bug for "0 millisecond" issue, after cheking whether
> problem is recreatable with Fx 1.0.x or not.
> If "0 millisecond" issue will be resolved, I think this bug will varnish.
Wouldn't that leave this bug as a duplicate of that one?
Comment 37•19 years ago
|
||
(In reply to comment #36)
> Where can I get it?
Old releases. Go http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/1.0.8/linux-i686/
http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/1.5/linux-i686/
http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/1.5.0.1/linux-i686/
Latest trunk(for development of Fx 3.0, not for Fx 1.5.0.x nor Fx 2.0)
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
> Wouldn't that leave this bug as a duplicate of that one?
This bug is better to be kept open, with setting "Depends on" to new bug.
At least nexts are to be clarified in this bug.
- whether ZERO is used or not when invalid millisecond value
- whether correct behaviour nor not when invalid millisecond value
Reporter | ||
Comment 38•19 years ago
|
||
This are my results:
1.0.8:
var delay=0;timerID=setTimeout("alert('?');",delay); //No alert, '2' printed on document
var timerID=setTimeout("alert('?');",delay); var delay; //No alert, nothing printed
var delay;var timerID=setTimeout("alert('?');",delay); //No alert, nothing printed
1.5:
var delay=0;timerID=setTimeout("alert('?');",delay); //'?' on alert, '2' printed
var timerID=setTimeout("alert('?');",delay); var delay; //No alert, nothing printed
var delay;var timerID=setTimeout("alert('?');",delay); //No alert, nothing printed
1.5.0.1:
var delay=0;timerID=setTimeout("alert('?');",delay); //No alert, '2' printed
var timerID=setTimeout("alert('?');",delay); var delay; //No alert, nothing printed
var delay;var timerID=setTimeout("alert('?');",delay); //No alert, nothing printed
So... should I open the new bug or not?
Comment 39•19 years ago
|
||
(In reply to comment #38)
> 1.0.8:
> var delay=0;timerID=setTimeout("alert('?');",delay); //No alert, '2' printed on
> document
> 1.5:
> var delay=0;timerID=setTimeout("alert('?');",delay); //'?' on alert, '2'
> printed
> 1.5.0.1:
> var delay=0;timerID=setTimeout("alert('?');",delay); //No alert, '2' printed
"delay=0" case looks to be independent problem from this bug(invalid delay value such as null, undefined, NaN), and looks for me to be a regression of problem resolved by Fx 1.5.0.0.
And your test result with 1.5.0.0 indicates that this bug won't automatically disappear even if delay=0 case will be resolved.
(My guess/exptectation/hope was found to be incorrect.)
Fibonacci, open new bug, indicating "spin-off of bug 332759 comment #38", and put the bug number in "depends on:" field of this bug.
Comment 40•19 years ago
|
||
(In reply to comment #38)
> 1.5:
> var timerID=setTimeout("alert('?');",delay); var delay; //No alert, nothing
> printed
> 1.5.0.1:
> var timerID=setTimeout("alert('?');",delay); var delay; //No alert, nothing
> printed
Fibonacci, following is your answer in Comment #27.
> 2-3. javascript:
> var timerID=setTimeout("alert(String(timerID);",delay);var delay;
> No Javascript errors.
> Alert box: 2
And you said timeout didn't fire in this case.
What is difference between Comment #27 and comment #38?
Reporter | ||
Comment 41•19 years ago
|
||
(In reply to comment #40)
> (In reply to comment #38)
> > 1.5:
> > var timerID=setTimeout("alert('?');",delay); var delay; //No alert, nothing
> > printed
> > 1.5.0.1:
> > var timerID=setTimeout("alert('?');",delay); var delay; //No alert, nothing
> > printed
>
> Fibonacci, following is your answer in Comment #27.
> > 2-3. javascript:
> > var timerID=setTimeout("alert(String(timerID);",delay);var delay;
> > No Javascript errors.
> > Alert box: 2
> And you said timeout didn't fire in this case.
>
> What is difference between Comment #27 and comment #38?
>
I don't know. When I had the Fx 1.5.0.1 that came with my Fedora Core 5 installation, the alert box appeared. When I removed my current Fx installation and installed the 1.5.0.1 version downloaded from the official page, the alert box didn't appear. Maybe the version that comes with FC5 is not an official one?
Reporter | ||
Comment 42•19 years ago
|
||
(In reply to comment #39)
>
> Fibonacci, open new bug, indicating "spin-off of bug 332759 comment #38", and
> put the bug number in "depends on:" field of this bug.
>
When I tried to make an HTML testcase for that bug, I found that timeout with 0 miliseconds DOES fire from an HTML file. It still does not, however, from the URL bar.
Comment 43•19 years ago
|
||
Click "View Data" button after load completion.
Comment 44•19 years ago
|
||
Test result with Seamonkey 2005040309/Win-2K.
>When 'View Data' is clicked:
>userAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1)
>Gecko/20060403 SeaMonkey/1.5a
>Now is 2043
>1. Timestamp=30 : Test_Case=1. 0/ timerID=2 / Timeout fired. ( Timestamp=321 )
>2. Timestamp=30 : Test_Case=2. -0/ timerID=3 / Timeout fired. ( Timestamp=321 )
>3. Timestamp=30 : Test_Case=3. -1/ timerID=4 / Timeout fired. ( Timestamp=321 )
>4. Timestamp=30 : Test_Case=4. '???'/ timerID=5 / Timeout fired. ( Timestamp=321 )
>5. Timestamp=30 : Test_Case=5. null/ timerID=6 / Timeout fired. ( Timestamp=321 )
>6. Timestamp=30 : Test_Case=6. NaN/ timerID=7 / Timeout fired. ( Timestamp=321 )
>7. Timestamp=30 : Test_Case=7. Infinity/ timerID=8 / Timeout is still not fired.
>8. Timestamp=40 : Test_Case=8. -Infinity/ timerID=9 / Timeout fired. ( Timestamp=321 )
>9. Timestamp=40 : Test_Case=9. No-parameter/ timerID=10 / Timeout fired. ( Timestamp=321 )
>10. Timestamp=40 : Test_Case=10. delay_declared_in_head/ timerID=11 / Timeout fired. ( Timestamp=321 )
>11. Timestamp=40 : Test_Case=11. delay_declared_in_body/ timerID=12 / Timeout fired. ( Timestamp=321 )
>12. Timestamp=40 : Test_Case=12. 2000/ timerID=13 / Timeout is still not fired.
>13. Timestamp=40 : Test_Case=13. 1000/ timerID=14 / Timeout fired. ( Timestamp=1032 )
>14. Timestamp=40 : Test_Case=14. 500/ timerID=15 / Timeout fired. ( Timestamp=531 )
>15. Timestamp=40 : Test_Case=15. 100/ timerID=16 / Timeout fired. ( Timestamp=321 )
>16. Timestamp=40 : Test_Case=16. 30/ timerID=17 / Timeout fired. ( Timestamp=321 )
Reporter | ||
Comment 45•19 years ago
|
||
(In reply to comment #43)
> Created an attachment (id=220374) [edit]
> HTML case of invalid millisecond value variations(null,NaN,'???',-Infinity
> etc.)
>
> Click "View Data" button after load completion.
>
When 'View Data' is clicked:
userAgent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.0.1) Gecko/20060313 Fedora/1.5.0.1-9 Firefox/1.5.0.2 pango-text
Now is 11722
1. Timestamp=24 : Test_Case=1. 0/ timerID=2 / Timeout fired. ( Timestamp=121 )
2. Timestamp=25 : Test_Case=2. -0/ timerID=3 / Timeout fired. ( Timestamp=121 )
3. Timestamp=25 : Test_Case=3. -1/ timerID=4 / Timeout fired. ( Timestamp=121 )
4. Timestamp=25 : Test_Case=4. '???'/ timerID=5 / Timeout fired. ( Timestamp=121 )
5. Timestamp=25 : Test_Case=5. null/ timerID=6 / Timeout fired. ( Timestamp=121 )
6. Timestamp=25 : Test_Case=6. NaN/ timerID=7 / Timeout fired. ( Timestamp=121 )
7. Timestamp=25 : Test_Case=7. Infinity/ timerID=8 / Timeout fired. ( Timestamp=121 )
8. Timestamp=25 : Test_Case=8. -Infinity/ timerID=9 / Timeout fired. ( Timestamp=121 )
9. Timestamp=25 : Test_Case=9. No-parameter/ timerID=10 / Timeout fired. ( Timestamp=121 )
10. Timestamp=25 : Test_Case=10. delay_declared_in_head/ timerID=11 / Timeout fired. ( Timestamp=121 )
11. Timestamp=25 : Test_Case=11. delay_declared_in_body/ timerID=12 / Timeout fired. ( Timestamp=121 )
12. Timestamp=25 : Test_Case=12. 2000/ timerID=13 / Timeout fired. ( Timestamp=2037 )
13. Timestamp=25 : Test_Case=13. 1000/ timerID=14 / Timeout fired. ( Timestamp=1044 )
14. Timestamp=26 : Test_Case=14. 500/ timerID=15 / Timeout fired. ( Timestamp=507 )
15. Timestamp=26 : Test_Case=15. 100/ timerID=16 / Timeout fired. ( Timestamp=136 )
16. Timestamp=26 : Test_Case=16. 30/ timerID=17 / Timeout fired. ( Timestamp=122 )
Comment 46•19 years ago
|
||
(In reply to comment #45)
> userAgent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.0.1) Gecko/20060313
> Fedora/1.5.0.1-9 Firefox/1.5.0.2 pango-text
>11. Timestamp=25 : Test_Case=11. delay_declared_in_body/ timerID=12 / Timeout fired. ( Timestamp=121 )
What is difference from your original report with original case?
No other successfull timeout firering when your original case?
Where function is difined?
- When this case, function is defined in head.
- When your original case, function is defined in body.
> 7. Timestamp=25 : Test_Case=7. Infinity/ timerID=8 / Timeout fired. (
> Timestamp=121 )
Why timeout still doesn't fire when my MS Win, although timeout fired on your Linux?
Reporter | ||
Comment 47•19 years ago
|
||
(In reply to comment #46)
>
> What is difference from your original report with original case?
Don't know, but timeout still does not fire either in the original testcase or in the provided URL.
> No other successfull timeout firering when your original case?
Not at all.
> Why timeout still doesn't fire when my MS Win, although timeout fired on your
> Linux?
No idea.
To further complicate things, I ran the test on my Fx 1.5.0.2 for Windows, under WINE. Here are the results - all timeouts fire, except for the one using Infinity:
When 'View Data' is clicked:
userAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; it; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2
Now is 12600
1. Timestamp=13 : Test_Case=1. 0/ timerID=2 / Timeout fired. ( Timestamp=98 )
2. Timestamp=13 : Test_Case=2. -0/ timerID=3 / Timeout fired. ( Timestamp=98 )
3. Timestamp=13 : Test_Case=3. -1/ timerID=4 / Timeout fired. ( Timestamp=98 )
4. Timestamp=13 : Test_Case=4. '???'/ timerID=5 / Timeout fired. ( Timestamp=98 )
5. Timestamp=14 : Test_Case=5. null/ timerID=6 / Timeout fired. ( Timestamp=98 )
6. Timestamp=14 : Test_Case=6. NaN/ timerID=7 / Timeout fired. ( Timestamp=98 )
7. Timestamp=14 : Test_Case=7. Infinity/ timerID=8 / Timeout is still not fired.
8. Timestamp=14 : Test_Case=8. -Infinity/ timerID=9 / Timeout fired. ( Timestamp=98 )
9. Timestamp=14 : Test_Case=9. No-parameter/ timerID=10 / Timeout fired. ( Timestamp=98 )
10. Timestamp=14 : Test_Case=10. delay_declared_in_head/ timerID=11 / Timeout fired. ( Timestamp=98 )
11. Timestamp=14 : Test_Case=11. delay_declared_in_body/ timerID=12 / Timeout fired. ( Timestamp=98 )
12. Timestamp=14 : Test_Case=12. 2000/ timerID=13 / Timeout fired. ( Timestamp=2012 )
13. Timestamp=15 : Test_Case=13. 1000/ timerID=14 / Timeout fired. ( Timestamp=1010 )
14. Timestamp=15 : Test_Case=14. 500/ timerID=15 / Timeout fired. ( Timestamp=502 )
15. Timestamp=15 : Test_Case=15. 100/ timerID=16 / Timeout fired. ( Timestamp=106 )
16. Timestamp=15 : Test_Case=16. 30/ timerID=17 / Timeout fired. ( Timestamp=98 )
Comment 48•19 years ago
|
||
I've opend Bug 337540 for "No JavaScript error" when x=setTimeout('...',delay);var delay;
Fibonacci, can you open bug for no-timeout-fire problem on Linux when "javascript:var timerID=setTimeout('alert(...);',0);"?
(comment #31 to comment #34)
Comment 49•19 years ago
|
||
(In reply to comment #48)
By Bob Clary's answer to Bug 337540, it's found that VariableDeclaration is processed at compile(scan) stage as for FunctionDeclaration, and the variable is set to "undefined" initially.
So, "x=setTimeout('...',delay);var delay;" is equivallent to "var delay;x=setTimeout('...',delay);" for this bug.
Fibonacci, can you open another bug for no-timeout-fire problem on Linux when
"javascript:var delay;var timerID=setTimeout('alert(...);',delay);" or "javascript:var timerID=setTimeout('alert(...);',NaN);"?
It seems that "undefined of delay" case is same as "ZERO of delay" case, because ZERO seems to be used when non-number.
But I think it's better to be separated initially, since ZERO is valid number(although I believe illegal value for setTimeout) but undefined/NaN/null are apperently invalid, not number.
Remaining questions:
Even though all test cases of commet #45 fire timeout when Linux,
(1) Why your original case(and test case with my modification. comment #23)
doesn't fire timeout when Linux?
(2) Why Infinity case in comment #45 doesn't fire timeout when MS Win
but fires timeout when Linux?
Reporter | ||
Comment 50•19 years ago
|
||
I've reran the tests on 1.5.0.3, this are the results:
Original HTML testcase:
Timer won't start. Bug still present.
Modified HTML testcase:
StartTheTimer_1: timeout loop ended.
CASE-1: ii=0,number,2 ii=1,number,3
StartTheTimer_2: timeout loop ended.
CASE-2: ii=0,number,4 ii=1,number,5
Modified HTML testcase no. 2:
Same thing as number 1.
HTML/Script for track variables in original test case:
1. Main(1,1) : window.secs=undefined
2. Main(1,2) : window.timerID=undefined
3. Main(1,3) : window.timerRunning=undefined
4. Main(1,4) : window.delay=undefined
5. InitializeTimer(1,1) : window.secs=undefined
6. InitializeTimer(1,2) : window.timerID=undefined
7. InitializeTimer(1,3) : window.timerRunning=undefined
8. InitializeTimer(1,4) : window.delay=undefined
9. InitializeTimer(2,1) : LOCAL-secs=undefined
10. InitializeTimer(2,2) : LOCAL-timerID=undefined
11. InitializeTimer(2,3) : LOCAL-timerRunning=undefined
12. InitializeTimer(2,4) : LOCAL-delay=undefined
13. InitializeTimer(3,1) : window.secs=2
14. InitializeTimer(3,2) : window.timerID=undefined
15. InitializeTimer(3,3) : window.timerRunning=undefined
16. InitializeTimer(3,4) : window.delay=undefined
17. InitializeTimer(4,1) : LOCAL-secs=2
18. InitializeTimer(4,2) : LOCAL-timerID=undefined
19. InitializeTimer(4,3) : LOCAL-timerRunning=undefined
20. InitializeTimer(4,4) : LOCAL-delay=undefined
21. StopTheClock(1,1) : window.secs=2
22. StopTheClock(1,2) : window.timerID=undefined
23. StopTheClock(1,3) : window.timerRunning=undefined
24. StopTheClock(1,4) : window.delay=undefined
25. StopTheClock(2,1) : LOCAL-secs=2
26. StopTheClock(2,2) : LOCAL-timerID=undefined
27. StopTheClock(2,3) : LOCAL-timerRunning=undefined
28. StopTheClock(2,4) : LOCAL-delay=undefined
29. InitializeTimer(5,1) : window.secs=2
30. InitializeTimer(5,2) : window.timerID=undefined
31. InitializeTimer(5,3) : window.timerRunning=undefined
32. InitializeTimer(5,4) : window.delay=undefined
33. InitializeTimer(6,1) : LOCAL-secs=2
34. InitializeTimer(6,2) : LOCAL-timerID=undefined
35. InitializeTimer(6,3) : LOCAL-timerRunning=undefined
36. InitializeTimer(6,4) : LOCAL-delay=undefined
37. StartTheTimer(1,1) : window.secs=2
38. StartTheTimer(1,2) : window.timerID=undefined
39. StartTheTimer(1,3) : window.timerRunning=undefined
40. StartTheTimer(1,4) : window.delay=undefined
41. StartTheTimer(2,1) : LOCAL-secs=2
42. StartTheTimer(2,2) : LOCAL-timerID=undefined
43. StartTheTimer(2,3) : LOCAL-timerRunning=undefined
44. StartTheTimer(2,4) : LOCAL-delay=undefined
45. StartTheTimer(3,1) : window.secs=1
46. StartTheTimer(3,2) : window.timerID=2
47. StartTheTimer(3,3) : window.timerRunning=true
48. StartTheTimer(3,4) : window.delay=undefined
49. StartTheTimer(4,1) : LOCAL-secs=1
50. StartTheTimer(4,2) : LOCAL-timerID=2
51. StartTheTimer(4,3) : LOCAL-timerRunning=true
52. StartTheTimer(4,4) : LOCAL-delay=undefined
53. InitializeTimer(7,1) : window.secs=1
54. InitializeTimer(7,2) : window.timerID=2
55. InitializeTimer(7,3) : window.timerRunning=true
56. InitializeTimer(7,4) : window.delay=undefined
57. InitializeTimer(8,1) : LOCAL-secs=1
58. InitializeTimer(8,2) : LOCAL-timerID=2
59. InitializeTimer(8,3) : LOCAL-timerRunning=true
60. InitializeTimer(8,4) : LOCAL-delay=undefined
61. Main(2,1) : window.secs=1
62. Main(2,2) : window.timerID=2
63. Main(2,3) : window.timerRunning=true
64. Main(2,4) : window.delay=undefined
65. Main(3,1) : window.secs=1
66. Main(3,2) : window.timerID=null
67. Main(3,3) : window.timerRunning=false
68. Main(3,4) : window.delay=1000
HTML case of invalid millisecond value variations(null,NaN,'???',-Infinity etc.):
When 'View Data' is clicked:
userAgent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.8.0.1) Gecko/20060313 Fedora/1.5.0.1-9 Firefox/1.5.0.3 pango-text
Now is 13100
1. Timestamp=7 : Test_Case=1. 0/ timerID=2 / Timeout fired. ( Timestamp=88 )
2. Timestamp=8 : Test_Case=2. -0/ timerID=3 / Timeout fired. ( Timestamp=88 )
3. Timestamp=8 : Test_Case=3. -1/ timerID=4 / Timeout fired. ( Timestamp=88 )
4. Timestamp=8 : Test_Case=4. '???'/ timerID=5 / Timeout fired. ( Timestamp=88 )
5. Timestamp=8 : Test_Case=5. null/ timerID=6 / Timeout fired. ( Timestamp=88 )
6. Timestamp=8 : Test_Case=6. NaN/ timerID=7 / Timeout fired. ( Timestamp=88 )
7. Timestamp=8 : Test_Case=7. Infinity/ timerID=8 / Timeout fired. ( Timestamp=88 )
8. Timestamp=8 : Test_Case=8. -Infinity/ timerID=9 / Timeout fired. ( Timestamp=88 )
9. Timestamp=8 : Test_Case=9. No-parameter/ timerID=10 / Timeout fired. ( Timestamp=88 )
10. Timestamp=8 : Test_Case=10. delay_declared_in_head/ timerID=11 / Timeout fired. ( Timestamp=88 )
11. Timestamp=8 : Test_Case=11. delay_declared_in_body/ timerID=12 / Timeout fired. ( Timestamp=88 )
12. Timestamp=8 : Test_Case=12. 2000/ timerID=13 / Timeout fired. ( Timestamp=2010 )
13. Timestamp=9 : Test_Case=13. 1000/ timerID=14 / Timeout fired. ( Timestamp=1013 )
14. Timestamp=9 : Test_Case=14. 500/ timerID=15 / Timeout fired. ( Timestamp=477 )
15. Timestamp=9 : Test_Case=15. 100/ timerID=16 / Timeout fired. ( Timestamp=125 )
16. Timestamp=9 : Test_Case=16. 30/ timerID=17 / Timeout fired. ( Timestamp=88 )
var timerID=setTimeout("alert(String(timerID));",delay);
Javascript error: delay is not defined. No alert box.
var delay;var timerID=setTimeout("alert(String(timerID));",delay);
No alert, no JS errors.
var timerID=setTimeout("alert(String(timerID);",delay);var delay;
No alert, no JS errors.
var timerID=setTimeout("alert(String(timerID);",delay);var delay=1000;
No alert, no JS errors.
(In reply to comment #49)
>
> Fibonacci, can you open another bug for no-timeout-fire problem on Linux when
> "javascript:var delay;var timerID=setTimeout('alert(...);',delay);" or
> "javascript:var timerID=setTimeout('alert(...);',NaN);"?
> It seems that "undefined of delay" case is same as "ZERO of delay" case,
> because ZERO seems to be used when non-number.
Javascript:var timerID=setTimeout("alert(String(timerID));",0); //does fire.
> Remaining questions:
> Even though all test cases of commet #45 fire timeout when Linux,
> (1) Why your original case(and test case with my modification. comment #23)
> doesn't fire timeout when Linux?
> (2) Why Infinity case in comment #45 doesn't fire timeout when MS Win
> but fires timeout when Linux?
No idea...
Comment 51•19 years ago
|
||
(In reply to comment #50)
> 10. Timestamp=8 : Test_Case=10. delay_declared_in_head/ timerID=11
> / Timeout fired. ( Timestamp=88 )
> var timerID=setTimeout("alert(String(timerID);",delay);var delay;
> No alert, no JS errors.
ZERO is used when my case but garbage(log millisecond value) is used when your original case or simple javascript case?
Fibonacci, will alert be issued when Linux?
(1) CTRL+T (Open new tab)
(2) Execute following script (merge to single line, please)
javascript:
var msg="hello";
var str="var timerID2=setTimeout('alert(msg);',delay);";
var timerID1=setTimeout(str,400);
var delay;
(3) Wait a few seconds
(4) javascript:alert(timerID1+","+timerID2+","+delay);
Difference from var timerID=setTimeout("...",delay);var delay; is exsitence of end of script execution after Variable Instantiation while starting scope.
(former case)
(1) Variable Instantiation for delay when scope is entered
(2) timerID=setTimeout(...) with delay
(3) Script execution ends
(above case)
(1) Variable Instantiation for delay when scope is entered
(2) timerID1=setTimeout(...)
(3) Script execution ends
(4) Timeout fires and script is executed
(5) timerID2=setTimeout(...) with delay
Reporter | ||
Comment 52•19 years ago
|
||
(In reply to comment #51)
>
> ZERO is used when my case but garbage(log millisecond value) is used when your
> original case or simple javascript case?
>
> Fibonacci, will alert be issued when Linux?
> (1) CTRL+T (Open new tab)
> (2) Execute following script (merge to single line, please)
> javascript:
> var msg="hello";
> var str="var timerID2=setTimeout('alert(msg);',delay);";
> var timerID1=setTimeout(str,400);
> var delay;
> (3) Wait a few seconds
> (4) javascript:alert(timerID1+","+timerID2+","+delay);
Alert box: 2,3,undefined
Comment 53•19 years ago
|
||
(In reply to comment #52)
> Alert box: 2,3,undefined
Which does your answer mean?
(A) Alert box contents at step(4) was "2,3,undefined". (i.e. no alert by step 2)
(B) Alert box of "hello" is displayed by step(2),
and alert box content at step(4) was "2,3,undefined"
By the way, I've opened Bug 337951 for Infinity problem, with expecting WONTFIX close or INVALID(works as designed) close.
Depends on: 337951
Reporter | ||
Comment 54•19 years ago
|
||
(In reply to comment #53)
> (In reply to comment #52)
> > Alert box: 2,3,undefined
> Which does your answer mean?
Only one alert box, which displayed the string "2,3,undefined".
> (A) Alert box contents at step(4) was "2,3,undefined". (i.e. no alert by step
> 2)
That's it.
> (B) Alert box of "hello" is displayed by step(2),
> and alert box content at step(4) was "2,3,undefined"
No, I saw no other alert box.
>
> By the way, I've opened Bug 337951 for Infinity problem, with expecting WONTFIX
> close or INVALID(works as designed) close.
I've created a testcase based on yours, where setTimeout(..., Infinity) doesn't fire. Please read the source code. What is the difference between my testcase and yours, I don't know, but one works and the other doesn't.
Comment 55•19 years ago
|
||
I've opend Bug 337956 for problem when setTimeout(...,delay);var delay;.
I believe this is the problem in your original test case.
Remaining question:
Why my test case for invalid millisecond value won't produce problem of Bug 337956, even though your original case always produces problem of Bug 337956?
Reporter | ||
Comment 56•19 years ago
|
||
(In reply to comment #55)
> I've opend Bug 337956 for problem when setTimeout(...,delay);var delay;.
> I believe this is the problem in your original test case.
I'm now subscribed there. Thank you.
> Remaining question:
> Why my test case for invalid millisecond value won't produce problem of Bug
> 337956, even though your original case always produces problem of Bug 337956?
Also: why does setTimeout(..., Infinity); fire on your testcase but not in mine (the one I uploaded to Bug 337951)? I can't find any substantial differences between them...
Comment 57•19 years ago
|
||
(In reply to comment #9)
> Could this be the result of Windows implementing comparison with NaN/Infinity
> differently from Linux?
You are right. This is bug report based on test result of a test case(test of illegal millisecond value of setTimeout. i.e. test of NaN/Infinity) for problem analysis of Bug 332759. (https://bugzilla.mozilla.org/attachment.cgi?id=220374)
Bug 332759 Comment #44(MS Win) and Bug 332759 Comment #45(Linux).
> if it isn't too much of a compatibility break.
I could find only 2 compatibility break cases.
This bug(Infinity) and Bug 337956(just be defined by "Variable Instantiation")
And as you seen, this bug is NOT a problem which always occurs on any build on any Linux. And as described in Bug 332759, Bug 337956's case is not recreated when my coding example, although original test case and javascript: case produces the problem.
So there is no "too much compatibility break" currently, I think.
Comment 58•19 years ago
|
||
Comment #57 was for Bug 337951. Ignore, please. Sorry for spam.
Comment 59•19 years ago
|
||
(In reply to comment #54)
> > (A) Alert box contents at step(4) was "2,3,undefined".
> > (i.e. no alert by step 2)
> That's it.
Test case with alert in script doesn't seems to be appropriate for your environment...
Fibonacci, could you check reslut of next case on Linux?
(1) CTRL+T (Open new tab)
(2) Execute following script (merge to single line, please)
javascript:
var x=0;
var str="var timerID2=setTimeout('x++;',delay);";
var timerID1=setTimeout(str,400);
var delay;
(3) Wait for a moment
(4) javascript:alert(timerID1+","+timerID2+","+x+","+delay);
Comment 60•19 years ago
|
||
Bug 337951 has been fixed.
Fibonacci, execute fix verification test with latest trunk nightly, please.
(Both of your minimum case of Bug 337951 and my cases of this bug)
Reporter | ||
Comment 61•19 years ago
|
||
(In reply to comment #60)
> Bug 337951 has been fixed.
> Fibonacci, execute fix verification test with latest trunk nightly, please.
> (Both of your minimum case of Bug 337951 and my cases of this bug)
>
Couldn't check it. The nightly build doesn't run for me, though no error messages are displayed. I'm using a remote computer's browser to post this while I get my Fx fixed.
Comment 62•19 years ago
|
||
(In reply to comment #61)
> The nightly build doesn't run for me
Trunk(for Fx 3.0 development) is possibly too different from 1.5.
Try trunk nightly with new profile. (start with switch of -ProfileManager)
Reporter | ||
Comment 63•19 years ago
|
||
(In reply to comment #62)
> (In reply to comment #61)
> > The nightly build doesn't run for me
> Trunk(for Fx 3.0 development) is possibly too different from 1.5.
> Try trunk nightly with new profile. (start with switch of -ProfileManager)
>
Ehm... excuse me? How do I do that?
Comment 64•19 years ago
|
||
(In reply to comment #63)
> How do I do that?
http://kb.mozillazine.org/Profile_Manager#Firefox_and_Thunderbird_users
Comment 65•19 years ago
|
||
To Fibonacci(bug opener):
Bug 337956 is opened for problem of your original case. I think it's better to resolve your problem in clearer Bug 337956. So I close this bug as DUP of Bug 337956. Please re-open if you think this bug is to be kept open.
*** This bug has been marked as a duplicate of 337956 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•