const PRUnichar *newFileUni = fileUni.ToNewUnicode();
XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report){    nsresult rv;    /* Use the console service to register the error. */    nsCOMPtr<nsIConsoleService> consoleService        (do_GetService("@mozilla.org/consoleservice;1"));    /*     * Make an nsIScriptError, populate it with information from this     * error, then log it with the console service.     */    nsCOMPtr<nsIScriptError>        errorObject(do_CreateInstance("@mozilla.org/scripterror;1"));        if (consoleService != nsnull && errorObject != nsnull && report != nsnull) {        /*         * Got an error object; prepare appropriate-width versions of         * various arguments to it.         */        nsAutoString fileUni;        fileUni.AssignWithConversion(report->filename);        const PRUnichar *newFileUni = fileUni.ToNewUnicode();                PRUint32 column = report->uctokenptr - report->uclinebuf;        rv = errorObject->Init(NS_REINTERPRET_CAST(const PRUnichar*, report->ucmessage), newFileUni, NS_REINTERPRET_CAST(const PRUnichar*, report->uclinebuf),                               report->lineno, column, report->flags,                               "XPInstall JavaScript");        nsMemory::Free((void *)newFileUni);        if (NS_SUCCEEDED(rv)) {            rv = consoleService->LogMessage(errorObject);            if (NS_SUCCEEDED(rv)) {              // We're done!              // For now, always also print out the error to stderr.              // return;            }        }    }        if (!report)        return;    nsIXPIListener *listener;    // lets set up an eventQ so that our xpcom/proxies will not have to:    nsCOMPtr<nsISoftwareUpdate> softwareUpdate =              do_GetService(kSoftwareUpdateCID, &rv);    if (!NS_SUCCEEDED(rv))    {        NS_WARNING("shouldn't have RunInstall() if we can't get SoftwareUpdate");        return;    }    softwareUpdate->GetMasterListener(&listener);        if(listener)    {        nsAutoString logMessage;        logMessage.AssignWithConversion("Line: ");        logMessage.AppendInt(report->lineno, 10);        logMessage.AppendWithConversion("\t");        if (report->ucmessage)            logMessage.Append( NS_REINTERPRET_CAST(const PRUnichar*, report->ucmessage) );         else            logMessage.AppendWithConversion( message );         listener->LogComment( logMessage.get() );    }}