Closed Bug 365149 Opened 18 years ago Closed 15 years ago

Firefox crashes due to JavaScript infinite recursion by calling onload() from the BODY tag's onload handler

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 201828

People

(Reporter: mozilla, Unassigned)

References

()

Details

User-Agent: Opera/9.10 (Windows NT 5.1; U; en) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9 Seems to happen when you try to set the BODY tag's onload event to "onload();" - causes infinite recursion. The crash doesn't happen in 2.0. Reproducible: Always Steps to Reproduce: 1.Go to the specified URL. Actual Results: Firefox crashes. Expected Results: It should either throw a JS exception (like 2.0 does) or not treat onload() as a special function (like other browsers).
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
I just inadvertantly hit this myself, an "onload" handler named "onload" causes an immediate crash in 1.5.0.9 <html> <head> <title>OnLoad Test</title> <script> function onload() { alert("onload()"); } </script> </head> <body onload="onload()"> This is the body </body> </html>
Assignee: nobody → events
Component: General → DOM: Events
QA Contact: general → ian
WFM Ubuntu Edgy FF2.0.0.1. Firefox doesn't crash, but firebug alerts me "too much recursion". Robin
3.5 still has the infinite recursion issue (no crash though). Firebug shows the code from the "onload" attribute is actually being put into a function named "onload". Not a huge problem, but seems like something that ought to be fixed. In my case I had my PHP backend automatically adding the onload attribute if it found a script for the current page with a function by that name, and scratched my head a little while wondering why it didn't fire.
Assignee: events → nobody
QA Contact: ian → events
Same for me on Vista with Firefox trunk; "infinite recursion" error message but no crash.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.