Bug 416886 - Find module loaders which are part of the static component list early, and process components which end up in the leftovers list in forwards instead of reverse order. This means that JS component in extensions can correctly override JS components in the core app. r=dougt a=schrep

This commit is contained in:
benjamin@smedbergs.us 2008-02-21 08:23:06 -08:00
parent 50662d1e5b
commit 86efff4ec1

View File

@ -2983,11 +2983,15 @@ nsComponentManagerImpl::LoadLeftoverComponents(
LoaderType curLoader = GetLoaderCount();
for (PRInt32 i = aLeftovers.Count() - 1; i >= 0; --i) {
for (PRInt32 i = 0; i < aLeftovers.Count(); ) {
nsresult rv = AutoRegisterComponent(aLeftovers[i], aDeferred,
minLoader);
if (NS_SUCCEEDED(rv))
if (NS_SUCCEEDED(rv)) {
aLeftovers.RemoveObjectAt(i);
}
else {
++i;
}
}
if (aLeftovers.Count())
// recursively try this again until there are no new loaders found
@ -3179,10 +3183,16 @@ nsComponentManagerImpl::AutoRegister(nsIFile *aSpec)
nsCOMArray<nsILocalFile> leftovers;
nsTArray<DeferredModule> deferred;
if (!aSpec)
if (!aSpec) {
mStaticModuleLoader.EnumerateModules(RegisterStaticModule,
deferred);
// Builtin component loaders (xpconnect!) can be static modules.
// Set them up now, so that JS components don't go into
// the leftovers list.
GetAllLoaders();
}
LoaderType curLoader = GetLoaderCount();
if (aSpec) {