Closed Bug 11069 Opened 26 years ago Closed 25 years ago

alert() crashes eventhandler

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: csom, Assigned: joki)

Details

[Type]: Javascript bug? [Occurance]: modal windows and eventhandling [Test]: OS=win NT4(hu) BROWSER=NN4(hu)/IE4(en) Abstract -------- The alert() function (generally modal windows) breaks the process flow (based on the eventhandling model) in some cases Example ------- <A HREF="http://bugzilla.mozilla.org" >click</A> <SCRIPT> document.links[0].onclick = newLoc; function newLoc(){ location.href="newpage.html" alert("bug?") return true } </SCRIPT> In the above example we catch the click event by setting: document.links[0].onclick = newLoc; Because the eventhandler has a 'return true' statement after it terminated the default action of the 'a href' tag must be executed, ie. it must jump to netscape.com. That's what the event model says, however real life says something else: - if the user is quick enough to click the OK button and/or the new.html page is far enough to be downloaded slowly then yep the browser jumps to bugzilla.mozilla.org, however - if the user is slow to click and/or the newpage.html is close enough to be downloaded then sure it gets downloaded which means that it clears the previous document. So the eventhandler cannot terminate, the link cannot be folowed due to the fact that the calling document is cleared. Ps.: the same happens if you replace alert() with confirm() or prompt() method. Generally (I guees) modal windows may cause bugs like this however I've just tested these 3 samples
I'm not sure what the appropriate behavior is here. In 4.x, my browser seems to always load the location.href link but I don't know if that's timing or what. The location.href obviously doesn't immediately replace the content, else the alert would not fire. But the link, I don't *think* should get executed based on the execution of the location.href line. Ideas? CC'ing brendan and vidur
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
This doesn't crash for me on any platform. 1999061209 Marking fixed and verified
checked on WinNT, Win98, Linux, Mac
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.