mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Remove webdriver use of SubpageId
This commit is contained in:
parent
bc58cd2de0
commit
ed72e5766b
5 changed files with 13 additions and 15 deletions
|
@ -475,9 +475,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
debug!("constellation got get root pipeline message");
|
debug!("constellation got get root pipeline message");
|
||||||
self.handle_get_pipeline(frame_id, resp_chan);
|
self.handle_get_pipeline(frame_id, resp_chan);
|
||||||
}
|
}
|
||||||
ConstellationMsg::GetFrame(parent_pipeline_id, subpage_id, resp_chan) => {
|
ConstellationMsg::GetFrame(pipeline_id, resp_chan) => {
|
||||||
debug!("constellation got get root pipeline message");
|
debug!("constellation got get root pipeline message");
|
||||||
self.handle_get_frame(parent_pipeline_id, subpage_id, resp_chan);
|
self.handle_get_frame(pipeline_id, resp_chan);
|
||||||
}
|
}
|
||||||
ConstellationMsg::Focus(pipeline_id) => {
|
ConstellationMsg::Focus(pipeline_id) => {
|
||||||
debug!("constellation got focus message");
|
debug!("constellation got focus message");
|
||||||
|
@ -919,11 +919,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_get_frame(&mut self,
|
fn handle_get_frame(&mut self,
|
||||||
containing_pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
subpage_id: SubpageId,
|
|
||||||
resp_chan: IpcSender<Option<FrameId>>) {
|
resp_chan: IpcSender<Option<FrameId>>) {
|
||||||
let frame_id = self.subpage_map.get(&(containing_pipeline_id, subpage_id)).and_then(
|
let frame_id = self.pipeline_to_frame_map.get(&pipeline_id).map(|x| *x);
|
||||||
|x| self.pipeline_to_frame_map.get(&x)).map(|x| *x);
|
|
||||||
resp_chan.send(frame_id).unwrap();
|
resp_chan.send(frame_id).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,8 +260,8 @@ pub enum Msg {
|
||||||
/// id, or for the root frame if this is None, over a provided channel
|
/// id, or for the root frame if this is None, over a provided channel
|
||||||
GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
|
GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
|
||||||
/// Request that the constellation send the FrameId corresponding to the document
|
/// Request that the constellation send the FrameId corresponding to the document
|
||||||
/// with the provided parent pipeline id and subpage id
|
/// with the provided pipeline id
|
||||||
GetFrame(PipelineId, SubpageId, IpcSender<Option<FrameId>>),
|
GetFrame(PipelineId, IpcSender<Option<FrameId>>),
|
||||||
/// Notifies the constellation that this frame has received focus.
|
/// Notifies the constellation that this frame has received focus.
|
||||||
Focus(PipelineId),
|
Focus(PipelineId),
|
||||||
/// Requests that the constellation retrieve the current contents of the clipboard
|
/// Requests that the constellation retrieve the current contents of the clipboard
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use constellation_msg::{PipelineId, SubpageId};
|
use constellation_msg::PipelineId;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use rustc_serialize::json::{Json, ToJson};
|
use rustc_serialize::json::{Json, ToJson};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -16,7 +16,7 @@ pub enum WebDriverScriptCommand {
|
||||||
GetActiveElement(IpcSender<Option<String>>),
|
GetActiveElement(IpcSender<Option<String>>),
|
||||||
GetElementTagName(String, IpcSender<Result<String, ()>>),
|
GetElementTagName(String, IpcSender<Result<String, ()>>),
|
||||||
GetElementText(String, IpcSender<Result<String, ()>>),
|
GetElementText(String, IpcSender<Result<String, ()>>),
|
||||||
GetFrameId(WebDriverFrameId, IpcSender<Result<Option<(PipelineId, SubpageId)>, ()>>),
|
GetFrameId(WebDriverFrameId, IpcSender<Result<Option<PipelineId>, ()>>),
|
||||||
GetUrl(IpcSender<Url>),
|
GetUrl(IpcSender<Url>),
|
||||||
GetTitle(IpcSender<String>)
|
GetTitle(IpcSender<String>)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ use ipc_channel::ipc::IpcSender;
|
||||||
use js::jsapi::JSContext;
|
use js::jsapi::JSContext;
|
||||||
use js::jsapi::{HandleValue, RootedValue};
|
use js::jsapi::{HandleValue, RootedValue};
|
||||||
use js::jsval::UndefinedValue;
|
use js::jsval::UndefinedValue;
|
||||||
use msg::constellation_msg::{PipelineId, SubpageId};
|
use msg::constellation_msg::PipelineId;
|
||||||
use msg::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue};
|
use msg::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue};
|
||||||
use page::Page;
|
use page::Page;
|
||||||
use script_task::get_page;
|
use script_task::get_page;
|
||||||
|
@ -85,7 +85,7 @@ pub fn handle_execute_async_script(page: &Rc<Page>,
|
||||||
pub fn handle_get_frame_id(page: &Rc<Page>,
|
pub fn handle_get_frame_id(page: &Rc<Page>,
|
||||||
pipeline: PipelineId,
|
pipeline: PipelineId,
|
||||||
webdriver_frame_id: WebDriverFrameId,
|
webdriver_frame_id: WebDriverFrameId,
|
||||||
reply: IpcSender<Result<Option<(PipelineId, SubpageId)>, ()>>) {
|
reply: IpcSender<Result<Option<PipelineId>, ()>>) {
|
||||||
let window = match webdriver_frame_id {
|
let window = match webdriver_frame_id {
|
||||||
WebDriverFrameId::Short(_) => {
|
WebDriverFrameId::Short(_) => {
|
||||||
// This isn't supported yet
|
// This isn't supported yet
|
||||||
|
@ -108,7 +108,7 @@ pub fn handle_get_frame_id(page: &Rc<Page>,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let frame_id = window.map(|x| x.and_then(|x| x.r().parent_info()));
|
let frame_id = window.map(|x| x.map(|x| x.r().pipeline()));
|
||||||
reply.send(frame_id).unwrap()
|
reply.send(frame_id).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -451,10 +451,10 @@ impl Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
let frame = match receiver.recv().unwrap() {
|
let frame = match receiver.recv().unwrap() {
|
||||||
Ok(Some((pipeline_id, subpage_id))) => {
|
Ok(Some(pipeline_id)) => {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
let ConstellationChan(ref const_chan) = self.constellation_chan;
|
let ConstellationChan(ref const_chan) = self.constellation_chan;
|
||||||
const_chan.send(ConstellationMsg::GetFrame(pipeline_id, subpage_id, sender)).unwrap();
|
const_chan.send(ConstellationMsg::GetFrame(pipeline_id, sender)).unwrap();
|
||||||
receiver.recv().unwrap()
|
receiver.recv().unwrap()
|
||||||
},
|
},
|
||||||
Ok(None) => None,
|
Ok(None) => None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue