mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
delegate resource reading to embedder
This commit is contained in:
parent
21517504cb
commit
9fb5795f37
52 changed files with 472 additions and 396 deletions
|
@ -19,6 +19,7 @@ compositing = {path = "../compositing"}
|
|||
debugger = {path = "../debugger"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
euclid = "0.17"
|
||||
embedder_traits = { path = "../embedder_traits" }
|
||||
gfx = {path = "../gfx"}
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
hyper = "0.10"
|
||||
|
|
|
@ -14,6 +14,8 @@ extern crate clipboard;
|
|||
extern crate compositing;
|
||||
extern crate debugger;
|
||||
extern crate devtools_traits;
|
||||
#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))]
|
||||
extern crate embedder_traits;
|
||||
extern crate euclid;
|
||||
#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))]
|
||||
extern crate gaol;
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use embedder_traits::resources;
|
||||
use gaol::profile::{Operation, PathPattern, Profile};
|
||||
use servo_config::resource_files;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Our content process sandbox profile on Mac. As restrictive as possible.
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn content_process_sandbox_profile() -> Profile {
|
||||
use gaol::platform;
|
||||
Profile::new(vec![
|
||||
|
||||
let mut operations = vec![
|
||||
Operation::FileReadAll(PathPattern::Literal(PathBuf::from("/dev/urandom"))),
|
||||
Operation::FileReadAll(PathPattern::Subpath(resource_files::resources_dir_path()
|
||||
.expect("Cannot find resource dir"))),
|
||||
Operation::FileReadAll(PathPattern::Subpath(PathBuf::from("/Library/Fonts"))),
|
||||
Operation::FileReadAll(PathPattern::Subpath(PathBuf::from("/System/Library/Fonts"))),
|
||||
Operation::FileReadAll(PathPattern::Subpath(PathBuf::from(
|
||||
|
@ -27,16 +26,32 @@ pub fn content_process_sandbox_profile() -> Profile {
|
|||
Operation::SystemInfoRead,
|
||||
Operation::PlatformSpecific(platform::macos::Operation::MachLookup(
|
||||
b"com.apple.FontServer".to_vec())),
|
||||
]).expect("Failed to create sandbox profile!")
|
||||
];
|
||||
|
||||
operations.extend(resources::sandbox_access_files().into_iter().map(|p| {
|
||||
Operation::FileReadAll(PathPattern::Literal(p))
|
||||
}));
|
||||
operations.extend(resources::sandbox_access_files_dirs().into_iter().map(|p| {
|
||||
Operation::FileReadAll(PathPattern::Subpath(p))
|
||||
}));
|
||||
|
||||
Profile::new(operations).expect("Failed to create sandbox profile!")
|
||||
}
|
||||
|
||||
/// Our content process sandbox profile on Linux. As restrictive as possible.
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
pub fn content_process_sandbox_profile() -> Profile {
|
||||
Profile::new(vec![
|
||||
let mut operations = vec![
|
||||
Operation::FileReadAll(PathPattern::Literal(PathBuf::from("/dev/urandom"))),
|
||||
Operation::FileReadAll(PathPattern::Subpath(resource_files::resources_dir_path()
|
||||
.expect("Cannot find resource dir"))),
|
||||
]).expect("Failed to create sandbox profile!")
|
||||
];
|
||||
|
||||
operations.extend(resources::sandbox_access_files().into_iter().map(|p| {
|
||||
Operation::FileReadAll(PathPattern::Literal(p))
|
||||
}));
|
||||
operations.extend(resources::sandbox_access_files_dirs().into_iter().map(|p| {
|
||||
Operation::FileReadAll(PathPattern::Subpath(p))
|
||||
}));
|
||||
|
||||
Profile::new(operations).expect("Failed to create sandbox profile!")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue