Closed Bug 354089 Opened 19 years ago Closed 19 years ago

onfocus="alert(); this.blur();" causes infinite alerts

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: roc, Assigned: roc)

References

Details

Attachments

(2 files)

Calling "blur" after "alert" doesn't work; we actually refocus the element. See attached testcase and patch.
Attached file testcase
Clicking in the input should pop up one alert and not give it focus. Instead it keeps popping up alerts ad infinitum. What happens is that the blur() doesn't update the focus controller, so the focus controller still thinks that the element is focused. Then tearing down the alert()'s window sends a platform window activate event to the document window, and the ESM asks the focus controller which element should be focused, which returns the input, and the ESM focuses it.
Attached patch fixSplinter Review
This fixes it by always calling EnsureFocusSynchronization in nsEventStateManager::SendFocusBlur after we've determined what will really be focused. In this case the focus controller is informed there is nothing to focus.
Attachment #239971 - Flags: superreview?(mats.palmgren)
Attachment #239971 - Flags: review?(mats.palmgren)
Want to fix bug 304634, bug 279819, bug 112294, and/or bug 210240 while you're at it?
Not really, no. IMHO they should all be fixed by reimplementing JS alerts to make them modal only to the nearest chrome ancestor (i.e., tab).
Comment on attachment 239971 [details] [diff] [review] fix Seems reasonable. r+sr=mats
Attachment #239971 - Flags: superreview?(mats.palmgren)
Attachment #239971 - Flags: superreview+
Attachment #239971 - Flags: review?(mats.palmgren)
Attachment #239971 - Flags: review+
checked in
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: