From 1a447c6984707c655a130461f910be9b95765daf Mon Sep 17 00:00:00 2001 From: Jonathan Jayet Date: Tue, 22 Aug 2017 16:30:32 +0200 Subject: [PATCH] First step toward iOS Support --- components/constellation/Cargo.toml | 2 +- components/constellation/lib.rs | 6 +++--- components/constellation/pipeline.rs | 6 +++--- components/script/Cargo.toml | 4 +++- components/script/dom/navigatorinfo.rs | 5 +++++ components/servo/Cargo.toml | 2 +- components/servo/lib.rs | 12 ++++++------ 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index f2ab08dc190..2d659bd4342 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -41,5 +41,5 @@ servo_url = {path = "../url"} webvr_traits = {path = "../webvr_traits"} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} -[target.'cfg(not(target_os = "windows"))'.dependencies] +[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios")))'.dependencies] gaol = {git = "https://github.com/servo/gaol"} diff --git a/components/constellation/lib.rs b/components/constellation/lib.rs index 1c444ff6603..48365cdef70 100644 --- a/components/constellation/lib.rs +++ b/components/constellation/lib.rs @@ -16,7 +16,7 @@ extern crate compositing; extern crate debugger; extern crate devtools_traits; extern crate euclid; -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] extern crate gaol; extern crate gfx; extern crate gfx_traits; @@ -46,11 +46,11 @@ mod constellation; mod event_loop; mod network_listener; mod pipeline; -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] mod sandboxing; mod timer_scheduler; pub use constellation::{Constellation, FromCompositorLogger, FromScriptLogger, InitialConstellationState}; pub use pipeline::UnprivilegedPipelineContent; -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] pub use sandboxing::content_process_sandbox_profile; diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 74ce33ff564..fb01df58af7 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -535,7 +535,7 @@ impl UnprivilegedPipelineContent { } } - #[cfg(not(target_os = "windows"))] + #[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] pub fn spawn_multiprocess(self) -> Result<(), Error> { use gaol::sandbox::{self, Sandbox, SandboxMethods}; use ipc_channel::ipc::IpcOneShotServer; @@ -583,9 +583,9 @@ impl UnprivilegedPipelineContent { Ok(()) } - #[cfg(target_os = "windows")] + #[cfg(any(target_os = "windows", target_os = "ios"))] pub fn spawn_multiprocess(self) -> Result<(), Error> { - error!("Multiprocess is not supported on Windows."); + error!("Multiprocess is not supported on Windows or iOS."); process::exit(1); } diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 7ab24e6b611..60f723055ff 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -24,7 +24,6 @@ serde_json = "1.0" tinyfiledialogs = "2.5.9" [dependencies] -angle = {git = "https://github.com/servo/angle", branch = "servo"} app_units = "0.5" audio-video-metadata = "0.1.2" base64 = "0.5.2" @@ -94,3 +93,6 @@ xml5ever = {version = "0.9"} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} webvr = {path = "../webvr"} webvr_traits = {path = "../webvr_traits"} + +[target.'cfg(not(target_os = "ios"))'.dependencies] +angle = {git = "https://github.com/servo/angle", branch = "servo"} diff --git a/components/script/dom/navigatorinfo.rs b/components/script/dom/navigatorinfo.rs index f0b331c49e6..fb356623db4 100644 --- a/components/script/dom/navigatorinfo.rs +++ b/components/script/dom/navigatorinfo.rs @@ -36,6 +36,11 @@ pub fn Platform() -> DOMString { DOMString::from("Mac") } +#[cfg(target_os = "ios")] +pub fn Platform() -> DOMString { + DOMString::from("iOS") +} + pub fn UserAgent() -> DOMString { DOMString::from(&*opts::get().user_agent) } diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index e4f64ed88d6..67c02538543 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -54,5 +54,5 @@ webdriver_server = {path = "../webdriver_server", optional = true} webvr = {path = "../webvr"} webvr_traits = {path = "../webvr_traits"} -[target.'cfg(not(target_os = "windows"))'.dependencies] +[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios")))'.dependencies] gaol = {git = "https://github.com/servo/gaol"} diff --git a/components/servo/lib.rs b/components/servo/lib.rs index af5b2ff0972..65244d68b2d 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -18,7 +18,7 @@ //! `WindowMethods` trait. extern crate env_logger; -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] extern crate gaol; extern crate gleam; extern crate log; @@ -76,10 +76,10 @@ use compositing::windowing::WindowEvent; use compositing::windowing::WindowMethods; use constellation::{Constellation, InitialConstellationState, UnprivilegedPipelineContent}; use constellation::{FromCompositorLogger, FromScriptLogger}; -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] use constellation::content_process_sandbox_profile; use env_logger::Logger as EnvLogger; -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] use gaol::sandbox::{ChildSandbox, ChildSandboxMethods}; use gfx::font_cache_thread::FontCacheThread; use ipc_channel::ipc::{self, IpcSender}; @@ -433,13 +433,13 @@ pub unsafe extern fn __errno_location() -> *mut i32 { __errno() } -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] fn create_sandbox() { ChildSandbox::new(content_process_sandbox_profile()).activate() .expect("Failed to activate sandbox!"); } -#[cfg(target_os = "windows")] +#[cfg(any(target_os = "windows", target_os = "ios"))] fn create_sandbox() { - panic!("Sandboxing is not supported on Windows."); + panic!("Sandboxing is not supported on Windows or iOS."); }