Fixing bug 119621 -- plugins refreshed only every other time, r=peterl, sr=beard

git-svn-id: svn://10.0.0.236/trunk@114204 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
av%netscape.com
2002-02-11 23:09:38 +00:00
parent 7e504a3c7f
commit b96821a2a8
8 changed files with 332 additions and 171 deletions

View File

@@ -48,6 +48,7 @@
#include "nsIDocShell.h"
#include "nsIWebNavigation.h"
#include "nsDOMClassInfo.h"
#include "nsPluginError.h"
static NS_DEFINE_CID(kPluginManagerCID, NS_PLUGINMANAGER_CID);
@@ -176,21 +177,6 @@ PluginArrayImpl::Refresh(PRBool aReloadDocuments)
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mDocShell);
if(aReloadDocuments && webNav) {
// we should take some measures to prevent recursive reload,
// check the URL and don't do anything if we just saw it.
nsCOMPtr<nsIURI> uri;
webNav->GetCurrentURI(getter_AddRefs(uri));
if(uri) {
PRBool sameURI = PR_FALSE;
uri->Equals(mLastURI, &sameURI);
if(sameURI) {
mLastURI = nsnull;
return res;
}
}
}
if (mPluginArray != nsnull) {
for (PRUint32 i = 0; i < mPluginCount; i++)
NS_IF_RELEASE(mPluginArray[i]);
@@ -211,16 +197,22 @@ PluginArrayImpl::Refresh(PRBool aReloadDocuments)
nsCOMPtr<nsIPluginManager> pm(do_QueryInterface(mPluginHost));
// NS_ERROR_PLUGINS_PLUGINSNOTCHANGED on reloading plugins indicates
// that plugins did not change and was not reloaded
PRBool pluginsNotChanged = PR_FALSE;
if(pm)
pm->ReloadPlugins(aReloadDocuments);
pluginsNotChanged = (NS_ERROR_PLUGINS_PLUGINSNOTCHANGED == pm->ReloadPlugins(aReloadDocuments));
// no need to reload the page if plugins have not been changed
// in fact, if we do reload we can hit recursive load problem, see bug 93351
if(pluginsNotChanged)
return res;
if (mNavigator)
mNavigator->RefreshMIMEArray();
if (aReloadDocuments && webNav) {
webNav->GetCurrentURI(getter_AddRefs(mLastURI));
if (aReloadDocuments && webNav)
webNav->Reload(nsIWebNavigation::LOAD_FLAGS_NONE);
}
return res;
}