Closed
Bug 132904
Opened 23 years ago
Closed 23 years ago
Clearing timeout without setting one & without passing timeoutID throws exception.
Categories
(Core :: DOM: Core & HTML, defect, P2)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
mozilla1.0
People
(Reporter: desale, Assigned: jst)
References
()
Details
(Whiteboard: [HAVE FIX])
Attachments
(2 files, 1 obsolete file)
300 bytes,
text/html
|
Details | |
4.99 KB,
patch
|
sicking
:
review+
jst
:
superreview+
dbaron
:
approval+
|
Details | Diff | Splinter Review |
If we use "clearTimeout()" method without passing "timeoutID" to it. [Which is
wrong because "clearTimeout()" method expects "timeoutID" as argument in order
to clear that particular timeout.]
It throws an exception. Filing this bug is wrong in itself because throwing
exception for it is correct thing to do.
However 4.x browser works fine even if we use "clearTimeout()" method without
passing "timeoutID", so it raises questions about all those webpages out there
which use "clearTimeout()" method without passing "timeoutID" & without setting
timeout.
for examples, please have a look at "bugscape bug# 9521".
I know best component to assign this bug to is "Evangelism", but I just talked
to Johnney & he said he could fix it, so I'm assgining it to dom-level-0.
STEPS TO REPRODUCE:
1] Visit http://bubblegum/desale/bug9521.html
OR
1] Load testcase I'm going to attach.
2] Click button 'Try clearing Timeout without setting one'
You will see alert showing exception we are catching.
Please have a look at source of testcase & you will see that I'm calling
cleartimeout() without passing timeoutID to it. [Absolutely wrong thing to do]
Well Standards say we should pass timeoutID.
So now we have to decide if we want to stick to standards or we want not to
throw exception, so all those webpages out there work fine as they used to work
with 4.x.
Testcase attachment following.
Reporter | ||
Comment 1•23 years ago
|
||
Reporter | ||
Comment 2•23 years ago
|
||
nsbeta1, priority p2. ccing Bob, Arun, Lisa & paul.
Keywords: nsbeta1
Priority: -- → P2
Comment 3•23 years ago
|
||
IE doesn't throw an exception when calling clearTimeout with no argument either.
Note that the test case throws an exception in IE due to it's use of 'start'.
Do we know of any pages/apis which rely on this behavior? I haven't seen this in
my incidents.
Assignee | ||
Comment 4•23 years ago
|
||
Transfering nsbeta1+ from the bugscape bug.
Status: NEW → ASSIGNED
OS: Windows NT → All
Hardware: PC → All
Target Milestone: --- → mozilla1.0
Assignee | ||
Comment 5•23 years ago
|
||
This patch makes clearTimeout() and clearInterval() callable w/o an argument,
or with any type of argument w/o us throwing an exception, just like 4x and IE
do.
Assignee | ||
Comment 6•23 years ago
|
||
I've seen bugs on this earlier, I can't say how common it is, but it's easy
enough to fix and it's one less backwards incompatibility to worry about, so I
say let's fix it.
Whiteboard: [HAVE FIX]
Reporter | ||
Comment 7•23 years ago
|
||
I also think fixing this one would be right call since we move one step forward
towards backward compatibility. I also say Lets fix it.
OS: All → Windows NT
Hardware: All → PC
Whiteboard: [HAVE FIX]
Target Milestone: mozilla1.0 → ---
Assignee | ||
Updated•23 years ago
|
OS: Windows NT → All
Hardware: PC → All
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla1.0
Assignee | ||
Comment 8•23 years ago
|
||
Comment on attachment 75680 [details] [diff] [review]
Proposed fix.
jband says sr=jband
Attachment #75680 -
Flags: superreview+
Comment on attachment 75680 [details] [diff] [review]
Proposed fix.
You might wanna keep the reference to bug 30700 (and this one). Either way
r=sicking
Attachment #75680 -
Flags: review+
Comment 10•23 years ago
|
||
See bug 58101 and all its duplicates for important examples
of this problem -
Comment 11•23 years ago
|
||
Johnny: will this patch allow users to do clearTimeout(TimeoutID)
where TimeoutID is uninitialized? i.e. where the variable provided
contains the value |undefined|? That crops up from time to time ...
Assignee | ||
Comment 12•23 years ago
|
||
Yes, this patch takes care of that problem too.
Comment 13•23 years ago
|
||
Thank you for the fast action on this.
Comment 14•23 years ago
|
||
Comment on attachment 75680 [details] [diff] [review]
Proposed fix.
>+ /**
>+ * These methods take one optional argument that's the timer ID to
>+ * clear. Often in existing code these methods afre passed
>+ * undefined, which is a nop so we need to support that as well.
>+ */
Please fix this comment (s/afre/are), also is "nop" a real word?
>+ if (argc < 1) {
>+ // No arguments, return early.
Is this what other browsers do? What's the point of calling it without argument
if it does nothing?
Assignee | ||
Comment 15•23 years ago
|
||
Calling clearTimeout() w/o arguments is obviously pointless, but we need to not
throw an exception to be compatible with other browsers.
Comment on attachment 75680 [details] [diff] [review]
Proposed fix.
a=dbaron for trunk checkin
Attachment #75680 -
Flags: approval+
Assignee | ||
Comment 17•23 years ago
|
||
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 19•9 years ago
|
||
Comment 20•9 years ago
|
||
Comment on attachment 8825096 [details]
_irrelevant_
attached by mistake, marking as obsolete
Attachment #8825096 -
Attachment description: avoid taking const references to fields behind accessors. → _irrelevant_
Attachment #8825096 -
Attachment filename: Bug-132904---avoid-taking-const-references-to-fiel.patch → _irrelevant_
Attachment #8825096 -
Attachment is obsolete: true
Attachment #8825096 -
Attachment is patch: false
You need to log in
before you can comment on or make changes to this bug.
Description
•