diff --git a/rdf/chrome/src/nsChromeRegistry.cpp b/rdf/chrome/src/nsChromeRegistry.cpp index d912b303edc4..0d5bf1619fb1 100644 --- a/rdf/chrome/src/nsChromeRegistry.cpp +++ b/rdf/chrome/src/nsChromeRegistry.cpp @@ -304,6 +304,8 @@ nsChromeRegistry::Init() } CheckForNewChrome(); + // CheckForNewChrome suppresses these during chrome registration + FlagXPCNativeWrappers(); return NS_OK; } @@ -2596,8 +2598,11 @@ nsChromeRegistry::InstallProvider(const nsACString& aProviderType, if (NS_FAILED(rv)) return NS_OK; - if (!mBatchInstallFlushes) + if (!mBatchInstallFlushes) { rv = remoteInstall->Flush(); + if (NS_SUCCEEDED(rv) && aProviderType.Equals("package")) + rv = FlagXPCNativeWrappers(); + } // XXX Handle the installation of overlays. @@ -2938,6 +2943,13 @@ nsChromeRegistry::AddToCompositeDataSource(PRBool aUseProfile) LoadDataSource(kChromeFileName, getter_AddRefs(mInstallDirChromeDataSource), PR_FALSE, nsnull); mChromeDataSource->AddDataSource(mInstallDirChromeDataSource); + return rv; +} + +nsresult +nsChromeRegistry::FlagXPCNativeWrappers() +{ + nsresult rv; // List all packages that want XPC native wrappers nsCOMPtr xpc(do_GetService("@mozilla.org/js/xpc/XPConnect;1", &rv)); NS_ENSURE_SUCCESS(rv, rv); @@ -3014,6 +3026,8 @@ nsresult nsChromeRegistry::LoadProfileDataSource() mChromeDataSource = nsnull; rv = AddToCompositeDataSource(PR_TRUE); if (NS_FAILED(rv)) return rv; + rv = FlagXPCNativeWrappers(); + if (NS_FAILED(rv)) return rv; // XXX this sucks ASS. This is a temporary hack until we get // around to fixing the skin switching bugs. @@ -3153,7 +3167,9 @@ nsChromeRegistry::CheckForNewChrome() if (dataBuffer) { PRInt32 bufferSize = PR_Read(file, dataBuffer, finfo.size); if (bufferSize > 0) { + mBatchInstallFlushes = PR_TRUE; rv = ProcessNewChromeBuffer(dataBuffer, bufferSize); + mBatchInstallFlushes = PR_FALSE; } delete [] dataBuffer; } @@ -3186,8 +3202,6 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) nsCAutoString fileURL; nsCAutoString chromeURL; - mBatchInstallFlushes = PR_TRUE; - // process chromeType, chromeProfile, chromeLocType, chromeLocation while (aBuffer < bufferEnd) { // parse one line of installed-chrome.txt @@ -3303,7 +3317,6 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) ++aBuffer; } - mBatchInstallFlushes = PR_FALSE; nsCOMPtr dataSource; LoadDataSource(kChromeFileName, getter_AddRefs(dataSource), PR_FALSE, nsnull); nsCOMPtr remote(do_QueryInterface(dataSource)); diff --git a/rdf/chrome/src/nsChromeRegistry.h b/rdf/chrome/src/nsChromeRegistry.h index 8aa31d3c6fa3..0b706f427533 100644 --- a/rdf/chrome/src/nsChromeRegistry.h +++ b/rdf/chrome/src/nsChromeRegistry.h @@ -145,7 +145,9 @@ private: nsISimpleEnumerator** aResult); nsresult AddToCompositeDataSource(PRBool aUseProfile); - + + nsresult FlagXPCNativeWrappers(); + nsresult GetBaseURL(const nsACString& aPackage, const nsACString& aProvider, nsACString& aBaseURL);