From 721693c43eacfb74dc83ef811224339ba1426a90 Mon Sep 17 00:00:00 2001 From: Lars Bergstrom Date: Thu, 7 Jan 2016 07:27:20 -0600 Subject: [PATCH] Remove usage of Gaol in the Windows configuration, since sandboxing is not supported there yet. --- components/compositing/constellation.rs | 4 ++++ components/compositing/lib.rs | 2 ++ components/servo/Cargo.lock | 4 ++-- components/servo/Cargo.toml | 17 ++++++++++++++++- components/servo/lib.rs | 15 ++++++++++++++- ports/gonk/Cargo.lock | 10 +++++----- 6 files changed, 43 insertions(+), 9 deletions(-) diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index b61c0b46c85..62170e3f5d4 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -19,7 +19,9 @@ use compositor_thread::Msg as ToCompositorMsg; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; use euclid::scale_factor::ScaleFactor; use euclid::size::{Size2D, TypedSize2D}; +#[cfg(not(target_os = "windows"))] use gaol; +#[cfg(not(target_os = "windows"))] use gaol::sandbox::{self, Sandbox, SandboxMethods}; use gfx::font_cache_thread::FontCacheThread; use gfx_traits::{Epoch, PaintMsg as FromPaintMsg}; @@ -40,6 +42,7 @@ use offscreen_gl_context::GLContextAttributes; use pipeline::{CompositionPipeline, InitialPipelineState, Pipeline, UnprivilegedPipelineContent}; use profile_traits::mem; use profile_traits::time; +#[cfg(not(target_os = "windows"))] use sandboxing; use script_traits::{AnimationState, CompositorEvent, ConstellationControlMsg}; use script_traits::{DocumentState, LayoutControlMsg}; @@ -282,6 +285,7 @@ enum ExitPipelineMode { } enum ChildProcess { +#[cfg(not(target_os = "windows"))] Sandboxed(gaol::platform::process::Process), Unsandboxed(process::Child), } diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 7e465e8a4d0..bf192bd044a 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -25,6 +25,7 @@ extern crate core_graphics; extern crate core_text; extern crate devtools_traits; extern crate euclid; +#[cfg(not(target_os = "windows"))] extern crate gaol; extern crate gfx; extern crate gfx_traits; @@ -66,6 +67,7 @@ pub mod compositor_thread; pub mod constellation; mod headless; pub mod pipeline; +#[cfg(not(target_os = "windows"))] pub mod sandboxing; mod scrolling; mod surface_map; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 693baf4b409..6b48af743df 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -67,9 +67,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "angle" version = "0.1.0" -source = "git+https://github.com/ecoal95/angle?branch=servo#2c14c35cdc223eb95efcaf6830d339db5b535d76" +source = "git+https://github.com/ecoal95/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" dependencies = [ - "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index f5b121d7741..9803afab38a 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -125,7 +125,22 @@ optional = true version = "0.3" features = ["release_max_level_info"] -[dependencies.gaol] +[target.arm-linux-androideabi.dependencies.gaol] +git = "https://github.com/pcwalton/gaol" + +[target.x86_64-apple-darwin.dependencies.gaol] +git = "https://github.com/pcwalton/gaol" + +[target.x86_64-unknown-linux.dependencies.gaol] +git = "https://github.com/pcwalton/gaol" + +[target.i686-unknown-linux-gnu.dependencies.gaol] +git = "https://github.com/pcwalton/gaol" + +[target.arm-unknown-linux-gnueabihf.dependencies.gaol] +git = "https://github.com/pcwalton/gaol" + +[target.aarch64-unknown-linux-gnueabihf.dependencies.gaol] git = "https://github.com/pcwalton/gaol" [dependencies.ipc-channel] diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 1dc17b0c4e3..6544b69e002 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -17,6 +17,7 @@ //! The `Browser` is fed events from a generic type that implements the //! `WindowMethods` trait. +#[cfg(not(target_os = "windows"))] extern crate gaol; #[macro_use] extern crate util as _util; @@ -60,10 +61,12 @@ use compositing::CompositorMsg as ConstellationMsg; use compositing::compositor_thread::InitialCompositorState; use compositing::constellation::InitialConstellationState; use compositing::pipeline::UnprivilegedPipelineContent; +#[cfg(not(target_os = "windows"))] use compositing::sandboxing; use compositing::windowing::WindowEvent; use compositing::windowing::WindowMethods; use compositing::{CompositorProxy, CompositorThread, Constellation}; +#[cfg(not(target_os = "windows"))] use gaol::sandbox::{ChildSandbox, ChildSandboxMethods}; use gfx::font_cache_thread::FontCacheThread; use ipc_channel::ipc::{self, IpcSender}; @@ -243,7 +246,7 @@ pub fn run_content_process(token: String) { // Enter the sandbox if necessary. if opts::get().sandbox { - ChildSandbox::new(sandboxing::content_process_sandbox_profile()).activate().unwrap(); + create_sandbox(); } script::init(); @@ -261,3 +264,13 @@ pub unsafe extern fn __errno_location() -> *mut i32 { extern { fn __errno() -> *mut i32; } __errno() } + +#[cfg(not(target_os = "windows"))] +fn create_sandbox() { + ChildSandbox::new(sandboxing::content_process_sandbox_profile()).activate().unwrap(); +} + +#[cfg(target_os = "windows")] +fn create_sandbox() { + panic!("Sandboxing is not supported on Windows."); +} diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index a7997e45ef3..07ae4e1df24 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -49,9 +49,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "angle" version = "0.1.0" -source = "git+https://github.com/ecoal95/angle?branch=servo#2c14c35cdc223eb95efcaf6830d339db5b535d76" +source = "git+https://github.com/ecoal95/angle?branch=servo#b31e70ef5cb675582de910d09b0c385ea2000a64" dependencies = [ - "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -231,7 +231,7 @@ dependencies = [ "core-text 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gaol 0.0.1 (git+https://github.com/pcwalton/gaol)", + "gaol 0.0.1 (git+https://github.com/adamncasey/gaol)", "gfx 0.0.1", "gfx_traits 0.0.1", "gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -543,7 +543,7 @@ dependencies = [ [[package]] name = "gaol" version = "0.0.1" -source = "git+https://github.com/pcwalton/gaol#e1349d8d3d933b3a90f9c86baa390261c510e019" +source = "git+https://github.com/adamncasey/gaol#53a1af134df736ea4c980560b3bd52c3471f74e3" dependencies = [ "libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1527,7 +1527,7 @@ dependencies = [ "devtools_traits 0.0.1", "env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gaol 0.0.1 (git+https://github.com/pcwalton/gaol)", + "gaol 0.0.1 (git+https://github.com/adamncasey/gaol)", "gfx 0.0.1", "gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",