mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Responding to review comments.
This commit is contained in:
parent
3962ffc501
commit
8797f6f3ec
5 changed files with 15 additions and 13 deletions
|
@ -293,7 +293,7 @@ impl<'a> Iterator for FrameTreeIterator<'a> {
|
|||
|
||||
struct WebDriverData {
|
||||
load_channel: Option<(PipelineId, IpcSender<webdriver_msg::LoadStatus>)>,
|
||||
resize_channel: Option<IpcSender<Option<WindowSizeData>>>,
|
||||
resize_channel: Option<IpcSender<WindowSizeData>>,
|
||||
}
|
||||
|
||||
impl WebDriverData {
|
||||
|
@ -1713,7 +1713,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
}
|
||||
|
||||
if let Some(resize_channel) = self.webdriver.resize_channel.take() {
|
||||
let _ = resize_channel.send(Some(new_size));
|
||||
let _ = resize_channel.send(new_size);
|
||||
}
|
||||
|
||||
self.window_size = new_size;
|
||||
|
|
|
@ -193,7 +193,7 @@ pub enum WebDriverCommandMsg {
|
|||
Refresh(PipelineId, IpcSender<LoadStatus>),
|
||||
ScriptCommand(PipelineId, WebDriverScriptCommand),
|
||||
SendKeys(PipelineId, Vec<(Key, KeyModifiers, KeyState)>),
|
||||
SetWindowSize(PipelineId, Size2D<u32>, IpcSender<Option<WindowSizeData>>),
|
||||
SetWindowSize(PipelineId, Size2D<u32>, IpcSender<WindowSizeData>),
|
||||
TakeScreenshot(PipelineId, IpcSender<Option<Image>>),
|
||||
}
|
||||
|
||||
|
|
1
components/servo/Cargo.lock
generated
1
components/servo/Cargo.lock
generated
|
@ -2476,6 +2476,7 @@ name = "webdriver_server"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"compositing 0.0.1",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
|
|
|
@ -223,7 +223,7 @@ impl Handler {
|
|||
constellation_chan: constellation_chan,
|
||||
script_timeout: 30_000,
|
||||
load_timeout: 300_000,
|
||||
resize_timeout: 30_000,
|
||||
resize_timeout: 500,
|
||||
implicit_wait_timeout: 0
|
||||
}
|
||||
}
|
||||
|
@ -379,19 +379,19 @@ impl Handler {
|
|||
self.constellation_chan.send(ConstellationMsg::WebDriverCommand(cmd_msg)).unwrap();
|
||||
|
||||
let timeout = self.resize_timeout;
|
||||
let constellation_chan = self.constellation_chan.clone();
|
||||
thread::spawn(move || {
|
||||
// On timeout, we send a GetWindowSize message to the constellation,
|
||||
// which will give the current window size.
|
||||
thread::sleep(Duration::from_millis(timeout as u64));
|
||||
let _ = sender.send(None);
|
||||
let cmd_msg = WebDriverCommandMsg::GetWindowSize(pipeline_id, sender);
|
||||
constellation_chan.send(ConstellationMsg::WebDriverCommand(cmd_msg)).unwrap();
|
||||
});
|
||||
|
||||
match receiver.recv().unwrap() {
|
||||
Some(window_size) => {
|
||||
let window_size = receiver.recv().unwrap();
|
||||
let vp = window_size.visible_viewport;
|
||||
let window_size_response = WindowSizeResponse::new(vp.width.get() as u64, vp.height.get() as u64);
|
||||
Ok(WebDriverResponse::WindowSize(window_size_response))
|
||||
},
|
||||
None => Err(WebDriverError::new(ErrorStatus::Timeout, "Resize timed out")),
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_is_enabled(&self, element: &WebElement) -> WebDriverResult<WebDriverResponse> {
|
||||
|
|
1
ports/cef/Cargo.lock
generated
1
ports/cef/Cargo.lock
generated
|
@ -2337,6 +2337,7 @@ name = "webdriver_server"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"compositing 0.0.1",
|
||||
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"image 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.2.2 (git+https://github.com/servo/ipc-channel)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue