nsXULPrototypeDocument::GetDocumentPrincipal(nsIPrincipal** aResult)
nsXULPrototypeDocument::GetDocumentPrincipal()
nsXULPrototypeDocument::GetDocumentPrincipal(nsIPrincipal** aResult){    NS_PRECONDITION(mNodeInfoManager, "missing nodeInfoManager");    if (!mDocumentPrincipal) {        nsresult rv;        nsCOMPtr<nsIScriptSecurityManager> securityManager =                  do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);        if (NS_FAILED(rv))            return NS_ERROR_FAILURE;        // XXX This should be handled by the security manager, see bug 160042        PRBool isChrome = PR_FALSE;        if (NS_SUCCEEDED(mURI->SchemeIs("chrome", &isChrome)) && isChrome) {            if (gSystemPrincipal) {                mDocumentPrincipal = gSystemPrincipal;            } else {                rv = securityManager->                     GetSystemPrincipal(getter_AddRefs(mDocumentPrincipal));                NS_IF_ADDREF(gSystemPrincipal = mDocumentPrincipal);            }        } else {            rv = securityManager->                 GetCodebasePrincipal(mURI, getter_AddRefs(mDocumentPrincipal));        }        if (NS_FAILED(rv))            return NS_ERROR_FAILURE;        mNodeInfoManager->SetDocumentPrincipal(mDocumentPrincipal);    }    *aResult = mDocumentPrincipal;    NS_ADDREF(*aResult);    return NS_OK;}