diff --git a/mozilla/dom/src/base/nsPluginArray.cpp b/mozilla/dom/src/base/nsPluginArray.cpp index 9774403a3cc..a4fd7bf2742 100644 --- a/mozilla/dom/src/base/nsPluginArray.cpp +++ b/mozilla/dom/src/base/nsPluginArray.cpp @@ -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 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 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 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; diff --git a/mozilla/dom/src/base/nsPluginArray.h b/mozilla/dom/src/base/nsPluginArray.h index 4c45aaf26d8..a380f106f38 100644 --- a/mozilla/dom/src/base/nsPluginArray.h +++ b/mozilla/dom/src/base/nsPluginArray.h @@ -26,6 +26,7 @@ #include "nsIDOMPluginArray.h" #include "nsIDOMPlugin.h" #include "nsIPluginHost.h" +#include "nsIURL.h" class NavigatorImpl; class nsIDocShell; @@ -60,6 +61,7 @@ protected: PRUint32 mPluginCount; nsIDOMPlugin** mPluginArray; nsIDocShell* mDocShell; // weak reference + nsCOMPtr mLastURI; }; class PluginElementImpl : public nsIDOMPlugin