Open Bug 444442 Opened 16 years ago Updated 2 years ago

Multiple alert boxes onmouse[down/up]

Categories

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

x86
Windows XP
defect

Tracking

()

People

(Reporter: TNO, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0

While debugging an application I came across some unexpected behavior with the alert dialog box where it didn't act modal as anticipated and launched two dialogs at once.

Reproducible: Always

Steps to Reproduce:
1. Using the HTML page below mousedown on "Click Me", wait a couple seconds and mouseup to see both alerts firing.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>FireFox 3 Alert Issue</title>
	<script type="text/javascript">
		var mouseDown = false;

		function addEvent(obj,type,fn){
			if (obj.attachEvent) {
				obj['e' + type + fn] = fn;
				obj[type + fn] = function(){
					obj['e' + type + fn](window.event);
				};
				obj.attachEvent('on' + type, obj[type + fn]);
			}
			else {
				obj.addEventListener(type, fn, false);
			}
		}
		addEvent(document,"mousedown",function(e){
			e = e || window.event;
			var target = e.target || e.srcElement;
			if (target.nodeType == 3){target = target.parentNode}
			if(target.id == "Foo"){
				mouseDown = true;
				alert("Mouse Down!");
			}
		});
		addEvent(document,"mouseup",function(e){
			if(mouseDown == true){
				mouseDown = false;
				alert("Mouse Up!");
			}
		});
	</script>
</head>
<body>
<span id="Foo">Click Me!</span>
</body>
</html>
Actual Results:  
Two alert dialogs display simultaneously

Expected Results:  
Only one Alert dialog should be seen at a time and should halt all activity within the current Tab(s)
Attached file reporter's testcase
I see this in all Firefox versions I tried, but not in Opera and IE6. They don't show the mouse up alert at all.
Status: UNCONFIRMED → NEW
Component: General → Event Handling
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → events
Version: unspecified → Trunk
This appears to be working as expected in Fx4.0b6
Component: Event Handling → User events and focus handling
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: