Closed Bug 457672 Opened 14 years ago Closed 14 years ago

window blur event is not fired when opening a new tab

Categories

(Core :: DOM: Events, defect, P1)

x86
Windows Vista
defect

Tracking

()

VERIFIED FIXED
mozilla1.9.1b3

People

(Reporter: michael.tamm2, Assigned: smaug)

References

()

Details

(Keywords: regression, verified1.9.1)

Attachments

(3 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3

The window blur event is not fired, when a new tab is opened (and sometimes - not always - also when you switch to another tab).

This behavior can be verified with the provided test page at http://www.michaeltamm.de/window_blur_test.html

The blur event will be fired, if another window is focused.

Reproducible: Always

Steps to Reproduce:
1. Go to http://www.michaeltamm.de/window_blur_test.html
2. Open a new tab.
3. Switch back to the tab displaying http://www.michaeltamm.de/window_blur_test.html
Actual Results:  
There is no paragraph with the text 'lost focus at ...'

Expected Results:  
The page should have two more paragraphs (added via JavaScript):
'lost focus at ...' followed by 'got focus at ...'
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b1pre) Gecko/20080928084201 Minefield/3.1b1pre

Confirmed with latest trunk on Windows XP.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → Trunk
This regressed on 3 July 2007 probably from Bug 238987.
Blocks: 238987
Component: Tabbed Browser → DOM: Events
Keywords: regression
Product: Firefox → Core
QA Contact: tabbed.browser → events
Flags: blocking1.9.1?
Attached file testcase
Note, blur and focus don't bubble per DOM Events spec.
Bug 238987 just revealed a bug that we don't always dispatch the blur event to
|window|, only to |document|. But that bug was there already in 1.8 (FF2).
Attached patch possible patch (obsolete) — Splinter Review
Changing focus/blur handling is always regression-risky.
I think the patch does what I'd like to see happening, but
something may rely on the old behavior.
Needs lots of testing.
I still need to write testcases for this
Attachment #340957 - Attachment is obsolete: true
Comment on attachment 340993 [details] [diff] [review]
passes mochitest, chrome and browser-chrome

Doesn't regress bug 200735, bug 203117, bug 194104 nor bug 201996.
(bryner fixed those bugs when modifying this code.)
Still need to write mochitests
Smaug, how risky do you think this is? Do you think you could get the tests written in time for 1.9.1? If so, it'd be awesome to get this in if we feel comfortable about this patch...
Assignee: nobody → Olli.Pettay
Flags: wanted1.9.1+
Flags: wanted1.9.0.x?
Flags: wanted-next+
Flags: blocking1.9.1?
Flags: blocking1.9.1-
Priority: -- → P1
Changing focus handling is always a bit risky.
The current code is clearly wrong, there is even the XXX comment.
I'll try to write the mochitest ASAP.
Attachment #340949 - Attachment is patch: false
Attachment #340949 - Attachment mime type: text/plain → text/html
Sorry, my asap wasn't really asap.
Attachment #350001 - Flags: superreview?(jst)
Attachment #350001 - Flags: review?(jst)
Comment on attachment 350001 [details] [diff] [review]
with mochitesttest

Looks good to me. r+sr=jst
Attachment #350001 - Flags: superreview?(jst)
Attachment #350001 - Flags: superreview+
Attachment #350001 - Flags: review?(jst)
Attachment #350001 - Flags: review+
Attachment #350001 - Flags: approval1.9.1?
Comment on attachment 350001 [details] [diff] [review]
with mochitesttest

If we want this for 1.9.1, this should land asap to get testing.
Comment on attachment 350001 [details] [diff] [review]
with mochitesttest

a191=beltzner
Attachment #350001 - Flags: approval1.9.1? → approval1.9.1+
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [needs-1.9.1-landing]
Fixed on trunk and 1.9.1
Whiteboard: [needs-1.9.1-landing]
I disabled the test on 1.9.1 for now because SM is also running mochitest
and the test relies on FF's new-window handling.
Depends on: 468261
(In reply to comment #15)

See bug 457672.
Flags: in-testsuite+
Keywords: fixed1.9.1
Target Milestone: --- → mozilla1.9.1b3
(In reply to comment #16)
> See bug 457672.

Argh: bug 468261 !
will look at a patch approval if you feel strongly about getting this into a 3.0.x release (and think the patch is safe enough), but not "wanted" in the sense of "release-drivers need to make sure this gets in sometime".
Flags: wanted1.9.0.x?
verified FIXED on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090331 Minefield/3.6a1pre

and

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4pre) Gecko/20090401 Shiretoko/3.5b4pre
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.