Bug 1333887 - Hold nsNPAPIPlugin alive for active nsNPAPIPluginInstance objects. This should happen through the plugin tag, but apparently that isn't always working. r=qdot

--HG--
extra : rebase_source : 79750e208d0d7dad50ee6711491222143618fb8d
This commit is contained in:
Benjamin Smedberg 2017-02-14 09:10:31 -05:00
Родитель 580d0db25f
Коммит ef157dd274
3 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -210,8 +210,6 @@ static void CheckClassInitialized()
NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,("NPN callbacks initialized\n"));
}
NS_IMPL_ISUPPORTS0(nsNPAPIPlugin)
nsNPAPIPlugin::nsNPAPIPlugin()
{
memset((void*)&mPluginFuncs, 0, sizeof(mPluginFuncs));

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/PluginLibrary.h"
#include "mozilla/RefCounted.h"
#if defined(XP_WIN)
#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name)
@ -24,7 +25,9 @@ typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGININIT) (const NPNetscapeFuncs*
typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFuncs* pCallbacks, NPPluginFuncs* fCallbacks);
typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) ();
class nsNPAPIPlugin : public nsISupports
// nsNPAPIPlugin is held alive both by active nsPluginTag instances and
// by active nsNPAPIPluginInstance.
class nsNPAPIPlugin final
{
private:
typedef mozilla::PluginLibrary PluginLibrary;
@ -32,7 +35,7 @@ private:
public:
nsNPAPIPlugin();
NS_DECL_ISUPPORTS
NS_INLINE_DECL_REFCOUNTING(nsNPAPIPlugin)
// Constructs and initializes an nsNPAPIPlugin object. A nullptr file path
// will prevent this from calling NP_Initialize.
@ -59,8 +62,8 @@ public:
static nsresult RetainStream(NPStream *pstream, nsISupports **aRetainedPeer);
protected:
virtual ~nsNPAPIPlugin();
private:
~nsNPAPIPlugin();
NPPluginFuncs mPluginFuncs;
PluginLibrary* mLibrary;

Просмотреть файл

@ -30,6 +30,7 @@ class PluginEventRunnable;
#include "mozilla/EventForwards.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/PluginLibrary.h"
#include "mozilla/RefPtr.h"
#include "mozilla/WeakPtr.h"
class nsPluginStreamListenerPeer; // browser-initiated stream class
@ -384,7 +385,7 @@ public:
nsXPIDLCString mFakeURL;
private:
nsNPAPIPlugin* mPlugin;
RefPtr<nsNPAPIPlugin> mPlugin;
nsTArray<nsNPAPIPluginStreamListener*> mStreamListeners;