mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev.
This commit is contained in:
parent
65d4b12bf2
commit
5f15eb5fbf
140 changed files with 1420 additions and 1222 deletions
|
@ -54,11 +54,12 @@ use js::jsval::{StringValue, ObjectValue, ObjectOrNullValue};
|
|||
use libc;
|
||||
use std::borrow::ToOwned;
|
||||
use std::default;
|
||||
use std::marker::MarkerTrait;
|
||||
use std::slice;
|
||||
|
||||
/// A trait to retrieve the constants necessary to check if a `JSObject`
|
||||
/// implements a given interface.
|
||||
pub trait IDLInterface {
|
||||
pub trait IDLInterface: MarkerTrait {
|
||||
/// Returns the prototype ID.
|
||||
fn get_prototype_id() -> PrototypeList::ID;
|
||||
/// Returns the prototype depth, i.e., the number of interfaces this
|
||||
|
@ -74,6 +75,7 @@ pub trait ToJSValConvertible {
|
|||
|
||||
/// A trait to convert `JSVal`s to Rust types.
|
||||
pub trait FromJSValConvertible {
|
||||
/// Optional configurable behaviour switch; use () for no configuration.
|
||||
type Config;
|
||||
/// Convert `val` to type `Self`.
|
||||
/// Optional configuration of type `T` can be passed as the `option`
|
||||
|
|
|
@ -62,7 +62,7 @@ use util::smallvec::{SmallVec, SmallVec16};
|
|||
use core::nonzero::NonZero;
|
||||
use std::cell::{Cell, UnsafeCell};
|
||||
use std::default::Default;
|
||||
use std::marker::ContravariantLifetime;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
|
||||
|
@ -677,7 +677,7 @@ impl<T: Reflectable> Root<T> {
|
|||
pub fn r<'b>(&'b self) -> JSRef<'b, T> {
|
||||
JSRef {
|
||||
ptr: self.ptr,
|
||||
chain: ContravariantLifetime,
|
||||
chain: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -688,7 +688,7 @@ impl<T: Reflectable> Root<T> {
|
|||
pub fn get_unsound_ref_forever<'b>(&self) -> JSRef<'b, T> {
|
||||
JSRef {
|
||||
ptr: self.ptr,
|
||||
chain: ContravariantLifetime,
|
||||
chain: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ impl<'a, T: Reflectable> Deref for JSRef<'a, T> {
|
|||
/// copyable.
|
||||
pub struct JSRef<'a, T> {
|
||||
ptr: NonZero<*const T>,
|
||||
chain: ContravariantLifetime<'a>,
|
||||
chain: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a, T> Copy for JSRef<'a, T> {}
|
||||
|
|
|
@ -32,6 +32,7 @@ use libc;
|
|||
use std::cell::RefCell;
|
||||
use std::collections::hash_map::HashMap;
|
||||
use std::collections::hash_map::Entry::{Vacant, Occupied};
|
||||
use std::marker::PhantomData;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
|
@ -53,6 +54,7 @@ pub struct Trusted<T> {
|
|||
refcount: Arc<Mutex<usize>>,
|
||||
script_chan: Box<ScriptChan + Send>,
|
||||
owner_thread: *const libc::c_void,
|
||||
phantom: PhantomData<T>,
|
||||
}
|
||||
|
||||
unsafe impl<T: Reflectable> Send for Trusted<T> {}
|
||||
|
@ -71,6 +73,7 @@ impl<T: Reflectable> Trusted<T> {
|
|||
refcount: refcount,
|
||||
script_chan: script_chan.clone(),
|
||||
owner_thread: (&*live_references) as *const _ as *const libc::c_void,
|
||||
phantom: PhantomData,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -102,6 +105,7 @@ impl<T: Reflectable> Clone for Trusted<T> {
|
|||
refcount: self.refcount.clone(),
|
||||
script_chan: self.script_chan.clone(),
|
||||
owner_thread: self.owner_thread,
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! The `ByteString` struct.
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
use std::hash::{Hash, SipHasher};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::str;
|
||||
use std::str::FromStr;
|
||||
|
||||
|
@ -144,8 +144,8 @@ impl ByteString {
|
|||
}
|
||||
}
|
||||
|
||||
impl Hash<SipHasher> for ByteString {
|
||||
fn hash(&self, state: &mut SipHasher) {
|
||||
impl Hash for ByteString {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
let ByteString(ref vec) = *self;
|
||||
vec.hash(state);
|
||||
}
|
||||
|
|
|
@ -184,10 +184,10 @@ impl<T: JSTraceable> JSTraceable for Option<T> {
|
|||
}
|
||||
|
||||
impl<K,V,S> JSTraceable for HashMap<K, V, S>
|
||||
where K: Hash<<S as HashState>::Hasher> + Eq + JSTraceable,
|
||||
where K: Hash + Eq + JSTraceable,
|
||||
V: JSTraceable,
|
||||
S: HashState,
|
||||
<S as HashState>::Hasher: Hasher<Output=u64>,
|
||||
<S as HashState>::Hasher: Hasher,
|
||||
{
|
||||
#[inline]
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
|
|
|
@ -577,7 +577,10 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut
|
|||
debug!("outerizing");
|
||||
let obj = *obj.unnamed_field1;
|
||||
let win: Root<window::Window> = native_from_reflector_jsmanaged(obj).unwrap().root();
|
||||
win.r().browser_context().as_ref().unwrap().window_proxy()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let win = win.r();
|
||||
let context = win.browser_context();
|
||||
context.as_ref().unwrap().window_proxy()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,9 @@ impl CharacterData {
|
|||
|
||||
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||
fn Data(self) -> DOMString {
|
||||
self.data.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
data.clone()
|
||||
}
|
||||
|
||||
fn SetData(self, arg: DOMString) -> ErrorResult {
|
||||
|
@ -77,11 +79,15 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
|||
}
|
||||
|
||||
fn Length(self) -> u32 {
|
||||
self.data.borrow().chars().count() as u32
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
data.chars().count() as u32
|
||||
}
|
||||
|
||||
fn SubstringData(self, offset: u32, count: u32) -> Fallible<DOMString> {
|
||||
Ok(self.data.borrow().slice_chars(offset as usize, (offset + count) as usize).to_owned())
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
Ok(data.slice_chars(offset as usize, (offset + count) as usize).to_owned())
|
||||
}
|
||||
|
||||
fn AppendData(self, arg: DOMString) -> ErrorResult {
|
||||
|
|
|
@ -188,9 +188,11 @@ pub trait DedicatedWorkerGlobalScopeHelpers {
|
|||
|
||||
impl<'a> DedicatedWorkerGlobalScopeHelpers for JSRef<'a, DedicatedWorkerGlobalScope> {
|
||||
fn script_chan(self) -> Box<ScriptChan+Send> {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let worker = self.worker.borrow();
|
||||
box SendableWorkerScriptChan {
|
||||
sender: self.own_sender.clone(),
|
||||
worker: self.worker.borrow().as_ref().unwrap().clone(),
|
||||
worker: worker.as_ref().unwrap().clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,10 +365,13 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
|||
/// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
|
||||
fn find_fragment_node(self, fragid: DOMString) -> Option<Temporary<Element>> {
|
||||
self.GetElementById(fragid.clone()).or_else(|| {
|
||||
let check_anchor = |&:&node: &JSRef<HTMLAnchorElement>| {
|
||||
let check_anchor = |&node: &JSRef<HTMLAnchorElement>| {
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(node);
|
||||
elem.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| {
|
||||
attr.r().value().as_slice() == fragid.as_slice()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.as_slice() == fragid.as_slice()
|
||||
})
|
||||
};
|
||||
let doc_node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
|
@ -461,7 +464,10 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
|||
/// Sends this document's title to the compositor.
|
||||
fn send_title_to_compositor(self) {
|
||||
let window = self.window().root();
|
||||
window.r().compositor().set_title(window.r().pipeline(), Some(self.Title()));
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let window = window.r();
|
||||
let mut compositor = window.compositor();
|
||||
compositor.set_title(window.pipeline(), Some(self.Title()));
|
||||
}
|
||||
|
||||
fn dirty_all_nodes(self) {
|
||||
|
@ -843,12 +849,16 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
|
||||
// http://dom.spec.whatwg.org/#dom-document-characterset
|
||||
fn CharacterSet(self) -> DOMString {
|
||||
self.encoding_name.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let encoding_name = self.encoding_name.borrow();
|
||||
encoding_name.clone()
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-inputencoding
|
||||
fn InputEncoding(self) -> DOMString {
|
||||
self.encoding_name.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let encoding_name = self.encoding_name.borrow();
|
||||
encoding_name.clone()
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-content_type
|
||||
|
@ -893,7 +903,9 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
|
||||
fn GetElementById(self, id: DOMString) -> Option<Temporary<Element>> {
|
||||
let id = Atom::from_slice(id.as_slice());
|
||||
match self.idmap.borrow().get(&id) {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let idmap = self.idmap.borrow();
|
||||
match idmap.get(&id) {
|
||||
None => None,
|
||||
Some(ref elements) => Some(Temporary::new((*elements)[0].clone())),
|
||||
}
|
||||
|
@ -1218,7 +1230,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
None => return false,
|
||||
};
|
||||
element.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| {
|
||||
attr.r().value().as_slice() == name.as_slice()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.as_slice() == name.as_slice()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -67,15 +67,23 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
|
|||
// http://dom.spec.whatwg.org/#dom-domtokenlist-length
|
||||
fn Length(self) -> u32 {
|
||||
self.attribute().root().map(|attr| {
|
||||
attr.r().value().tokens().map(|tokens| tokens.len()).unwrap_or(0)
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.tokens().map(|tokens| tokens.len()).unwrap_or(0)
|
||||
}).unwrap_or(0) as u32
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-domtokenlist-item
|
||||
fn Item(self, index: u32) -> Option<DOMString> {
|
||||
self.attribute().root().and_then(|attr| attr.r().value().tokens().and_then(|tokens| {
|
||||
tokens.get(index as usize).map(|token| token.as_slice().to_owned())
|
||||
}))
|
||||
self.attribute().root().and_then(|attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.tokens().and_then(|tokens| {
|
||||
tokens.get(index as usize).map(|token| token.as_slice().to_owned())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> {
|
||||
|
@ -88,12 +96,13 @@ impl<'a> DOMTokenListMethods for JSRef<'a, DOMTokenList> {
|
|||
fn Contains(self, token: DOMString) -> Fallible<bool> {
|
||||
self.check_token_exceptions(token.as_slice()).map(|token| {
|
||||
self.attribute().root().map(|attr| {
|
||||
attr.r()
|
||||
.value()
|
||||
.tokens()
|
||||
.expect("Should have parsed this attribute")
|
||||
.iter()
|
||||
.any(|atom| *atom == token)
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.tokens()
|
||||
.expect("Should have parsed this attribute")
|
||||
.iter()
|
||||
.any(|atom| *atom == token)
|
||||
}).unwrap_or(false)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -618,9 +618,14 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
}
|
||||
|
||||
fn get_attributes(self, local_name: &Atom) -> Vec<Temporary<Attr>> {
|
||||
self.attrs.borrow().iter().map(|attr| attr.root()).filter_map(|attr| {
|
||||
if *attr.r().local_name() == *local_name {
|
||||
Some(Temporary::from_rooted(attr.r()))
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attrs = self.attrs.borrow();
|
||||
attrs.iter().map(|attr| attr.root()).filter_map(|attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let attr_local_name = attr.local_name();
|
||||
if *attr_local_name == *local_name {
|
||||
Some(Temporary::from_rooted(attr))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -746,12 +751,15 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
let owner_doc = node.owner_doc().root();
|
||||
owner_doc.r().quirks_mode()
|
||||
};
|
||||
let is_equal = |&:lhs: &Atom, rhs: &Atom| match quirks_mode {
|
||||
let is_equal = |lhs: &Atom, rhs: &Atom| match quirks_mode {
|
||||
NoQuirks | LimitedQuirks => lhs == rhs,
|
||||
Quirks => lhs.as_slice().eq_ignore_ascii_case(rhs.as_slice())
|
||||
};
|
||||
self.get_attribute(ns!(""), &atom!("class")).root().map(|attr| {
|
||||
attr.r().value().tokens().map(|tokens| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.tokens().map(|tokens| {
|
||||
tokens.iter().any(|atom| is_equal(name, atom))
|
||||
}).unwrap_or(false)
|
||||
}).unwrap_or(false)
|
||||
|
@ -764,9 +772,15 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
}
|
||||
|
||||
fn has_attribute(self, name: &Atom) -> bool {
|
||||
assert!(name.as_slice().bytes().all(|&:b| b.to_ascii_lowercase() == b));
|
||||
self.attrs.borrow().iter().map(|attr| attr.root()).any(|attr| {
|
||||
*attr.r().local_name() == *name && *attr.r().namespace() == ns!("")
|
||||
assert!(name.as_slice().bytes().all(|b| b.to_ascii_lowercase() == b));
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attrs = self.attrs.borrow();
|
||||
attrs.iter().map(|attr| attr.root()).any(|attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let local_name = attr.local_name();
|
||||
let namespace = attr.namespace();
|
||||
*local_name == *name && *namespace == ns!("")
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -811,11 +825,12 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
|||
|
||||
fn get_tokenlist_attribute(self, name: &Atom) -> Vec<Atom> {
|
||||
self.get_attribute(ns!(""), name).root().map(|attr| {
|
||||
attr.r()
|
||||
.value()
|
||||
.tokens()
|
||||
.expect("Expected a TokenListAttrValue")
|
||||
.to_vec()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.tokens()
|
||||
.expect("Expected a TokenListAttrValue")
|
||||
.to_vec()
|
||||
}).unwrap_or(vec!())
|
||||
}
|
||||
|
||||
|
@ -1328,14 +1343,20 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
|
|||
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str> {
|
||||
self.get_attribute(namespace.clone(), attr).root().map(|attr| {
|
||||
// This transmute is used to cheat the lifetime restriction.
|
||||
unsafe { mem::transmute(attr.r().value().as_slice()) }
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
unsafe { mem::transmute(value.as_slice()) }
|
||||
})
|
||||
}
|
||||
#[allow(unsafe_blocks)]
|
||||
fn get_attrs(self, attr: &Atom) -> Vec<&'a str> {
|
||||
self.get_attributes(attr).into_iter().map(|attr| attr.root()).map(|attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
// This transmute is used to cheat the lifetime restriction.
|
||||
unsafe { mem::transmute(attr.r().value().as_slice()) }
|
||||
unsafe { mem::transmute(value.as_slice()) }
|
||||
}).collect()
|
||||
}
|
||||
fn get_link(self) -> Option<&'a str> {
|
||||
|
@ -1375,7 +1396,10 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
|
|||
fn get_id(self) -> Option<Atom> {
|
||||
self.get_attribute(ns!(""), &atom!("id")).map(|attr| {
|
||||
let attr = attr.root();
|
||||
match *attr.r().value() {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
match *value {
|
||||
AttrValue::Atom(ref val) => val.clone(),
|
||||
_ => panic!("`id` attribute should be AttrValue::Atom"),
|
||||
}
|
||||
|
|
|
@ -68,12 +68,14 @@ impl ErrorEvent {
|
|||
let event: JSRef<Event> = EventCast::from_ref(ev.r());
|
||||
event.InitEvent(type_, bubbles == EventBubbles::Bubbles,
|
||||
cancelable == EventCancelable::Cancelable);
|
||||
*ev.r().message.borrow_mut() = message;
|
||||
*ev.r().filename.borrow_mut() = filename;
|
||||
ev.r().lineno.set(lineno);
|
||||
ev.r().colno.set(colno);
|
||||
ev.r().error.set(error);
|
||||
Temporary::from_rooted(ev.r())
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let ev = ev.r();
|
||||
*ev.message.borrow_mut() = message;
|
||||
*ev.filename.borrow_mut() = filename;
|
||||
ev.lineno.set(lineno);
|
||||
ev.colno.set(colno);
|
||||
ev.error.set(error);
|
||||
Temporary::from_rooted(ev)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
|
@ -116,11 +118,15 @@ impl<'a> ErrorEventMethods for JSRef<'a, ErrorEvent> {
|
|||
}
|
||||
|
||||
fn Message(self) -> DOMString {
|
||||
self.message.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let message = self.message.borrow();
|
||||
message.clone()
|
||||
}
|
||||
|
||||
fn Filename(self) -> DOMString {
|
||||
self.filename.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let filename = self.filename.borrow();
|
||||
filename.clone()
|
||||
}
|
||||
|
||||
fn Error(self, _cx: *mut JSContext) -> JSVal {
|
||||
|
|
|
@ -178,7 +178,9 @@ impl<'a> EventMethods for JSRef<'a, Event> {
|
|||
}
|
||||
|
||||
fn Type(self) -> DOMString {
|
||||
self.type_.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let type_ = self.type_.borrow();
|
||||
type_.clone()
|
||||
}
|
||||
|
||||
fn GetTarget(self) -> Option<Temporary<EventTarget>> {
|
||||
|
|
|
@ -245,7 +245,9 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
|
|||
}
|
||||
|
||||
fn has_handlers(self) -> bool {
|
||||
!self.handlers.borrow().is_empty()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let handlers = self.handlers.borrow();
|
||||
!handlers.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,10 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
|||
|
||||
#[allow(unsafe_blocks)]
|
||||
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
||||
if self.data.borrow().contains_key(&name) {
|
||||
match (*self.data.borrow())[name][0].clone() {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
if data.contains_key(&name) {
|
||||
match data[name][0].clone() {
|
||||
FormDatum::StringData(ref s) => Some(eString(s.clone())),
|
||||
FormDatum::FileData(ref f) => {
|
||||
Some(eFile(Unrooted::from_js(*f)))
|
||||
|
@ -97,7 +99,9 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
|||
}
|
||||
|
||||
fn Has(self, name: DOMString) -> bool {
|
||||
self.data.borrow().contains_key(&name)
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
data.contains_key(&name)
|
||||
}
|
||||
#[allow(unrooted_must_root)]
|
||||
fn Set(self, name: DOMString, value: JSRef<Blob>, filename: Option<DOMString>) {
|
||||
|
|
|
@ -229,7 +229,7 @@ impl<'a> Activatable for JSRef<'a, HTMLButtonElement> {
|
|||
h
|
||||
})
|
||||
.find(|r| r.form_owner() == owner)
|
||||
.map(|&:s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey));
|
||||
.map(|s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ use util::str::DOMString;
|
|||
|
||||
use string_cache::Atom;
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
use std::default::Default;
|
||||
|
||||
|
@ -161,7 +162,7 @@ impl<'a> HTMLElementCustomAttributeHelpers for JSRef<'a, HTMLElement> {
|
|||
fn set_custom_attr(self, name: DOMString, value: DOMString) -> ErrorResult {
|
||||
if name.as_slice().chars()
|
||||
.skip_while(|&ch| ch != '\u{2d}')
|
||||
.nth(1).map_or(false, |ch| ch as u8 - b'a' < 26) {
|
||||
.nth(1).map_or(false, |ch| ch >= 'a' && ch <= 'z') {
|
||||
return Err(Syntax);
|
||||
}
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
|
@ -172,7 +173,10 @@ impl<'a> HTMLElementCustomAttributeHelpers for JSRef<'a, HTMLElement> {
|
|||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
element.get_attribute(ns!(""), &Atom::from_slice(to_snake_case(name).as_slice())).map(|attr| {
|
||||
let attr = attr.root();
|
||||
attr.r().value().as_slice().to_owned()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
value.as_slice().to_owned()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,9 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-value
|
||||
fn Value(self) -> DOMString {
|
||||
self.textinput.borrow().get_content()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let textinput = self.textinput.borrow();
|
||||
textinput.get_content()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-input-value
|
||||
|
@ -781,7 +783,7 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
|
|||
h
|
||||
})
|
||||
.find(|r| r.form_owner() == owner)
|
||||
.map(|&:s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey));
|
||||
.map(|s| s.synthetic_click_activation(ctrlKey, shiftKey, altKey, metaKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,12 @@ impl HTMLLinkElement {
|
|||
|
||||
fn get_attr(element: JSRef<Element>, name: &Atom) -> Option<String> {
|
||||
let elem = element.get_attribute(ns!(""), name).root();
|
||||
elem.map(|e| e.r().value().as_slice().to_owned())
|
||||
elem.map(|e| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let e = e.r();
|
||||
let value = e.value();
|
||||
value.as_slice().to_owned()
|
||||
})
|
||||
}
|
||||
|
||||
fn is_stylesheet(value: &Option<String>) -> bool {
|
||||
|
|
|
@ -177,7 +177,9 @@ impl<'a> HTMLTextAreaElementMethods for JSRef<'a, HTMLTextAreaElement> {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value
|
||||
fn Value(self) -> DOMString {
|
||||
self.textinput.borrow().get_content()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let textinput = self.textinput.borrow();
|
||||
textinput.get_content()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#dom-textarea-value
|
||||
|
|
|
@ -85,15 +85,17 @@ impl KeyboardEvent {
|
|||
let ev = KeyboardEvent::new_uninitialized(window).root();
|
||||
ev.r().InitKeyboardEvent(type_, canBubble, cancelable, view, key, location,
|
||||
"".to_owned(), repeat, "".to_owned());
|
||||
*ev.r().code.borrow_mut() = code;
|
||||
ev.r().ctrl.set(ctrlKey);
|
||||
ev.r().alt.set(altKey);
|
||||
ev.r().shift.set(shiftKey);
|
||||
ev.r().meta.set(metaKey);
|
||||
ev.r().char_code.set(char_code);
|
||||
ev.r().key_code.set(key_code);
|
||||
ev.r().is_composing.set(isComposing);
|
||||
Temporary::from_rooted(ev.r())
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let ev = ev.r();
|
||||
*ev.code.borrow_mut() = code;
|
||||
ev.ctrl.set(ctrlKey);
|
||||
ev.alt.set(altKey);
|
||||
ev.shift.set(shiftKey);
|
||||
ev.meta.set(metaKey);
|
||||
ev.char_code.set(char_code);
|
||||
ev.key_code.set(key_code);
|
||||
ev.is_composing.set(isComposing);
|
||||
Temporary::from_rooted(ev)
|
||||
}
|
||||
|
||||
pub fn Constructor(global: GlobalRef,
|
||||
|
@ -571,11 +573,15 @@ impl<'a> KeyboardEventMethods for JSRef<'a, KeyboardEvent> {
|
|||
}
|
||||
|
||||
fn Key(self) -> DOMString {
|
||||
self.key.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let key = self.key.borrow();
|
||||
key.clone()
|
||||
}
|
||||
|
||||
fn Code(self) -> DOMString {
|
||||
self.code.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let code = self.code.borrow();
|
||||
code.clone()
|
||||
}
|
||||
|
||||
fn Location(self) -> u32 {
|
||||
|
|
|
@ -33,11 +33,19 @@ impl NamedNodeMap {
|
|||
|
||||
impl<'a> NamedNodeMapMethods for JSRef<'a, NamedNodeMap> {
|
||||
fn Length(self) -> u32 {
|
||||
self.owner.root().r().attrs().len() as u32
|
||||
let owner = self.owner.root();
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let owner = owner.r();
|
||||
let attrs = owner.attrs();
|
||||
attrs.len() as u32
|
||||
}
|
||||
|
||||
fn Item(self, index: u32) -> Option<Temporary<Attr>> {
|
||||
self.owner.root().r().attrs().as_slice().get(index as uint).map(|x| Temporary::new(x.clone()))
|
||||
let owner = self.owner.root();
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let owner = owner.r();
|
||||
let attrs = owner.attrs();
|
||||
attrs.as_slice().get(index as uint).map(|x| Temporary::new(x.clone()))
|
||||
}
|
||||
|
||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Temporary<Attr>> {
|
||||
|
|
|
@ -856,7 +856,9 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
}
|
||||
|
||||
fn get_unique_id(self) -> String {
|
||||
self.unique_id.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let id = self.unique_id.borrow();
|
||||
id.clone()
|
||||
}
|
||||
|
||||
fn summarize(self) -> NodeInfo {
|
||||
|
@ -865,8 +867,10 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
*unique_id = uuid::Uuid::new_v4().to_simple_string();
|
||||
}
|
||||
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let unique_id = self.unique_id.borrow();
|
||||
NodeInfo {
|
||||
uniqueId: self.unique_id.borrow().clone(),
|
||||
uniqueId: unique_id.clone(),
|
||||
baseURI: self.GetBaseURI().unwrap_or("".to_owned()),
|
||||
parent: self.GetParentNode().root().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()),
|
||||
nodeType: self.NodeType() as uint,
|
||||
|
@ -1122,7 +1126,7 @@ impl NodeIterator {
|
|||
}
|
||||
|
||||
fn next_child<'b>(&self, node: JSRef<'b, Node>) -> Option<JSRef<'b, Node>> {
|
||||
let skip = |&:element: JSRef<Element>| {
|
||||
let skip = |element: JSRef<Element>| {
|
||||
!self.include_descendants_of_void && element.is_void()
|
||||
};
|
||||
|
||||
|
@ -1163,10 +1167,10 @@ impl<'a> Iterator for NodeIterator {
|
|||
.expect("Got to root without reaching start node")
|
||||
.root()
|
||||
.get_unsound_ref_forever();
|
||||
self.depth -= 1;
|
||||
if JS::from_rooted(candidate) == self.start_node {
|
||||
break;
|
||||
}
|
||||
self.depth -= 1;
|
||||
}
|
||||
if JS::from_rooted(candidate) != self.start_node {
|
||||
candidate.next_sibling().map(|node| JS::from_rooted(node.root().r()))
|
||||
|
@ -2058,13 +2062,18 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap();
|
||||
let other_characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(other).unwrap();
|
||||
*characterdata.data() == *other_characterdata.data()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let own_data = characterdata.data();
|
||||
let other_data = other_characterdata.data();
|
||||
*own_data == *other_data
|
||||
}
|
||||
fn is_equal_element_attrs(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||
let element: JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
||||
let other_element: JSRef<Element> = ElementCast::to_ref(other).unwrap();
|
||||
assert!(element.attrs().len() == other_element.attrs().len());
|
||||
element.attrs().iter().map(|attr| attr.root()).all(|attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attrs = element.attrs();
|
||||
attrs.iter().map(|attr| attr.root()).all(|attr| {
|
||||
other_element.attrs().iter().map(|attr| attr.root()).any(|other_attr| {
|
||||
(*attr.r().namespace() == *other_attr.r().namespace()) &&
|
||||
(attr.r().local_name() == other_attr.r().local_name()) &&
|
||||
|
@ -2217,7 +2226,9 @@ impl<'a> VirtualMethods for JSRef<'a, Node> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> style::node::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
|
||||
impl<'a> style::node::TNode<'a> for JSRef<'a, Node> {
|
||||
type Element = JSRef<'a, Element>;
|
||||
|
||||
fn parent_node(self) -> Option<JSRef<'a, Node>> {
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
|
@ -2305,12 +2316,22 @@ impl<'a> style::node::TNode<'a, JSRef<'a, Element>> for JSRef<'a, Node> {
|
|||
match attr.namespace {
|
||||
NamespaceConstraint::Specific(ref ns) => {
|
||||
self.as_element().get_attribute(ns.clone(), name).root()
|
||||
.map_or(false, |attr| test(attr.r().value().as_slice()))
|
||||
.map_or(false, |attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
test(value.as_slice())
|
||||
})
|
||||
},
|
||||
NamespaceConstraint::Any => {
|
||||
self.as_element().get_attributes(name).into_iter()
|
||||
.map(|attr| attr.root())
|
||||
.any(|attr| test(attr.r().value().as_slice()))
|
||||
.any(|attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
let value = attr.value();
|
||||
test(value.as_slice())
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ impl<'a> PrivateTreeWalkerHelpers for JSRef<'a, TreeWalker> {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait TreeWalkerHelpers<'a> {
|
||||
pub trait TreeWalkerHelpers {
|
||||
fn parent_node(self) -> Fallible<Option<Temporary<Node>>>;
|
||||
fn first_child(self) -> Fallible<Option<Temporary<Node>>>;
|
||||
fn last_child(self) -> Fallible<Option<Temporary<Node>>>;
|
||||
|
@ -354,7 +354,7 @@ pub trait TreeWalkerHelpers<'a> {
|
|||
fn prev_node(self) -> Fallible<Option<Temporary<Node>>>;
|
||||
}
|
||||
|
||||
impl<'a> TreeWalkerHelpers<'a> for JSRef<'a, TreeWalker> {
|
||||
impl<'a> TreeWalkerHelpers for JSRef<'a, TreeWalker> {
|
||||
// http://dom.spec.whatwg.org/#dom-treewalker-parentnode
|
||||
fn parent_node(self) -> Fallible<Option<Temporary<Node>>> {
|
||||
// "1. Let node be the value of the currentNode attribute."
|
||||
|
|
|
@ -53,7 +53,10 @@ impl URLSearchParams {
|
|||
let u = u.root();
|
||||
let usp = usp.r();
|
||||
let mut map = usp.data.borrow_mut();
|
||||
*map = u.r().data.borrow().clone();
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let r = u.r();
|
||||
let data = r.data.borrow();
|
||||
*map = data.clone();
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
|
@ -81,11 +84,15 @@ impl<'a> URLSearchParamsMethods for JSRef<'a, URLSearchParams> {
|
|||
}
|
||||
|
||||
fn Get(self, name: DOMString) -> Option<DOMString> {
|
||||
self.data.borrow().get(&name).map(|v| v[0].clone())
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
data.get(&name).map(|v| v[0].clone())
|
||||
}
|
||||
|
||||
fn Has(self, name: DOMString) -> bool {
|
||||
self.data.borrow().contains_key(&name)
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let data = self.data.borrow();
|
||||
data.contains_key(&name)
|
||||
}
|
||||
|
||||
fn Set(self, name: DOMString, value: DOMString) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//[Unforgeable] readonly attribute WindowProxy window;
|
||||
//[Replaceable] readonly attribute WindowProxy self;
|
||||
readonly attribute Window window;
|
||||
readonly attribute Window self;
|
||||
[BinaryName="Self_"] readonly attribute Window self;
|
||||
/*[Unforgeable]*/ readonly attribute Document document;
|
||||
// attribute DOMString name;
|
||||
/*[PutForwards=href, Unforgeable]*/ readonly attribute Location location;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// http://www.whatwg.org/html/#workerglobalscope
|
||||
//[Exposed=Worker]
|
||||
interface WorkerGlobalScope : EventTarget {
|
||||
readonly attribute WorkerGlobalScope self;
|
||||
[BinaryName="Self_"] readonly attribute WorkerGlobalScope self;
|
||||
readonly attribute WorkerLocation location;
|
||||
|
||||
//void close();
|
||||
|
|
|
@ -179,11 +179,11 @@ impl Window {
|
|||
&self.image_cache_task
|
||||
}
|
||||
|
||||
pub fn compositor(&self) -> RefMut<Box<ScriptListener+'static>> {
|
||||
pub fn compositor<'a>(&'a self) -> RefMut<'a, Box<ScriptListener+'static>> {
|
||||
self.compositor.borrow_mut()
|
||||
}
|
||||
|
||||
pub fn browser_context(&self) -> Ref<Option<BrowserContext>> {
|
||||
pub fn browser_context<'a>(&'a self) -> Ref<'a, Option<BrowserContext>> {
|
||||
self.browser_context.borrow()
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,9 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
}
|
||||
|
||||
fn Document(self) -> Temporary<Document> {
|
||||
self.browser_context().as_ref().unwrap().active_document()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let context = self.browser_context();
|
||||
context.as_ref().unwrap().active_document()
|
||||
}
|
||||
|
||||
fn Location(self) -> Temporary<Location> {
|
||||
|
@ -301,7 +303,9 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
}
|
||||
|
||||
fn GetFrameElement(self) -> Option<Temporary<Element>> {
|
||||
self.browser_context().as_ref().unwrap().frame_element()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let context = self.browser_context();
|
||||
context.as_ref().unwrap().frame_element()
|
||||
}
|
||||
|
||||
fn Navigator(self) -> Temporary<Navigator> {
|
||||
|
@ -356,7 +360,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
Temporary::from_rooted(self)
|
||||
}
|
||||
|
||||
fn Self(self) -> Temporary<Window> {
|
||||
fn Self_(self) -> Temporary<Window> {
|
||||
self.Window()
|
||||
}
|
||||
|
||||
|
@ -373,7 +377,10 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
browser_context.frame_element().map_or(self.Window(), |fe| {
|
||||
let frame_element = fe.root();
|
||||
let window = window_from_node(frame_element.r()).root();
|
||||
window.r().browser_context().as_ref().unwrap().active_window()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let r = window.r();
|
||||
let context = r.browser_context();
|
||||
context.as_ref().unwrap().active_window()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -644,7 +651,9 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
|
|||
}
|
||||
|
||||
fn steal_fragment_name(self) -> Option<String> {
|
||||
self.fragment_name.borrow_mut().take()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let mut name = self.fragment_name.borrow_mut();
|
||||
name.take()
|
||||
}
|
||||
|
||||
fn set_window_size(self, size: WindowSizeData) {
|
||||
|
@ -688,7 +697,9 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
|
|||
}
|
||||
|
||||
fn layout_is_idle(self) -> bool {
|
||||
self.layout_join_port.borrow().is_none()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let port = self.layout_join_port.borrow();
|
||||
port.is_none()
|
||||
}
|
||||
|
||||
fn set_resize_event(self, event: WindowSizeData) {
|
||||
|
|
|
@ -84,7 +84,7 @@ impl WorkerGlobalScope {
|
|||
}
|
||||
|
||||
impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
||||
fn Self(self) -> Temporary<WorkerGlobalScope> {
|
||||
fn Self_(self) -> Temporary<WorkerGlobalScope> {
|
||||
Temporary::from_rooted(self)
|
||||
}
|
||||
|
||||
|
|
|
@ -369,9 +369,13 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
|||
// Step 4
|
||||
Some(Method::Connect) | Some(Method::Trace) => Err(Security),
|
||||
Some(Method::Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security),
|
||||
Some(_) if method.is_token() => {
|
||||
Some(parsed_method) => {
|
||||
// Step 3
|
||||
if !method.is_token() {
|
||||
return Err(Syntax)
|
||||
}
|
||||
|
||||
*self.request_method.borrow_mut() = maybe_method.unwrap();
|
||||
*self.request_method.borrow_mut() = parsed_method;
|
||||
|
||||
// Step 6
|
||||
let base = self.global.root().r().get_url();
|
||||
|
@ -675,7 +679,9 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
|||
self.status.get()
|
||||
}
|
||||
fn StatusText(self) -> ByteString {
|
||||
self.status_text.borrow().clone()
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let status_text = self.status_text.borrow();
|
||||
status_text.clone()
|
||||
}
|
||||
fn GetResponseHeader(self, name: ByteString) -> Option<ByteString> {
|
||||
self.filter_response_headers().iter().find(|h| {
|
||||
|
@ -981,9 +987,12 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
None => {}
|
||||
}
|
||||
|
||||
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let response = self.response.borrow();
|
||||
// According to Simon, decode() should never return an error, so unwrap()ing
|
||||
// the result should be fine. XXXManishearth have a closer look at this later
|
||||
encoding.decode(self.response.borrow().as_slice(), DecoderTrap::Replace).unwrap().to_owned()
|
||||
encoding.decode(response.as_slice(), DecoderTrap::Replace).unwrap().to_owned()
|
||||
}
|
||||
fn filter_response_headers(self) -> Headers {
|
||||
// http://fetch.spec.whatwg.org/#concept-response-header-list
|
||||
|
@ -992,7 +1001,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
use hyper::header::SetCookie;
|
||||
|
||||
// a dummy header so we can use headers.remove::<SetCookie2>()
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
struct SetCookie2;
|
||||
impl Header for SetCookie2 {
|
||||
fn header_name() -> &'static str {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue