diff --git a/extensions/reporter/resources/content/reporter/contents.rdf b/extensions/reporter/resources/content/reporter/contents.rdf index 8a134ba5617..ecf609ac16f 100644 --- a/extensions/reporter/resources/content/reporter/contents.rdf +++ b/extensions/reporter/resources/content/reporter/contents.rdf @@ -11,7 +11,8 @@ chrome:authorURL="http://reporter.mozilla.org/" chrome:extension="true" chrome:description="Broken Web Site Reporting Tool" - chrome:name="reporter"> + chrome:name="reporter" + chrome:xpcNativeWrappers="true"> diff --git a/extensions/wallet/resources/content/contents.rdf b/extensions/wallet/resources/content/contents.rdf index 0a0b4e836dc..6c737034404 100644 --- a/extensions/wallet/resources/content/contents.rdf +++ b/extensions/wallet/resources/content/contents.rdf @@ -12,6 +12,7 @@ chrome:displayName="Form Manager" chrome:author="mozilla.org" chrome:name="wallet" + chrome:xpcNativeWrappers="true" #expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"> diff --git a/mailnews/base/resources/content/contents.rdf b/mailnews/base/resources/content/contents.rdf index 7ecefbe63f9..11d97954ce3 100644 --- a/mailnews/base/resources/content/contents.rdf +++ b/mailnews/base/resources/content/contents.rdf @@ -13,6 +13,7 @@ chrome:displayName="Messenger" chrome:author="mozilla.org" chrome:name="messenger" + chrome:xpcNativeWrappers="true" #expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__" #expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__"> diff --git a/rdf/chrome/src/nsChromeRegistry.cpp b/rdf/chrome/src/nsChromeRegistry.cpp index 87b11a9e434..eef280008dc 100644 --- a/rdf/chrome/src/nsChromeRegistry.cpp +++ b/rdf/chrome/src/nsChromeRegistry.cpp @@ -95,6 +95,7 @@ #include "nsNetCID.h" #include "nsIJARURI.h" #include "nsIFileURL.h" +#include "nsIXPConnect.h" static char kChromePrefix[] = "chrome://"; nsIAtom* nsChromeRegistry::sCPrefix; // atom for "c" @@ -129,6 +130,7 @@ DEFINE_RDF_VOCAB(CHROME_URI, CHROME, skinVersion); DEFINE_RDF_VOCAB(CHROME_URI, CHROME, localeVersion); DEFINE_RDF_VOCAB(CHROME_URI, CHROME, packageVersion); DEFINE_RDF_VOCAB(CHROME_URI, CHROME, disabled); +DEFINE_RDF_VOCAB(CHROME_URI, CHROME, xpcNativeWrappers); //////////////////////////////////////////////////////////////////////////////// @@ -216,6 +218,7 @@ nsChromeRegistry::Init() { "selectedLocale", nsnull }, { "selectedSkin", nsnull }, { "hasOverlays", nsnull }, + { "xpcNativeWrappers", nsnull }, { "previewURL", nsnull }, }; @@ -290,6 +293,10 @@ nsChromeRegistry::Init() getter_AddRefs(mDisabled)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource"); + rv = mRDFService->GetResource(nsDependentCString(kURICHROME_xpcNativeWrappers), + getter_AddRefs(mXPCNativeWrappers)); + NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource"); + nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) { @@ -2920,7 +2927,42 @@ nsChromeRegistry::AddToCompositeDataSource(PRBool aUseProfile) // Always load the install dir datasources LoadDataSource(kChromeFileName, getter_AddRefs(mInstallDirChromeDataSource), PR_FALSE, nsnull); mChromeDataSource->AddDataSource(mInstallDirChromeDataSource); - + + // List all packages that want XPC native wrappers + nsCOMPtr xpc(do_GetService("@mozilla.org/js/xpc/XPConnect;1", &rv)); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr arcs; + nsCOMPtr trueLiteral; + mRDFService->GetLiteral(NS_LITERAL_STRING("true").get(), getter_AddRefs(trueLiteral)); + rv = mChromeDataSource->GetSources(mXPCNativeWrappers, trueLiteral, PR_TRUE, + getter_AddRefs(arcs)); + if (NS_FAILED(rv)) return rv; + + nsCAutoString uri; + PRBool more; + rv = arcs->HasMoreElements(&more); + if (NS_FAILED(rv)) return rv; + while (more) { + nsCOMPtr supp; + rv = arcs->GetNext(getter_AddRefs(supp)); + if (NS_FAILED(rv)) return rv; + nsCOMPtr package(do_QueryInterface(supp)); + if (package) { + const char urn[] = "urn:mozilla:package:"; + const char* source; + package->GetValueConst(&source); + if (!memcmp(source, urn, sizeof urn - 1)) { + uri.AssignLiteral("chrome://"); + uri.Append(source + sizeof urn - 1); + uri.Append('/'); + rv = xpc->FlagSystemFilenamePrefix(uri.get()); + NS_ENSURE_SUCCESS(rv, rv); + } + } + rv = arcs->HasMoreElements(&more); + if (NS_FAILED(rv)) return rv; + } + return NS_OK; } diff --git a/rdf/chrome/src/nsChromeRegistry.h b/rdf/chrome/src/nsChromeRegistry.h index b27bf6e6a97..ac5fef5052b 100644 --- a/rdf/chrome/src/nsChromeRegistry.h +++ b/rdf/chrome/src/nsChromeRegistry.h @@ -255,6 +255,7 @@ protected: nsCOMPtr mLocaleVersion; nsCOMPtr mPackageVersion; nsCOMPtr mDisabled; + nsCOMPtr mXPCNativeWrappers; nsCOMPtr mOverrideJAR; nsCString mOverrideJARURL; diff --git a/security/manager/pki/resources/content/contents.rdf b/security/manager/pki/resources/content/contents.rdf index cde69c9fbba..5913c773208 100644 --- a/security/manager/pki/resources/content/contents.rdf +++ b/security/manager/pki/resources/content/contents.rdf @@ -49,6 +49,7 @@ chrome:displayName="pippki" chrome:author="PSM Team" chrome:name="pippki" + chrome:xpcNativeWrappers="true" #expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"> diff --git a/xpfe/browser/resources/content/contents.rdf b/xpfe/browser/resources/content/contents.rdf index 2bb04b0d941..e69de29bb2d 100644 --- a/xpfe/browser/resources/content/contents.rdf +++ b/xpfe/browser/resources/content/contents.rdf @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - diff --git a/xpfe/communicator/resources/content/contents.rdf b/xpfe/communicator/resources/content/contents.rdf index 9e2b826faed..08a963016c1 100644 --- a/xpfe/communicator/resources/content/contents.rdf +++ b/xpfe/communicator/resources/content/contents.rdf @@ -12,6 +12,7 @@ chrome:displayName="Communicator Shared" chrome:author="mozilla.org" chrome:name="communicator" + chrome:xpcNativeWrappers="true" #expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__" #expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__"> diff --git a/xpfe/global/resources/content/contents.rdf b/xpfe/global/resources/content/contents.rdf index df38215915f..bfe1dcbf6ad 100644 --- a/xpfe/global/resources/content/contents.rdf +++ b/xpfe/global/resources/content/contents.rdf @@ -12,6 +12,7 @@ chrome:displayName="Toolkit" chrome:author="mozilla.org" chrome:name="global" + chrome:xpcNativeWrappers="true" #expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__" #expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__">