2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
1998-07-28 02:07:25 +00:00
|
|
|
|
2009-07-02 05:48:08 +00:00
|
|
|
#ifndef nsPluginHost_h_
|
|
|
|
#define nsPluginHost_h_
|
1998-07-28 02:07:25 +00:00
|
|
|
|
|
|
|
#include "nsIPluginHost.h"
|
2001-03-12 02:07:15 +00:00
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsCOMPtr.h"
|
1998-07-28 02:07:25 +00:00
|
|
|
#include "prlink.h"
|
2008-02-29 02:06:00 +00:00
|
|
|
#include "prclist.h"
|
2007-07-03 21:42:35 +00:00
|
|
|
#include "nsIPluginTag.h"
|
2000-03-23 00:45:49 +00:00
|
|
|
#include "nsPluginsDir.h"
|
2003-05-27 21:14:55 +00:00
|
|
|
#include "nsPluginDirServiceProvider.h"
|
2002-05-16 20:47:29 +00:00
|
|
|
#include "nsWeakPtr.h"
|
2002-06-01 00:56:38 +00:00
|
|
|
#include "nsIPrompt.h"
|
2005-11-06 18:34:03 +00:00
|
|
|
#include "nsWeakReference.h"
|
2013-09-19 13:54:42 +00:00
|
|
|
#include "MainThreadUtils.h"
|
2008-03-10 07:07:15 +00:00
|
|
|
#include "nsTArray.h"
|
2009-12-15 20:44:52 +00:00
|
|
|
#include "nsTObserverArray.h"
|
|
|
|
#include "nsITimer.h"
|
2009-12-15 22:47:22 +00:00
|
|
|
#include "nsPluginTags.h"
|
2011-02-08 22:16:07 +00:00
|
|
|
#include "nsIEffectiveTLDService.h"
|
|
|
|
#include "nsIIDNService.h"
|
2011-05-21 13:28:54 +00:00
|
|
|
#include "nsCRT.h"
|
2007-02-17 18:44:42 +00:00
|
|
|
|
2015-02-10 19:58:01 +00:00
|
|
|
#ifdef XP_WIN
|
2015-05-01 15:07:19 +00:00
|
|
|
#include <minwindef.h>
|
2015-02-10 19:58:01 +00:00
|
|
|
#include "nsIWindowsRegKey.h"
|
|
|
|
#endif
|
|
|
|
|
2014-12-29 23:12:40 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace plugins {
|
|
|
|
class PluginAsyncSurrogate;
|
2015-02-05 12:56:19 +00:00
|
|
|
class PluginTag;
|
2014-12-29 23:12:40 +00:00
|
|
|
} // namespace plugins
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|
2014-12-29 23:12:40 +00:00
|
|
|
|
2008-09-15 12:45:01 +00:00
|
|
|
class nsNPAPIPlugin;
|
2000-07-22 01:34:13 +00:00
|
|
|
class nsIFile;
|
2001-02-21 20:38:08 +00:00
|
|
|
class nsIChannel;
|
2011-05-21 13:28:54 +00:00
|
|
|
class nsPluginNativeWindow;
|
2012-01-31 21:55:54 +00:00
|
|
|
class nsObjectLoadingContent;
|
|
|
|
class nsPluginInstanceOwner;
|
2014-10-29 15:05:36 +00:00
|
|
|
class nsPluginUnloadRunnable;
|
2013-08-27 05:05:29 +00:00
|
|
|
class nsNPAPIPluginInstance;
|
|
|
|
class nsNPAPIPluginStreamListener;
|
|
|
|
class nsIPluginInstanceOwner;
|
|
|
|
class nsIInputStream;
|
|
|
|
class nsIStreamListener;
|
2015-05-01 15:07:19 +00:00
|
|
|
#ifndef npapi_h_
|
|
|
|
struct _NPP;
|
|
|
|
typedef _NPP* NPP;
|
|
|
|
#endif
|
2005-11-06 18:34:03 +00:00
|
|
|
|
2010-12-09 22:28:15 +00:00
|
|
|
class nsInvalidPluginTag : public nsISupports
|
|
|
|
{
|
2014-06-23 19:56:07 +00:00
|
|
|
virtual ~nsInvalidPluginTag();
|
2010-12-09 22:28:15 +00:00
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit nsInvalidPluginTag(const char* aFullPath, int64_t aLastModifiedTime = 0);
|
|
|
|
|
2010-12-09 22:28:15 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2014-09-02 00:49:25 +00:00
|
|
|
|
2010-12-09 22:28:15 +00:00
|
|
|
nsCString mFullPath;
|
2012-08-22 15:56:38 +00:00
|
|
|
int64_t mLastModifiedTime;
|
2010-12-09 22:28:15 +00:00
|
|
|
bool mSeen;
|
2014-09-02 00:49:25 +00:00
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<nsInvalidPluginTag> mPrev;
|
|
|
|
RefPtr<nsInvalidPluginTag> mNext;
|
2010-12-09 22:28:15 +00:00
|
|
|
};
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsPluginHost final : public nsIPluginHost,
|
2015-03-27 18:52:19 +00:00
|
|
|
public nsIObserver,
|
|
|
|
public nsITimerCallback,
|
|
|
|
public nsSupportsWeakReference
|
1998-07-28 02:07:25 +00:00
|
|
|
{
|
2015-02-25 16:36:39 +00:00
|
|
|
friend class nsPluginTag;
|
2015-05-20 13:30:05 +00:00
|
|
|
friend class nsFakePluginTag;
|
2014-06-23 19:56:07 +00:00
|
|
|
virtual ~nsPluginHost();
|
2015-02-25 16:36:39 +00:00
|
|
|
|
1998-07-28 02:07:25 +00:00
|
|
|
public:
|
2009-07-02 05:48:08 +00:00
|
|
|
nsPluginHost();
|
1998-07-28 02:07:25 +00:00
|
|
|
|
2013-03-20 18:29:00 +00:00
|
|
|
static already_AddRefed<nsPluginHost> GetInst();
|
2000-07-22 01:34:13 +00:00
|
|
|
|
1999-03-05 04:36:00 +00:00
|
|
|
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
1998-07-28 02:07:25 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2009-06-25 21:06:54 +00:00
|
|
|
NS_DECL_NSIPLUGINHOST
|
|
|
|
NS_DECL_NSIOBSERVER
|
2009-12-15 20:44:52 +00:00
|
|
|
NS_DECL_NSITIMERCALLBACK
|
1998-07-28 02:07:25 +00:00
|
|
|
|
2011-05-21 13:28:54 +00:00
|
|
|
nsresult LoadPlugins();
|
2012-01-06 00:02:51 +00:00
|
|
|
nsresult UnloadPlugins();
|
2012-04-24 20:25:21 +00:00
|
|
|
|
2015-02-25 16:36:39 +00:00
|
|
|
nsresult SetUpPluginInstance(const nsACString &aMimeType,
|
2011-05-21 13:28:54 +00:00
|
|
|
nsIURI *aURL,
|
2012-10-03 02:43:18 +00:00
|
|
|
nsPluginInstanceOwner *aOwner);
|
2013-06-11 14:58:43 +00:00
|
|
|
|
2015-02-25 16:36:39 +00:00
|
|
|
// Acts like a bitfield
|
|
|
|
enum PluginFilter {
|
|
|
|
eExcludeNone = nsIPluginHost::EXCLUDE_NONE,
|
2015-05-20 13:30:05 +00:00
|
|
|
eExcludeDisabled = nsIPluginHost::EXCLUDE_DISABLED,
|
|
|
|
eExcludeFake = nsIPluginHost::EXCLUDE_FAKE
|
2015-02-25 16:36:39 +00:00
|
|
|
};
|
|
|
|
// FIXME-jsplugins comment about fake
|
|
|
|
bool HavePluginForType(const nsACString & aMimeType,
|
|
|
|
PluginFilter aFilter = eExcludeDisabled);
|
|
|
|
|
|
|
|
// FIXME-jsplugins what if fake has different extensions
|
|
|
|
bool HavePluginForExtension(const nsACString & aExtension,
|
|
|
|
/* out */ nsACString & aMimeType,
|
|
|
|
PluginFilter aFilter = eExcludeDisabled);
|
2012-02-10 13:39:40 +00:00
|
|
|
|
2015-05-20 13:30:05 +00:00
|
|
|
void GetPlugins(nsTArray<nsCOMPtr<nsIInternalPluginTag>>& aPluginArray,
|
2015-07-14 13:21:14 +00:00
|
|
|
bool aIncludeDisabled = false);
|
|
|
|
|
2015-11-11 04:35:00 +00:00
|
|
|
nsresult FindPluginsForContent(uint32_t aPluginEpoch,
|
|
|
|
nsTArray<mozilla::plugins::PluginTag>* aPlugins,
|
|
|
|
uint32_t* aNewPluginEpoch);
|
2011-05-21 13:28:54 +00:00
|
|
|
|
|
|
|
nsresult GetURL(nsISupports* pluginInst,
|
|
|
|
const char* url,
|
|
|
|
const char* target,
|
2012-05-17 23:54:26 +00:00
|
|
|
nsNPAPIPluginStreamListener* streamListener,
|
2011-05-21 13:28:54 +00:00
|
|
|
const char* altHost,
|
|
|
|
const char* referrer,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool forceJSEnabled);
|
2011-05-21 13:28:54 +00:00
|
|
|
nsresult PostURL(nsISupports* pluginInst,
|
|
|
|
const char* url,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t postDataLen,
|
2011-05-21 13:28:54 +00:00
|
|
|
const char* postData,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isFile,
|
2011-05-21 13:28:54 +00:00
|
|
|
const char* target,
|
2012-05-17 23:54:26 +00:00
|
|
|
nsNPAPIPluginStreamListener* streamListener,
|
2011-05-21 13:28:54 +00:00
|
|
|
const char* altHost,
|
|
|
|
const char* referrer,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool forceJSEnabled,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t postHeadersLength,
|
2011-05-21 13:28:54 +00:00
|
|
|
const char* postHeaders);
|
|
|
|
|
|
|
|
nsresult FindProxyForURL(const char* url, char* *result);
|
|
|
|
nsresult UserAgent(const char **retstring);
|
2015-02-25 16:36:39 +00:00
|
|
|
nsresult ParsePostBufferToFixHeaders(const char *inPostData,
|
|
|
|
uint32_t inPostDataLen,
|
|
|
|
char **outPostData,
|
|
|
|
uint32_t *outPostDataLen);
|
2011-05-21 13:28:54 +00:00
|
|
|
nsresult CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile);
|
|
|
|
nsresult NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow);
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, bool isVisible);
|
2011-05-21 13:28:54 +00:00
|
|
|
void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame);
|
|
|
|
|
2015-02-25 16:36:39 +00:00
|
|
|
nsresult GetPluginName(nsNPAPIPluginInstance *aPluginInstance,
|
|
|
|
const char** aPluginName);
|
2011-05-18 01:48:34 +00:00
|
|
|
nsresult StopPluginInstance(nsNPAPIPluginInstance* aInstance);
|
2015-02-25 16:36:39 +00:00
|
|
|
nsresult GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance,
|
|
|
|
nsIPluginTag **aPluginTag);
|
2011-05-18 01:48:34 +00:00
|
|
|
|
2009-06-25 21:06:54 +00:00
|
|
|
nsresult
|
2015-02-25 16:36:39 +00:00
|
|
|
NewPluginURLStream(const nsString& aURL,
|
|
|
|
nsNPAPIPluginInstance *aInstance,
|
2012-05-17 23:54:26 +00:00
|
|
|
nsNPAPIPluginStreamListener *aListener,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsIInputStream *aPostStream = nullptr,
|
2015-02-25 16:36:39 +00:00
|
|
|
const char *aHeadersData = nullptr,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aHeadersDataLen = 0);
|
1999-01-25 08:05:00 +00:00
|
|
|
|
2009-06-25 21:06:54 +00:00
|
|
|
nsresult
|
2015-02-25 16:36:39 +00:00
|
|
|
GetURLWithHeaders(nsNPAPIPluginInstance *pluginInst,
|
|
|
|
const char* url,
|
2013-10-23 20:34:30 +00:00
|
|
|
const char* target = nullptr,
|
|
|
|
nsNPAPIPluginStreamListener* streamListener = nullptr,
|
|
|
|
const char* altHost = nullptr,
|
|
|
|
const char* referrer = nullptr,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool forceJSEnabled = false,
|
2015-02-25 16:36:39 +00:00
|
|
|
uint32_t getHeadersLength = 0,
|
2013-10-23 20:34:30 +00:00
|
|
|
const char* getHeaders = nullptr);
|
2009-06-25 21:06:54 +00:00
|
|
|
|
|
|
|
nsresult
|
2015-02-25 16:36:39 +00:00
|
|
|
AddHeadersToChannel(const char *aHeadersData, uint32_t aHeadersDataLen,
|
r=av
a=waterson
bug=51919
This fix makes it so nsIPluginManager::PostURL() works correctly in the
case of a null target and non-null streamListener.
The fix was to add parameters to NewPluginURLStream() for headers and
post data:
NS_IMETHOD
- NewPluginURLStream(const nsString& aURL, nsIPluginInstance *aInstance, nsIPluginStreamListener *aListener);
+ NewPluginURLStream(const nsString& aURL, nsIPluginInstance *aInstance,
+ nsIPluginStreamListener *aListener,
+ void *aPostData = nsnull, PRUint32 aPostDataLen = 0,
+ const char *aHeadersData = nsnull,
+ PRUint32 aHeadersDataLen = 0);
And to add a new method to correctly send the headers to the channel:
+ NS_IMETHOD
+ AddHeadersToChannel(const char *aHeadersData, PRUint32 aHeadersDataLen,
+ nsIChannel *aGenericChannel);
Files in this fix:
M modules/plugin/nglsrc/nsPluginHostImpl.cpp
M modules/plugin/nglsrc/nsPluginHostImpl.h
2000-09-08 23:58:36 +00:00
|
|
|
nsIChannel *aGenericChannel);
|
1999-06-04 22:32:27 +00:00
|
|
|
|
2005-02-11 23:37:51 +00:00
|
|
|
static nsresult GetPluginTempDir(nsIFile **aDir);
|
|
|
|
|
2012-07-02 20:44:39 +00: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 21:42:35 +00:00
|
|
|
|
2016-01-06 01:57:11 +00:00
|
|
|
// Helper that checks if a plugin of a given MIME type can be loaded by the
|
|
|
|
// parent process. It checks the plugin.load_in_parent_process.<mime> pref.
|
|
|
|
// Always returns false if plugin.load_in_parent_process.<mime> is not set.
|
|
|
|
static bool ShouldLoadTypeInParent(const nsACString& aMimeType);
|
|
|
|
|
2015-01-30 15:54:19 +00:00
|
|
|
// checks whether aType is a type we recognize for potential special handling
|
|
|
|
enum SpecialType { eSpecialType_None,
|
2015-10-12 19:48:12 +00:00
|
|
|
// Needed to whitelist for async init support
|
|
|
|
eSpecialType_Test,
|
2015-01-30 15:54:19 +00:00
|
|
|
// Informs some decisions about OOP and quirks
|
|
|
|
eSpecialType_Flash,
|
|
|
|
// Binds to the <applet> tag, has various special
|
|
|
|
// rules around opening channels, codebase, ...
|
|
|
|
eSpecialType_Java,
|
|
|
|
// Some IPC quirks
|
|
|
|
eSpecialType_Silverlight,
|
|
|
|
// Native widget quirks
|
|
|
|
eSpecialType_PDF,
|
|
|
|
// Native widget quirks
|
2015-05-20 19:13:16 +00:00
|
|
|
eSpecialType_RealPlayer,
|
|
|
|
// Native widget quirks
|
|
|
|
eSpecialType_Unity };
|
2015-01-30 15:54:19 +00:00
|
|
|
static SpecialType GetSpecialType(const nsACString & aMIMEType);
|
2007-09-04 18:19:31 +00:00
|
|
|
|
2009-12-15 22:47:22 +00:00
|
|
|
static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
|
|
|
|
|
2010-03-24 21:22:04 +00:00
|
|
|
void PluginCrashed(nsNPAPIPlugin* plugin,
|
|
|
|
const nsAString& pluginDumpID,
|
|
|
|
const nsAString& browserDumpID);
|
2009-12-16 20:08:45 +00:00
|
|
|
|
2010-07-20 02:11:26 +00:00
|
|
|
nsNPAPIPluginInstance *FindInstance(const char *mimetype);
|
2011-11-12 01:10:31 +00:00
|
|
|
nsNPAPIPluginInstance *FindOldestStoppedInstance();
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t StoppedInstanceCount();
|
2010-01-27 01:30:58 +00:00
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
nsTArray< RefPtr<nsNPAPIPluginInstance> > *InstanceArray();
|
2010-01-27 01:30:58 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
// Return the tag for |aLibrary| if found, nullptr if not.
|
2010-07-20 02:11:26 +00:00
|
|
|
nsPluginTag* FindTagForLibrary(PRLibrary* aLibrary);
|
2010-04-05 15:25:59 +00:00
|
|
|
|
2011-04-28 20:08:33 +00: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.
|
2015-02-25 16:36:39 +00:00
|
|
|
nsresult InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aURL,
|
2012-12-13 00:12:41 +00:00
|
|
|
nsObjectLoadingContent *aContent,
|
|
|
|
nsPluginInstanceOwner** aOwner);
|
2011-04-28 20:08:33 +00:00
|
|
|
|
2013-10-23 20:34:30 +00:00
|
|
|
// Does not accept nullptr and should never fail.
|
2010-11-19 20:58:59 +00:00
|
|
|
nsPluginTag* TagForPlugin(nsNPAPIPlugin* aPlugin);
|
|
|
|
|
2015-01-17 02:34:47 +00:00
|
|
|
nsPluginTag* PluginWithId(uint32_t aId);
|
|
|
|
|
2015-02-25 16:36:39 +00:00
|
|
|
nsresult GetPlugin(const nsACString &aMimeType, nsNPAPIPlugin** aPlugin);
|
2014-10-29 15:05:36 +00:00
|
|
|
nsresult GetPluginForContentProcess(uint32_t aPluginId, nsNPAPIPlugin** aPlugin);
|
|
|
|
void NotifyContentModuleDestroyed(uint32_t aPluginId);
|
2011-05-11 20:23:25 +00:00
|
|
|
|
2012-12-13 00:12:41 +00:00
|
|
|
nsresult NewPluginStreamListener(nsIURI* aURL,
|
|
|
|
nsNPAPIPluginInstance* aInstance,
|
|
|
|
nsIStreamListener **aStreamListener);
|
2012-04-24 20:25:21 +00:00
|
|
|
|
2014-12-29 23:12:40 +00:00
|
|
|
void CreateWidget(nsPluginInstanceOwner* aOwner);
|
|
|
|
|
2015-06-30 22:08:19 +00:00
|
|
|
nsresult EnumerateSiteData(const nsACString& domain,
|
|
|
|
const InfallibleTArray<nsCString>& sites,
|
|
|
|
InfallibleTArray<nsCString>& result,
|
|
|
|
bool firstMatchOnly);
|
|
|
|
|
1998-07-28 02:07:25 +00:00
|
|
|
private:
|
2014-10-29 15:05:36 +00:00
|
|
|
friend class nsPluginUnloadRunnable;
|
|
|
|
|
2015-02-25 16:36:39 +00:00
|
|
|
void DestroyRunningInstances(nsPluginTag* aPluginTag);
|
2002-05-16 20:47:29 +00:00
|
|
|
|
2015-02-25 16:36:39 +00:00
|
|
|
// Writes updated plugins settings to disk and unloads the plugin
|
|
|
|
// if it is now disabled. Should only be called by the plugin tag in question
|
|
|
|
void UpdatePluginInfo(nsPluginTag* aPluginTag);
|
|
|
|
|
|
|
|
nsresult TrySetUpPluginInstance(const nsACString &aMimeType, nsIURI *aURL,
|
|
|
|
nsPluginInstanceOwner *aOwner);
|
|
|
|
|
|
|
|
// FIXME-jsplugins comment here about when things may be fake
|
2012-06-14 02:51:21 +00:00
|
|
|
nsPluginTag*
|
|
|
|
FindPreferredPlugin(const InfallibleTArray<nsPluginTag*>& matches);
|
|
|
|
|
2015-05-20 13:30:05 +00:00
|
|
|
// Find a plugin for the given type. If aIncludeFake is true a fake plugin
|
|
|
|
// will be preferred if one exists; otherwise a fake plugin will never be
|
|
|
|
// returned. If aCheckEnabled is false, disabled plugins can be returned.
|
|
|
|
nsIInternalPluginTag* FindPluginForType(const nsACString& aMimeType,
|
|
|
|
bool aIncludeFake, bool aCheckEnabled);
|
|
|
|
|
|
|
|
// Find specifically a fake plugin for the given type. If aCheckEnabled is
|
|
|
|
// false, disabled plugins can be returned.
|
|
|
|
nsFakePluginTag* FindFakePluginForType(const nsACString & aMimeType,
|
|
|
|
bool aCheckEnabled);
|
|
|
|
|
|
|
|
// Find specifically a fake plugin for the given extension. If aCheckEnabled
|
|
|
|
// is false, disabled plugins can be returned. aMimeType will be filled in
|
|
|
|
// with the MIME type the plugin is registered for.
|
|
|
|
nsFakePluginTag* FindFakePluginForExtension(const nsACString & aExtension,
|
|
|
|
/* out */ nsACString & aMimeType,
|
|
|
|
bool aCheckEnabled);
|
|
|
|
|
|
|
|
// Find specifically a native (NPAPI) plugin for the given type. If
|
|
|
|
// aCheckEnabled is false, disabled plugins can be returned.
|
2015-02-25 16:36:39 +00:00
|
|
|
nsPluginTag* FindNativePluginForType(const nsACString & aMimeType,
|
|
|
|
bool aCheckEnabled);
|
2005-11-06 18:34:03 +00:00
|
|
|
|
2015-05-20 13:30:05 +00:00
|
|
|
// Find specifically a native (NPAPI) plugin for the given extension. If
|
|
|
|
// aCheckEnabled is false, disabled plugins can be returned. aMimeType will
|
|
|
|
// be filled in with the MIME type the plugin is registered for.
|
2015-02-25 16:36:39 +00:00
|
|
|
nsPluginTag* FindNativePluginForExtension(const nsACString & aExtension,
|
|
|
|
/* out */ nsACString & aMimeType,
|
|
|
|
bool aCheckEnabled);
|
1999-03-29 22:18:05 +00:00
|
|
|
|
2011-11-12 01:10:31 +00:00
|
|
|
nsresult
|
|
|
|
FindStoppedPluginForURL(nsIURI* aURL, nsIPluginInstanceOwner *aOwner);
|
|
|
|
|
2014-10-29 15:05:36 +00:00
|
|
|
nsresult FindPluginsInContent(bool aCreatePluginList, bool * aPluginsChanged);
|
|
|
|
|
2002-02-11 23:09:38 +00:00
|
|
|
nsresult
|
2011-09-29 06:19:26 +00:00
|
|
|
FindPlugins(bool aCreatePluginList, bool * aPluginsChanged);
|
2002-02-11 23:09:38 +00:00
|
|
|
|
2015-02-25 16:36:39 +00:00
|
|
|
// FIXME revisit, no ns prefix
|
2012-06-29 22:28:45 +00:00
|
|
|
// Registers or unregisters the given mime type with the category manager
|
2015-05-20 13:30:05 +00:00
|
|
|
enum nsRegisterType { ePluginRegister,
|
|
|
|
ePluginUnregister,
|
|
|
|
// Checks if this type should still be registered first
|
|
|
|
ePluginMaybeUnregister };
|
2015-05-20 13:30:05 +00:00
|
|
|
void RegisterWithCategoryManager(const nsCString& aMimeType,
|
|
|
|
nsRegisterType aType);
|
2012-06-29 22:28:45 +00:00
|
|
|
|
2014-10-29 15:05:36 +00:00
|
|
|
void AddPluginTag(nsPluginTag* aPluginTag);
|
|
|
|
|
2000-09-22 00:58:46 +00:00
|
|
|
nsresult
|
2011-03-31 18:26:57 +00:00
|
|
|
ScanPluginsDirectory(nsIFile *pluginsDir,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCreatePluginList,
|
|
|
|
bool *aPluginsChanged);
|
2011-03-31 18:26:57 +00:00
|
|
|
|
2001-11-17 15:26:02 +00:00
|
|
|
nsresult
|
2011-03-31 18:26:57 +00:00
|
|
|
ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCreatePluginList,
|
|
|
|
bool *aPluginsChanged);
|
2001-02-02 23:48:17 +00:00
|
|
|
|
2012-04-03 22:08:07 +00:00
|
|
|
nsresult EnsurePluginLoaded(nsPluginTag* aPluginTag);
|
2011-02-19 01:05:23 +00:00
|
|
|
|
2012-04-03 22:08:07 +00:00
|
|
|
bool IsRunningPlugin(nsPluginTag * aPluginTag);
|
2000-09-22 00:58:46 +00:00
|
|
|
|
2001-10-18 12:26:23 +00:00
|
|
|
// Stores all plugins info into the registry
|
2002-08-14 22:31:59 +00:00
|
|
|
nsresult WritePluginInfo();
|
|
|
|
|
|
|
|
// Loads all cached plugins info into mCachedPlugins
|
|
|
|
nsresult ReadPluginInfo();
|
2002-02-13 02:18:57 +00:00
|
|
|
|
2009-06-10 20:47:49 +00:00
|
|
|
// Given a file path, returns the plugins info from our cache
|
2002-02-13 02:18:57 +00:00
|
|
|
// and removes it from the cache.
|
2009-06-10 20:47:49 +00:00
|
|
|
void RemoveCachedPluginsInfo(const char *filePath,
|
2007-07-03 21:42:35 +00:00
|
|
|
nsPluginTag **result);
|
2002-02-11 23:09:38 +00:00
|
|
|
|
2011-02-19 01:05:23 +00:00
|
|
|
// Checks to see if a tag object is in our list of live tags.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsLiveTag(nsIPluginTag* tag);
|
2015-02-25 16:36:39 +00:00
|
|
|
|
2012-07-23 17:52:51 +00:00
|
|
|
// Checks our list of live tags for an equivalent tag.
|
|
|
|
nsPluginTag* HaveSamePlugin(const nsPluginTag * aPluginTag);
|
2015-02-25 16:36:39 +00:00
|
|
|
|
2012-07-23 17:52:51 +00:00
|
|
|
// Returns the first plugin at |path|
|
|
|
|
nsPluginTag* FirstPluginWithPath(const nsCString& path);
|
2011-02-19 01:05:23 +00:00
|
|
|
|
2001-11-17 15:26:02 +00:00
|
|
|
nsresult EnsurePrivateDirServiceProvider();
|
2001-10-18 12:26:23 +00:00
|
|
|
|
2010-01-27 01:30:58 +00:00
|
|
|
void OnPluginInstanceDestroyed(nsPluginTag* aPluginTag);
|
|
|
|
|
2014-10-29 15:05:36 +00:00
|
|
|
// To be used by the chrome process whenever the set of plugins changes.
|
|
|
|
void IncrementChromeEpoch();
|
|
|
|
|
|
|
|
// To be used by the chrome process; returns the current epoch.
|
|
|
|
uint32_t ChromeEpoch();
|
|
|
|
|
|
|
|
// To be used by the content process to get/set the last observed epoch value
|
|
|
|
// from the chrome process.
|
|
|
|
uint32_t ChromeEpochForContent();
|
|
|
|
void SetChromeEpochForContent(uint32_t aEpoch);
|
|
|
|
|
2015-12-24 01:18:57 +00:00
|
|
|
void UpdateInMemoryPluginInfo(nsPluginTag* aPluginTag);
|
|
|
|
|
2015-07-09 22:03:00 +00:00
|
|
|
// On certain platforms, we only want to load certain plugins. This function
|
|
|
|
// centralizes loading rules.
|
|
|
|
bool ShouldAddPlugin(nsPluginTag* aPluginTag);
|
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<nsPluginTag> mPlugins;
|
|
|
|
RefPtr<nsPluginTag> mCachedPlugins;
|
|
|
|
RefPtr<nsInvalidPluginTag> mInvalidPlugins;
|
2015-05-20 13:30:05 +00:00
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
nsTArray< RefPtr<nsFakePluginTag> > mFakePlugins;
|
2015-05-20 13:30:05 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mPluginsLoaded;
|
2005-01-05 00:21:06 +00:00
|
|
|
|
|
|
|
// set by pref plugin.override_internal_types
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mOverrideInternalTypes;
|
2005-01-05 00:21:06 +00:00
|
|
|
|
2009-10-05 09:00:57 +00:00
|
|
|
// set by pref plugin.disable
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mPluginsDisabled;
|
2009-10-05 09:00:57 +00:00
|
|
|
|
2010-07-20 02:11:26 +00: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.
|
2015-10-18 05:24:48 +00:00
|
|
|
nsTArray< RefPtr<nsNPAPIPluginInstance> > mInstances;
|
2010-01-27 01:30:58 +00:00
|
|
|
|
2009-02-09 18:48:06 +00:00
|
|
|
nsCOMPtr<nsIFile> mPluginRegFile;
|
2007-07-20 20:34:51 +00:00
|
|
|
#ifdef XP_WIN
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<nsPluginDirServiceProvider> mPrivateDirServiceProvider;
|
2015-02-10 19:58:01 +00:00
|
|
|
|
|
|
|
// In order to reload plugins when they change, we watch the registry via
|
|
|
|
// this object.
|
|
|
|
nsCOMPtr<nsIWindowsRegKey> mRegKeyHKLM;
|
|
|
|
nsCOMPtr<nsIWindowsRegKey> mRegKeyHKCU;
|
2009-02-09 18:48:06 +00:00
|
|
|
#endif
|
2005-02-11 23:37:51 +00:00
|
|
|
|
2011-02-08 22:16:07 +00:00
|
|
|
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
|
|
|
nsCOMPtr<nsIIDNService> mIDNService;
|
|
|
|
|
|
|
|
// Helpers for ClearSiteData and SiteHasData.
|
|
|
|
nsresult NormalizeHostname(nsCString& host);
|
|
|
|
|
2002-05-16 20:47:29 +00:00
|
|
|
nsWeakPtr mCurrentDocument; // weak reference, we use it to id document only
|
2005-02-11 23:37:51 +00:00
|
|
|
|
2014-10-29 15:05:36 +00:00
|
|
|
// This epoch increases each time we load the list of plugins from disk.
|
|
|
|
// In the chrome process, this stores the actual epoch.
|
|
|
|
// In the content process, this stores the last epoch value observed
|
|
|
|
// when reading plugins from chrome.
|
|
|
|
uint32_t mPluginEpoch;
|
|
|
|
|
2005-02-11 23:37:51 +00:00
|
|
|
static nsIFile *sPluginTempDir;
|
2005-11-06 18:34:03 +00:00
|
|
|
|
|
|
|
// We need to hold a global ptr to ourselves because we register for
|
|
|
|
// two different CIDs for some reason...
|
2009-07-02 05:48:08 +00:00
|
|
|
static nsPluginHost* sInst;
|
1998-07-28 02:07:25 +00:00
|
|
|
};
|
|
|
|
|
2014-12-29 23:12:40 +00:00
|
|
|
class PluginDestructionGuard : protected PRCList
|
2008-02-29 02:06:00 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit PluginDestructionGuard(nsNPAPIPluginInstance *aInstance);
|
2014-12-29 23:12:40 +00:00
|
|
|
explicit PluginDestructionGuard(mozilla::plugins::PluginAsyncSurrogate *aSurrogate);
|
2014-09-03 03:22:02 +00:00
|
|
|
explicit PluginDestructionGuard(NPP npp);
|
2008-02-29 02:06:00 +00:00
|
|
|
|
|
|
|
~PluginDestructionGuard();
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool DelayDestroy(nsNPAPIPluginInstance *aInstance);
|
2008-02-29 02:06:00 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread");
|
|
|
|
|
2011-09-30 06:02:59 +00:00
|
|
|
mDelayedDestroy = false;
|
2008-02-29 02:06:00 +00:00
|
|
|
|
|
|
|
PR_INIT_CLIST(this);
|
|
|
|
PR_INSERT_BEFORE(this, &sListHead);
|
|
|
|
}
|
|
|
|
|
2014-12-29 23:12:40 +00:00
|
|
|
void InitAsync()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread");
|
|
|
|
|
|
|
|
mDelayedDestroy = false;
|
|
|
|
|
|
|
|
PR_INIT_CLIST(this);
|
|
|
|
// Instances with active surrogates must be inserted *after* sListHead so
|
|
|
|
// that they appear to be at the bottom of the stack
|
|
|
|
PR_INSERT_AFTER(this, &sListHead);
|
|
|
|
}
|
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<nsNPAPIPluginInstance> mInstance;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mDelayedDestroy;
|
2008-02-29 02:06:00 +00:00
|
|
|
|
|
|
|
static PRCList sListHead;
|
|
|
|
};
|
|
|
|
|
2009-07-06 06:10:10 +00:00
|
|
|
#endif // nsPluginHost_h_
|