Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow_navigation: use channel to send response #17684

Merged
merged 1 commit into from Jul 17, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Some generated files are not rendered by default. Learn more.

@@ -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) => {
@@ -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.
@@ -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 {
@@ -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"}
@@ -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;
@@ -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 {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.