nsCOMPtr<nsIURI> baseURL; nsresult status = nsComponentManager::CreateInstance(kStdURLCID, nsnull, NS_GET_IID(nsIURI), getter_AddRefs(baseURL));
nsresult status; nsCOMPtr<nsIURI> baseURL = do_CreateInstance(kStdURLCID, &status);
nsresult makeAbsTest(const char* i_BaseURI, const char* relativePortion,                     const char* expectedResult){    if (!i_BaseURI)        return NS_ERROR_FAILURE;    // build up the base URL    nsCOMPtr<nsIURI> baseURL;    nsresult status = nsComponentManager::CreateInstance(kStdURLCID, nsnull,         NS_GET_IID(nsIURI), getter_AddRefs(baseURL));    if (NS_FAILED(status))    {        printf("CreateInstance failed\n");        return status;    }    status = baseURL->SetSpec(nsDependentCString(i_BaseURI));    if (NS_FAILED(status)) return status;    // get the new spec    nsCAutoString newURL;    status = baseURL->Resolve(nsDependentCString(relativePortion), newURL);    if (NS_FAILED(status)) return status;    nsCAutoString temp;    baseURL->GetSpec(temp);    printf("Analyzing %s\n", temp.get());    printf("With      %s\n", relativePortion);    printf("Got       %s\n", newURL.get());    if (expectedResult) {        printf("Expect    %s\n", expectedResult);        int res = PL_strcmp(newURL.get(), expectedResult);        if (res == 0) {            printf("\tPASSED\n\n");            return NS_OK;        } else {            printf("\tFAILED\n\n");            return NS_ERROR_FAILURE;        }    }    return NS_OK;}