diff --git a/servo/Cargo.lock b/servo/Cargo.lock index 48a6e4354562..8f70f7e6aa85 100644 --- a/servo/Cargo.lock +++ b/servo/Cargo.lock @@ -1141,6 +1141,7 @@ dependencies = [ "euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libservo 0.0.1", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", diff --git a/servo/components/compositing/compositor.rs b/servo/components/compositing/compositor.rs index 707ccf830164..93431755a4d8 100644 --- a/servo/components/compositing/compositor.rs +++ b/servo/components/compositing/compositor.rs @@ -509,10 +509,7 @@ impl IOCompositor { } (Msg::AllowNavigation(url, response_chan), ShutdownState::NotShuttingDown) => { - let allow = self.window.allow_navigation(url); - if let Err(e) = response_chan.send(allow) { - warn!("Failed to send allow_navigation result ({}).", e); - } + self.window.allow_navigation(url, response_chan); } (Msg::Recomposite(reason), ShutdownState::NotShuttingDown) => { diff --git a/servo/components/compositing/windowing.rs b/servo/components/compositing/windowing.rs index 8e728d220846..8604b41de465 100644 --- a/servo/components/compositing/windowing.rs +++ b/servo/components/compositing/windowing.rs @@ -8,6 +8,7 @@ use compositor_thread::EventLoopWaker; use euclid::{Point2D, Size2D}; use euclid::{TypedPoint2D, TypedRect, ScaleFactor, TypedSize2D}; use gleam::gl; +use ipc_channel::ipc::IpcSender; use msg::constellation_msg::{Key, KeyModifiers, KeyState, TraversalDirection}; use net_traits::net_error_list::NetError; use script_traits::{DevicePixel, LoadData, MouseButton, TouchEventType, TouchId, TouchpadPressurePhase}; @@ -131,7 +132,7 @@ pub trait WindowMethods { /// Called when the browser encounters an error while loading a URL fn load_error(&self, code: NetError, url: String); /// Wether or not to follow a link - fn allow_navigation(&self, url: ServoUrl) -> bool; + fn allow_navigation(&self, url: ServoUrl, IpcSender); /// Called when the tag has finished parsing fn head_parsed(&self); /// Called when the history state has changed. diff --git a/servo/ports/cef/window.rs b/servo/ports/cef/window.rs index 4f4837e0a41e..f38a7c11a740 100644 --- a/servo/ports/cef/window.rs +++ b/servo/ports/cef/window.rs @@ -24,6 +24,7 @@ use gleam::gl; use msg::constellation_msg::{Key, KeyModifiers}; use net_traits::net_error_list::NetError; use script_traits::{DevicePixel, LoadData}; +use servo::ipc_channel::ipc::IpcSender; use servo_geometry::DeviceIndependentPixel; use std::cell::RefCell; use std::ffi::CString; @@ -489,8 +490,10 @@ impl WindowMethods for Window { } } - fn allow_navigation(&self, _: ServoUrl) -> bool { - true + fn allow_navigation(&self, _: ServoUrl, response_chan: IpcSender) { + if let Err(e) = response_chan.send(true) { + warn!("Failed to send allow_navigation() response: {}", e); + }; } fn supports_clipboard(&self) -> bool { diff --git a/servo/ports/glutin/Cargo.toml b/servo/ports/glutin/Cargo.toml index 7a4e746915f2..b53ea7db4a0c 100644 --- a/servo/ports/glutin/Cargo.toml +++ b/servo/ports/glutin/Cargo.toml @@ -13,6 +13,7 @@ bitflags = "0.7" compositing = {path = "../../components/compositing"} euclid = "0.15" gleam = "0.4" +libservo = {path = "../../components/servo"} log = "0.3.5" msg = {path = "../../components/msg"} net_traits = {path = "../../components/net_traits"} diff --git a/servo/ports/glutin/lib.rs b/servo/ports/glutin/lib.rs index 025572e65a11..0426d2ba4d60 100644 --- a/servo/ports/glutin/lib.rs +++ b/servo/ports/glutin/lib.rs @@ -17,6 +17,7 @@ extern crate msg; extern crate net_traits; #[cfg(any(target_os = "linux", target_os = "macos"))] extern crate osmesa_sys; extern crate script_traits; +extern crate servo; extern crate servo_config; extern crate servo_geometry; extern crate servo_url; diff --git a/servo/ports/glutin/window.rs b/servo/ports/glutin/window.rs index 6488a48164f9..b35b7d5f3c04 100644 --- a/servo/ports/glutin/window.rs +++ b/servo/ports/glutin/window.rs @@ -25,6 +25,7 @@ use net_traits::net_error_list::NetError; #[cfg(any(target_os = "linux", target_os = "macos"))] use osmesa_sys; use script_traits::{DevicePixel, LoadData, TouchEventType, TouchpadPressurePhase}; +use servo::ipc_channel::ipc::IpcSender; use servo_config::opts; use servo_config::prefs::PREFS; use servo_config::resource_files; @@ -1300,8 +1301,10 @@ impl WindowMethods for Window { } } - fn allow_navigation(&self, _: ServoUrl) -> bool { - true + fn allow_navigation(&self, _: ServoUrl, response_chan: IpcSender) { + if let Err(e) = response_chan.send(true) { + warn!("Failed to send allow_navigation() response: {}", e); + }; } fn supports_clipboard(&self) -> bool {