make ConvertChromeURL return an error code when it cannot successfully convert a chrome URL rather than build a "wacky default" - remove some cruft too

This commit is contained in:
ben%bengoodger.com 2004-04-30 01:46:02 +00:00
parent 3bb4b07de7
commit 394a8fe8c0
2 changed files with 5 additions and 26 deletions

View File

@ -696,7 +696,7 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
}
nsCAutoString spec;
rv = reg->ConvertChromeURL(aURI, spec);
reg->ConvertChromeURL(aURI, spec);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIIOService> ioServ(do_GetService(kIOServiceCID, &rv));

View File

@ -517,43 +517,22 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, nsACString& aResult)
return NS_OK;
rv = GetBaseURL(package, provider, finalURL);
#ifdef DEBUG
if (NS_FAILED(rv)) {
#ifdef DEBUG
nsCAutoString msg("chrome: failed to get base url");
nsCAutoString url;
rv = aChromeURL->GetSpec(url);
if (NS_SUCCEEDED(rv)) {
nsresult rv2 = aChromeURL->GetSpec(url);
if (NS_SUCCEEDED(rv2)) {
msg += " for ";
msg += url.get();
}
msg += " -- using wacky default";
NS_WARNING(msg.get());
}
#endif
if (finalURL.IsEmpty()) {
// hard-coded fallback
if (provider.Equals("skin")) {
finalURL = "resource:/chrome/skins/classic/";
}
else if (provider.Equals("locale")) {
finalURL = "resource:/chrome/locales/en-US/";
}
else if (package.Equals("aim")) {
finalURL = "resource:/chrome/packages/aim/";
}
else if (package.Equals("messenger")) {
finalURL = "resource:/chrome/packages/messenger/";
}
else if (package.Equals("global")) {
finalURL = "resource:/chrome/packages/widget-toolkit/";
}
else {
finalURL = "resource:/chrome/packages/core/";
}
return rv;
}
aResult = finalURL + remaining;
return NS_OK;
}