Bug 70739

Summary: NPAPI plugins with Cocoa event model don't get correct focusChanged events
Product: WebKit Reporter: Rudi Sherry <rsherry>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ahmad.saleem792, andersca, ap, rniwa, sam, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.6   
Attachments:
Description Flags
WebKit plugin for *.pluginbug served as application/vnd.pluginbug none

Rudi Sherry
Reported 2011-10-24 10:36:28 PDT
Created attachment 112210 [details] WebKit plugin for *.pluginbug served as application/vnd.pluginbug When a plugin gets loaded and uses the Cocoa Event model, it becomes the focus but never gets the cocoa event "NPCocoaEventFocusChanged"; same when clicking into the plugin area after the focus is in the URL bar. Our plugin needs to know exactly when it is, and isn't, the focus so we can enable our controls, blink our cursor, etc. I've included a plugin that responds to files with extension 'pluginbug' served with MIME type 'application/vnd.pluginbug' (target 10.6 SDK). All it does is do the logging of events and calls, and the output below is what we get. I've tried this in Safari 5.1.1 as well as a nightly from late last week. NP_Initialize NP_GetEntryPoints NPP_New NPP_SetWindow NPP_HandleEvent NPCocoaEventWindowFocusChanged OFF NPP_HandleEvent NPCocoaEventWindowFocusChanged OFF NPP_NewStream NPP_StreamAsFile NPP_DestroyStream NPP_HandleEvent NPCocoaEventDrawRect NPP_GetValue 15 We were never told that we got the focus specifically, only that the window got the focus. The keyboard focus is actually in the plug-in (that is, keys sent to the browser are forwarded to the plug-in. In addition clicking in the plug-in, then clicking in the URL bar, which should remove focus from the plugin, does not fire any focus-changed events. ...moved the mouse to the plug-in area and clicked (which fires the getFocus finally); NPP_HandleEvent NPCocoaEventMouseEntered NPP_HandleEvent NPCocoaEventFocusChanged ON NPP_HandleEvent NPCocoaEventFocusChanged ON NPP_HandleEvent NPCocoaEventMouseDown NPP_HandleEvent NPCocoaEventMouseUp ...moved mouse to URL bar and clicked (which never fires a loseFocus): NPP_HandleEvent NPCocoaEventMouseExited ... moved mouse back to plugin and clicked NPP_HandleEvent NPCocoaEventMouseEntered NPP_HandleEvent NPCocoaEventMouseDown NPP_HandleEvent NPCocoaEventMouseUp ... hit apple-Quit NPP_HandleEvent NPCocoaEventFlagsChanged NPP_HandleEvent NPCocoaEventKeyDown NPP_Destroy NP_Shutdown
Attachments
WebKit plugin for *.pluginbug served as application/vnd.pluginbug (17.46 KB, application/octet-stream)
2011-10-24 10:36 PDT, Rudi Sherry
no flags
Sam Weinig
Comment 1 2011-10-24 17:04:34 PDT
Rudi Sherry
Comment 2 2011-12-16 15:56:49 PST
(In reply to comment #1) > <rdar://problem/10337858> I can't see that bug so I don't know how it's going. Any news?
Rudi Sherry
Comment 3 2012-01-16 09:01:17 PST
I found this happens only if you start with Top Sites and click on the plugin page (so you must get that page into the Top Sites first). If you start with HTML and click on a link, we do *not* get the window-focus-changed OFF.
Rudi Sherry
Comment 4 2012-01-30 16:17:16 PST
After testing with embedded plug-ins, there appear to be an ambiguity in the model. The plugin window focus addresses whether the Safari window has the focus or not (regardless of which element in it has). The plugin focus addresses whether the plugin has the focus within the web content (regardless of whether the web content itself has focus). There doesn't seem to be anything that tracks when the web content gets/loses the focus within the Safari window; that is moving from the URL text-field to the HTML content doesn't fire anything to the plugin. Is there some way to track that?
Ahmad Saleem
Comment 5 2022-06-20 10:37:45 PDT
NPAPI is not support from Safari 14 onward and removed from WebkitGTK as well. Can this be marked as "WONTFIX"? Thanks!
Note You need to log in before you can comment on or make changes to this bug.