aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/bindings/trace.rs6
-rw-r--r--components/script/dom/eventtarget.rs5
-rw-r--r--components/script/lib.rs2
3 files changed, 8 insertions, 5 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 930fd59edbe..c4f59491c57 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -39,7 +39,7 @@ use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData};
use net::image_cache_task::ImageCacheTask;
use script_traits::ScriptControlChan;
use std::collections::hashmap::HashMap;
-use collections::hash::Hash;
+use collections::hash::{Hash, Hasher};
use style::PropertyDeclarationBlock;
use std::comm::{Receiver, Sender};
use string_cache::{Atom, Namespace};
@@ -170,7 +170,9 @@ impl<T: JSTraceable> JSTraceable for Option<T> {
}
}
-impl<K: Eq+Hash+JSTraceable, V: JSTraceable> JSTraceable for HashMap<K, V> {
+impl<K,V,S,H> JSTraceable for HashMap<K, V, H> where K: Eq + Hash<S> + JSTraceable,
+ V: JSTraceable,
+ H: Hasher<S> {
#[inline]
fn trace(&self, trc: *mut JSTracer) {
for e in self.iter() {
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 233047691ea..0ced9c9c41e 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -18,6 +18,7 @@ use dom::xmlhttprequest::XMLHttpRequestId;
use dom::virtualmethods::VirtualMethods;
use js::jsapi::{JS_CompileUCFunction, JS_GetFunctionObject, JS_CloneFunctionObject};
use js::jsapi::{JSContext, JSObject};
+use servo_util::fnv::FnvHasher;
use servo_util::str::DOMString;
use libc::{c_char, size_t};
use std::ptr;
@@ -69,7 +70,7 @@ pub struct EventListenerEntry {
pub struct EventTarget {
type_id: EventTargetTypeId,
reflector_: Reflector,
- handlers: DOMRefCell<HashMap<DOMString, Vec<EventListenerEntry>>>,
+ handlers: DOMRefCell<HashMap<DOMString, Vec<EventListenerEntry>, FnvHasher>>,
}
impl EventTarget {
@@ -77,7 +78,7 @@ impl EventTarget {
EventTarget {
type_id: type_id,
reflector_: Reflector::new(),
- handlers: DOMRefCell::new(HashMap::new()),
+ handlers: DOMRefCell::new(HashMap::with_hasher(FnvHasher)),
}
}
diff --git a/components/script/lib.rs b/components/script/lib.rs
index e03801f5217..02a96942927 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -5,7 +5,7 @@
#![comment = "The Servo Parallel Browser Project"]
#![license = "MPL"]
-#![feature(globs, macro_rules, struct_variant, phase, unsafe_destructor)]
+#![feature(default_type_params, globs, macro_rules, struct_variant, phase, unsafe_destructor)]
#![deny(unused_imports, unused_variable)]
#![allow(non_snake_case)]