diff --git a/mozilla/netwerk/protocol/http/src/Makefile.in b/mozilla/netwerk/protocol/http/src/Makefile.in index 4e93f4316de..3f9dda52eef 100644 --- a/mozilla/netwerk/protocol/http/src/Makefile.in +++ b/mozilla/netwerk/protocol/http/src/Makefile.in @@ -36,6 +36,8 @@ REQUIRES = xpcom \ intl \ exthandler \ caps \ + xpconnect \ + js \ $(NULL) CPPSRCS = \ diff --git a/mozilla/netwerk/protocol/http/src/makefile.win b/mozilla/netwerk/protocol/http/src/makefile.win index 4cc32b21eed..b1910164219 100644 --- a/mozilla/netwerk/protocol/http/src/makefile.win +++ b/mozilla/netwerk/protocol/http/src/makefile.win @@ -29,6 +29,8 @@ REQUIRES = xpcom \ intl \ exthandler \ caps \ + xpconnect \ + js \ $(NULL) include <$(DEPTH)/config/config.mak> diff --git a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp index 12fa99de0bf..3c7e1e172ba 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -34,6 +34,7 @@ #include "nsISupportsPrimitives.h" #include "nsIURL.h" #include "nsIMIMEService.h" +#include "nsIScriptSecurityManager.h" #include "nsCExternalHandlerService.h" #include "nsMimeTypes.h" #include "nsNetUtil.h" @@ -1466,6 +1467,15 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType) getter_AddRefs(newURI)); if (NS_FAILED(rv)) return rv; + // verify that this is a legal redirect + nsCOMPtr securityManager = + do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID); + if (securityManager) { + rv = securityManager->CheckLoadURI(mURI, newURI, + nsIScriptSecurityManager::DISALLOW_FROM_MAIL); + if (NS_FAILED(rv)) return rv; + } + // Kill the current cache entry if we are redirecting // back to ourself. PRBool redirectingBackToSameURI = PR_FALSE; diff --git a/mozilla/uriloader/base/nsDocLoader.cpp b/mozilla/uriloader/base/nsDocLoader.cpp index 6771143f506..48c0da02046 100644 --- a/mozilla/uriloader/base/nsDocLoader.cpp +++ b/mozilla/uriloader/base/nsDocLoader.cpp @@ -1263,6 +1263,7 @@ NS_IMETHODIMP nsDocLoaderImpl::OnRedirect(nsIHttpChannel *aOldChannel, nsIChanne rv = aNewChannel->GetURI(getter_AddRefs(newURI)); if (NS_FAILED(rv)) return rv; +#ifdef HTTP_DOESNT_CALL_CHECKLOADURI // verify that this is a legal redirect nsCOMPtr securityManager = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); @@ -1270,6 +1271,7 @@ NS_IMETHODIMP nsDocLoaderImpl::OnRedirect(nsIHttpChannel *aOldChannel, nsIChanne rv = securityManager->CheckLoadURI(oldURI, newURI, nsIScriptSecurityManager::DISALLOW_FROM_MAIL); if (NS_FAILED(rv)) return rv; +#endif nsLoadFlags loadFlags = 0; PRInt32 stateFlags = nsIWebProgressListener::STATE_REDIRECTING |