mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Add plugins for compositing and net crates #7699
Changed to_string calls to to_owned calls where was a need.
This commit is contained in:
parent
44de9173cc
commit
88815d21ba
18 changed files with 43 additions and 31 deletions
|
@ -43,6 +43,9 @@ path = "../canvas_traits"
|
|||
[dependencies.canvas]
|
||||
path = "../canvas"
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../plugins"
|
||||
|
||||
[dependencies.azure]
|
||||
git = "https://github.com/servo/rust-azure"
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ fn initialize_png(width: usize, height: usize) -> (Vec<gl::GLuint>, Vec<gl::GLui
|
|||
}
|
||||
|
||||
pub fn reporter_name() -> String {
|
||||
"compositor-reporter".to_string()
|
||||
"compositor-reporter".to_owned()
|
||||
}
|
||||
|
||||
impl<Window: WindowMethods> IOCompositor<Window> {
|
||||
|
|
|
@ -486,10 +486,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
}
|
||||
ConstellationMsg::GetClipboardContents(sender) => {
|
||||
let result = self.clipboard_ctx.as_ref().map_or(
|
||||
"".to_string(),
|
||||
"".to_owned(),
|
||||
|ctx| ctx.get_contents().unwrap_or_else(|e| {
|
||||
debug!("Error getting clipboard contents ({}), defaulting to empty string", e);
|
||||
"".to_string()
|
||||
"".to_owned()
|
||||
})
|
||||
);
|
||||
sender.send(result).unwrap();
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#![feature(iter_cmp)]
|
||||
#![feature(slice_bytes)]
|
||||
#![feature(vec_push_all)]
|
||||
#![feature(plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ path = "../util"
|
|||
[dependencies.devtools_traits]
|
||||
path = "../devtools_traits"
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../plugins"
|
||||
|
||||
[dependencies.png]
|
||||
git = "https://github.com/servo/rust-png"
|
||||
features = [ "serde-serialization" ]
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Ar
|
|||
let chan = start_sending(start_chan, Metadata {
|
||||
final_url: load_data.url,
|
||||
content_type: Some(ContentType(Mime(TopLevel::Text, SubLevel::Html, vec![]))),
|
||||
charset: Some("utf-8".to_string()),
|
||||
charset: Some("utf-8".to_owned()),
|
||||
headers: None,
|
||||
status: Some(RawStatus(200, "OK".into())),
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ pub fn factory(mut load_data: LoadData, start_chan: LoadConsumer, classifier: Ar
|
|||
}
|
||||
_ => {
|
||||
start_sending(start_chan, Metadata::default(load_data.url))
|
||||
.send(Done(Err("Unknown about: URL.".to_string())))
|
||||
.send(Done(Err("Unknown about: URL.".to_owned())))
|
||||
.unwrap();
|
||||
return
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ impl Cookie {
|
|||
|
||||
// Step 5
|
||||
match PUB_DOMAINS.iter().find(|&x| domain == *x) {
|
||||
Some(val) if *val == url_host => domain = "".to_string(),
|
||||
Some(val) if *val == url_host => domain = "".to_owned(),
|
||||
Some(_) => return None,
|
||||
None => {}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ impl Cookie {
|
|||
}
|
||||
}
|
||||
|
||||
if self.cookie.secure && url.scheme != "https".to_string() {
|
||||
if self.cookie.secure && url.scheme != "https".to_owned() {
|
||||
return false;
|
||||
}
|
||||
if self.cookie.httponly && source == CookieSource::NonHTTP {
|
||||
|
|
|
@ -107,7 +107,7 @@ impl CookieStorage {
|
|||
_ => acc + ";"
|
||||
}) + &c.cookie.name + "=" + &c.cookie.value
|
||||
};
|
||||
let result = url_cookies.iter_mut().fold("".to_string(), reducer);
|
||||
let result = url_cookies.iter_mut().fold("".to_owned(), reducer);
|
||||
|
||||
info!(" === COOKIES SENT: {}", result);
|
||||
match result.len() {
|
||||
|
|
|
@ -41,7 +41,7 @@ pub fn load(load_data: LoadData, start_chan: LoadConsumer) {
|
|||
let parts: Vec<&str> = scheme_data.splitn(2, ',').collect();
|
||||
if parts.len() != 2 {
|
||||
start_sending(start_chan,
|
||||
metadata).send(Done(Err("invalid data uri".to_string()))).unwrap();
|
||||
metadata).send(Done(Err("invalid data uri".to_owned()))).unwrap();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ pub fn load(load_data: LoadData, start_chan: LoadConsumer) {
|
|||
let bytes = bytes.into_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
|
||||
match bytes.from_base64() {
|
||||
Err(..) => {
|
||||
progress_chan.send(Done(Err("non-base64 data uri".to_string()))).unwrap();
|
||||
progress_chan.send(Done(Err("non-base64 data uri".to_owned()))).unwrap();
|
||||
}
|
||||
Ok(data) => {
|
||||
progress_chan.send(Payload(data)).unwrap();
|
||||
|
|
|
@ -167,7 +167,7 @@ impl CORSCache for BasicCORSCache {
|
|||
None => {
|
||||
self.insert(CORSCacheEntry::new(request.origin, request.destination, new_max_age,
|
||||
request.credentials,
|
||||
HeaderOrMethod::HeaderData(header_name.to_string())));
|
||||
HeaderOrMethod::HeaderData(header_name.to_owned())));
|
||||
false
|
||||
}
|
||||
}
|
||||
|
@ -228,13 +228,13 @@ impl CORSCache for CORSCacheSender {
|
|||
|
||||
fn match_header(&mut self, request: CacheRequestDetails, header_name: &str) -> bool {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::MatchHeader(request, header_name.to_string(), tx));
|
||||
self.send(CORSCacheTaskMsg::MatchHeader(request, header_name.to_owned(), tx));
|
||||
rx.recv().unwrap_or(false)
|
||||
}
|
||||
|
||||
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_string(), new_max_age, tx));
|
||||
self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_owned(), new_max_age, tx));
|
||||
rx.recv().unwrap_or(false)
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ impl Request {
|
|||
=> vec![qitem(Mime(TopLevel::Image, SubLevel::Png, vec![])),
|
||||
// FIXME: This should properly generate a MimeType that has a
|
||||
// SubLevel of svg+xml (https://github.com/hyperium/mime.rs/issues/22)
|
||||
qitem(Mime(TopLevel::Image, SubLevel::Ext("svg+xml".to_string()), vec![])),
|
||||
qitem(Mime(TopLevel::Image, SubLevel::Ext("svg+xml".to_owned()), vec![])),
|
||||
QualityItem::new(Mime(TopLevel::Image, SubLevel::Star, vec![]), q(0.8)),
|
||||
QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), q(0.5))],
|
||||
Context::Form | Context::Frame | Context::Hyperlink |
|
||||
|
@ -164,14 +164,14 @@ impl Request {
|
|||
=> vec![qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
|
||||
// FIXME: This should properly generate a MimeType that has a
|
||||
// SubLevel of xhtml+xml (https://github.com/hyperium/mime.rs/issues/22)
|
||||
qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_string()), vec![])),
|
||||
qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_owned()), vec![])),
|
||||
QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]), q(0.9)),
|
||||
QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), q(0.8))],
|
||||
Context::Internal if self.context_frame_type != ContextFrameType::ContextNone
|
||||
=> vec![qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
|
||||
// FIXME: This should properly generate a MimeType that has a
|
||||
// SubLevel of xhtml+xml (https://github.com/hyperium/mime.rs/issues/22)
|
||||
qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_string()), vec![])),
|
||||
qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_owned()), vec![])),
|
||||
QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]), q(0.9)),
|
||||
QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), q(0.8))],
|
||||
Context::Style
|
||||
|
|
|
@ -29,7 +29,7 @@ fn read_block(reader: &mut File) -> Result<ReadStatus, String> {
|
|||
buf.truncate(n);
|
||||
Ok(ReadStatus::Partial(buf))
|
||||
}
|
||||
Err(e) => Err(e.description().to_string()),
|
||||
Err(e) => Err(e.description().to_owned()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ pub fn factory(load_data: LoadData, senders: LoadConsumer, classifier: Arc<MIMEC
|
|||
}
|
||||
Err(e) => {
|
||||
let progress_chan = start_sending(senders, metadata);
|
||||
progress_chan.send(Done(Err(e.description().to_string()))).unwrap();
|
||||
progress_chan.send(Done(Err(e.description().to_owned()))).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ pub fn preload_hsts_domains() -> Option<HSTSList> {
|
|||
pub fn secure_url(url: &Url) -> Url {
|
||||
if &*url.scheme == "http" {
|
||||
let mut secure_url = url.clone();
|
||||
secure_url.scheme = "https".to_string();
|
||||
secure_url.scheme = "https".to_owned();
|
||||
secure_url.relative_scheme_data_mut()
|
||||
.map(|scheme_data| {
|
||||
scheme_data.default_port = Some(443);
|
||||
|
|
|
@ -124,7 +124,7 @@ fn load_for_consumer(load_data: LoadData,
|
|||
send_error(url, e, start_chan)
|
||||
}
|
||||
Err(LoadError::MaxRedirects(url)) => {
|
||||
send_error(url, "too many redirects".to_string(), start_chan)
|
||||
send_error(url, "too many redirects".to_owned(), start_chan)
|
||||
}
|
||||
Err(LoadError::Cors(url, msg)) |
|
||||
Err(LoadError::InvalidRedirect(url, msg)) |
|
||||
|
@ -237,7 +237,7 @@ impl HttpRequestFactory for NetworkHttpRequestFactory {
|
|||
)
|
||||
},
|
||||
Err(e) => {
|
||||
return Err(LoadError::Connection(url, e.description().to_string()))
|
||||
return Err(LoadError::Connection(url, e.description().to_owned()))
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -267,13 +267,13 @@ impl HttpRequest for WrappedHttpRequest {
|
|||
let url = self.request.url.clone();
|
||||
let mut request_writer = match self.request.start() {
|
||||
Ok(streaming) => streaming,
|
||||
Err(e) => return Err(LoadError::Connection(url, e.description().to_string()))
|
||||
Err(e) => return Err(LoadError::Connection(url, e.description().to_owned()))
|
||||
};
|
||||
|
||||
if let Some(ref data) = *body {
|
||||
match request_writer.write_all(&data) {
|
||||
Err(e) => {
|
||||
return Err(LoadError::Connection(url, e.description().to_string()))
|
||||
return Err(LoadError::Connection(url, e.description().to_owned()))
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -282,9 +282,9 @@ impl HttpRequest for WrappedHttpRequest {
|
|||
let response = match request_writer.send() {
|
||||
Ok(w) => w,
|
||||
Err(HttpError::Io(ref io_error)) if io_error.kind() == io::ErrorKind::ConnectionAborted => {
|
||||
return Err(LoadError::ConnectionAborted(io_error.description().to_string()));
|
||||
return Err(LoadError::ConnectionAborted(io_error.description().to_owned()));
|
||||
},
|
||||
Err(e) => return Err(LoadError::Connection(url, e.description().to_string()))
|
||||
Err(e) => return Err(LoadError::Connection(url, e.description().to_owned()))
|
||||
};
|
||||
|
||||
Ok(WrappedHttpResponse { response: response })
|
||||
|
@ -315,7 +315,7 @@ fn set_default_accept(headers: &mut Headers) {
|
|||
if !headers.has::<Accept>() {
|
||||
let accept = Accept(vec![
|
||||
qitem(Mime(TopLevel::Text, SubLevel::Html, vec![])),
|
||||
qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_string()), vec![])),
|
||||
qitem(Mime(TopLevel::Application, SubLevel::Ext("xhtml+xml".to_owned()), vec![])),
|
||||
QualityItem::new(Mime(TopLevel::Application, SubLevel::Xml, vec![]), Quality(900u16)),
|
||||
QualityItem::new(Mime(TopLevel::Star, SubLevel::Star, vec![]), Quality(800u16)),
|
||||
]);
|
||||
|
@ -374,7 +374,7 @@ fn update_sts_list_from_response(url: &Url, response: &HttpResponse, hsts_list:
|
|||
IncludeSubdomains::NotIncluded
|
||||
};
|
||||
|
||||
if let Some(entry) = HSTSEntry::new(host.to_string(), include_subdomains, Some(header.max_age)) {
|
||||
if let Some(entry) = HSTSEntry::new(host.to_owned(), include_subdomains, Some(header.max_age)) {
|
||||
info!("adding host {} to the strict transport security list", host);
|
||||
info!("- max-age {}", header.max_age);
|
||||
if header.include_subdomains {
|
||||
|
@ -638,7 +638,7 @@ pub fn load<A>(load_data: LoadData,
|
|||
return Err(
|
||||
LoadError::Cors(
|
||||
url,
|
||||
"Preflight fetch inconsistent with main fetch".to_string()));
|
||||
"Preflight fetch inconsistent with main fetch".to_owned()));
|
||||
} else {
|
||||
// XXXManishearth There are some CORS-related steps here,
|
||||
// but they don't seem necessary until credentials are implemented
|
||||
|
@ -667,7 +667,7 @@ pub fn load<A>(load_data: LoadData,
|
|||
}
|
||||
|
||||
if redirected_to.contains(&url) {
|
||||
return Err(LoadError::InvalidRedirect(doc_url, "redirect loop".to_string()));
|
||||
return Err(LoadError::InvalidRedirect(doc_url, "redirect loop".to_owned()));
|
||||
}
|
||||
|
||||
redirected_to.insert(doc_url.clone());
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#![feature(path_ext)]
|
||||
#![feature(plugin)]
|
||||
#![feature(vec_push_all)]
|
||||
#![feature(plugin)]
|
||||
#![plugin(plugins)]
|
||||
|
||||
extern crate net_traits;
|
||||
extern crate cookie as cookie_rs;
|
||||
|
|
|
@ -244,7 +244,7 @@ impl ResourceManager {
|
|||
_ => {
|
||||
debug!("resource_task: no loader for scheme {}", load_data.url.scheme);
|
||||
start_sending(consumer, Metadata::default(load_data.url))
|
||||
.send(ProgressMsg::Done(Err("no loader for scheme".to_string()))).unwrap();
|
||||
.send(ProgressMsg::Done(Err("no loader for scheme".to_owned()))).unwrap();
|
||||
return
|
||||
}
|
||||
};
|
||||
|
|
|
@ -172,7 +172,7 @@ impl StorageManager {
|
|||
}
|
||||
|
||||
fn origin_as_string(&self, url: Url) -> String {
|
||||
let mut origin = "".to_string();
|
||||
let mut origin = "".to_owned();
|
||||
origin.push_str(&url.scheme);
|
||||
origin.push_str("://");
|
||||
url.domain().map(|domain| origin.push_str(&domain));
|
||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -241,6 +241,7 @@ dependencies = [
|
|||
"net_traits 0.0.1",
|
||||
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
|
||||
"plugins 0.0.1",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png)",
|
||||
"profile_traits 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
|
@ -1086,6 +1087,7 @@ dependencies = [
|
|||
"log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"net_traits 0.0.1",
|
||||
"openssl 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png)",
|
||||
"regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex_macros 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue