diff --git a/src/components/script/dom/bindings/js.rs b/src/components/script/dom/bindings/js.rs index b5a83b01e7c..bbceae0ad6d 100644 --- a/src/components/script/dom/bindings/js.rs +++ b/src/components/script/dom/bindings/js.rs @@ -47,7 +47,7 @@ use layout_interface::TrustedNodeAddress; use script_task::StackRoots; use std::cast; -use std::cell::RefCell; +use std::cell::{Cell, RefCell}; use std::kinds::marker::ContravariantLifetime; /// A type that represents a JS-owned value that is rooted for the lifetime of this value. @@ -269,6 +269,15 @@ impl, U: Reflectable> OptionalSettable for Option> { } } +impl, U: Reflectable> OptionalSettable for Cell>> { + fn assign(&mut self, val: Option) { + let mut item = self.get(); + item.assign(val); + self.set(item); + } +} + + /// Root a rootable Option type (used for Option>) pub trait OptionalRootable { fn root<'a, 'b>(self) -> Option>;