Closed Bug 56799 Opened 24 years ago Closed 23 years ago

Javascript highlighting causes exceptions

Categories

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

Sun
All
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: reinout, Assigned: jst)

References

()

Details

Go to the above URL and move mouse over menu options on the left.
The output I get is:

JavaScript error:
http://www.parool.nl/actueel/lunchnieuws/355023061.html line 22: can't convert
TimeoutID to an integer

JavaScript error:
 line 0: uncaught exception: [Exception... "Parameter is not a number"  code:
"1005" nsresult: "0x805303ed (NS_ERROR_DOM_NOT_NUMBER_ERR)"  location:
"http://www.parool.nl/actueel/lunchnieuws/355023061.html Line: 22"]
On a mouse over the following javascript is invoked (along with some other
javascript):

clearTimeout(TimeoutID);

As far as I can see the problem is that TimeoutID is not defined.
TimeoutID needs to be a number, and mozilla has difficulty in converting an
undefined variable to a number.  Hence the error.
Conor is correct. The script defines TimeoutID, but doesn't initialize it.
Then it calls clearTimeout(TimoutID) :


<SCRIPT LANGUAGE="JavaScript">

   var js = !(((navigator.appName.toLowerCase()   etc. etc. 
   var TimeoutID;

   function mouseOver(name) {
     if (js) {
        clearTimeout(TimeoutID);
        buttonname = name;
        document.images[buttonname].src = "/nav/ov_" + buttonname + "_roll.gif";
     }
   }


You can produce the same error by typing this in the URL bar and hitting Enter: 

          javascript: var x; clearTimeout(x)


In Mozilla, you will see the reported errors in the JavaScript console. 
In NN4.7, I see no errors. By contrast, this produces no errors in Mozilla:


          javascript: var x=1; clearTimeout(x)


As to why the behavior differs between Mozilla and NN4.x, I will have
to defer to the DOM group. Reassigning to DOM Level 0. Is this bug valid?
Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
OS: Solaris → All
setting bug status to New
Status: UNCONFIRMED → NEW
Ever confirmed: true
Won't fix, the mozilla DOM doesn't accept unitialized variables as input,
unfortunately. The site needs to initialize TimeoutID to 0 before calling
clearTimeout().

WONTFIX.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
*** Bug 59605 has been marked as a duplicate of this bug. ***
VERIFIED wontfix
Status: RESOLVED → VERIFIED
Reopening, since this was actually fixed by the XPCDOM landing, so mozilla now
works as 4.x did.
Status: VERIFIED → REOPENED
Resolution: WONTFIX → ---
Marking WORKSFORME since this was fixed a few weeks ago.
Status: REOPENED → RESOLVED
Closed: 24 years ago23 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.