Safari seems to enter the plugin on NP_Initialize, whilst Opera&Firefox enter on a main function like: int main(NPNetscapeFuncs *pFuncs, NPPluginFuncs *pluginFuncs, NPP_ShutdownProcPtr *shutdown) This behavior only seems to happen on Darwin, as Opera&Firefox seem to enter on NP_Initialize on Linux/Win32. So perhaps this isn't a bug and Opera&Firefox Darwin plugin support needs updating. The Netscape Plugin Example /Developer/Examples/WebKit/NetscapeMoviePlugIn/ seems to imply that the _main function_ entry point is for old CFM legacy type stuff. That's misleading. Don't waste time ripping it out and find Opera&Firefox stop working. Also Localized.r seems to be required for Opera&Firefox and not Safari. Very odd. I found this reference: http://developer.mozilla.org/en/docs/Gecko_Plugin_API_Reference:Plug-in_Development_Overview#Mac_OS_X It would be nice if Opera&WebKit&Firefox were more in sync when it comes to plugin registration.
The issue with the example code needs to be tracked through Radar. I see that you filed <rdar://problem/5570872> on that issue, which is great. This bugzilla entry can focus specifically on the behavioural difference between WebKit and Firefox/Opera when loading NPAPI plugins. Specifically, the problem is that "main" is not called by WebKit on a mach-o plugin while Firefox/Opera require it to be present for the plugin to be used in a page. This can be reproduced by doing modifying the NetscapeMoviePlugin sample code to remove the two references to "int main(...)". You can also verify with a debugger that "main" is invoked by both Firefox and Opera as part of the plugin initialization for mach-o plugins, not only for CFM binaries as WebKit currently does.
<rdar://problem/5573222>
We've removed this example code.