nsCOMPtr<nsIScriptSecurityManager> secMan( do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv;  return secMan->GetCodebasePrincipal(originURI, outPrincipal);
return aSecMan->GetCodebasePrincipal(originURI, aOutPrincipal);
CreatePrincipal(nsISupports* securitySupports,                nsIPrincipal ** outPrincipal){    nsresult rv;    nsCOMPtr<nsISecurityContext> securityContext(        do_QueryInterface(securitySupports, &rv));    if (NS_FAILED(rv)) return rv;    char originBuf1[512];    char* origin = originBuf1;    size_t originSize = sizeof(originBuf1);    rv = securityContext->GetOrigin(origin, originSize);    while (NS_FAILED(rv) && originSize < 65536U)    {  // Try allocating a larger buffer on the heap        if (origin != originBuf1)        PR_Free(origin);        originSize *= 2;        origin = (char*)PR_Malloc(originSize);        if (!origin)            return NS_ERROR_OUT_OF_MEMORY;        rv = securityContext->GetOrigin(origin, originSize);    }    if (NS_FAILED(rv))    {        if (origin != originBuf1)            PR_Free(origin);        return rv;    }    nsCOMPtr<nsIURI> originURI;    rv = NS_NewURI(getter_AddRefs(originURI), origin);    if (origin != originBuf1)        PR_Free(origin);    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIScriptSecurityManager> secMan(        do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv));    if (NS_FAILED(rv)) return rv;    return secMan->GetCodebasePrincipal(originURI, outPrincipal);}