Fix for 93351 -- preventing endless reload loop on plugins.refresh(1), r=peterl, sr=jst

git-svn-id: svn://10.0.0.236/trunk@100704 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
av%netscape.com
2001-08-10 01:12:05 +00:00
parent fd42b37a1a
commit 62fd9fc9fa
2 changed files with 22 additions and 8 deletions

View File

@@ -57,7 +57,6 @@ PluginArrayImpl::~PluginArrayImpl()
}
}
// QueryInterface implementation for PluginArrayImpl
NS_INTERFACE_MAP_BEGIN(PluginArrayImpl)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPluginArray)
@@ -66,11 +65,9 @@ NS_INTERFACE_MAP_BEGIN(PluginArrayImpl)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PluginArray)
NS_INTERFACE_MAP_END
NS_IMPL_ADDREF(PluginArrayImpl)
NS_IMPL_RELEASE(PluginArrayImpl)
NS_IMETHODIMP
PluginArrayImpl::GetLength(PRUint32* aLength)
{
@@ -161,6 +158,23 @@ PluginArrayImpl::Refresh(PRBool aReloadDocuments)
{
nsresult res = NS_OK;
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]);
@@ -187,11 +201,9 @@ PluginArrayImpl::Refresh(PRBool aReloadDocuments)
if (mNavigator)
mNavigator->RefreshMIMEArray();
if (aReloadDocuments && mDocShell) {
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
if (webNav)
webNav->Reload(nsIWebNavigation::LOAD_FLAGS_NONE);
if (aReloadDocuments && webNav) {
webNav->GetCurrentURI(getter_AddRefs(mLastURI));
webNav->Reload(nsIWebNavigation::LOAD_FLAGS_NONE);
}
return res;