Closed Bug 800314 Opened 13 years ago Closed 13 years ago

download notification steals focus

Categories

(Firefox :: Downloads Panel, defect)

19 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 20

People

(Reporter: devel, Assigned: mconley)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/19.0 Firefox/19.0 Build ID: 20121009030547 Steps to reproduce: 1. Click on resource that triggers a download 2. Unfocus firefox window (focus a different window) Actual results: The download manager animation (or notification, it is unclear which one) appears and steals the focus off that other window again. Expected results: Focus should have stayed with the other window.
Component: Untriaged → Downloads Panel
Sebastian a) Does this reproduce with current nightly? (you are reporting this against a nightly build that is over a month old, which is something we to avoid, because the problem might already be gone in a newer build) b) If you are still able to reproduce, can you determine the exact nightly build where problem first appears? I was unable to reproduce with a current nightly build
Flags: needinfo?(devel)
I am still able to reproduce it. My window manager is e16 and the focus setting is focus-follows-mouse.
Flags: needinfo?(devel)
My Nightly build: 19.0a1 (2012-10-21)
Re b) I'm sorry I can't determine the exact Nightly build, I'd say it first occurred in the build I've reported originally (2012-10-09), the version I had before (2012-10-03) didn't show the bug (as far as I remember).
I'm confirming this to remember we should verify the focus behavior before releasing the feature. Though I think there are various focus bugs with panels and focus-follows-mouse, so this may just end up being a dupe of some platform bug.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to Sebastian Freundt from comment #0) > User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/19.0 Firefox/19.0 > Build ID: 20121009030547 > > Steps to reproduce: > > 1. Click on resource that triggers a download > 2. Unfocus firefox window (focus a different window) > > > > Actual results: > > The download manager animation (or notification, it is unclear which one) > appears and steals the focus off that other window again. > > > > Expected results: > > Focus should have stayed with the other window. Sebastian: Is this the "download has started" visual notification (an arrow drifts across the screen until reaching the download button), or the "download has completed" visual notification (download button glows)? -Mike
It's the "download has started".
Sebastian: I've so far been unable to reproduce this bug. Are you still able to reproduce it reliably? -Mike
Yes, on multiple computers (all I've had access to in the last 2 weeks (that's 6 in total)), under multiple users (7 different users). It's very reliable. I should mention too that my default download action for any file is to save the file to disk.
(In reply to Sebastian Freundt from comment #9) > Yes, on multiple computers (all I've had access to in the last 2 weeks > (that's 6 in total)), under multiple users (7 different users). It's very > reliable. I should mention too that my default download action for any file > is to save the file to disk. Ok, wow, yeah that sounds really reliable. So maybe I'm just not clear on the STR. For one thing, I'm not able to easily focus another window before the download notification displays. I had to do some Scratchpad hackery to make that happen. What normally happens is when I choose to Save a File, the browser window for which the download was first initiated gets focused again, and I see the notification. So, how are you able to focus another window in time? Can you give me more granular steps to reproduce? Thanks, -Mike
Well, it's multiple factors: - I have a window manager with focus-follows-mouse (e16) - I have to download files from a very distant machine (Australia, bom.gov.au, while I'm in Germany, the round-trip time is roughly 330ms) - an actual download there (for me) starts after about half a second, by which time I'm long off doing something else in my terminal Try the IDA00001.dat for example on ftp://ftp.bom.gov.au/anon/gen/fwo/ And, like I said, make sure there's no Save a File dialogue.
Sebastian: Here's a screencast of me being unable to reproduce the problem. What am I doing wrong? http://www.youtube.com/watch?v=pwVQbSt8LFk -Mike
Try typing in the terminal window, or do anything that doesn't involve the mouse (using the mouse wheel focusses windows under the cursor (at least in my wm)) Also, whilst trying to record my desktop here I found the sourceforge download links work a bit better as there's always a 5 second delay. Unfortunately I can't view my own video on youtube (might be my fault) but here it is anyway: http://www.youtube.com/watch?v=TOWgToXVzec
Still no dice: http://www.youtube.com/watch?v=dXK1UDtV9xI You said that you reproduced this reliably on multiple machines over several users...did they all have the e16 window manager? Did they all use focus-follows-mouse?
Yes, we tried it on e16 and i3. And yes, focus-follows-mouse on e16, and i3 is essentially mouseless. Here's an (annotated) xev trace of my firefox process that clearly demonstrates the (mis)behaviour: freundt@clyde:pts/14:~/temp> xev -id 0x24003a5 EnterNotify event, serial 13, synthetic NO, window 0x24003a5, root 0x1ad, subw 0x0, time 3694259059, (1262,720), root:(1262,720), mode NotifyNormal, detail NotifyNonlinear, same_screen YES, focus NO, state 16 KeymapNotify event, serial 13, synthetic NO, window 0x0, keys: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 MotionNotify event, serial 13, synthetic NO, window 0x24003a5, root 0x1ad, subw 0x0, time 3694259059, (1262,720), root:(1262,720), state 0x10, is_hint 0, same_screen YES FocusIn event, serial 13, synthetic NO, window 0x24003a5, mode NotifyNormal, detail NotifyNonlinear MotionNotify event, serial 14, synthetic NO, window 0x24003a5, root 0x1ad, subw 0x0, time 3694259867, (1136,568), root:(1136,568), state 0x10, is_hint 0, same_screen YES ... /* lots of MotionNotify events, in there also my mouse click to start a download */ MotionNotify event, serial 19, synthetic NO, window 0x24003a5, root 0x1ad, subw 0x0, time 3694276083, (1266,567), root:(1266,567), state 0x10, is_hint 0, same_screen YES LeaveNotify event, serial 19, synthetic NO, window 0x24003a5, root 0x1ad, subw 0x0, time 3694276091, (1323,576), root:(1323,576), mode NotifyNormal, detail NotifyNonlinear, same_screen YES, focus NO, state 16 FocusOut event, serial 19, synthetic NO, window 0x24003a5, mode NotifyNormal, detail NotifyNonlinearVirtual /* here I left the window, hence FocusOut */ /* when the download is about to start this happens: */ PropertyNotify event, serial 19, synthetic NO, window 0x24003a5, atom 0x124 (_NET_WM_NAME), time 3694277085, state PropertyNewValue PropertyNotify event, serial 19, synthetic NO, window 0x24003a5, atom 0x27 (WM_NAME), time 3694277085, state PropertyNewValue PropertyNotify event, serial 19, synthetic NO, window 0x24003a5, atom 0x125 (_NET_WM_ICON_NAME), time 3694277085, state PropertyNewValue PropertyNotify event, serial 19, synthetic NO, window 0x24003a5, atom 0x25 (WM_ICON_NAME), time 3694277085, state PropertyNewValue PropertyNotify event, serial 19, synthetic NO, window 0x24003a5, atom 0x23 (WM_HINTS), time 3694296339, state PropertyNewValue ConfigureNotify event, serial 19, synthetic YES, window 0x24003a5, event 0x24003a5, window 0x24003a5, (0,0), width 1280, height 1024, border_width 0, above 0xcd212d, override NO FocusIn event, serial 19, synthetic NO, window 0x24003a5, mode NotifyNormal, detail NotifyNonlinear /* here's the stolen focus! */ KeymapNotify event, serial 19, synthetic NO, window 0x0, keys: 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 PropertyNotify event, serial 19, synthetic NO, window 0x24003a5, atom 0x23 (WM_HINTS), time 3694296413, state PropertyNewValue PropertyNotify event, serial 19, synthetic NO, window 0x24003a5, atom 0x132 (_NET_WM_USER_TIME), time 3694301145, state PropertyNewValue FocusOut event, serial 19, synthetic NO, window 0x24003a5, mode NotifyNormal, detail NotifyNonlinearVirtual ^C
And here's the backtrace: Breakpoint 13, 0x00007fc75035cfb0 in XSendEvent () from /usr/lib64/libX11.so.6 (gdb) bt #0 0x00007fc75035cfb0 in XSendEvent () from /usr/lib64/libX11.so.6 #1 0x00007fc74e32ed36 in gdk_window_focus () from /usr/lib64/libgdk-x11-2.0.so.0 #2 0x00007fc752d8e3de in nsWindow::SetFocus(bool) () from /home/freundt/usr/firefox/libxul.so #3 0x00007fc751e8634b in nsFocusManager::RaiseWindow(nsPIDOMWindow*) () from /home/freundt/usr/firefox/libxul.so #4 0x00007fc751e863f1 in nsFocusManager::SetActiveWindow(nsIDOMWindow*) () from /home/freundt/usr/firefox/libxul.so #5 0x00007fc751e8f7a7 in nsGlobalWindow::Focus() () from /home/freundt/usr/firefox/libxul.so #6 0x00007fc751e8f32f in nsGlobalWindow::Focus() () from /home/freundt/usr/firefox/libxul.so #7 0x00007fc752e599b2 in NS_InvokeByIndex_P () from /home/freundt/usr/firefox/libxul.so #8 0x00007fc752ca17cb in XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) () from /home/freundt/usr/firefox/libxul.so #9 0x00007fc752ca8826 in XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #10 0x00007fc753001d70 in js::InvokeKernel(JSContext*, JS::CallArgs, js::MaybeConstruct) () from /home/freundt/usr/firefox/libxul.so #11 0x00007fc753002298 in js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value*, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #12 0x00007fc753022ee3 in js::BaseProxyHandler::call(JSContext*, JSObject*, unsigned int, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #13 0x00007fc7530600d8 in js::Wrapper::call(JSContext*, JSObject*, unsigned int, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #14 0x00007fc7530604c9 in js::CrossCompartmentWrapper::call(JSContext*, JSObject*, unsigned int, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #15 0x00007fc7530232ff in proxy_Call(JSContext*, unsigned int, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #16 0x00007fc753002042 in js::InvokeKernel(JSContext*, JS::CallArgs, js::MaybeConstruct) () from /home/freundt/usr/firefox/libxul.so #17 0x00007fc752ff785f in js::Interpret(JSContext*, js::StackFrame*, js::InterpMode) () from /home/freundt/usr/firefox/libxul.so #18 0x00007fc75300185d in js::RunScript(JSContext*, JS::Handle<JSScript*>, js::StackFrame*) () from /home/freundt/usr/firefox/libxul.so #19 0x00007fc753001e4d in js::InvokeKernel(JSContext*, JS::CallArgs, js::MaybeConstruct) () from /home/freundt/usr/firefox/libxul.so #20 0x00007fc753002298 in js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value*, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #21 0x00007fc752fa0e58 in JS_CallFunctionValue(JSContext*, JSObject*, JS::Value, unsigned int, JS::Value*, JS::Value*) () from /home/freundt/usr/firefox/libxul.so #22 0x00007fc752c9bfd2 in nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS*, unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) () from /home/freundt/usr/firefox/libxul.so #23 0x00007fc752c98f19 in nsXPCWrappedJS::CallMethod(unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) () from /home/freundt/usr/firefox/libxul.so #24 0x00007fc752e5a5d5 in PrepareAndDispatch () from /home/freundt/usr/firefox/libxul.so #25 0x00007fc752e59af7 in SharedStub () from /home/freundt/usr/firefox/libxul.so #26 0x00007fc752097fc0 in nsDownloadManager::NotifyListenersOnDownloadStateChange(short, nsDownload*) () from /home/freundt/usr/firefox/libxul.so #27 0x00007fc75209d4e6 in nsDownload::SetState(short) () from /home/freundt/usr/firefox/libxul.so #28 0x00007fc75209e43c in nsDownloadManager::AddDownload(short, nsIURI*, nsIURI*, nsAString_internal const&, nsIMIMEInfo*, long, nsIFile*, nsICancelable*, bool, nsIDownload**) () from /home/freundt/usr/firefox/libxul.so #29 0x00007fc752d15ece in nsDownloadProxy::Init(nsIURI*, nsIURI*, nsAString_internal const&, nsIMIMEInfo*, long, nsIFile*, nsICancelable*, bool) () from /home/freundt/usr/firefox/libxul.so #30 0x00007fc752069cc3 in nsExternalAppHandler::InitializeDownload(nsITransfer*) () from /home/freundt/usr/firefox/libxul.so #31 0x00007fc752069e0b in nsExternalAppHandler::CreateProgressListener() () from /home/freundt/usr/firefox/libxul.so #32 0x00007fc752cf1b8b in nsExternalAppHandler::SaveToDisk(nsIFile*, bool) () from /home/freundt/usr/firefox/libxul.so #33 0x00007fc75206a65f in nsExternalAppHandler::OnStartRequest(nsIRequest*, nsISupports*) () from /home/freundt/usr/firefox/libxul.so #34 0x00007fc752cec248 in nsDocumentOpenInfo::OnStartRequest(nsIRequest*, nsISupports*) () from /home/freundt/usr/firefox/libxul.so #35 0x00007fc7527df3fe in mozilla::net::nsHttpChannel::CallOnStartRequest() () from /home/freundt/usr/firefox/libxul.so #36 0x00007fc7527df794 in mozilla::net::nsHttpChannel::ContinueProcessNormal(tag_nsresult) () from /home/freundt/usr/firefox/libxul.so #37 0x00007fc7527e02c1 in mozilla::net::nsHttpChannel::ProcessNormal() () from /home/freundt/usr/firefox/libxul.so #38 0x00007fc7527e0620 in mozilla::net::nsHttpChannel::ProcessResponse() () from /home/freundt/usr/firefox/libxul.so #39 0x00007fc7527e387d in mozilla::net::nsHttpChannel::OnStartRequest(nsIRequest*, nsISupports*) () from /home/freundt/usr/firefox/libxul.so #40 0x00007fc75278a14a in nsInputStreamPump::OnStateStart() () from /home/freundt/usr/firefox/libxul.so #41 0x00007fc75278a537 in nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) () from /home/freundt/usr/firefox/libxul.so #42 0x00007fc752e3c678 in nsInputStreamReadyEvent::Run() () from /home/freundt/usr/firefox/libxul.so ---Type <return> to continue, or q <return> to quit--- #43 0x00007fc752e4b142 in nsThread::ProcessNextEvent(bool, bool*) () from /home/freundt/usr/firefox/libxul.so #44 0x00007fc752e23c0c in NS_ProcessNextEvent_P(nsIThread*, bool) () from /home/freundt/usr/firefox/libxul.so #45 0x00007fc752dce055 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) () from /home/freundt/usr/firefox/libxul.so #46 0x00007fc752e6de83 in MessageLoop::Run() () from /home/freundt/usr/firefox/libxul.so #47 0x00007fc752163e90 in nsBaseAppShell::Run() () from /home/freundt/usr/firefox/libxul.so #48 0x00007fc752096808 in nsAppStartup::Run() () from /home/freundt/usr/firefox/libxul.so #49 0x00007fc7527791ca in XREMain::XRE_mainRun() () from /home/freundt/usr/firefox/libxul.so #50 0x00007fc751c1358a in XREMain::XRE_main(int, char**, nsXREAppData const*) () from /home/freundt/usr/firefox/libxul.so #51 0x00007fc751c13719 in XRE_main () from /home/freundt/usr/firefox/libxul.so #52 0x0000000000407267 in main () (gdb)
Ok, so I think we've figured it out - we do indeed force focus when a new download is initted - here: http://mxr.mozilla.org/mozilla-central/source/browser/components/downloads/src/DownloadsCommon.jsm#828 The thing is, *most* window managers prevent an app from stealing focus unless the user directly initiated the focus switch. That's why I wasn't able to reproduce it on Windows, OSX or Ubuntu - all of them have window managers that just prevent the focus stealing from happening. I don't think the bug reporters window manager is doing the focus-stealing prevention thing. I'm not even 100% sure why we need to force focus there. I'll see if Paolo minds if we remove the focus call.
Hey Paolo - is there a good reason to force focus here?
Assignee: nobody → mconley
Attachment #684090 - Flags: review?(paolo.mozmail)
Removing from our list of release blockers, since this is an uncommon setup.
No longer blocks: ReleaseDownloadsPane
Comment on attachment 684090 [details] [diff] [review] Remove force focus I think this was intended for the case where you start a download by opening a tab from the Library window, to bring the browser window to the foreground, so that you could see the download start notification (otherwise you wouldn't see any notification if the window is hidden), and use keyboard interaction with the newly started download, if the panel was opened. I suggest you double-check the case above, but now that we often don't open the panel, I agree we may change this, and live with the fact we may not see the download start notification (it's an edge case like the one in this bug). A comment in the patch with your conclusions would be welcome.
Attachment #684090 - Flags: review?(paolo.mozmail) → review+
(In reply to Paolo Amadini [:paolo] from comment #20) > I think this was intended for the case where you start a download by opening > a tab from the Library window, to bring the browser window to the foreground, > so that you could see the download start notification This was my suspect as well, though once we have the new view in place that action will just start the common download progressing in the Library itself, so we don't need to show anything further. The user is already notified by the library itself. This focus call applies to the old library ui that we don't intend to ship, so I think it's a good call to just remove it. Not sure if you want a comment added to code, I don't think it's needed. Though a nice multiline check-in comment would be welcome.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: