2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-07-01 22:48:08 -07:00
|
|
|
#ifndef nsPluginHost_h_
|
|
|
|
#define nsPluginHost_h_
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsIPluginHost.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "prlink.h"
|
2008-02-28 18:06:00 -08:00
|
|
|
#include "prclist.h"
|
|
|
|
#include "npapi.h"
|
2008-09-15 05:45:01 -07:00
|
|
|
#include "nsNPAPIPluginInstance.h"
|
2007-07-03 14:42:35 -07:00
|
|
|
#include "nsIPluginTag.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsPluginsDir.h"
|
|
|
|
#include "nsPluginDirServiceProvider.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsWeakPtr.h"
|
|
|
|
#include "nsIPrompt.h"
|
|
|
|
#include "nsWeakReference.h"
|
2008-02-28 18:06:00 -08:00
|
|
|
#include "nsThreadUtils.h"
|
2008-03-10 00:07:15 -07:00
|
|
|
#include "nsTArray.h"
|
2009-12-15 12:44:52 -08:00
|
|
|
#include "nsTObserverArray.h"
|
|
|
|
#include "nsITimer.h"
|
2009-12-15 14:47:22 -08:00
|
|
|
#include "nsPluginTags.h"
|
2013-02-14 13:38:41 -08:00
|
|
|
#include "nsPluginPlayPreviewInfo.h"
|
2011-02-08 14:16:07 -08:00
|
|
|
#include "nsIEffectiveTLDService.h"
|
|
|
|
#include "nsIIDNService.h"
|
2011-05-21 06:28:54 -07:00
|
|
|
#include "nsCRT.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-09-15 05:45:01 -07:00
|
|
|
class nsNPAPIPlugin;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIComponentManager;
|
|
|
|
class nsIFile;
|
|
|
|
class nsIChannel;
|
2011-05-21 06:28:54 -07:00
|
|
|
class nsPluginNativeWindow;
|
2012-01-31 13:55:54 -08:00
|
|
|
class nsObjectLoadingContent;
|
|
|
|
class nsPluginInstanceOwner;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-12-09 14:28:15 -08:00
|
|
|
class nsInvalidPluginTag : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
2012-08-22 08:56:38 -07:00
|
|
|
nsInvalidPluginTag(const char* aFullPath, int64_t aLastModifiedTime = 0);
|
2010-12-09 14:28:15 -08:00
|
|
|
virtual ~nsInvalidPluginTag();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
nsCString mFullPath;
|
2012-08-22 08:56:38 -07:00
|
|
|
int64_t mLastModifiedTime;
|
2010-12-09 14:28:15 -08:00
|
|
|
bool mSeen;
|
|
|
|
|
|
|
|
nsRefPtr<nsInvalidPluginTag> mPrev;
|
|
|
|
nsRefPtr<nsInvalidPluginTag> mNext;
|
|
|
|
};
|
|
|
|
|
2009-07-01 22:48:08 -07:00
|
|
|
class nsPluginHost : public nsIPluginHost,
|
|
|
|
public nsIObserver,
|
2009-12-15 12:44:52 -08:00
|
|
|
public nsITimerCallback,
|
2009-07-01 22:48:08 -07:00
|
|
|
public nsSupportsWeakReference
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2009-07-01 22:48:08 -07:00
|
|
|
nsPluginHost();
|
|
|
|
virtual ~nsPluginHost();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-03-20 11:29:00 -07:00
|
|
|
static already_AddRefed<nsPluginHost> GetInst();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2009-06-25 14:06:54 -07:00
|
|
|
NS_DECL_NSIPLUGINHOST
|
|
|
|
NS_DECL_NSIOBSERVER
|
2009-12-15 12:44:52 -08:00
|
|
|
NS_DECL_NSITIMERCALLBACK
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-05-21 06:28:54 -07:00
|
|
|
nsresult Init();
|
|
|
|
nsresult LoadPlugins();
|
2012-01-05 16:02:51 -08:00
|
|
|
nsresult UnloadPlugins();
|
2012-04-24 13:25:21 -07:00
|
|
|
|
2011-05-21 06:28:54 -07:00
|
|
|
nsresult SetUpPluginInstance(const char *aMimeType,
|
|
|
|
nsIURI *aURL,
|
2012-10-02 19:43:18 -07:00
|
|
|
nsPluginInstanceOwner *aOwner);
|
2011-12-09 14:56:20 -08:00
|
|
|
nsresult IsPluginEnabledForType(const char* aMimeType);
|
|
|
|
nsresult IsPluginEnabledForExtension(const char* aExtension, const char* &aMimeType);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult GetBlocklistStateForType(const char *aMimeType, uint32_t *state);
|
2012-02-10 05:39:40 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult GetPluginCount(uint32_t* aPluginCount);
|
|
|
|
nsresult GetPlugins(uint32_t aPluginCount, nsIDOMPlugin** aPluginArray);
|
2011-05-21 06:28:54 -07:00
|
|
|
|
|
|
|
nsresult GetURL(nsISupports* pluginInst,
|
|
|
|
const char* url,
|
|
|
|
const char* target,
|
2012-05-17 16:54:26 -07:00
|
|
|
nsNPAPIPluginStreamListener* streamListener,
|
2011-05-21 06:28:54 -07:00
|
|
|
const char* altHost,
|
|
|
|
const char* referrer,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool forceJSEnabled);
|
2011-05-21 06:28:54 -07:00
|
|
|
nsresult PostURL(nsISupports* pluginInst,
|
|
|
|
const char* url,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t postDataLen,
|
2011-05-21 06:28:54 -07:00
|
|
|
const char* postData,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isFile,
|
2011-05-21 06:28:54 -07:00
|
|
|
const char* target,
|
2012-05-17 16:54:26 -07:00
|
|
|
nsNPAPIPluginStreamListener* streamListener,
|
2011-05-21 06:28:54 -07:00
|
|
|
const char* altHost,
|
|
|
|
const char* referrer,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool forceJSEnabled,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t postHeadersLength,
|
2011-05-21 06:28:54 -07:00
|
|
|
const char* postHeaders);
|
|
|
|
|
|
|
|
nsresult FindProxyForURL(const char* url, char* *result);
|
|
|
|
nsresult UserAgent(const char **retstring);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult ParsePostBufferToFixHeaders(const char *inPostData, uint32_t inPostDataLen,
|
|
|
|
char **outPostData, uint32_t *outPostDataLen);
|
2011-05-21 06:28:54 -07:00
|
|
|
nsresult CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile);
|
|
|
|
nsresult NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, bool isVisible);
|
2011-05-21 06:28:54 -07:00
|
|
|
void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame);
|
|
|
|
|
2011-05-17 18:48:34 -07:00
|
|
|
nsresult GetPluginName(nsNPAPIPluginInstance *aPluginInstance, const char** aPluginName);
|
|
|
|
nsresult StopPluginInstance(nsNPAPIPluginInstance* aInstance);
|
|
|
|
nsresult GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance, nsIPluginTag **aPluginTag);
|
|
|
|
|
2009-06-25 14:06:54 -07:00
|
|
|
nsresult
|
2007-03-22 10:30:00 -07:00
|
|
|
NewPluginURLStream(const nsString& aURL,
|
2010-07-16 12:55:54 -07:00
|
|
|
nsNPAPIPluginInstance *aInstance,
|
2012-05-17 16:54:26 -07:00
|
|
|
nsNPAPIPluginStreamListener *aListener,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsIInputStream *aPostStream = nullptr,
|
|
|
|
const char *aHeadersData = nullptr,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aHeadersDataLen = 0);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-06-25 14:06:54 -07:00
|
|
|
nsresult
|
2010-07-16 12:55:54 -07:00
|
|
|
GetURLWithHeaders(nsNPAPIPluginInstance *pluginInst,
|
2009-06-25 14:06:54 -07:00
|
|
|
const char* url,
|
|
|
|
const char* target = NULL,
|
2012-05-17 16:54:26 -07:00
|
|
|
nsNPAPIPluginStreamListener* streamListener = NULL,
|
2009-06-25 14:06:54 -07:00
|
|
|
const char* altHost = NULL,
|
|
|
|
const char* referrer = NULL,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool forceJSEnabled = false,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t getHeadersLength = 0,
|
2009-06-25 14:06:54 -07:00
|
|
|
const char* getHeaders = NULL);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
2010-07-16 12:55:54 -07:00
|
|
|
DoURLLoadSecurityCheck(nsNPAPIPluginInstance *aInstance,
|
2007-03-22 10:30:00 -07:00
|
|
|
const char* aURL);
|
|
|
|
|
2009-06-25 14:06:54 -07:00
|
|
|
nsresult
|
2012-08-22 08:56:38 -07:00
|
|
|
AddHeadersToChannel(const char *aHeadersData, uint32_t aHeadersDataLen,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIChannel *aGenericChannel);
|
|
|
|
|
|
|
|
static nsresult GetPluginTempDir(nsIFile **aDir);
|
|
|
|
|
2007-07-13 17:28:05 -07:00
|
|
|
// Writes updated plugins settings to disk and unloads the plugin
|
|
|
|
// if it is now disabled
|
|
|
|
nsresult UpdatePluginInfo(nsPluginTag* aPluginTag);
|
2013-02-15 13:00:25 -08:00
|
|
|
|
2012-07-02 13:44:39 -07:00
|
|
|
// Helper that checks if a type is whitelisted in plugin.allowed_types.
|
|
|
|
// Always returns true if plugin.allowed_types is not set
|
|
|
|
static bool IsTypeWhitelisted(const char *aType);
|
2007-07-03 14:42:35 -07:00
|
|
|
|
2007-09-04 11:19:31 -07:00
|
|
|
// checks whether aTag is a "java" plugin tag (a tag for a plugin
|
|
|
|
// that does Java)
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool IsJavaMIMEType(const char *aType);
|
2007-09-04 11:19:31 -07:00
|
|
|
|
2009-06-13 13:16:40 -07:00
|
|
|
static nsresult GetPrompt(nsIPluginInstanceOwner *aOwner, nsIPrompt **aPrompt);
|
|
|
|
|
2009-12-15 14:47:22 -08:00
|
|
|
static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
|
|
|
|
|
2010-03-24 14:22:04 -07:00
|
|
|
void PluginCrashed(nsNPAPIPlugin* plugin,
|
|
|
|
const nsAString& pluginDumpID,
|
|
|
|
const nsAString& browserDumpID);
|
2009-12-16 12:08:45 -08:00
|
|
|
|
2010-07-19 19:11:26 -07:00
|
|
|
nsNPAPIPluginInstance *FindInstance(const char *mimetype);
|
2011-11-11 17:10:31 -08:00
|
|
|
nsNPAPIPluginInstance *FindOldestStoppedInstance();
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t StoppedInstanceCount();
|
2010-01-26 17:30:58 -08:00
|
|
|
|
2010-07-19 19:11:26 -07:00
|
|
|
nsTArray< nsRefPtr<nsNPAPIPluginInstance> > *InstanceArray();
|
2010-01-26 17:30:58 -08:00
|
|
|
|
2013-04-23 13:02:12 -07:00
|
|
|
void DestroyRunningInstances(nsPluginTag* aPluginTag);
|
2010-01-26 17:30:58 -08:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
// Return the tag for |aLibrary| if found, nullptr if not.
|
2010-07-19 19:11:26 -07:00
|
|
|
nsPluginTag* FindTagForLibrary(PRLibrary* aLibrary);
|
2010-04-05 08:25:59 -07:00
|
|
|
|
2011-04-28 13:08:33 -07:00
|
|
|
// The last argument should be false if we already have an in-flight stream
|
|
|
|
// and don't need to set up a new stream.
|
2012-12-12 16:12:41 -08:00
|
|
|
nsresult InstantiatePluginInstance(const char *aMimeType, nsIURI* aURL,
|
|
|
|
nsObjectLoadingContent *aContent,
|
|
|
|
nsPluginInstanceOwner** aOwner);
|
2011-04-28 13:08:33 -07:00
|
|
|
|
2010-11-19 12:58:59 -08:00
|
|
|
// Does not accept NULL and should never fail.
|
|
|
|
nsPluginTag* TagForPlugin(nsNPAPIPlugin* aPlugin);
|
|
|
|
|
2011-05-11 13:23:25 -07:00
|
|
|
nsresult GetPlugin(const char *aMimeType, nsNPAPIPlugin** aPlugin);
|
|
|
|
|
2012-12-12 16:12:41 -08:00
|
|
|
nsresult NewPluginStreamListener(nsIURI* aURL,
|
|
|
|
nsNPAPIPluginInstance* aInstance,
|
|
|
|
nsIStreamListener **aStreamListener);
|
2012-04-24 13:25:21 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
private:
|
2009-06-25 14:06:54 -07:00
|
|
|
nsresult
|
2012-10-02 19:43:18 -07:00
|
|
|
TrySetUpPluginInstance(const char *aMimeType, nsIURI *aURL, nsPluginInstanceOwner *aOwner);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-13 19:51:21 -07:00
|
|
|
nsPluginTag*
|
|
|
|
FindPreferredPlugin(const InfallibleTArray<nsPluginTag*>& matches);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Return an nsPluginTag for this type, if any. If aCheckEnabled is
|
|
|
|
// true, only enabled plugins will be returned.
|
|
|
|
nsPluginTag*
|
2011-09-28 23:19:26 -07:00
|
|
|
FindPluginForType(const char* aMimeType, bool aCheckEnabled);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsPluginTag*
|
|
|
|
FindPluginEnabledForExtension(const char* aExtension, const char* &aMimeType);
|
|
|
|
|
2011-11-11 17:10:31 -08:00
|
|
|
nsresult
|
|
|
|
FindStoppedPluginForURL(nsIURI* aURL, nsIPluginInstanceOwner *aOwner);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
2011-09-28 23:19:26 -07:00
|
|
|
FindPlugins(bool aCreatePluginList, bool * aPluginsChanged);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-29 15:28:45 -07:00
|
|
|
// Registers or unregisters the given mime type with the category manager
|
|
|
|
// (performs no checks - see UpdateCategoryManager)
|
|
|
|
enum nsRegisterType { ePluginRegister, ePluginUnregister };
|
|
|
|
void RegisterWithCategoryManager(nsCString &aMimeType, nsRegisterType aType);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
2011-03-31 11:26:57 -07:00
|
|
|
ScanPluginsDirectory(nsIFile *pluginsDir,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aCreatePluginList,
|
|
|
|
bool *aPluginsChanged);
|
2011-03-31 11:26:57 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
2011-03-31 11:26:57 -07:00
|
|
|
ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aCreatePluginList,
|
|
|
|
bool *aPluginsChanged);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-04-03 15:08:07 -07:00
|
|
|
nsresult EnsurePluginLoaded(nsPluginTag* aPluginTag);
|
2011-02-18 17:05:23 -08:00
|
|
|
|
2012-04-03 15:08:07 -07:00
|
|
|
bool IsRunningPlugin(nsPluginTag * aPluginTag);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Stores all plugins info into the registry
|
|
|
|
nsresult WritePluginInfo();
|
|
|
|
|
|
|
|
// Loads all cached plugins info into mCachedPlugins
|
|
|
|
nsresult ReadPluginInfo();
|
|
|
|
|
2009-06-10 13:47:49 -07:00
|
|
|
// Given a file path, returns the plugins info from our cache
|
2007-03-22 10:30:00 -07:00
|
|
|
// and removes it from the cache.
|
2009-06-10 13:47:49 -07:00
|
|
|
void RemoveCachedPluginsInfo(const char *filePath,
|
2007-07-03 14:42:35 -07:00
|
|
|
nsPluginTag **result);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-02-18 17:05:23 -08:00
|
|
|
// Checks to see if a tag object is in our list of live tags.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsLiveTag(nsIPluginTag* tag);
|
2012-07-23 10:52:51 -07:00
|
|
|
|
|
|
|
// Checks our list of live tags for an equivalent tag.
|
|
|
|
nsPluginTag* HaveSamePlugin(const nsPluginTag * aPluginTag);
|
|
|
|
|
|
|
|
// Returns the first plugin at |path|
|
|
|
|
nsPluginTag* FirstPluginWithPath(const nsCString& path);
|
2011-02-18 17:05:23 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult EnsurePrivateDirServiceProvider();
|
|
|
|
|
2010-01-26 17:30:58 -08:00
|
|
|
void OnPluginInstanceDestroyed(nsPluginTag* aPluginTag);
|
|
|
|
|
2007-07-03 14:42:35 -07:00
|
|
|
nsRefPtr<nsPluginTag> mPlugins;
|
|
|
|
nsRefPtr<nsPluginTag> mCachedPlugins;
|
2010-12-09 14:28:15 -08:00
|
|
|
nsRefPtr<nsInvalidPluginTag> mInvalidPlugins;
|
2013-02-14 13:38:41 -08:00
|
|
|
nsTArray< nsRefPtr<nsPluginPlayPreviewInfo> > mPlayPreviewMimeTypes;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mPluginsLoaded;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// set by pref plugin.override_internal_types
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mOverrideInternalTypes;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-10-05 02:00:57 -07:00
|
|
|
// set by pref plugin.disable
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mPluginsDisabled;
|
2012-07-11 08:56:34 -07:00
|
|
|
// set by pref plugins.click_to_play
|
|
|
|
bool mPluginsClickToPlay;
|
2009-10-05 02:00:57 -07:00
|
|
|
|
2010-07-19 19:11:26 -07:00
|
|
|
// Any instances in this array will have valid plugin objects via GetPlugin().
|
|
|
|
// When removing an instance it might not die - be sure to null out it's plugin.
|
|
|
|
nsTArray< nsRefPtr<nsNPAPIPluginInstance> > mInstances;
|
2010-01-26 17:30:58 -08:00
|
|
|
|
2009-02-09 10:48:06 -08:00
|
|
|
nsCOMPtr<nsIFile> mPluginRegFile;
|
2007-07-20 13:34:51 -07:00
|
|
|
#ifdef XP_WIN
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRefPtr<nsPluginDirServiceProvider> mPrivateDirServiceProvider;
|
2009-02-09 10:48:06 -08:00
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-02-08 14:16:07 -08:00
|
|
|
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
|
|
|
nsCOMPtr<nsIIDNService> mIDNService;
|
|
|
|
|
|
|
|
// Helpers for ClearSiteData and SiteHasData.
|
|
|
|
nsresult NormalizeHostname(nsCString& host);
|
|
|
|
nsresult EnumerateSiteData(const nsACString& domain,
|
2012-11-29 08:14:14 -08:00
|
|
|
const InfallibleTArray<nsCString>& sites,
|
2011-02-08 14:16:07 -08:00
|
|
|
InfallibleTArray<nsCString>& result,
|
|
|
|
bool firstMatchOnly);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsWeakPtr mCurrentDocument; // weak reference, we use it to id document only
|
|
|
|
|
|
|
|
static nsIFile *sPluginTempDir;
|
|
|
|
|
|
|
|
// We need to hold a global ptr to ourselves because we register for
|
|
|
|
// two different CIDs for some reason...
|
2009-07-01 22:48:08 -07:00
|
|
|
static nsPluginHost* sInst;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2013-04-11 20:20:18 -07:00
|
|
|
class MOZ_STACK_CLASS PluginDestructionGuard : protected PRCList
|
2008-02-28 18:06:00 -08:00
|
|
|
{
|
|
|
|
public:
|
2011-05-17 18:48:34 -07:00
|
|
|
PluginDestructionGuard(nsNPAPIPluginInstance *aInstance)
|
2008-02-28 18:06:00 -08:00
|
|
|
: mInstance(aInstance)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginDestructionGuard(NPP npp)
|
2012-07-30 07:20:58 -07:00
|
|
|
: mInstance(npp ? static_cast<nsNPAPIPluginInstance*>(npp->ndata) : nullptr)
|
2008-02-28 18:06:00 -08:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
~PluginDestructionGuard();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool DelayDestroy(nsNPAPIPluginInstance *aInstance);
|
2008-02-28 18:06:00 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread");
|
|
|
|
|
2011-09-29 23:02:59 -07:00
|
|
|
mDelayedDestroy = false;
|
2008-02-28 18:06:00 -08:00
|
|
|
|
|
|
|
PR_INIT_CLIST(this);
|
|
|
|
PR_INSERT_BEFORE(this, &sListHead);
|
|
|
|
}
|
|
|
|
|
2011-05-17 18:48:34 -07:00
|
|
|
nsRefPtr<nsNPAPIPluginInstance> mInstance;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDelayedDestroy;
|
2008-02-28 18:06:00 -08:00
|
|
|
|
|
|
|
static PRCList sListHead;
|
|
|
|
};
|
|
|
|
|
2009-07-05 23:10:10 -07:00
|
|
|
#endif // nsPluginHost_h_
|