Fixing 143178 -- refreshing plugins before going to the plugin finder sevice, r=peterl, sr=beard

This commit is contained in:
av%netscape.com 2002-05-16 20:41:26 +00:00
Родитель ad57ee44a1
Коммит c405585a95
2 изменённых файлов: 28 добавлений и 17 удалений

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

@ -125,6 +125,8 @@
// for embedding
#include "nsIWebBrowserChromeFocus.h"
#include "nsPluginError.h"
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
static NS_DEFINE_CID(kDocumentCharsetInfoCID, NS_DOCUMENTCHARSETINFO_CID);
@ -4183,14 +4185,15 @@ nsDocShell::NewContentViewerObj(const char *aContentType,
docLoaderFactory(do_CreateInstance(contractId.get()));
if (!docLoaderFactory) {
// try again after loading plugins
nsresult err;
nsCOMPtr<nsIPluginHost> pluginHost =
do_GetService(kPluginManagerCID, &err);
if (NS_FAILED(err))
nsCOMPtr<nsIPluginManager> pluginManager = do_GetService(kPluginManagerCID);
if (!pluginManager)
return NS_ERROR_FAILURE;
pluginHost->LoadPlugins();
// no need to do anything if plugins have not been changed
// PR_FALSE will ensure that currently running plugins will not be shut down
// but the plugin list will still be updated with newly installed plugins
if (NS_ERROR_PLUGINS_PLUGINSNOTCHANGED == pluginManager->ReloadPlugins(PR_FALSE))
return NS_ERROR_FAILURE;
docLoaderFactory = do_CreateInstance(contractId.get());

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

@ -49,6 +49,7 @@
#include "nsIWebNavigation.h"
#include "nsDOMClassInfo.h"
#include "nsPluginError.h"
#include "nsIComponentRegistrar.h"
static NS_DEFINE_CID(kPluginManagerCID, NS_PLUGINMANAGER_CID);
@ -175,17 +176,12 @@ PluginArrayImpl::Refresh(PRBool aReloadDocuments)
{
nsresult res = NS_OK;
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mDocShell);
if (mPluginArray != nsnull) {
for (PRUint32 i = 0; i < mPluginCount; i++)
NS_IF_RELEASE(mPluginArray[i]);
delete[] mPluginArray;
}
mPluginCount = 0;
mPluginArray = nsnull;
// refresh the component registry first, see bug 87913
nsCOMPtr<nsIServiceManager> servManager;
NS_GetServiceManager(getter_AddRefs(servManager));
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servManager);
if (registrar)
registrar->AutoRegister(nsnull);
if (!mPluginHost) {
mPluginHost = do_GetService(kPluginManagerCID, &res);
@ -208,6 +204,18 @@ PluginArrayImpl::Refresh(PRBool aReloadDocuments)
if(pluginsNotChanged)
return res;
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mDocShell);
if (mPluginArray != nsnull) {
for (PRUint32 i = 0; i < mPluginCount; i++)
NS_IF_RELEASE(mPluginArray[i]);
delete[] mPluginArray;
}
mPluginCount = 0;
mPluginArray = nsnull;
if (mNavigator)
mNavigator->RefreshMIMEArray();