зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1644917 - Part 0: Make AddDynamicPathList a static non-member function. r=gcp
Not strictly necessary, but I noticed this while I was making changes: AddDynamicPathList can be a simple static function instead of a private static method, and doesn't need to be in the header. Differential Revision: https://phabricator.services.mozilla.com/D81422
This commit is contained in:
Родитель
c6cbad9a52
Коммит
0808445a13
|
@ -277,6 +277,19 @@ static void AddSharedMemoryPaths(SandboxBroker::Policy* aPolicy, pid_t aPid) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void AddDynamicPathList(SandboxBroker::Policy* policy,
|
||||||
|
const char* aPathListPref, int perms) {
|
||||||
|
nsAutoCString pathList;
|
||||||
|
nsresult rv = Preferences::GetCString(aPathListPref, pathList);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
for (const nsACString& path : pathList.Split(',')) {
|
||||||
|
nsCString trimPath(path);
|
||||||
|
trimPath.Trim(" ", true, true);
|
||||||
|
policy->AddDynamic(perms, trimPath.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SandboxBrokerPolicyFactory::SandboxBrokerPolicyFactory() {
|
SandboxBrokerPolicyFactory::SandboxBrokerPolicyFactory() {
|
||||||
// Policy entries that are the same in every process go here, and
|
// Policy entries that are the same in every process go here, and
|
||||||
// are cached over the lifetime of the factory.
|
// are cached over the lifetime of the factory.
|
||||||
|
@ -652,19 +665,6 @@ UniquePtr<SandboxBroker::Policy> SandboxBrokerPolicyFactory::GetContentPolicy(
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SandboxBrokerPolicyFactory::AddDynamicPathList(
|
|
||||||
SandboxBroker::Policy* policy, const char* aPathListPref, int perms) {
|
|
||||||
nsAutoCString pathList;
|
|
||||||
nsresult rv = Preferences::GetCString(aPathListPref, pathList);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
for (const nsACString& path : pathList.Split(',')) {
|
|
||||||
nsCString trimPath(path);
|
|
||||||
trimPath.Trim(" ", true, true);
|
|
||||||
policy->AddDynamic(perms, trimPath.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ UniquePtr<SandboxBroker::Policy>
|
/* static */ UniquePtr<SandboxBroker::Policy>
|
||||||
SandboxBrokerPolicyFactory::GetUtilityPolicy(int aPid) {
|
SandboxBrokerPolicyFactory::GetUtilityPolicy(int aPid) {
|
||||||
auto policy = MakeUnique<SandboxBroker::Policy>();
|
auto policy = MakeUnique<SandboxBroker::Policy>();
|
||||||
|
|
|
@ -23,8 +23,6 @@ class SandboxBrokerPolicyFactory {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UniquePtr<const SandboxBroker::Policy> mCommonContentPolicy;
|
UniquePtr<const SandboxBroker::Policy> mCommonContentPolicy;
|
||||||
static void AddDynamicPathList(SandboxBroker::Policy* policy,
|
|
||||||
const char* aPathListPref, int perms);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
Загрузка…
Ссылка в новой задаче