}
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    nsIXULChromeRegistry* reg = info->GetChromeRegistry();#ifndef MOZ_XUL_APP    nsCOMPtr<nsIChromeRegistrySea> cr = do_QueryInterface(reg);#endif    if (reg)    {        // build up jar: URL        nsCString spec;        spec.SetCapacity(200);        spec = "jar:";        nsCAutoString localURL;        rv = NS_GetURLSpecFromFile(info->GetFile(), localURL);        if (NS_SUCCEEDED(rv)) {            spec.Append(localURL);            spec.Append("!/");        }        // Now register the new chrome        if (NS_SUCCEEDED(rv))        {            PRBool isSkin    = (info->GetType() & CHROME_SKIN);            PRBool isLocale  = (info->GetType() & CHROME_LOCALE);            PRBool isContent = (info->GetType() & CHROME_CONTENT);            PRBool selected  = (info->GetFlags() != 0);            if ( isContent )            {                rv = reg->InstallPackage(spec.get(), PR_TRUE);            }            if ( isSkin )            {                PRBool installed = PR_FALSE;                // Look for a theme manifest                static NS_DEFINE_IID(kIZipReaderIID, NS_IZIPREADER_IID);                static NS_DEFINE_IID(kZipReaderCID,  NS_ZIPREADER_CID);                nsresult rv;                nsCOMPtr<nsIZipReader> hZip = do_CreateInstance(kZipReaderCID, &rv);                if (hZip)                    rv = hZip->Init(info->GetFile());                if (NS_SUCCEEDED(rv))                {                    hZip->Open();                    nsIExtensionManager* em = info->GetExtensionManager();                    rv = hZip->Test("install.rdf");                    if (NS_SUCCEEDED(rv) && em)                    {                        rv = em->InstallTheme(info->GetFile(), nsIExtensionManager::FLAG_INSTALL_PROFILE);                        if (NS_SUCCEEDED(rv))                            installed = PR_TRUE;                    }                        hZip->Close();                    // Extension Manager copies the theme .jar file to                     // a different location, so remove the temporary file.                    info->GetFile()->Remove(PR_FALSE);                }                                // We either have an old-style theme with no theme.rdf                 // manifest, OR we have a new style theme and InstallTheme                // returned an error (e.g. it's not implemented in Seamonkey,                 // or something else went wrong)                if (!installed)                    rv = reg->InstallSkin(spec.get(), PR_TRUE, PR_FALSE);                #ifndef MOZ_XUL_APP                if (NS_SUCCEEDED(rv) && selected && cr)                {                    NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());                    rv = cr->SelectSkin(utf8Args, PR_TRUE);                }#endif            }            if ( isLocale )            {                rv = reg->InstallLocale(spec.get(), PR_TRUE);#ifndef MOZ_XUL_APP                if (NS_SUCCEEDED(rv) && selected && cr)                {                    NS_ConvertUCS2toUTF8 utf8Args(info->GetArguments());                    rv = cr->SelectLocale(utf8Args, PR_TRUE);                }#endif            }            // 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        }    }    if (listener)        listener->OnInstallDone(info->GetURL(), nsInstall::SUCCESS);    delete info;}