开发者

Firefox Tab Tearing kills my NPPlugin

开发者 https://www.devze.com 2022-12-14 12:25 出处:网络
I have an NPAPI Plugin that runs in Firefox, but any time that the tab is \"torn off\" (by dragging the tab into space so a new window is formed), the plugin is destroyed and recreated. The problem is

I have an NPAPI Plugin that runs in Firefox, but any time that the tab is "torn off" (by dragging the tab into space so a new window is formed), the plugin is destroyed and recreated. The problem is that the plugin needs to be initialized with information from an Ajax call, and I cannot find any way in Javascript to detect this, so the plugin is not getting the nece开发者_运维技巧ssary initialization information.

So, any ideas as to how to detect this event and/or make the plugin not be destroyed/recreated when the tab is torn off?


What operating system are you dealing with? If it is actually destroying your plugin and recreating it, you could always have the plugin attempt to call a javascript method on startup.

Specify the name of the function in a param tag and then on plugin startup, attempt to get a reference to that method by calling NPN_GetProperty on the window NPObject (which you can get by calling NPN_GetValue(NPNVWindowNPObject, &npobjectptr) and then calling NPN_GetProperty(npp, npobjectptr, NPN_GetStringIdentifier(functionname), &destObj)

Then you can invoke that method with a reference to your plugin (which you can get again with NPN_GetValue) and the js function will know that it's time to initialize your plugin (again?).

You could do other things as well, such as store initialization data in global space and try to figure out a way to detect that it should be the same plugin instance... not sure how to be sure it's supposed to be the same one, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消