Replaced DOMString by String in devtools.

This commit is contained in:
Alan Jeffrey 2015-11-10 15:40:10 -06:00
parent 9cbc4393eb
commit 5101506089
6 changed files with 27 additions and 28 deletions

View file

@ -206,16 +206,16 @@ impl NodeInfoToProtocol for NodeInfo {
NodeActorMsg {
actor: actor_name,
baseURI: self.baseURI.0,
baseURI: self.baseURI,
parent: actors.script_to_actor(self.parent.clone()),
nodeType: self.nodeType,
namespaceURI: self.namespaceURI.0,
nodeName: self.nodeName.0,
namespaceURI: self.namespaceURI,
nodeName: self.nodeName,
numChildren: self.numChildren,
name: self.name.0,
publicId: self.publicId.0,
systemId: self.systemId.0,
name: self.name,
publicId: self.publicId,
systemId: self.systemId,
attrs: self.attrs.into_iter().map(|attr| {
AttrMsg {
@ -233,7 +233,7 @@ impl NodeInfoToProtocol for NodeInfo {
isDocumentElement: self.isDocumentElement,
shortValue: self.shortValue.0,
shortValue: self.shortValue,
incompleteValue: self.incompleteValue,
}
}

View file

@ -225,7 +225,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
let DevtoolsPageInfo { title, url } = page_info;
let tab = TabActor {
name: actors.new_name("tab"),
title: title.0,
title: String::from(title),
url: url.serialize(),
console: console.name(),
inspector: inspector.name(),

View file

@ -35,13 +35,12 @@ use rustc_serialize::{Decodable, Decoder};
use std::net::TcpStream;
use time::Duration;
use url::Url;
use util::str::DOMString;
// Information would be attached to NewGlobal to be received and show in devtools.
// Extend these fields if we need more information.
#[derive(Deserialize, Serialize)]
pub struct DevtoolsPageInfo {
pub title: DOMString,
pub title: String,
pub url: Url
}
@ -102,22 +101,22 @@ pub struct AttrInfo {
#[derive(Deserialize, Serialize)]
pub struct NodeInfo {
pub uniqueId: String,
pub baseURI: DOMString,
pub baseURI: String,
pub parent: String,
pub nodeType: u16,
pub namespaceURI: DOMString,
pub nodeName: DOMString,
pub namespaceURI: String,
pub nodeName: String,
pub numChildren: usize,
pub name: DOMString,
pub publicId: DOMString,
pub systemId: DOMString,
pub name: String,
pub publicId: String,
pub systemId: String,
pub attrs: Vec<AttrInfo>,
pub isDocumentElement: bool,
pub shortValue: DOMString,
pub shortValue: String,
pub incompleteValue: bool,
}

View file

@ -806,17 +806,17 @@ impl Node {
pub fn summarize(&self) -> NodeInfo {
NodeInfo {
uniqueId: self.get_unique_id(),
baseURI: self.BaseURI(),
baseURI: String::from(self.BaseURI()),
parent: self.GetParentNode().map(|node| node.get_unique_id()).unwrap_or("".to_owned()),
nodeType: self.NodeType(),
namespaceURI: DOMString::new(), //FIXME
nodeName: self.NodeName(),
namespaceURI: String::new(), //FIXME
nodeName: String::from(self.NodeName()),
numChildren: self.ChildNodes().Length() as usize,
//FIXME doctype nodes only
name: DOMString::new(),
publicId: DOMString::new(),
systemId: DOMString::new(),
name: String::new(),
publicId: String::new(),
systemId: String::new(),
attrs: self.downcast().map(Element::summarize).unwrap_or(vec![]),
isDocumentElement:
@ -825,7 +825,7 @@ impl Node {
.map(|elem| elem.upcast::<Node>() == self)
.unwrap_or(false),
shortValue: self.GetNodeValue().unwrap_or_default(), //FIXME: truncate
shortValue: self.GetNodeValue().map(String::from).unwrap_or_default(), //FIXME: truncate
incompleteValue: false, //FIXME: reflect truncation
}
}

View file

@ -85,7 +85,7 @@ impl Worker {
let pipeline_id = global.pipeline();
let title = format!("Worker for {}", worker_url);
let page_info = DevtoolsPageInfo {
title: DOMString(title),
title: title,
url: worker_url.clone(),
};
chan.send(ScriptToDevtoolsControlMsg::NewGlobal((pipeline_id, Some(worker_id)),

View file

@ -1632,7 +1632,7 @@ impl ScriptTask {
let content_type = match metadata.content_type {
Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, _))) => {
Some(DOMString("text/plain".to_owned()))
Some(DOMString::from("text/plain"))
}
_ => None
};
@ -1705,7 +1705,7 @@ impl ScriptTask {
fn notify_devtools(&self, title: DOMString, url: Url, ids: (PipelineId, Option<WorkerId>)) {
if let Some(ref chan) = self.devtools_chan {
let page_info = DevtoolsPageInfo {
title: title,
title: String::from(title),
url: url,
};
chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
@ -1924,7 +1924,7 @@ impl ScriptTask {
// http://dev.w3.org/csswg/cssom-view/#resizing-viewports
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize
let uievent = UIEvent::new(window.r(),
DOMString("resize".to_owned()), EventBubbles::DoesNotBubble,
DOMString::from("resize"), EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable, Some(window.r()),
0i32);
uievent.upcast::<Event>().fire(window.upcast());