2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-19 02:01:16 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-07-28 06:07:25 +04:00
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1998-07-28 06:07:25 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-07-28 06:07:25 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
2009-07-06 10:10:10 +04:00
|
|
|
* Josh Aas <josh@mozilla.com>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-19 02:01:16 +04:00
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
2001-09-29 00:14:13 +04:00
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-19 02:01:16 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-19 02:01:16 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-07-28 06:07:25 +04:00
|
|
|
|
2009-07-02 09:48:08 +04:00
|
|
|
#ifndef nsPluginHost_h_
|
|
|
|
#define nsPluginHost_h_
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
#include "nsIPluginHost.h"
|
2001-03-12 05:07:15 +03:00
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsCOMPtr.h"
|
1998-07-28 06:07:25 +04:00
|
|
|
#include "prlink.h"
|
2008-02-29 05:06:00 +03:00
|
|
|
#include "prclist.h"
|
|
|
|
#include "npapi.h"
|
2008-09-15 16:45:01 +04:00
|
|
|
#include "nsNPAPIPluginInstance.h"
|
2007-07-04 01:42:35 +04:00
|
|
|
#include "nsIPluginTag.h"
|
2000-03-23 03:45:49 +03:00
|
|
|
#include "nsPluginsDir.h"
|
2003-05-28 01:14:55 +04:00
|
|
|
#include "nsPluginDirServiceProvider.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2002-05-17 00:47:29 +04:00
|
|
|
#include "nsWeakPtr.h"
|
2002-06-01 04:56:38 +04:00
|
|
|
#include "nsIPrompt.h"
|
2002-08-30 02:00:20 +04:00
|
|
|
#include "nsISupportsArray.h"
|
2005-11-06 21:34:03 +03:00
|
|
|
#include "nsWeakReference.h"
|
2008-02-29 05:06:00 +03:00
|
|
|
#include "nsThreadUtils.h"
|
2008-03-10 10:07:15 +03:00
|
|
|
#include "nsTArray.h"
|
2009-12-15 23:44:52 +03:00
|
|
|
#include "nsTObserverArray.h"
|
|
|
|
#include "nsITimer.h"
|
2009-12-16 01:47:22 +03:00
|
|
|
#include "nsPluginTags.h"
|
2011-02-09 01:16:07 +03:00
|
|
|
#include "nsIEffectiveTLDService.h"
|
|
|
|
#include "nsIIDNService.h"
|
2011-05-21 17:28:54 +04:00
|
|
|
#include "nsCRT.h"
|
2007-02-17 21:44:42 +03:00
|
|
|
|
2008-09-15 16:45:01 +04:00
|
|
|
class nsNPAPIPlugin;
|
2000-07-22 05:34:13 +04:00
|
|
|
class nsIComponentManager;
|
|
|
|
class nsIFile;
|
2001-02-21 23:38:08 +03:00
|
|
|
class nsIChannel;
|
2011-05-21 17:28:54 +04:00
|
|
|
class nsPluginNativeWindow;
|
2012-02-01 01:55:54 +04:00
|
|
|
class nsObjectLoadingContent;
|
|
|
|
class nsPluginInstanceOwner;
|
2005-11-06 21:34:03 +03:00
|
|
|
|
2009-12-15 23:44:52 +03:00
|
|
|
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
|
|
|
|
#define MAC_CARBON_PLUGINS
|
|
|
|
#endif
|
|
|
|
|
2010-12-10 01:28:15 +03:00
|
|
|
class nsInvalidPluginTag : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsInvalidPluginTag(const char* aFullPath, PRInt64 aLastModifiedTime = 0);
|
|
|
|
virtual ~nsInvalidPluginTag();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
nsCString mFullPath;
|
|
|
|
PRInt64 mLastModifiedTime;
|
|
|
|
bool mSeen;
|
|
|
|
|
|
|
|
nsRefPtr<nsInvalidPluginTag> mPrev;
|
|
|
|
nsRefPtr<nsInvalidPluginTag> mNext;
|
|
|
|
};
|
|
|
|
|
2009-07-02 09:48:08 +04:00
|
|
|
class nsPluginHost : public nsIPluginHost,
|
|
|
|
public nsIObserver,
|
2009-12-15 23:44:52 +03:00
|
|
|
public nsITimerCallback,
|
2009-07-02 09:48:08 +04:00
|
|
|
public nsSupportsWeakReference
|
1998-07-28 06:07:25 +04:00
|
|
|
{
|
|
|
|
public:
|
2009-07-02 09:48:08 +04:00
|
|
|
nsPluginHost();
|
|
|
|
virtual ~nsPluginHost();
|
1998-07-28 06:07:25 +04:00
|
|
|
|
2009-07-02 09:48:08 +04:00
|
|
|
static nsPluginHost* GetInst();
|
2000-07-22 05:34:13 +04:00
|
|
|
|
1999-03-05 07:36:00 +03:00
|
|
|
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
1998-07-28 06:07:25 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2009-06-26 01:06:54 +04:00
|
|
|
NS_DECL_NSIPLUGINHOST
|
|
|
|
NS_DECL_NSIOBSERVER
|
2009-12-15 23:44:52 +03:00
|
|
|
NS_DECL_NSITIMERCALLBACK
|
1998-07-28 06:07:25 +04:00
|
|
|
|
2011-05-21 17:28:54 +04:00
|
|
|
nsresult Init();
|
|
|
|
nsresult Destroy();
|
|
|
|
nsresult LoadPlugins();
|
2012-02-28 00:36:46 +04:00
|
|
|
nsresult CreateListenerForChannel(nsIChannel* aChannel,
|
|
|
|
nsObjectLoadingContent* aContent,
|
|
|
|
nsIStreamListener** aListener);
|
2011-05-21 17:28:54 +04:00
|
|
|
nsresult SetUpPluginInstance(const char *aMimeType,
|
|
|
|
nsIURI *aURL,
|
|
|
|
nsIPluginInstanceOwner *aOwner);
|
2011-12-10 02:56:20 +04:00
|
|
|
nsresult IsPluginEnabledForType(const char* aMimeType);
|
|
|
|
nsresult IsPluginEnabledForExtension(const char* aExtension, const char* &aMimeType);
|
2012-02-10 17:39:40 +04:00
|
|
|
|
2011-05-21 17:28:54 +04:00
|
|
|
nsresult GetPluginCount(PRUint32* aPluginCount);
|
|
|
|
nsresult GetPlugins(PRUint32 aPluginCount, nsIDOMPlugin** aPluginArray);
|
|
|
|
|
|
|
|
nsresult GetURL(nsISupports* pluginInst,
|
|
|
|
const char* url,
|
|
|
|
const char* target,
|
|
|
|
nsIPluginStreamListener* streamListener,
|
|
|
|
const char* altHost,
|
|
|
|
const char* referrer,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool forceJSEnabled);
|
2011-05-21 17:28:54 +04:00
|
|
|
nsresult PostURL(nsISupports* pluginInst,
|
|
|
|
const char* url,
|
|
|
|
PRUint32 postDataLen,
|
|
|
|
const char* postData,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isFile,
|
2011-05-21 17:28:54 +04:00
|
|
|
const char* target,
|
|
|
|
nsIPluginStreamListener* streamListener,
|
|
|
|
const char* altHost,
|
|
|
|
const char* referrer,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool forceJSEnabled,
|
2011-05-21 17:28:54 +04:00
|
|
|
PRUint32 postHeadersLength,
|
|
|
|
const char* postHeaders);
|
|
|
|
|
|
|
|
nsresult FindProxyForURL(const char* url, char* *result);
|
|
|
|
nsresult UserAgent(const char **retstring);
|
|
|
|
nsresult ParsePostBufferToFixHeaders(const char *inPostData, PRUint32 inPostDataLen,
|
|
|
|
char **outPostData, PRUint32 *outPostDataLen);
|
|
|
|
nsresult CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile);
|
|
|
|
nsresult NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow);
|
|
|
|
nsresult InstantiateDummyJavaPlugin(nsIPluginInstanceOwner *aOwner);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void AddIdleTimeTarget(nsIPluginInstanceOwner* objectFrame, bool isVisible);
|
2011-05-21 17:28:54 +04:00
|
|
|
void RemoveIdleTimeTarget(nsIPluginInstanceOwner* objectFrame);
|
|
|
|
|
2011-05-18 05:48:34 +04:00
|
|
|
nsresult GetPluginName(nsNPAPIPluginInstance *aPluginInstance, const char** aPluginName);
|
|
|
|
nsresult StopPluginInstance(nsNPAPIPluginInstance* aInstance);
|
|
|
|
nsresult HandleBadPlugin(PRLibrary* aLibrary, nsNPAPIPluginInstance *aInstance);
|
|
|
|
nsresult GetPluginTagForInstance(nsNPAPIPluginInstance *aPluginInstance, nsIPluginTag **aPluginTag);
|
|
|
|
|
2009-06-26 01:06:54 +04:00
|
|
|
nsresult
|
2001-04-18 03:30:25 +04:00
|
|
|
NewPluginURLStream(const nsString& aURL,
|
2010-07-16 23:55:54 +04:00
|
|
|
nsNPAPIPluginInstance *aInstance,
|
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-09 03:58:36 +04:00
|
|
|
nsIPluginStreamListener *aListener,
|
2009-12-27 23:26:00 +03:00
|
|
|
nsIInputStream *aPostStream = nsnull,
|
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-09 03:58:36 +04:00
|
|
|
const char *aHeadersData = nsnull,
|
|
|
|
PRUint32 aHeadersDataLen = 0);
|
1999-01-25 11:05:00 +03:00
|
|
|
|
2009-06-26 01:06:54 +04:00
|
|
|
nsresult
|
2010-07-16 23:55:54 +04:00
|
|
|
GetURLWithHeaders(nsNPAPIPluginInstance *pluginInst,
|
2009-06-26 01:06:54 +04:00
|
|
|
const char* url,
|
|
|
|
const char* target = NULL,
|
|
|
|
nsIPluginStreamListener* streamListener = NULL,
|
|
|
|
const char* altHost = NULL,
|
|
|
|
const char* referrer = NULL,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool forceJSEnabled = false,
|
2009-06-26 01:06:54 +04:00
|
|
|
PRUint32 getHeadersLength = 0,
|
|
|
|
const char* getHeaders = NULL);
|
|
|
|
|
2003-04-03 23:11:41 +04:00
|
|
|
nsresult
|
2010-07-16 23:55:54 +04:00
|
|
|
DoURLLoadSecurityCheck(nsNPAPIPluginInstance *aInstance,
|
2003-04-03 23:11:41 +04:00
|
|
|
const char* aURL);
|
|
|
|
|
2009-06-26 01:06:54 +04:00
|
|
|
nsresult
|
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-09 03:58:36 +04:00
|
|
|
AddHeadersToChannel(const char *aHeadersData, PRUint32 aHeadersDataLen,
|
|
|
|
nsIChannel *aGenericChannel);
|
1999-06-05 02:32:27 +04:00
|
|
|
|
2005-02-12 02:37:51 +03:00
|
|
|
static nsresult GetPluginTempDir(nsIFile **aDir);
|
|
|
|
|
2007-07-14 04:28:05 +04:00
|
|
|
// Writes updated plugins settings to disk and unloads the plugin
|
|
|
|
// if it is now disabled
|
|
|
|
nsresult UpdatePluginInfo(nsPluginTag* aPluginTag);
|
2007-07-04 01:42:35 +04:00
|
|
|
|
2007-09-04 22:19:31 +04:00
|
|
|
// checks whether aTag is a "java" plugin tag (a tag for a plugin
|
|
|
|
// that does Java)
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool IsJavaMIMEType(const char *aType);
|
2007-09-04 22:19:31 +04:00
|
|
|
|
2009-06-14 00:16:40 +04:00
|
|
|
static nsresult GetPrompt(nsIPluginInstanceOwner *aOwner, nsIPrompt **aPrompt);
|
|
|
|
|
2009-12-16 01:47:22 +03:00
|
|
|
static nsresult PostPluginUnloadEvent(PRLibrary* aLibrary);
|
|
|
|
|
2010-03-25 00:22:04 +03:00
|
|
|
void PluginCrashed(nsNPAPIPlugin* plugin,
|
|
|
|
const nsAString& pluginDumpID,
|
|
|
|
const nsAString& browserDumpID);
|
2009-12-16 23:08:45 +03:00
|
|
|
|
2010-07-20 06:11:26 +04:00
|
|
|
nsNPAPIPluginInstance *FindInstance(const char *mimetype);
|
2011-11-12 05:10:31 +04:00
|
|
|
nsNPAPIPluginInstance *FindOldestStoppedInstance();
|
|
|
|
PRUint32 StoppedInstanceCount();
|
2010-01-27 04:30:58 +03:00
|
|
|
|
2010-07-20 06:11:26 +04:00
|
|
|
nsTArray< nsRefPtr<nsNPAPIPluginInstance> > *InstanceArray();
|
2010-01-27 04:30:58 +03:00
|
|
|
|
2010-07-20 06:11:26 +04:00
|
|
|
void DestroyRunningInstances(nsISupportsArray* aReloadDocs, nsPluginTag* aPluginTag);
|
2010-01-27 04:30:58 +03:00
|
|
|
|
2010-04-05 19:25:59 +04:00
|
|
|
// Return the tag for |aLibrary| if found, nsnull if not.
|
2010-07-20 06:11:26 +04:00
|
|
|
nsPluginTag* FindTagForLibrary(PRLibrary* aLibrary);
|
2010-04-05 19:25:59 +04:00
|
|
|
|
2011-04-29 00:08:33 +04: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.
|
|
|
|
nsresult InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
|
2012-02-01 01:55:54 +04:00
|
|
|
nsObjectLoadingContent *aContent,
|
|
|
|
nsPluginInstanceOwner** aOwner);
|
2011-04-29 00:08:33 +04:00
|
|
|
|
|
|
|
nsresult InstantiateFullPagePlugin(const char *aMimeType,
|
|
|
|
nsIURI* aURI,
|
2012-02-01 01:55:54 +04:00
|
|
|
nsObjectLoadingContent *aContent,
|
|
|
|
nsPluginInstanceOwner **aOwner,
|
2011-04-29 00:08:33 +04:00
|
|
|
nsIStreamListener **aStreamListener);
|
2010-10-23 05:16:29 +04:00
|
|
|
|
2010-11-19 23:58:59 +03:00
|
|
|
// Does not accept NULL and should never fail.
|
|
|
|
nsPluginTag* TagForPlugin(nsNPAPIPlugin* aPlugin);
|
|
|
|
|
2011-05-12 00:23:25 +04:00
|
|
|
nsresult GetPlugin(const char *aMimeType, nsNPAPIPlugin** aPlugin);
|
|
|
|
|
1998-07-28 06:07:25 +04:00
|
|
|
private:
|
2009-06-26 01:06:54 +04:00
|
|
|
nsresult
|
2002-05-17 00:47:29 +04:00
|
|
|
TrySetUpPluginInstance(const char *aMimeType, nsIURI *aURL, nsIPluginInstanceOwner *aOwner);
|
|
|
|
|
2005-09-21 23:14:30 +04:00
|
|
|
nsresult
|
2012-02-01 01:55:54 +04:00
|
|
|
NewEmbeddedPluginStreamListener(nsIURI* aURL, nsObjectLoadingContent *aContent,
|
2010-07-16 23:55:54 +04:00
|
|
|
nsNPAPIPluginInstance* aInstance,
|
2005-09-21 23:14:30 +04:00
|
|
|
nsIStreamListener** aListener);
|
|
|
|
|
1999-01-25 11:05:00 +03:00
|
|
|
nsresult
|
2012-02-01 01:55:54 +04:00
|
|
|
NewEmbeddedPluginStream(nsIURI* aURL, nsObjectLoadingContent *aContent, nsNPAPIPluginInstance* aInstance);
|
2002-02-12 02:09:38 +03:00
|
|
|
|
1999-01-25 11:05:00 +03:00
|
|
|
nsresult
|
2010-07-18 03:47:29 +04:00
|
|
|
NewFullPagePluginStream(nsIURI* aURI,
|
|
|
|
nsNPAPIPluginInstance *aInstance,
|
|
|
|
nsIStreamListener **aStreamListener);
|
1999-01-25 11:05:00 +03:00
|
|
|
|
2005-11-06 21:34:03 +03:00
|
|
|
// Return an nsPluginTag for this type, if any. If aCheckEnabled is
|
|
|
|
// true, only enabled plugins will be returned.
|
|
|
|
nsPluginTag*
|
2011-09-29 10:19:26 +04:00
|
|
|
FindPluginForType(const char* aMimeType, bool aCheckEnabled);
|
2005-11-06 21:34:03 +03:00
|
|
|
|
|
|
|
nsPluginTag*
|
|
|
|
FindPluginEnabledForExtension(const char* aExtension, const char* &aMimeType);
|
1999-03-30 02:18:05 +04:00
|
|
|
|
2011-11-12 05:10:31 +04:00
|
|
|
nsresult
|
|
|
|
FindStoppedPluginForURL(nsIURI* aURL, nsIPluginInstanceOwner *aOwner);
|
|
|
|
|
2002-02-12 02:09:38 +03:00
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
FindPlugins(bool aCreatePluginList, bool * aPluginsChanged);
|
2002-02-12 02:09:38 +03:00
|
|
|
|
2000-09-22 04:58:46 +04:00
|
|
|
nsresult
|
2011-03-31 22:26:57 +04:00
|
|
|
ScanPluginsDirectory(nsIFile *pluginsDir,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aCreatePluginList,
|
|
|
|
bool *aPluginsChanged);
|
2011-03-31 22:26:57 +04:00
|
|
|
|
2001-11-17 18:26:02 +03:00
|
|
|
nsresult
|
2011-03-31 22:26:57 +04:00
|
|
|
ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aCreatePluginList,
|
|
|
|
bool *aPluginsChanged);
|
2001-02-03 02:48:17 +03:00
|
|
|
|
2012-04-04 02:08:07 +04:00
|
|
|
nsresult EnsurePluginLoaded(nsPluginTag* aPluginTag);
|
2011-02-19 04:05:23 +03:00
|
|
|
|
2012-04-04 02:08:07 +04:00
|
|
|
bool IsRunningPlugin(nsPluginTag * aPluginTag);
|
2000-09-22 04:58:46 +04:00
|
|
|
|
2001-10-18 16:26:23 +04:00
|
|
|
// Stores all plugins info into the registry
|
2002-08-15 02:31:59 +04:00
|
|
|
nsresult WritePluginInfo();
|
|
|
|
|
|
|
|
// Loads all cached plugins info into mCachedPlugins
|
|
|
|
nsresult ReadPluginInfo();
|
2002-02-13 05:18:57 +03:00
|
|
|
|
2009-06-11 00:47:49 +04:00
|
|
|
// Given a file path, returns the plugins info from our cache
|
2002-02-13 05:18:57 +03:00
|
|
|
// and removes it from the cache.
|
2009-06-11 00:47:49 +04:00
|
|
|
void RemoveCachedPluginsInfo(const char *filePath,
|
2007-07-04 01:42:35 +04:00
|
|
|
nsPluginTag **result);
|
2002-02-12 02:09:38 +03:00
|
|
|
|
2011-02-19 04:05:23 +03:00
|
|
|
// Checks to see if a tag object is in our list of live tags.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsLiveTag(nsIPluginTag* tag);
|
2011-02-19 04:05:23 +03:00
|
|
|
|
|
|
|
// Checks our list of live tags for an equivalent tag.
|
2002-02-13 05:18:57 +03:00
|
|
|
nsPluginTag* HaveSamePlugin(nsPluginTag * aPluginTag);
|
|
|
|
|
|
|
|
// checks if given plugin is a duplicate of what we already have
|
|
|
|
// in the plugin list but found in some different place
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsDuplicatePlugin(nsPluginTag * aPluginTag);
|
2005-11-06 21:34:03 +03:00
|
|
|
|
2001-11-17 18:26:02 +03:00
|
|
|
nsresult EnsurePrivateDirServiceProvider();
|
2001-10-18 16:26:23 +04:00
|
|
|
|
2010-01-27 04:30:58 +03:00
|
|
|
void OnPluginInstanceDestroyed(nsPluginTag* aPluginTag);
|
|
|
|
|
2007-07-04 01:42:35 +04:00
|
|
|
nsRefPtr<nsPluginTag> mPlugins;
|
|
|
|
nsRefPtr<nsPluginTag> mCachedPlugins;
|
2010-12-10 01:28:15 +03:00
|
|
|
nsRefPtr<nsInvalidPluginTag> mInvalidPlugins;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPluginsLoaded;
|
|
|
|
bool mDontShowBadPluginMessage;
|
|
|
|
bool mIsDestroyed;
|
2005-01-05 03:21:06 +03:00
|
|
|
|
|
|
|
// set by pref plugin.override_internal_types
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mOverrideInternalTypes;
|
2005-01-05 03:21:06 +03:00
|
|
|
|
2009-10-05 13:00:57 +04:00
|
|
|
// set by pref plugin.disable
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPluginsDisabled;
|
2009-10-05 13:00:57 +04:00
|
|
|
|
2010-07-20 06:11:26 +04: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-27 04:30:58 +03:00
|
|
|
|
2009-02-09 21:48:06 +03:00
|
|
|
nsCOMPtr<nsIFile> mPluginRegFile;
|
2007-07-21 00:34:51 +04:00
|
|
|
#ifdef XP_WIN
|
2003-05-28 01:14:55 +04:00
|
|
|
nsRefPtr<nsPluginDirServiceProvider> mPrivateDirServiceProvider;
|
2009-02-09 21:48:06 +03:00
|
|
|
#endif
|
2005-02-12 02:37:51 +03:00
|
|
|
|
2011-02-09 01:16:07 +03:00
|
|
|
nsCOMPtr<nsIEffectiveTLDService> mTLDService;
|
|
|
|
nsCOMPtr<nsIIDNService> mIDNService;
|
|
|
|
|
|
|
|
// Helpers for ClearSiteData and SiteHasData.
|
|
|
|
nsresult NormalizeHostname(nsCString& host);
|
|
|
|
nsresult EnumerateSiteData(const nsACString& domain,
|
|
|
|
const nsTArray<nsCString>& sites,
|
|
|
|
InfallibleTArray<nsCString>& result,
|
|
|
|
bool firstMatchOnly);
|
|
|
|
|
2002-05-17 00:47:29 +04:00
|
|
|
nsWeakPtr mCurrentDocument; // weak reference, we use it to id document only
|
2005-02-12 02:37:51 +03:00
|
|
|
|
|
|
|
static nsIFile *sPluginTempDir;
|
2005-11-06 21:34:03 +03:00
|
|
|
|
|
|
|
// We need to hold a global ptr to ourselves because we register for
|
|
|
|
// two different CIDs for some reason...
|
2009-07-02 09:48:08 +04:00
|
|
|
static nsPluginHost* sInst;
|
2009-12-15 23:44:52 +03:00
|
|
|
|
|
|
|
#ifdef MAC_CARBON_PLUGINS
|
|
|
|
nsCOMPtr<nsITimer> mVisiblePluginTimer;
|
|
|
|
nsTObserverArray<nsIPluginInstanceOwner*> mVisibleTimerTargets;
|
|
|
|
nsCOMPtr<nsITimer> mHiddenPluginTimer;
|
|
|
|
nsTObserverArray<nsIPluginInstanceOwner*> mHiddenTimerTargets;
|
|
|
|
#endif
|
1998-07-28 06:07:25 +04:00
|
|
|
};
|
|
|
|
|
2008-07-01 05:03:50 +04:00
|
|
|
class NS_STACK_CLASS PluginDestructionGuard : protected PRCList
|
2008-02-29 05:06:00 +03:00
|
|
|
{
|
|
|
|
public:
|
2011-05-18 05:48:34 +04:00
|
|
|
PluginDestructionGuard(nsNPAPIPluginInstance *aInstance)
|
2008-02-29 05:06:00 +03:00
|
|
|
: mInstance(aInstance)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginDestructionGuard(NPP npp)
|
2008-09-15 16:45:01 +04:00
|
|
|
: mInstance(npp ? static_cast<nsNPAPIPluginInstance*>(npp->ndata) : nsnull)
|
2008-02-29 05:06:00 +03:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
~PluginDestructionGuard();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool DelayDestroy(nsNPAPIPluginInstance *aInstance);
|
2008-02-29 05:06:00 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(NS_IsMainThread(), "Should be on the main thread");
|
|
|
|
|
2011-09-30 10:02:59 +04:00
|
|
|
mDelayedDestroy = false;
|
2008-02-29 05:06:00 +03:00
|
|
|
|
|
|
|
PR_INIT_CLIST(this);
|
|
|
|
PR_INSERT_BEFORE(this, &sListHead);
|
|
|
|
}
|
|
|
|
|
2011-05-18 05:48:34 +04:00
|
|
|
nsRefPtr<nsNPAPIPluginInstance> mInstance;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDelayedDestroy;
|
2008-02-29 05:06:00 +03:00
|
|
|
|
|
|
|
static PRCList sListHead;
|
|
|
|
};
|
|
|
|
|
2009-07-06 10:10:10 +04:00
|
|
|
#endif // nsPluginHost_h_
|