Add enough Webdriver support to enable Get().

This is incomplete in several ways:

* It assumes that there's only one constellation (i.e. top level browsing context), ever.
* The session support is very basic indeed (no capabilities)
* Passing channels over channels may not sit well with IPC
* The error handling is mostly missing
This commit is contained in:
James Graham 2015-04-03 23:23:52 +01:00
parent 7fddf4aa13
commit 009e2baaf0
10 changed files with 164 additions and 18 deletions

View file

@ -31,6 +31,9 @@ path = "../net_traits"
[dependencies.util]
path = "../util"
[dependencies.webdriver_server]
path = "../webdriver_server"
[dependencies.devtools_traits]
path = "../devtools_traits"

View file

@ -32,7 +32,7 @@ use std::collections::HashMap;
use std::io::{self, Write};
use std::marker::PhantomData;
use std::mem::replace;
use std::sync::mpsc::{Receiver, channel};
use std::sync::mpsc::{Sender, Receiver, channel};
use url::Url;
use util::cursor::Cursor;
use util::geometry::PagePx;
@ -383,6 +383,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
subpage_id,
event);
}
ConstellationMsg::GetRootPipeline(resp_chan) => {
debug!("constellation got get root pipeline message");
self.handle_get_root_pipeline(resp_chan);
}
}
true
}
@ -679,6 +683,14 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
pipeline.trigger_mozbrowser_event(subpage_id, event);
}
fn handle_get_root_pipeline(&mut self, resp_chan: Sender<Option<PipelineId>>) {
let pipeline_id = self.root_frame_id.map(|frame_id| {
let frame = self.frames.get(&frame_id).unwrap();
frame.current
});
resp_chan.send(pipeline_id).unwrap();
}
fn add_or_replace_pipeline_in_frame_tree(&mut self, frame_change: FrameChange) {
let evicted_frames = match frame_change.old_pipeline_id {
Some(old_pipeline_id) => {

View file

@ -27,6 +27,7 @@ extern crate net_traits;
#[macro_use]
extern crate util;
extern crate gleam;
extern crate webdriver_server;
extern crate libc;
extern crate time;