Bug 83536.
Merge script principal implementations into one class. Should reduce footprint, speed up calls to caps a little bit, and fixes several memory leaks. Also fixes bugs 211174 and 211263 r=jst@netscape.com sr=bzbarsky@mit.edu moa=mstoltz@netscape.com (he looked at an earlier patch and said it looked fine, and will do a retroactive review when he returns from vacation as well) git-svn-id: svn://10.0.0.236/trunk@145137 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -22,12 +22,11 @@
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsIAggregatePrincipal.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIJAR.h"
|
||||
|
||||
static NS_DEFINE_CID(kScriptSecurityManagerCID, NS_SCRIPTSECURITYMANAGER_CID);
|
||||
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -424,22 +423,28 @@ nsJARChannel::GetOwner(nsISupports **result)
|
||||
if (cert) {
|
||||
// Get the codebase principal
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(kScriptSecurityManagerCID, &rv);
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> codebase;
|
||||
rv = secMan->GetCodebasePrincipal(mJarBaseURI,
|
||||
getter_AddRefs(codebase));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsIURI> codebaseURI;
|
||||
codebase->GetURI(getter_AddRefs(codebaseURI));
|
||||
|
||||
nsCOMPtr<nsIURI> domainURI;
|
||||
codebase->GetDomain(getter_AddRefs(domainURI));
|
||||
|
||||
// Join the certificate and the codebase
|
||||
nsCOMPtr<nsIAggregatePrincipal> agg = do_QueryInterface(cert, &rv);
|
||||
rv = cert->SetURI(codebaseURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = agg->SetCodebase(codebase);
|
||||
rv = cert->SetDomain(domainURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mOwner = do_QueryInterface(agg, &rv);
|
||||
mOwner = do_QueryInterface(cert, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ADDREF(*result = mOwner);
|
||||
|
||||
Reference in New Issue
Block a user