Closed
Bug 437283
Opened 16 years ago
Closed 16 years ago
window.focus() does not update nsIWindowWatcher::activeWindow
Categories
(Core :: Widget: Gtk, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: sdwilsh, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
8.02 KB,
patch
|
Details | Diff | Splinter Review |
Over in bug 437063, I have a browser test that focuses the main browser window to take focus away from the download manager. I then test the visible attribute on nsIDownloadManagerUI, which tests that the ui is 1) open, and 2) the frontmost window by checking nsIWindowWatcher::activeWindow == nsIWindowMediator::getMostRecentWindow("Download:Manager"). This works, as expected on mac and windows, but does not on Linux.
Comment 1•16 years ago
|
||
Is the window actually frontmost in the UI and the display doesn't match what the code returns, or that the window is not actually frontmost?
Reporter | ||
Comment 2•16 years ago
|
||
(In reply to comment #1) > Is the window actually frontmost in the UI and the display doesn't match what > the code returns, or that the window is not actually frontmost? I was just about to post a comment about this :) I added a throw "foo"; right after I call window.focus() in my test to stop the test from executing. The main browser window did in fact gain focus and was the front-most window, so the API doesn't appear to return the proper window.
Reporter | ||
Comment 3•16 years ago
|
||
I think the issue is that window.focus is not synchronous. This test file doesn't even pass on OS X, but it's essentially the same thing that the download manager test file does (which oddly enough, passes). Not sure what to do at this point.
Comment 4•16 years ago
|
||
Yeah, if I'm reading the Mozilla code correctly in gtk2/nsWindow.cpp:SetFocus we just call gtk_window_present which is not synchronous.
Comment 5•16 years ago
|
||
I think probably the right thing to do in your test is to fall back to the main loop, and wait for the focus event and then do your check (or a time out, say 10 seconds).
Reporter | ||
Comment 6•16 years ago
|
||
Right - looks my code in 437063 needs updating. Thanks for looking into this.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•