void xxxNeverCalledXUL() { XRE_main(0, nsnull, nsnull); XRE_GetFileFromPath(nsnull, nsnull); XRE_GetStaticComponents(nsnull, nsnull); XRE_InitEmbedding(nsnull, nsnull, nsnull, nsnull, 0); XRE_TermEmbedding(); }
void xxxNeverCalledXUL() { XRE_main(0, nsnull, nsnull); XRE_GetFileFromPath(nsnull, nsnull); XRE_GetStaticComponents(nsnull, nsnull); XRE_LockProfileDirectory(nsnull, nsnull); XRE_InitEmbedding(nsnull, nsnull, nsnull, nsnull, 0); XRE_NotifyProfile(); XRE_TermEmbedding(); XRE_CreateAppData(nsnull, nsnull); XRE_ParseAppData(nsnull, nsnull); XRE_FreeAppData(nsnull); }
/* static */ void EmbedPrivate::PushStartup(void) { // increment the number of widgets sWidgetCount++; // if this is the first widget, fire up xpcom if (sWidgetCount == 1) { nsresult rv; nsCOMPtr<nsILocalFile> binDir; if (sCompPath) { rv = NS_NewNativeLocalFile(nsDependentCString(sCompPath), 1, getter_AddRefs(binDir)); if (NS_FAILED(rv)) return; } const char *grePath = sPath; if (!grePath) grePath = getenv("MOZILLA_FIVE_HOME"); if (!grePath) return; nsCOMPtr<nsILocalFile> greDir; rv = NS_NewNativeLocalFile(nsDependentCString(grePath), PR_TRUE, getter_AddRefs(greDir)); if (NS_FAILED(rv)) return; if (sProfileDir && !sProfileLock) { rv = XRE_LockProfileDirectory(sProfileDir, &sProfileLock); if (NS_FAILED(rv)) return; } rv = XRE_InitEmbedding(greDir, binDir, const_cast<GTKEmbedDirectoryProvider*>(&kDirectoryProvider), nsnull, nsnull); if (NS_FAILED(rv)) return; if (sProfileDir) XRE_NotifyProfile(); rv = RegisterAppComponents(); NS_ASSERTION(NS_SUCCEEDED(rv), "Warning: Failed to register app components.\n"); } }
bool LLEmbeddedBrowser::init( std::string applicationDir, std::string componentDir, std::string profileDir, void* nativeWindowHandleIn ) { mNativeWindowHandle = nativeWindowHandleIn; NS_ConvertUTF8toUTF16 applicationDirUTF16(applicationDir.c_str()); NS_ConvertUTF8toUTF16 componentDirUTF16(componentDir.c_str()); NS_ConvertUTF8toUTF16 profileDirUTF16(profileDir.c_str()); nsCOMPtr< nsILocalFile > applicationDirNative; nsresult result = NS_NewLocalFile( applicationDirUTF16, PR_FALSE, getter_AddRefs( applicationDirNative ) ); if ( NS_FAILED( result ) ) { setLastError( 0x1000 ); return false; }; nsCOMPtr< nsILocalFile > componentDirNative; result = NS_NewLocalFile( componentDirUTF16 , PR_FALSE, getter_AddRefs( componentDirNative ) ); if ( NS_FAILED( result ) ) { setLastError( 0x1001 ); return false; }; result = XRE_InitEmbedding( componentDirNative, applicationDirNative, nsnull, nsnull, 0 ); if ( NS_FAILED( result ) ) { setLastError( 0x1002 ); return false; }; nsCOMPtr< nsILocalFile > profileDirNative; result = NS_NewLocalFile( profileDirUTF16 , PR_TRUE, getter_AddRefs( profileDirNative ) ); if ( NS_FAILED( result ) ) { setLastError( 0x1007 ); return false; }; nsCOMPtr< nsProfileDirServiceProvider > locProvider; NS_NewProfileDirServiceProvider( PR_TRUE, getter_AddRefs( locProvider ) ); if ( ! locProvider ) { setLastError( 0x1003 ); XRE_TermEmbedding(); return PR_FALSE; }; result = locProvider->Register(); if ( NS_FAILED( result ) ) { setLastError( 0x1004 ); XRE_TermEmbedding(); return PR_FALSE; }; result = locProvider->SetProfileDir( profileDirNative ); if ( NS_FAILED( result ) ) { setLastError( 0x1005 ); XRE_TermEmbedding(); return PR_FALSE; }; nsCOMPtr<nsIPref> pref = do_CreateInstance( NS_PREF_CONTRACTID ); if ( pref ) { pref->SetBoolPref( "security.warn_entering_secure", PR_FALSE ); pref->SetBoolPref( "security.warn_entering_weak", PR_FALSE ); pref->SetBoolPref( "security.warn_leaving_secure", PR_FALSE ); pref->SetBoolPref( "security.warn_submit_insecure", PR_FALSE ); pref->SetBoolPref( "network.protocol-handler.warn-external-default", PR_FALSE ); } else { setLastError( 0x1006 ); }; // disable proxy by default enableProxy( false, "", 0 ); // Originally from Linux version but seems to help other platforms too nsresult rv; nsCOMPtr<nsIAppShell> appShell; NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); appShell = do_CreateInstance(kAppShellCID, &rv); if (!appShell) { setLastError( 0x1008 ); return PR_FALSE; } sAppShell = appShell.get(); NS_ADDREF(sAppShell); sAppShell->Create(0, nsnull); sAppShell->Spinup(); clearLastError(); return true; }