nsresult rv = NS_ERROR_FAILURE;  nsCOMPtr<nsIScriptSecurityManager> secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv);
nsSyncLoader::OnRedirect(nsIHttpChannel *aHttpChannel,                         nsIChannel *aNewChannel){    NS_ENSURE_ARG_POINTER(aNewChannel);    nsresult rv = NS_ERROR_FAILURE;    nsCOMPtr<nsIScriptSecurityManager> secMan =        do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);    NS_ENSURE_SUCCESS(rv, rv);    nsCOMPtr<nsIURI> oldURI;    rv = aHttpChannel->GetURI(getter_AddRefs(oldURI)); // The original URI    NS_ENSURE_SUCCESS(rv, rv);    nsCOMPtr<nsIURI> newURI;    rv = aNewChannel->GetURI(getter_AddRefs(newURI)); // The new URI    NS_ENSURE_SUCCESS(rv, rv);    rv = secMan->CheckSameOriginURI(oldURI, newURI);    NS_ENSURE_SUCCESS(rv, rv);    mChannel = aNewChannel;    return NS_OK;}