Closed Bug 436063 Opened 16 years ago Closed 14 years ago

Invisible sheets accessible from Dock's window menu

Categories

(Core :: XUL, defect, P2)

x86
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: hramrach, Assigned: mstange)

Details

Attachments

(1 file, 3 obsolete files)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9) Gecko/2008051202 Firefox/3.0
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9) Gecko/2008051202 Firefox/3.0

When there are multiple dialogs they are sometimes ordered incorrectly, and the application seemingly locks up.

Reproducible: Sometimes

Steps to Reproduce:
1. open multiple sites that ask to set a cookie or supply basic auth credentials
2. close firefox
3. restart firefox
Actual Results:  
When the session loads sometimes multiple dialogs are displayed and their controls are unusable

Expected Results:  
the dialogs should work normally

The problem appears only when multiple dialogs are displayed.
The dialogs are modal in some way, and I suspect that while the first dialog is displayed only the last one is functional.

The application menus do not work. However, it is possible to use the dock icon menu to switch to different cookie query windows. These appear as windows without title, and when they are activated this way they are detached from their parent and appear as standalone dialogs. In all but one only the checkbox and the "show details" option work, the confirm or reject buttons do not. They are not grayed, just do nothing. The working dialog is not always the one that is actually displayed.

The issue with basic auth dialog is not as severe. The dialog sometimes loses focus and it is impossible to type in it. However, the focus can be restored to (some) auth dialog by switching to another application and back to Firefox (this does not work for the cookie dialogs, though). I am not sure multiple dialogs are required for this as I never needed to resort to window switching voodoo to fix this one. This one can be also seen on Linux.
> The problem appears only when multiple dialogs are displayed.

I can't get this to happen (at least with the basic auth dialog, which
so far is the only one I've tested with).

I opened two different sites that require basic auth (in two tabs in
the same window), then quit and selected "Save and quit" (in the "Quit
Firefox" dialog).  When I restarted Firefox both tabs re-appeared, I
only ever saw one basic auth dialog.  I got the same results opening
these sites in two different windows.  The (single) basic auth dialog
was for the tab (or window) that was currently focused.

I tested with Firefox 3 RC 1 on OS X 10.4.11.
Whiteboard: qawanted
I couldn't reproduce it with Michal's STR, but I've found a different way to trigger the bug:

1. Go to http://office.kis.uni-kl.de/
2. Click "Or you can add an exception...", "Add Exception..." and "Get Certificate".
3. Click "View".
4. Choose the "Add Security Exception" window from the Dock menu. (The hidden sheet is now a window.)
5. Click "View" another time.
6. Close the "Certificate Viewer" sheet.
7. Close it again.
Thanks, Markus.

As best I can tell the real problem is that you can access an
invisible sheet from the Dock's window menu.  So (I think) the fix
should be to stop that from happening.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: focus problems with OS X dialogs (sheets) → Invisible sheets accessible from Dock's window menu
Whiteboard: qawanted
Assignee: nobody → jag
Component: General → XP Toolkit/Widgets
Product: Firefox → Core
QA Contact: general → xptoolkit.widgets
Version: unspecified → Trunk
Assignee: jag → smichaud
Priority: -- → P2
I haven't tested Firefox 3.6.2 or Trunk to see if this bug still exists.  Having delved into the dock menu code recently, however, the relevant code should be in toolkit/xre/MacMacApplicationDelegate.mm in the -applicationDockMenu method.  The core has to build the windows list manually for some reason by enumerating the windows via the nsIWindowMediator service. I would think it is straightforward to exclude invisible sheets during that enumeration.
Thanks Tom, that worked.
Assignee: smichaud → mstange
Status: NEW → ASSIGNED
Attachment #439012 - Flags: review?(joshmoz)
Comment on attachment 439012 [details] [diff] [review]
block invisible windows and sheet parents

+    if (!cocoaWindow || ![cocoaWindow isVisible] || [cocoaWindow attachedSheet])

Does "isVisible" return true or false for a regular dock-minimized window? If minimized windows are not considered visible then I think this is wrong.
Attached patch v2 (obsolete) — Splinter Review
Your suspicion was correct; minimized windows return false for isVisible.

But there's a slightly simpler way to fix the bug.
Attachment #439012 - Attachment is obsolete: true
Attachment #439108 - Flags: review?(joshmoz)
Attachment #439012 - Flags: review?(joshmoz)
Comment on attachment 439108 [details] [diff] [review]
v2

Hm, I probably need to look at toolkit/content/macWindowMenu.js, too.
Attachment #439108 - Flags: review?(joshmoz)
Comment on attachment 439108 [details] [diff] [review]
v2

Ah, no, that's not for the Dock menu, but for the Window menu in the menu bar, which I'm not touching here.
Attachment #439108 - Flags: review?(joshmoz)
Comment on attachment 439108 [details] [diff] [review]
v2

+  NSApplication* app = [NSApplication sharedApplication];

Just use "NSApp".

+- (id)initWithApplication:(NSApplication*)aApp;

Why pass this around, why not just use NSApp wherever we need it.

This doesn't apply on trunk any more, sorry it took me a bit to get to the review. I'm still testing the patch.
Yeah that sounds better.
Comment on attachment 439108 [details] [diff] [review]
v2

I was concerned about how this would interact with our native menu system but I haven't been able to find any issues so if you can fix the stuff I commented about before then I'll r+. Thanks.
Attachment #439108 - Flags: review?(joshmoz) → review-
Attached patch v3 (obsolete) — Splinter Review
Attachment #439108 - Attachment is obsolete: true
Attachment #442164 - Flags: review?(joshmoz)
Attached patch v3Splinter Review
There was a mistake in the last patch.
Attachment #442164 - Attachment is obsolete: true
Attachment #442166 - Flags: review?(joshmoz)
Attachment #442164 - Flags: review?(joshmoz)
Attachment #442166 - Flags: review?(joshmoz) → review+
http://hg.mozilla.org/mozilla-central/rev/d5da063cf883
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: