nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsAString& aElementID, nsCString& aURI)
nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI)
nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsAString& aElementID, nsCString& aURI){    // Convert an element's ID to a URI that can be used to refer to    // the element in the XUL graph.    if (aElementID.FindChar(':') > 0) {        // Assume it's absolute already. Use as is.        aURI.Assign(NS_ConvertUCS2toUTF8(aElementID));    }    else {        nsresult rv;        nsCOMPtr<nsIURI> docURL;        rv = aDocument->GetBaseURL(*getter_AddRefs(docURL));        if (NS_FAILED(rv)) return rv;        // XXX Urgh. This is so broken; I'd really just like to use        // NS_MakeAbsolueURI(). Unfortunatly, doing that breaks        // MakeElementID in some cases that I haven't yet been able to        // figure out.#define USE_BROKEN_RELATIVE_PARSING#ifdef USE_BROKEN_RELATIVE_PARSING        docURL->GetSpec(aURI);        if (aElementID.First() != '#') {            aURI.Append('#');        }        aURI.Append(NS_ConvertUCS2toUTF8(aElementID));#else        nsXPIDLCString spec;        rv = NS_MakeAbsoluteURI(nsCAutoString(aElementID), docURL, getter_Copies(spec));        if (NS_SUCCEEDED(rv)) {            aURI = spec;        }        else {            NS_WARNING("MakeElementURI: NS_MakeAbsoluteURI failed");            aURI = aElementID;        }#endif    }    return NS_OK;}