allow_navigation: use channel to send response

This commit is contained in:
Paul Rouget 2017-06-26 08:13:10 +02:00
parent d8ba8cad58
commit cd3172c913
7 changed files with 16 additions and 9 deletions

View file

@ -509,10 +509,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
(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) => {

View file

@ -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<bool>);
/// Called when the <head> tag has finished parsing
fn head_parsed(&self);
/// Called when the history state has changed.