[Webkit-unassigned] [Bug 3784] JavaScript save dialog disappears right away (sheet triggers blur event)

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Tue Mar 14 05:14:01 PST 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=3784


darin at apple.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|JavaScript save dialog      |JavaScript save dialog
                   |disappearing instantly      |disappears right away (sheet
                   |                            |triggers blur event)




------- Comment #10 from darin at apple.com  2006-03-14 05:13 PDT -------
I still can't reproduce a crash. Alexey's steps do reliably reproduce a case
where the window is closed right away.

The reason for that is that the site has a blur handler that closes the window.
The bug here is that we deliver a blur event when the sheet comes up, which
isn't right. The sheet shouldn't count for purposes of the JavaScript blur and
focus events.

The source of that trouble is -[WebHTMLView _updateFocusState]. It needs to
treat the window as key for purposes of focus and blur events even when there's
a sheet up. So instead of just calling -[NSWindow isKeyWindow] it should
probably call -[NSApplication keyWindow] and check if the key window is either
the WebHTMLView's own window or the attachedSheet of that window. Similarly, if
the key window is a modal dialog I don't think we should deliver a blur event.

Two things that might make this tricky to fix:

    1) We probably want to treat the window as not focused for purposes of the
window's appearance. So we should be careful to only do the new check for the
value for setWindowHasFocus: and leave setDisplaysWithFocusAttributes: alone,
still using isKeyWindow.

    2) -[WebHTMLView _updateFocusState] is currently called from -[WebHTMLView
windowDidBecomeKey:] and -[WebHTMLView windowDidResignKey:], and we register
for those only for the window itself in -[WebHTMLView addWindowObservers]. If
we leave the window in a focused state when the sheet becomes the key window,
we won't get any notification at all when the sheet resigns key if you click on
some other window. And we'd want to send a blur event in that case. One way to
fix this would be to register for those notifications on a sheet when the sheet
is up. We could register for NSWindowWillBeginSheetNotification and
NSWindowDidEndSheetNotification notifications, and then set up and tear down an
observer for the sheet. A simpler way would be to register for
NSWindowDidBecomeKeyNotification and NSWindowDidResignKeyNotification globally
without passing a window pointer, and then check the window pointer in the
handler method.

None of this necessarily has to do with the crash; I can't reproduce the crash
so I'm not sure. You could probably still reproduce the crash by just having
JavaScript code in some other window that closes this window. It doesn't have
to be from the blur event. Or you could still trigger the blur event with the
save dialog up by clicking in another window.


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list