mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
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:
parent
3bb4b07de7
commit
394a8fe8c0
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user