Closed Bug 618470 Opened 14 years ago Closed 8 years ago

nsIWindowMediator::getMostRecentWindow doesn't match what is thought to be focused

Categories

(Core :: Widget, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: dwitte, Unassigned)

References

Details

+++ This bug was initially created as a clone of Bug #528706 +++ In bug 599253 we discovered that getMostRecentWindow, which sessionstore uses internally, doesn't actually return the currently focused window. For instance, a 'waitForFocus(...)' call won't necessarily result in getMostRecentWindow matching what's focused. See https://bugzilla.mozilla.org/show_bug.cgi?id=599253#c389 for details.
getMostRecentWindow isn't supposed to do this. The focused window can be retrieved with nsIFocusManager::GetActiveWindow.
Should the docs be updated for getMostRecentWindow to encourage using Services.ww.activeWindow? https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowMediator#getMostRecentWindow%28%29 I know I didn't realize it was a better choice. I guess the only question then becomes what's the best way to get the active browser window?
You could compare the result of getMostRecent (In reply to Mike Kaply [:mkaply] from comment #2) > Should the docs be updated for getMostRecentWindow to encourage using > Services.ww.activeWindow? Services.focus.activeWindow (Services.ww.activeWindow is just a wrapper around this) should be used to determine the active window. getMostRecentWindow returns whatever window happened to be last focused, although it might or might not be focused at the time. For example, getMostRecentWindow("navigator:browser") returns the last browser window that was used, but there may be some non browser window or a different application focused. You could compare the result to Services.focus.activeWindow to determine whether it is the active window. I'm not clear what issue the original filer was having, and bug 599253 doesn't say in enough detail to know either, so I don't know for sure if this bug is invalid.
Dwitte: Any response to Neil's comments?
Flags: needinfo?(dwitte)
I haven't touched this in a long long time, so I can't shed more light, sorry.
Flags: needinfo?(dwitte)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.