Bug 1384483 - Allow reading userContent.css in the sandbox. r=jld

MozReview-Commit-ID: A43RY1J95VF

--HG--
extra : rebase_source : 0c8355b34e79d8b0f4ec744a6f2b8b4414e0ab5c
extra : histedit_source : 6ddf29193d5a8b26e50a6a5b8e885caeff366033
This commit is contained in:
Gian-Carlo Pascutto 2017-07-31 17:58:19 +02:00
parent 91ca7a8cc8
commit 0d8bd27705

View File

@ -250,6 +250,25 @@ SandboxBrokerPolicyFactory::GetContentPolicy(int aPid, bool aFileProcess)
policy->AddDir(rdonly, "/");
}
// userContent.css sits in the profile, which is normally blocked
// and we can't get the profile dir earlier
nsCOMPtr<nsIFile> profileDir;
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
getter_AddRefs(profileDir));
if (NS_SUCCEEDED(rv)) {
rv = profileDir->AppendNative(NS_LITERAL_CSTRING("chrome"));
if (NS_SUCCEEDED(rv)) {
rv = profileDir->AppendNative(NS_LITERAL_CSTRING("userContent.css"));
if (NS_SUCCEEDED(rv)) {
nsAutoCString tmpPath;
rv = profileDir->GetNativePath(tmpPath);
if (NS_SUCCEEDED(rv)) {
policy->AddPath(rdonly, tmpPath.get());
}
}
}
}
// Return the common policy.
return policy;