Move sandboxing into the constellation crate.

This commit is contained in:
Ms2ger 2016-05-20 18:05:07 +02:00
parent f1efeb00af
commit 38d96c9564
9 changed files with 10 additions and 16 deletions

View file

@ -33,6 +33,3 @@ serde = "0.7"
serde_macros = "0.7" serde_macros = "0.7"
time = "0.1.17" time = "0.1.17"
url = {version = "1.0.0", features = ["heap_size"]} url = {version = "1.0.0", features = ["heap_size"]}
[target.'cfg(not(target_os = "windows"))'.dependencies]
gaol = {git = "https://github.com/servo/gaol"}

View file

@ -15,8 +15,6 @@ extern crate app_units;
extern crate azure; extern crate azure;
extern crate euclid; extern crate euclid;
#[cfg(not(target_os = "windows"))]
extern crate gaol;
extern crate gfx; extern crate gfx;
extern crate gfx_traits; extern crate gfx_traits;
extern crate gleam; extern crate gleam;
@ -59,8 +57,6 @@ mod compositor;
mod compositor_layer; mod compositor_layer;
pub mod compositor_thread; pub mod compositor_thread;
mod delayed_composition; mod delayed_composition;
#[cfg(not(target_os = "windows"))]
pub mod sandboxing;
mod surface_map; mod surface_map;
mod touch; mod touch;
pub mod windowing; pub mod windowing;

View file

@ -16,8 +16,6 @@ use clipboard::ClipboardContext;
use compositing::CompositorMsg as FromCompositorMsg; use compositing::CompositorMsg as FromCompositorMsg;
use compositing::compositor_thread::CompositorProxy; use compositing::compositor_thread::CompositorProxy;
use compositing::compositor_thread::Msg as ToCompositorMsg; use compositing::compositor_thread::Msg as ToCompositorMsg;
#[cfg(not(target_os = "windows"))]
use compositing::sandboxing;
use compositing::{AnimationTickType, SendableFrameTree}; use compositing::{AnimationTickType, SendableFrameTree};
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use euclid::scale_factor::ScaleFactor; use euclid::scale_factor::ScaleFactor;
@ -49,6 +47,8 @@ use pipeline::{InitialPipelineState, Pipeline, UnprivilegedPipelineContent};
use profile_traits::mem; use profile_traits::mem;
use profile_traits::time; use profile_traits::time;
use rand::{random, Rng, SeedableRng, StdRng}; use rand::{random, Rng, SeedableRng, StdRng};
#[cfg(not(target_os = "windows"))]
use sandboxing::content_process_sandbox_profile;
use script_traits::{AnimationState, CompositorEvent, ConstellationControlMsg}; use script_traits::{AnimationState, CompositorEvent, ConstellationControlMsg};
use script_traits::{DocumentState, LayoutControlMsg}; use script_traits::{DocumentState, LayoutControlMsg};
use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest}; use script_traits::{IFrameLoadInfo, IFrameSandboxState, TimerEventRequest};
@ -482,7 +482,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
command.env("RUST_BACKTRACE", value); command.env("RUST_BACKTRACE", value);
} }
let profile = sandboxing::content_process_sandbox_profile(); let profile = content_process_sandbox_profile();
ChildProcess::Sandboxed(Sandbox::new(profile).start(&mut command) ChildProcess::Sandboxed(Sandbox::new(profile).start(&mut command)
.expect("Failed to start sandboxed child process!")) .expect("Failed to start sandboxed child process!"))
} else { } else {

View file

@ -43,7 +43,11 @@ extern crate webrender_traits;
mod constellation; mod constellation;
mod pipeline; mod pipeline;
#[cfg(not(target_os = "windows"))]
mod sandboxing;
mod timer_scheduler; mod timer_scheduler;
pub use constellation::{Constellation, InitialConstellationState}; pub use constellation::{Constellation, InitialConstellationState};
pub use pipeline::UnprivilegedPipelineContent; pub use pipeline::UnprivilegedPipelineContent;
#[cfg(not(target_os = "windows"))]
pub use sandboxing::content_process_sandbox_profile;

View file

@ -309,7 +309,6 @@ dependencies = [
"app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"azure 0.4.5 (git+https://github.com/servo/rust-azure)", "azure 0.4.5 (git+https://github.com/servo/rust-azure)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gaol 0.0.1 (git+https://github.com/servo/gaol)",
"gfx 0.0.1", "gfx 0.0.1",
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"gleam 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -60,11 +60,11 @@ fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) { }
use compositing::CompositorEventListener; use compositing::CompositorEventListener;
use compositing::CompositorMsg as ConstellationMsg; use compositing::CompositorMsg as ConstellationMsg;
use compositing::compositor_thread::InitialCompositorState; use compositing::compositor_thread::InitialCompositorState;
#[cfg(not(target_os = "windows"))]
use compositing::sandboxing;
use compositing::windowing::WindowEvent; use compositing::windowing::WindowEvent;
use compositing::windowing::WindowMethods; use compositing::windowing::WindowMethods;
use compositing::{CompositorProxy, CompositorThread}; use compositing::{CompositorProxy, CompositorThread};
#[cfg(not(target_os = "windows"))]
use constellation::content_process_sandbox_profile;
use constellation::{Constellation, InitialConstellationState, UnprivilegedPipelineContent}; use constellation::{Constellation, InitialConstellationState, UnprivilegedPipelineContent};
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
use gaol::sandbox::{ChildSandbox, ChildSandboxMethods}; use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
@ -280,7 +280,7 @@ pub unsafe extern fn __errno_location() -> *mut i32 {
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
fn create_sandbox() { fn create_sandbox() {
ChildSandbox::new(sandboxing::content_process_sandbox_profile()).activate() ChildSandbox::new(content_process_sandbox_profile()).activate()
.expect("Failed to activate sandbox!"); .expect("Failed to activate sandbox!");
} }

1
ports/cef/Cargo.lock generated
View file

@ -271,7 +271,6 @@ dependencies = [
"app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"azure 0.4.5 (git+https://github.com/servo/rust-azure)", "azure 0.4.5 (git+https://github.com/servo/rust-azure)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gaol 0.0.1 (git+https://github.com/servo/gaol)",
"gfx 0.0.1", "gfx 0.0.1",
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"gleam 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",

1
ports/gonk/Cargo.lock generated
View file

@ -273,7 +273,6 @@ dependencies = [
"app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"azure 0.4.5 (git+https://github.com/servo/rust-azure)", "azure 0.4.5 (git+https://github.com/servo/rust-azure)",
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gaol 0.0.1 (git+https://github.com/servo/gaol)",
"gfx 0.0.1", "gfx 0.0.1",
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"gleam 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",