Closed Bug 418445 Opened 17 years ago Closed 3 years ago

More than one Alert box can be displayed at the same time!

Categories

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

1.8 Branch
x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: briant, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12

Using the html page example I have provided follow the directions on the page. In summary there are two problems.

1) Javascript Alert boxes should be Modal!
2) If you find yourself in a state where you have two (modal) Alert boxes open at the same time (see my example) if you dimiss the second Alert box while leaving the first open, the first Alert box is no longer modal! This is a really big problem for my application. I don't see how it is possible to have to Alert boxes open at the same time EVER. Try my html example in IE and you will see how one would expect it to work. No matter how you slice it though, having a second modal window open while there is already a modal window open breaks all the rules!

Reproducible: Always

Steps to Reproduce:
Please try the following html code in Firefox. (Further instruction to reproduce are included on the page)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Firefox Modal Form Error Example</title>
<script language="javascript">
<!--
function testLength(oField, iMaxLimit) {
	if(oField.value.length > iMaxLimit) {
		//invalid length
		oField.value = oField.value.substring(0, iMaxLimit);
		alert("The maximum length for this field is " + iMaxLimit + " characters.\nThe text has been truncated!")
	}
}

function validateForm(oForm) {
	alert("Submit!\n\nIf you are following the directions then dismiss this modal window and then while the first modal window is still open you will be able to edit the form's contents. (The first modal window no longer behaves as a modal window!")
}
//-->
</script>
</head>

<body>
<h1>Firefox Modal Window Error Example</h1>
To reproduce the modal window bug please perform the following steps:
<p>1) Copy 30 characters into your clipboard
<br>2) RIGHT CLICK and paste the contents of your clipboard into the textarea
<br>3) Click the Submit button
<br>4) DISMISS the first modal window
<br>5) Now! Without dismissing the first modal window you can click and change text anywhere on the form.
<br><br>As soon as the first modal window is displayed it should NOT be possible to envoke a second modal window in the first place!
<br>Try this example in IE to see how it SHOULD work!
<form name="my_form" onsubmit="validateForm(document.my_form);" method="post">
<b>Enter Text:</b> (Max 20 Characters)<br>
<textarea name="my_text" cols="50" rows="5" onchange="javascript:testLength(document.my_form.my_text, 20);"></textarea>
<p><input type="button" value="Submit" onclick="javascript:validateForm(document.my_form);">
</form>
</body>
</html>



Expected Results:  
It should NEVER be possible to have two Modal Windows open at the same time. NEVER!

You should check to see if a Modal Window is already open before opening a (second) new modal window. Again, this bug really breaks the rules.
This seems to be worksforme on trunk.
Brian, could you perhaps try this also with a trunk build?
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/

In any case, I don't think this bug should remain security sensitive.
Attached file testcase2 (obsolete) —
Although, I can still see this happening on trunk with using alerts in iframes.
Comment on attachment 304267 [details]
HTML example of submitted bug with instructions

Brian, the testcase you attached is basically bug 31889, I think.

If you don't mind, I'm morphing this bug into the fact that the bug can still be seen with the testcase that I attached.
Attachment #304267 - Attachment is obsolete: true
Group: security
Status: UNCONFIRMED → NEW
Component: General → Event Handling
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → events
Version: unspecified → Trunk
Keywords: testcase
Blocks: 418681
Hello,

I'm not sure of your comments regarding iframes. Did you see this happening in the example code I sent you? It is easy to reproduce. The whole point is the fact that it should never be possible to have two modal forms displayed at the same time. Kinda defeats the purpose of a modal form. Additionally, once Firefox gets itself into this state (two or more modal forms open at same time) things get even worse as once the first modal form (Alert box in your case) is dismissed, but while the "second" modal form is still displayed, the Alert box is no longer modal! This is real problem for web applications.

Personally I think this is a security issue because with this kind of error who knows what your application is doing behind the scenes. As I've said, it should never be possible to display two modal forms at the same time. The fact that this is happening causes me a great deal of concern.
Sorry Brian, I shouldn't have hijacked your bug. I've now filed bug 418736 for my testcase.
No longer blocks: 418681
Attachment #304546 - Attachment is obsolete: true
Attachment #304267 - Attachment is obsolete: false
Hello,

I'm a little new to all of this. I've never filed a bug report with you guys before but this one seriously breaks my commercial application. Can you tell me as it is not clear from the comments, if you have reproduced this bug. I've tried on several machines in our office and it happens on all of them. We're running the latest public build of Firefox but you probably already know that.
Brian, yes, I have reproduced the bug (on branch, which is Firefox 2, not trunk, which is Firefox 3).
This isn't an issue on trunk anymore (which is what Firefox 3 will be made of, you can check it with Firefox 3 beta). It is however an issue with Firefox 2.

I think this is basically the same as bug 31889, see also the testcase that bug. Brian, do you agree?
Version: Trunk → 1.8 Branch
I agree this bug is very similar to bug #31889 but I'm not sure it is exactly the same. One thing not mentioned in the previous bug report is the fact that once this bug happens, i.e. you have two js Alert boxes open at the same time, once you dismiss the first Alert, but with the second still open, it is possible to click on the *main* browser and edit the form that raised the Alert in the first place. Of course this doesn't jive with the Modal Form concept! :)
Component: Event Handling → User events and focus handling

Closing this as resolved:wfm since using the provided testcase I can no longer edit the text field after dismissing the first modal and the 2d one is still displayed. Bug 31889 should handle the case of having multiple modals opened in the same time.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: