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

@ -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<bool>) {
if let Err(e) = response_chan.send(true) {
warn!("Failed to send allow_navigation() response: {}", e);
};
}
fn supports_clipboard(&self) -> bool {

View file

@ -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"}

View file

@ -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;

View file

@ -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<bool>) {
if let Err(e) = response_chan.send(true) {
warn!("Failed to send allow_navigation() response: {}", e);
};
}
fn supports_clipboard(&self) -> bool {