зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #17684 - allow_navigation: use channel to send response (from paulrouget:fix_allow_navigation); r=paulrouget
From the embedder perspective, this makes things easier in term of synchronicity. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 495faf3201141980acbf16c186252fa96d1cc3ea --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : c2b9931907dc844793413bdef7e052e0f23bc906
This commit is contained in:
Родитель
3c2e8f57fc
Коммит
2523a012c0
|
@ -1141,6 +1141,7 @@ dependencies = [
|
||||||
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"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)",
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net_traits 0.0.1",
|
"net_traits 0.0.1",
|
||||||
|
|
|
@ -509,10 +509,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::AllowNavigation(url, response_chan), ShutdownState::NotShuttingDown) => {
|
(Msg::AllowNavigation(url, response_chan), ShutdownState::NotShuttingDown) => {
|
||||||
let allow = self.window.allow_navigation(url);
|
self.window.allow_navigation(url, response_chan);
|
||||||
if let Err(e) = response_chan.send(allow) {
|
|
||||||
warn!("Failed to send allow_navigation result ({}).", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::Recomposite(reason), ShutdownState::NotShuttingDown) => {
|
(Msg::Recomposite(reason), ShutdownState::NotShuttingDown) => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ use compositor_thread::EventLoopWaker;
|
||||||
use euclid::{Point2D, Size2D};
|
use euclid::{Point2D, Size2D};
|
||||||
use euclid::{TypedPoint2D, TypedRect, ScaleFactor, TypedSize2D};
|
use euclid::{TypedPoint2D, TypedRect, ScaleFactor, TypedSize2D};
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
|
use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, TraversalDirection};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState, TraversalDirection};
|
||||||
use net_traits::net_error_list::NetError;
|
use net_traits::net_error_list::NetError;
|
||||||
use script_traits::{DevicePixel, LoadData, MouseButton, TouchEventType, TouchId, TouchpadPressurePhase};
|
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
|
/// Called when the browser encounters an error while loading a URL
|
||||||
fn load_error(&self, code: NetError, url: String);
|
fn load_error(&self, code: NetError, url: String);
|
||||||
/// Wether or not to follow a link
|
/// 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
|
/// Called when the <head> tag has finished parsing
|
||||||
fn head_parsed(&self);
|
fn head_parsed(&self);
|
||||||
/// Called when the history state has changed.
|
/// Called when the history state has changed.
|
||||||
|
|
|
@ -24,6 +24,7 @@ use gleam::gl;
|
||||||
use msg::constellation_msg::{Key, KeyModifiers};
|
use msg::constellation_msg::{Key, KeyModifiers};
|
||||||
use net_traits::net_error_list::NetError;
|
use net_traits::net_error_list::NetError;
|
||||||
use script_traits::{DevicePixel, LoadData};
|
use script_traits::{DevicePixel, LoadData};
|
||||||
|
use servo::ipc_channel::ipc::IpcSender;
|
||||||
use servo_geometry::DeviceIndependentPixel;
|
use servo_geometry::DeviceIndependentPixel;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
@ -489,8 +490,10 @@ impl WindowMethods for Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn allow_navigation(&self, _: ServoUrl) -> bool {
|
fn allow_navigation(&self, _: ServoUrl, response_chan: IpcSender<bool>) {
|
||||||
true
|
if let Err(e) = response_chan.send(true) {
|
||||||
|
warn!("Failed to send allow_navigation() response: {}", e);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn supports_clipboard(&self) -> bool {
|
fn supports_clipboard(&self) -> bool {
|
||||||
|
|
|
@ -13,6 +13,7 @@ bitflags = "0.7"
|
||||||
compositing = {path = "../../components/compositing"}
|
compositing = {path = "../../components/compositing"}
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
gleam = "0.4"
|
gleam = "0.4"
|
||||||
|
libservo = {path = "../../components/servo"}
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
msg = {path = "../../components/msg"}
|
msg = {path = "../../components/msg"}
|
||||||
net_traits = {path = "../../components/net_traits"}
|
net_traits = {path = "../../components/net_traits"}
|
||||||
|
|
|
@ -17,6 +17,7 @@ extern crate msg;
|
||||||
extern crate net_traits;
|
extern crate net_traits;
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))] extern crate osmesa_sys;
|
#[cfg(any(target_os = "linux", target_os = "macos"))] extern crate osmesa_sys;
|
||||||
extern crate script_traits;
|
extern crate script_traits;
|
||||||
|
extern crate servo;
|
||||||
extern crate servo_config;
|
extern crate servo_config;
|
||||||
extern crate servo_geometry;
|
extern crate servo_geometry;
|
||||||
extern crate servo_url;
|
extern crate servo_url;
|
||||||
|
|
|
@ -25,6 +25,7 @@ use net_traits::net_error_list::NetError;
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
use osmesa_sys;
|
use osmesa_sys;
|
||||||
use script_traits::{DevicePixel, LoadData, TouchEventType, TouchpadPressurePhase};
|
use script_traits::{DevicePixel, LoadData, TouchEventType, TouchpadPressurePhase};
|
||||||
|
use servo::ipc_channel::ipc::IpcSender;
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use servo_config::prefs::PREFS;
|
use servo_config::prefs::PREFS;
|
||||||
use servo_config::resource_files;
|
use servo_config::resource_files;
|
||||||
|
@ -1300,8 +1301,10 @@ impl WindowMethods for Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn allow_navigation(&self, _: ServoUrl) -> bool {
|
fn allow_navigation(&self, _: ServoUrl, response_chan: IpcSender<bool>) {
|
||||||
true
|
if let Err(e) = response_chan.send(true) {
|
||||||
|
warn!("Failed to send allow_navigation() response: {}", e);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn supports_clipboard(&self) -> bool {
|
fn supports_clipboard(&self) -> bool {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче