}
extern "C" void RunChromeInstallOnThread(void *data){    nsresult rv;    NS_ASSERTION(data, "No nsInstallInfo passed to Chrome Install");    nsInstallInfo *info = (nsInstallInfo*)data;    nsIXPIListener* listener = info->GetListener();    if (listener)        listener->OnInstallStart(info->GetURL());    // make sure we've got a chrome registry -- can't proceed if not    CHROMEREG_IFACE* reg = info->GetChromeRegistry();    NS_ASSERTION(reg, "We shouldn't get here without a chrome registry.");    if (reg)    {#ifdef MOZ_XUL_APP        PRBool installed = PR_FALSE;        if (info->GetType() == CHROME_SKIN) {            static NS_DEFINE_CID(kZipReaderCID,  NS_ZIPREADER_CID);            nsCOMPtr<nsIZipReader> hZip = do_CreateInstance(kZipReaderCID, &rv);            if (hZip)                rv = hZip->Init(info->GetFile());            if (NS_SUCCEEDED(rv))                rv = hZip->Open();            if (NS_SUCCEEDED(rv))            {                rv = hZip->Test("install.rdf");                nsIExtensionManager* em = info->GetExtensionManager();                if (NS_SUCCEEDED(rv) && em) {                    rv = em->InstallTheme(info->GetFile(), nsIExtensionManager::FLAG_INSTALL_PROFILE);                    if (NS_SUCCEEDED(rv)) {                        installed = PR_TRUE;                        info->GetFile()->Remove(PR_FALSE);                        // Extension Manager copies the theme .jar file to                         // a different location, so remove the temporary file.                    }                }                    hZip->Close();            }        }        if (!installed) {            reg->ProcessContentsManifest(info->GetFileJARURL(),                                         info->GetManifestURL(),                                         PR_TRUE,                                         info->GetType() == CHROME_SKIN);            reg->CheckForNewChrome();        }#else        PRBool isSkin    = (info->GetType() & CHROME_SKIN);        PRBool isLocale  = (info->GetType() & CHROME_LOCALE);        PRBool isContent = (info->GetType() & CHROME_CONTENT);        PRBool selected  = (info->GetFlags() != 0);        const nsCString& spec = info->GetFileJARSpec();        if ( isContent )            rv = reg->InstallPackage(spec.get(), PR_TRUE);        if ( isSkin )        {            rv = reg->InstallSkin(spec.get(), PR_TRUE, PR_FALSE);                            if (NS_SUCCEEDED(rv) && selected)            {                NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());                rv = reg->SelectSkin(utf8Args, PR_TRUE);            }        }        if ( isLocale )        {            rv = reg->InstallLocale(spec.get(), PR_TRUE);            if (NS_SUCCEEDED(rv) && selected)            {                NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());                rv = reg->SelectLocale(utf8Args, PR_TRUE);            }        }        // now that all types are registered try to activate        if ( isSkin && selected )            reg->RefreshSkins();#ifdef RELOAD_CHROME_WORKS// XXX ReloadChrome() crashes right now            if ( isContent || (isLocale && selected) )                reg->ReloadChrome();#endif#endif    }    if (listener)        listener->OnInstallDone(info->GetURL(), nsInstall::SUCCESS);    delete info;}