Mac NSAPI plugin needs to know when Firefox is quitting

View: New views
1 Messages — Rating Filter:   Alert me  

Mac NSAPI plugin needs to know when Firefox is quitting

by Rudi Sherry-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a mac NSAP plug-in that loads frameworks; these frameworks
contain objective-c code. Frameworks that contain objective-c code
cannot be unloaded (according to Apple), so my plug-in cannot be
unloaded either.

When a resource of my plug-ins mime type is loaded, I get the usual
NP_Initialized ... code; when the resource is unloaded (the user
presses Back, or closes the window, or surfs on, or the DOM is
changed... whatever), I get NPP_Destroy() then NP_Shutdown.
NP_Shutdown() is the last communication I get from Mozilla... until
another resource of my mime type is loaded.  Then I get the same
sequence as before.

Since I can't unload my code, I can't unload at NP_Shutdown.  However,
I need to terminate the frameworks in the right order (I don't have
control over changing that) so I need to do that when Firefox Quits,
or it will crash inside my plug-in.

I can't find a hook so my plug-in's native code (objective-c or C++)
can execute something just before Firefox Quits.

Firefox does not call [NSApp terminate:] when it quits, so there is
nothing posted by the Notificaiton manager.  I see that it calls
NotifyObserver( ... "application-quit" ...), but I can't see where to
hook into that.  I could have any instance of my plug-in create a
javascript observer for that, but when the instance is destroyed that
javascript object would go away.

Is there anything I've missed?

Any help would be appreciated,

Rudi
_______________________________________________
dev-tech-plugins mailing list
dev-tech-plugins@...
https://lists.mozilla.org/listinfo/dev-tech-plugins
LightInTheBox - Buy quality products at wholesale price!