From 845130e95ad411e1c0a6b8c06fe9d90690b936dd Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Wed, 22 Mar 2000 09:28:42 +0000 Subject: [PATCH] Fixing a bug in the skin/locale installation function. --- chrome/src/nsChromeRegistry.cpp | 54 +++++++++++++++++++++++++++++ rdf/chrome/src/nsChromeRegistry.cpp | 54 +++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/chrome/src/nsChromeRegistry.cpp b/chrome/src/nsChromeRegistry.cpp index 703c4b36de02..e61ee5f189ae 100644 --- a/chrome/src/nsChromeRegistry.cpp +++ b/chrome/src/nsChromeRegistry.cpp @@ -1269,6 +1269,60 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCAutoString& aProviderTy installContainer->AppendElement(kid); seqKids->HasMoreElements(&moreKids); } + + // See if we're a packages seq. If so, we need to set up the baseURL and + // the package arcs. + if (val.Find(":packages") != -1 && aProviderType != nsCAutoString("package")) { + // Get the literal for our base URL. + nsAutoString unistr(aBaseURL); + nsCOMPtr literal; + mRDFService->GetLiteral(unistr.GetUnicode(), getter_AddRefs(literal)); + + // Iterate over our kids a second time. + nsCOMPtr seqKids; + installContainer->GetElements(getter_AddRefs(seqKids)); + PRBool moreKids; + seqKids->HasMoreElements(&moreKids); + while (moreKids) { + nsCOMPtr supp; + seqKids->GetNext(getter_AddRefs(supp)); + nsCOMPtr entry(do_QueryInterface(supp)); + if (entry) { + nsCOMPtr retVal; + installSource->GetTarget(entry, mBaseURL, PR_TRUE, getter_AddRefs(retVal)); + if (retVal) + installSource->Change(entry, mBaseURL, retVal, literal); + else + installSource->Assert(entry, mBaseURL, literal, PR_TRUE); + + // Now set up the package arc. + const char* val; + entry->GetValueConst(&val); + nsCAutoString value(val); + PRInt32 index = value.RFind(":"); + if (index != -1) { + // Peel off the package name. + nsCAutoString packageName; + value.Right(packageName, value.Length() - index - 1); + + nsCAutoString resourceName = "urn:mozilla:package:"; + resourceName += packageName; + nsCOMPtr packageResource; + GetResource(resourceName, getter_AddRefs(packageResource)); + if (packageResource) { + retVal = nsnull; + installSource->GetTarget(entry, mPackage, PR_TRUE, getter_AddRefs(retVal)); + if (retVal) + installSource->Change(entry, mPackage, retVal, packageResource); + else + installSource->Assert(entry, mPackage, packageResource, PR_TRUE); + } + } + } + + seqKids->HasMoreElements(&moreKids); + } + } } else { // We're not a seq. Get all of the arcs that go out. diff --git a/rdf/chrome/src/nsChromeRegistry.cpp b/rdf/chrome/src/nsChromeRegistry.cpp index 703c4b36de02..e61ee5f189ae 100644 --- a/rdf/chrome/src/nsChromeRegistry.cpp +++ b/rdf/chrome/src/nsChromeRegistry.cpp @@ -1269,6 +1269,60 @@ NS_IMETHODIMP nsChromeRegistry::InstallProvider(const nsCAutoString& aProviderTy installContainer->AppendElement(kid); seqKids->HasMoreElements(&moreKids); } + + // See if we're a packages seq. If so, we need to set up the baseURL and + // the package arcs. + if (val.Find(":packages") != -1 && aProviderType != nsCAutoString("package")) { + // Get the literal for our base URL. + nsAutoString unistr(aBaseURL); + nsCOMPtr literal; + mRDFService->GetLiteral(unistr.GetUnicode(), getter_AddRefs(literal)); + + // Iterate over our kids a second time. + nsCOMPtr seqKids; + installContainer->GetElements(getter_AddRefs(seqKids)); + PRBool moreKids; + seqKids->HasMoreElements(&moreKids); + while (moreKids) { + nsCOMPtr supp; + seqKids->GetNext(getter_AddRefs(supp)); + nsCOMPtr entry(do_QueryInterface(supp)); + if (entry) { + nsCOMPtr retVal; + installSource->GetTarget(entry, mBaseURL, PR_TRUE, getter_AddRefs(retVal)); + if (retVal) + installSource->Change(entry, mBaseURL, retVal, literal); + else + installSource->Assert(entry, mBaseURL, literal, PR_TRUE); + + // Now set up the package arc. + const char* val; + entry->GetValueConst(&val); + nsCAutoString value(val); + PRInt32 index = value.RFind(":"); + if (index != -1) { + // Peel off the package name. + nsCAutoString packageName; + value.Right(packageName, value.Length() - index - 1); + + nsCAutoString resourceName = "urn:mozilla:package:"; + resourceName += packageName; + nsCOMPtr packageResource; + GetResource(resourceName, getter_AddRefs(packageResource)); + if (packageResource) { + retVal = nsnull; + installSource->GetTarget(entry, mPackage, PR_TRUE, getter_AddRefs(retVal)); + if (retVal) + installSource->Change(entry, mPackage, retVal, packageResource); + else + installSource->Assert(entry, mPackage, packageResource, PR_TRUE); + } + } + } + + seqKids->HasMoreElements(&moreKids); + } + } } else { // We're not a seq. Get all of the arcs that go out.