mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.
This commit is contained in:
parent
ff8cbff810
commit
95fc29fa0d
255 changed files with 3550 additions and 3362 deletions
|
@ -11,7 +11,7 @@
|
|||
|
||||
use hyper::method::Method;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::comm::{Sender, Receiver, channel};
|
||||
use std::sync::mpsc::{Sender, Receiver, channel};
|
||||
use time;
|
||||
use time::{now, Timespec};
|
||||
use url::Url;
|
||||
|
@ -19,7 +19,7 @@ use url::Url;
|
|||
/// Union type for CORS cache entries
|
||||
///
|
||||
/// Each entry might pertain to a header or method
|
||||
#[deriving(Clone)]
|
||||
#[derive(Clone)]
|
||||
pub enum HeaderOrMethod {
|
||||
HeaderData(String),
|
||||
MethodData(Method)
|
||||
|
@ -42,7 +42,7 @@ impl HeaderOrMethod {
|
|||
}
|
||||
|
||||
/// An entry in the CORS cache
|
||||
#[deriving(Clone)]
|
||||
#[derive(Clone)]
|
||||
pub struct CORSCacheEntry {
|
||||
pub origin: Url,
|
||||
pub url: Url,
|
||||
|
@ -100,7 +100,7 @@ pub trait CORSCache {
|
|||
}
|
||||
|
||||
/// A simple, vector-based CORS Cache
|
||||
#[deriving(Clone)]
|
||||
#[derive(Clone)]
|
||||
#[unstable = "This might later be replaced with a HashMap-like entity, though that requires a separate Origin struct"]
|
||||
pub struct BasicCORSCache(Vec<CORSCacheEntry>);
|
||||
|
||||
|
@ -207,43 +207,43 @@ impl CORSCache for CORSCacheSender {
|
|||
fn clear (&mut self, request: CacheRequestDetails) {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::Clear(request, tx));
|
||||
let _ = rx.recv_opt();
|
||||
let _ = rx.recv();
|
||||
}
|
||||
|
||||
fn cleanup(&mut self) {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::Cleanup(tx));
|
||||
let _ = rx.recv_opt();
|
||||
let _ = rx.recv();
|
||||
}
|
||||
|
||||
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));
|
||||
rx.recv_opt().unwrap_or(false)
|
||||
rx.recv().unwrap_or(false)
|
||||
}
|
||||
|
||||
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: uint) -> bool {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::MatchHeaderUpdate(request, header_name.to_string(), new_max_age, tx));
|
||||
rx.recv_opt().unwrap_or(false)
|
||||
rx.recv().unwrap_or(false)
|
||||
}
|
||||
|
||||
fn match_method(&mut self, request: CacheRequestDetails, method: Method) -> bool {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::MatchMethod(request, method, tx));
|
||||
rx.recv_opt().unwrap_or(false)
|
||||
rx.recv().unwrap_or(false)
|
||||
}
|
||||
|
||||
fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: uint) -> bool {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::MatchMethodUpdate(request, method, new_max_age, tx));
|
||||
rx.recv_opt().unwrap_or(false)
|
||||
rx.recv().unwrap_or(false)
|
||||
}
|
||||
|
||||
fn insert(&mut self, entry: CORSCacheEntry) {
|
||||
let (tx, rx) = channel();
|
||||
self.send(CORSCacheTaskMsg::Insert(entry, tx));
|
||||
let _ = rx.recv_opt();
|
||||
let _ = rx.recv();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ impl CORSCache for CORSCacheSender {
|
|||
/// let task = CORSCacheTask::new();
|
||||
/// let builder = TaskBuilder::new().named("XHRTask");
|
||||
/// let mut sender = task.get_sender();
|
||||
/// builder.spawn(proc() { task.run() });
|
||||
/// builder.spawn(move || { task.run() });
|
||||
/// sender.insert(CORSCacheEntry::new(/* parameters here */));
|
||||
/// ```
|
||||
pub struct CORSCacheTask {
|
||||
|
@ -284,7 +284,7 @@ impl CORSCacheTask {
|
|||
/// Send ExitMsg to the associated Sender to exit
|
||||
pub fn run(&mut self) {
|
||||
loop {
|
||||
match self.receiver.recv() {
|
||||
match self.receiver.recv().unwrap() {
|
||||
CORSCacheTaskMsg::Clear(request, tx) => {
|
||||
self.cache.clear(request);
|
||||
tx.send(());
|
||||
|
|
|
@ -11,7 +11,7 @@ use fetch::cors_cache::CORSCache;
|
|||
use fetch::response::Response;
|
||||
|
||||
/// A [request context](http://fetch.spec.whatwg.org/#concept-request-context)
|
||||
#[deriving(Copy)]
|
||||
#[derive(Copy)]
|
||||
pub enum Context {
|
||||
Audio, Beacon, CSPreport, Download, Embed, Eventsource,
|
||||
Favicon, Fetch, Font, Form, Frame, Hyperlink, IFrame, Image,
|
||||
|
@ -21,7 +21,7 @@ pub enum Context {
|
|||
}
|
||||
|
||||
/// A [request context frame type](http://fetch.spec.whatwg.org/#concept-request-context-frame-type)
|
||||
#[deriving(Copy)]
|
||||
#[derive(Copy)]
|
||||
pub enum ContextFrameType {
|
||||
Auxiliary,
|
||||
TopLevel,
|
||||
|
@ -37,7 +37,7 @@ pub enum Referer {
|
|||
}
|
||||
|
||||
/// A [request mode](http://fetch.spec.whatwg.org/#concept-request-mode)
|
||||
#[deriving(Copy)]
|
||||
#[derive(Copy)]
|
||||
pub enum RequestMode {
|
||||
SameOrigin,
|
||||
NoCORS,
|
||||
|
@ -46,7 +46,7 @@ pub enum RequestMode {
|
|||
}
|
||||
|
||||
/// Request [credentials mode](http://fetch.spec.whatwg.org/#concept-request-credentials-mode)
|
||||
#[deriving(Copy)]
|
||||
#[derive(Copy)]
|
||||
pub enum CredentialsMode {
|
||||
Omit,
|
||||
CredentialsSameOrigin,
|
||||
|
@ -54,7 +54,7 @@ pub enum CredentialsMode {
|
|||
}
|
||||
|
||||
/// [Response tainting](http://fetch.spec.whatwg.org/#concept-request-response-tainting)
|
||||
#[deriving(Copy)]
|
||||
#[derive(Copy)]
|
||||
pub enum ResponseTainting {
|
||||
Basic,
|
||||
CORSTainting,
|
||||
|
|
|
@ -6,10 +6,10 @@ use url::Url;
|
|||
use hyper::status::StatusCode;
|
||||
use hyper::header::Headers;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::comm::Receiver;
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
||||
/// [Response type](http://fetch.spec.whatwg.org/#concept-response-type)
|
||||
#[deriving(Clone, PartialEq, Copy)]
|
||||
#[derive(Clone, PartialEq, Copy)]
|
||||
pub enum ResponseType {
|
||||
Basic,
|
||||
CORS,
|
||||
|
@ -19,7 +19,7 @@ pub enum ResponseType {
|
|||
}
|
||||
|
||||
/// [Response termination reason](http://fetch.spec.whatwg.org/#concept-response-termination-reason)
|
||||
#[deriving(Clone, Copy)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum TerminationReason {
|
||||
EndUserAbort,
|
||||
Fatal,
|
||||
|
@ -29,7 +29,7 @@ pub enum TerminationReason {
|
|||
/// The response body can still be pushed to after fetch
|
||||
/// This provides a way to store unfinished response bodies
|
||||
#[unstable = "I haven't yet decided exactly how the interface for this will be"]
|
||||
#[deriving(Clone)]
|
||||
#[derive(Clone)]
|
||||
pub enum ResponseBody {
|
||||
Empty, // XXXManishearth is this necessary, or is Done(vec![]) enough?
|
||||
Receiving(Vec<u8>),
|
||||
|
@ -50,7 +50,7 @@ pub struct ResponseLoader {
|
|||
}
|
||||
|
||||
/// A [Response](http://fetch.spec.whatwg.org/#concept-response) as defined by the Fetch spec
|
||||
#[deriving(Clone)]
|
||||
#[derive(Clone)]
|
||||
pub struct Response {
|
||||
pub response_type: ResponseType,
|
||||
pub termination_reason: Option<TerminationReason>,
|
||||
|
@ -110,7 +110,7 @@ impl Response {
|
|||
ResponseType::Default | ResponseType::Error => unreachable!(),
|
||||
ResponseType::Basic => {
|
||||
let headers = old_headers.iter().filter(|header| {
|
||||
match header.name().to_ascii_lower().as_slice() {
|
||||
match header.name().to_ascii_lowercase().as_slice() {
|
||||
"set-cookie" | "set-cookie2" => false,
|
||||
_ => true
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ impl Response {
|
|||
},
|
||||
ResponseType::CORS => {
|
||||
let headers = old_headers.iter().filter(|header| {
|
||||
match header.name().to_ascii_lower().as_slice() {
|
||||
match header.name().to_ascii_lowercase().as_slice() {
|
||||
"cache-control" | "content-language" |
|
||||
"content-type" | "expires" | "last-modified" | "Pragma" => false,
|
||||
// XXXManishearth handle Access-Control-Expose-Headers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue