Bug 1170207 - allow overrides of chrome://../skin/ URIs with other chrome://../skin/ URIs within skin manifests, r=bsmedberg

This commit is contained in:
Gijs Kruitbosch 2015-06-01 17:05:39 +01:00
parent 8e85bbdf4a
commit ad6bd576e5
2 changed files with 26 additions and 1 deletions

View File

@ -947,6 +947,29 @@ nsChromeRegistryChrome::ManifestOverride(ManifestProcessingContext& cx, int line
return;
}
if (cx.mType == NS_SKIN_LOCATION) {
bool chromeSkinOnly = false;
nsresult rv = chromeuri->SchemeIs("chrome", &chromeSkinOnly);
chromeSkinOnly = chromeSkinOnly && NS_SUCCEEDED(rv);
if (chromeSkinOnly) {
rv = resolveduri->SchemeIs("chrome", &chromeSkinOnly);
chromeSkinOnly = chromeSkinOnly && NS_SUCCEEDED(rv);
}
if (chromeSkinOnly) {
nsAutoCString chromePath, resolvedPath;
chromeuri->GetPath(chromePath);
resolveduri->GetPath(resolvedPath);
chromeSkinOnly = StringBeginsWith(chromePath, NS_LITERAL_CSTRING("/skin/")) &&
StringBeginsWith(resolvedPath, NS_LITERAL_CSTRING("/skin/"));
}
if (!chromeSkinOnly) {
LogMessageWithContext(cx.GetManifestURI(), lineno, nsIScriptError::warningFlag,
"Cannot register non-chrome://.../skin/ URIs '%s' and '%s' as overrides and/or to be overridden from a skin manifest.",
chrome, resolved);
return;
}
}
if (!CanLoadResource(resolveduri)) {
LogMessageWithContext(cx.GetManifestURI(), lineno, nsIScriptError::warningFlag,
"Cannot register non-local URI '%s' for an override.", resolved);

View File

@ -135,7 +135,9 @@ static const ManifestDirective kParsingTable[] = {
nullptr, &nsChromeRegistry::ManifestStyle, nullptr
},
{
"override", 2, false, true, true, true, false,
// NB: note that while skin manifests can use this, they are only allowed
// to use it for chrome://../skin/ URLs
"override", 2, false, false, true, true, false,
nullptr, &nsChromeRegistry::ManifestOverride, nullptr
},
{