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

--HG--
extra : commitid : 8Cka7fttIni
extra : rebase_source : 68812fb7445fa19f9d2a0b03386f227233542192
extra : histedit_source : a4aef3fa2f08e06e8564cd8e7f380d5079ab9800
This commit is contained in:
Gijs Kruitbosch 2015-06-01 17:05:39 +01:00
parent fcd0865493
commit 9a5e3280e6
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
},
{