зеркало из https://github.com/mozilla/pjs.git
Fix 24884
This commit is contained in:
Родитель
fdf39e134e
Коммит
8edd476539
|
@ -75,4 +75,5 @@ include <$(DEPTH)\config\rules.mak>
|
|||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) $(DLL) $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
$(MAKE_INSTALL) redirect.html $(DIST)\bin\res\errors
|
||||
|
||||
|
|
|
@ -1375,6 +1375,7 @@ nsresult nsHTTPChannel::Redirect(const char *aNewLocation,
|
|||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
PRBool checkSecurity = PR_TRUE;
|
||||
|
||||
*aResult = nsnull;
|
||||
|
||||
|
@ -1388,6 +1389,19 @@ nsresult nsHTTPChannel::Redirect(const char *aNewLocation,
|
|||
rv = serv->NewURI(aNewLocation, mURI, getter_AddRefs(newURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool eq = PR_FALSE;
|
||||
rv = mURI -> Equals (newURI, &eq);
|
||||
|
||||
if (eq)
|
||||
{
|
||||
// loop detected
|
||||
// ruslan/24884
|
||||
rv = serv->NewURI (LOOPING_REDIRECT_ERROR_URI, mURI, getter_AddRefs (newURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
checkSecurity = PR_FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Move the Reference of the old location to the new one
|
||||
// if the new one has none
|
||||
|
@ -1431,11 +1445,14 @@ nsresult nsHTTPChannel::Redirect(const char *aNewLocation,
|
|||
nsAllocator::Free(newURLSpec);
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||
if (checkSecurity)
|
||||
{
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = securityManager->CheckLoadURI(mOriginalURI ? mOriginalURI : mURI, newURI, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = securityManager->CheckLoadURI(mOriginalURI ? mOriginalURI : mURI, newURI, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
rv = NS_OpenURI(getter_AddRefs(channel), newURI, serv, mLoadGroup,
|
||||
mCallbacks, mLoadAttributes,
|
||||
|
@ -1496,7 +1513,10 @@ nsresult nsHTTPChannel::ResponseCompleted (nsIStreamListener *aListener,
|
|||
nsresult rv1 = ReadFromCache ();
|
||||
|
||||
if (NS_SUCCEEDED (rv1))
|
||||
{
|
||||
aStatus = NS_ERROR_GENERATE_SUCCESS (NS_ERROR_MODULE_NETWORK, NS_ERROR_GET_CODE (aStatus));
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ class nsHTTPRequest;
|
|||
class nsHTTPResponse;
|
||||
class nsICachedNetData;
|
||||
|
||||
#define LOOPING_REDIRECT_ERROR_URI "resource:/res/errors/redirect.html"
|
||||
|
||||
// Utility functions- TODO share from nsURLHelpers...
|
||||
nsresult
|
||||
DupString(char* *o_Dest, const char* i_Src);
|
||||
|
|
Загрузка…
Ссылка в новой задаче