Auto merge of #14495 - frewsxcv:reflectable-domobject, r=jdm

Rename `Reflectable` to `DomObject`.

Fixes https://github.com/servo/servo/issues/8473.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14495)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-12-08 12:41:08 -08:00 committed by GitHub
commit b192ae9db7
72 changed files with 168 additions and 168 deletions

View file

@ -35,7 +35,7 @@ use syntax::symbol::Symbol;
/// Handles the auto-deriving for `#[derive(JSTraceable)]` /// Handles the auto-deriving for `#[derive(JSTraceable)]`
pub mod jstraceable; pub mod jstraceable;
pub mod lints; pub mod lints;
/// Autogenerates implementations of Reflectable on DOM structs /// Autogenerates implementations of DomObject on DOM structs
pub mod reflector; pub mod reflector;
/// Utilities for writing plugins /// Utilities for writing plugins
mod utils; mod utils;

View file

@ -25,14 +25,14 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
Some(f) => { Some(f) => {
let field_name = f.ident; let field_name = f.ident;
let impl_item = quote_item!(cx, let impl_item = quote_item!(cx,
impl ::dom::bindings::reflector::Reflectable for $struct_name { impl ::dom::bindings::reflector::DomObject for $struct_name {
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector { fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector {
&self.$field_name &self.$field_name
} }
} }
); );
let impl_item_mut = quote_item!(cx, let impl_item_mut = quote_item!(cx,
impl ::dom::bindings::reflector::MutReflectable for $struct_name { impl ::dom::bindings::reflector::MutDomObject for $struct_name {
fn init_reflector(&mut self, obj: *mut ::js::jsapi::JSObject) { fn init_reflector(&mut self, obj: *mut ::js::jsapi::JSObject) {
self.$field_name.set_jsobject(obj); self.$field_name.set_jsobject(obj);
} }
@ -45,14 +45,14 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
None => { None => {
let field_name = def.fields()[0].ident; let field_name = def.fields()[0].ident;
let impl_item = quote_item!(cx, let impl_item = quote_item!(cx,
impl ::dom::bindings::reflector::Reflectable for $struct_name { impl ::dom::bindings::reflector::DomObject for $struct_name {
fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector { fn reflector<'a>(&'a self) -> &'a ::dom::bindings::reflector::Reflector {
self.$field_name.reflector() self.$field_name.reflector()
} }
} }
); );
let impl_item_mut = quote_item!(cx, let impl_item_mut = quote_item!(cx,
impl ::dom::bindings::reflector::MutReflectable for $struct_name { impl ::dom::bindings::reflector::MutDomObject for $struct_name {
fn init_reflector(&mut self, obj: *mut ::js::jsapi::JSObject) { fn init_reflector(&mut self, obj: *mut ::js::jsapi::JSObject) {
self.$field_name.init_reflector(obj); self.$field_name.init_reflector(obj);
} }
@ -69,7 +69,7 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable:
unsafe fn to_jsval(&self, unsafe fn to_jsval(&self,
cx: *mut ::js::jsapi::JSContext, cx: *mut ::js::jsapi::JSContext,
rval: ::js::jsapi::MutableHandleValue) { rval: ::js::jsapi::MutableHandleValue) {
let object = ::dom::bindings::reflector::Reflectable::reflector(self).get_jsobject(); let object = ::dom::bindings::reflector::DomObject::reflector(self).get_jsobject();
object.to_jsval(cx, rval) object.to_jsval(cx, rval)
} }
} }

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods; use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::USVString; use dom::bindings::str::USVString;
use dom::blob::{Blob, BlobImpl}; use dom::blob::{Blob, BlobImpl};
use dom::formdata::FormData; use dom::formdata::FormData;
@ -41,7 +41,7 @@ pub enum FetchedData {
// https://fetch.spec.whatwg.org/#concept-body-consume-body // https://fetch.spec.whatwg.org/#concept-body-consume-body
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn consume_body<T: BodyOperations + Reflectable>(object: &T, body_type: BodyType) -> Rc<Promise> { pub fn consume_body<T: BodyOperations + DomObject>(object: &T, body_type: BodyType) -> Rc<Promise> {
let promise = Promise::new(&object.global()); let promise = Promise::new(&object.global());
// Step 1 // Step 1
@ -63,7 +63,7 @@ pub fn consume_body<T: BodyOperations + Reflectable>(object: &T, body_type: Body
// https://fetch.spec.whatwg.org/#concept-body-consume-body // https://fetch.spec.whatwg.org/#concept-body-consume-body
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn consume_body_with_promise<T: BodyOperations + Reflectable>(object: &T, pub fn consume_body_with_promise<T: BodyOperations + DomObject>(object: &T,
body_type: BodyType, body_type: BodyType,
promise: &Promise) { promise: &Promise) {
// Step 5 // Step 5
@ -93,7 +93,7 @@ pub fn consume_body_with_promise<T: BodyOperations + Reflectable>(object: &T,
// https://fetch.spec.whatwg.org/#concept-body-package-data // https://fetch.spec.whatwg.org/#concept-body-package-data
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn run_package_data_algorithm<T: BodyOperations + Reflectable>(object: &T, fn run_package_data_algorithm<T: BodyOperations + DomObject>(object: &T,
bytes: Vec<u8>, bytes: Vec<u8>,
body_type: BodyType, body_type: BodyType,
mime_type: Ref<Vec<u8>>) mime_type: Ref<Vec<u8>>)

View file

@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str}; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::AnimationFrameCallback; use dom::document::AnimationFrameCallback;
use dom::element::Element; use dom::element::Element;

View file

@ -181,7 +181,7 @@ pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Ref
} }
} }
impl<T: Reflectable> JSTraceable for JS<T> { impl<T: DomObject> JSTraceable for JS<T> {
unsafe fn trace(&self, trc: *mut JSTracer) { unsafe fn trace(&self, trc: *mut JSTracer) {
trace_reflector(trc, "", unsafe { (**self.ptr).reflector() }); trace_reflector(trc, "", unsafe { (**self.ptr).reflector() });
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::structuredclone::StructuredCloneData;
use js::jsapi::{JSRuntime, JS_RequestInterruptCallback}; use js::jsapi::{JSRuntime, JS_RequestInterruptCallback};
use js::rust::Runtime; use js::rust::Runtime;
@ -17,11 +17,11 @@ pub enum WorkerScriptMsg {
DOMMessage(StructuredCloneData) DOMMessage(StructuredCloneData)
} }
pub struct SimpleWorkerErrorHandler<T: Reflectable> { pub struct SimpleWorkerErrorHandler<T: DomObject> {
pub addr: Trusted<T>, pub addr: Trusted<T>,
} }
impl<T: Reflectable> SimpleWorkerErrorHandler<T> { impl<T: DomObject> SimpleWorkerErrorHandler<T> {
pub fn new(addr: Trusted<T>) -> SimpleWorkerErrorHandler<T> { pub fn new(addr: Trusted<T>) -> SimpleWorkerErrorHandler<T> {
SimpleWorkerErrorHandler { SimpleWorkerErrorHandler {
addr: addr addr: addr

View file

@ -4,7 +4,7 @@
use dom::abstractworker::WorkerScriptMsg; use dom::abstractworker::WorkerScriptMsg;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
use script_runtime::{ScriptChan, CommonScriptMsg, ScriptPort}; use script_runtime::{ScriptChan, CommonScriptMsg, ScriptPort};
use std::sync::mpsc::{Receiver, Sender}; use std::sync::mpsc::{Receiver, Sender};
@ -13,12 +13,12 @@ use std::sync::mpsc::{Receiver, Sender};
/// common event loop messages. While this SendableWorkerScriptChan is alive, the associated /// common event loop messages. While this SendableWorkerScriptChan is alive, the associated
/// Worker object will remain alive. /// Worker object will remain alive.
#[derive(JSTraceable, Clone)] #[derive(JSTraceable, Clone)]
pub struct SendableWorkerScriptChan<T: Reflectable> { pub struct SendableWorkerScriptChan<T: DomObject> {
pub sender: Sender<(Trusted<T>, CommonScriptMsg)>, pub sender: Sender<(Trusted<T>, CommonScriptMsg)>,
pub worker: Trusted<T>, pub worker: Trusted<T>,
} }
impl<T: JSTraceable + Reflectable + 'static> ScriptChan for SendableWorkerScriptChan<T> { impl<T: JSTraceable + DomObject + 'static> ScriptChan for SendableWorkerScriptChan<T> {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
self.sender.send((self.worker.clone(), msg)).map_err(|_| ()) self.sender.send((self.worker.clone(), msg)).map_err(|_| ())
} }
@ -35,12 +35,12 @@ impl<T: JSTraceable + Reflectable + 'static> ScriptChan for SendableWorkerScript
/// worker event loop messages. While this SendableWorkerScriptChan is alive, the associated /// worker event loop messages. While this SendableWorkerScriptChan is alive, the associated
/// Worker object will remain alive. /// Worker object will remain alive.
#[derive(JSTraceable, Clone)] #[derive(JSTraceable, Clone)]
pub struct WorkerThreadWorkerChan<T: Reflectable> { pub struct WorkerThreadWorkerChan<T: DomObject> {
pub sender: Sender<(Trusted<T>, WorkerScriptMsg)>, pub sender: Sender<(Trusted<T>, WorkerScriptMsg)>,
pub worker: Trusted<T>, pub worker: Trusted<T>,
} }
impl<T: JSTraceable + Reflectable + 'static> ScriptChan for WorkerThreadWorkerChan<T> { impl<T: JSTraceable + DomObject + 'static> ScriptChan for WorkerThreadWorkerChan<T> {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
self.sender self.sender
.send((self.worker.clone(), WorkerScriptMsg::Common(msg))) .send((self.worker.clone(), WorkerScriptMsg::Common(msg)))
@ -55,7 +55,7 @@ impl<T: JSTraceable + Reflectable + 'static> ScriptChan for WorkerThreadWorkerCh
} }
} }
impl<T: Reflectable> ScriptPort for Receiver<(Trusted<T>, WorkerScriptMsg)> { impl<T: DomObject> ScriptPort for Receiver<(Trusted<T>, WorkerScriptMsg)> {
fn recv(&self) -> Result<CommonScriptMsg, ()> { fn recv(&self) -> Result<CommonScriptMsg, ()> {
match self.recv().map(|(_, msg)| msg) { match self.recv().map(|(_, msg)| msg) {
Ok(WorkerScriptMsg::Common(script_msg)) => Ok(script_msg), Ok(WorkerScriptMsg::Common(script_msg)) => Ok(script_msg),

View file

@ -5,7 +5,7 @@
//! Base classes to work with IDL callbacks. //! Base classes to work with IDL callbacks.
use dom::bindings::error::{Error, Fallible, report_pending_exception}; use dom::bindings::error::{Error, Fallible, report_pending_exception};
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use js::jsapi::{Heap, MutableHandleObject, RootedObject}; use js::jsapi::{Heap, MutableHandleObject, RootedObject};
use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject}; use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject};
@ -132,7 +132,7 @@ impl CallbackInterface {
} }
/// Wraps the reflector for `p` into the compartment of `cx`. /// Wraps the reflector for `p` into the compartment of `cx`.
pub fn wrap_call_this_object<T: Reflectable>(cx: *mut JSContext, pub fn wrap_call_this_object<T: DomObject>(cx: *mut JSContext,
p: &T, p: &T,
rval: MutableHandleObject) { rval: MutableHandleObject) {
rval.set(p.reflector().get_jsobject().get()); rval.set(p.reflector().get_jsobject().get());

View file

@ -5528,8 +5528,8 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'dom::bindings::js::RootedReference', 'dom::bindings::js::RootedReference',
'dom::bindings::namespace::NamespaceObjectClass', 'dom::bindings::namespace::NamespaceObjectClass',
'dom::bindings::namespace::create_namespace_object', 'dom::bindings::namespace::create_namespace_object',
'dom::bindings::reflector::MutReflectable', 'dom::bindings::reflector::MutDomObject',
'dom::bindings::reflector::Reflectable', 'dom::bindings::reflector::DomObject',
'dom::bindings::utils::DOMClass', 'dom::bindings::utils::DOMClass',
'dom::bindings::utils::DOMJSClass', 'dom::bindings::utils::DOMJSClass',
'dom::bindings::utils::DOM_PROTO_UNFORGEABLE_HOLDER_SLOT', 'dom::bindings::utils::DOM_PROTO_UNFORGEABLE_HOLDER_SLOT',
@ -6294,7 +6294,7 @@ class CGCallback(CGClass):
}) })
return [ClassMethod(method.name + '_', method.returnType, args, return [ClassMethod(method.name + '_', method.returnType, args,
bodyInHeader=True, bodyInHeader=True,
templateArgs=["T: Reflectable"], templateArgs=["T: DomObject"],
body=bodyWithThis, body=bodyWithThis,
visibility='pub'), visibility='pub'),
ClassMethod(method.name + '__', method.returnType, argsWithoutThis, ClassMethod(method.name + '__', method.returnType, argsWithoutThis,
@ -6917,7 +6917,7 @@ class GlobalGenRoots():
CGGeneric("use dom::bindings::inheritance::Castable;\n"), CGGeneric("use dom::bindings::inheritance::Castable;\n"),
CGGeneric("use dom::bindings::js::{JS, LayoutJS, Root};\n"), CGGeneric("use dom::bindings::js::{JS, LayoutJS, Root};\n"),
CGGeneric("use dom::bindings::trace::JSTraceable;\n"), CGGeneric("use dom::bindings::trace::JSTraceable;\n"),
CGGeneric("use dom::bindings::reflector::Reflectable;\n"), CGGeneric("use dom::bindings::reflector::DomObject;\n"),
CGGeneric("use js::jsapi::JSTracer;\n\n"), CGGeneric("use js::jsapi::JSTracer;\n\n"),
CGGeneric("use std::mem;\n\n")] CGGeneric("use std::mem;\n\n")]
allprotos = [] allprotos = []

View file

@ -35,7 +35,7 @@
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::reflector::{Reflectable, Reflector}; use dom::bindings::reflector::{DomObject, Reflector};
use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::str::{ByteString, DOMString, USVString};
use dom::bindings::utils::DOMClass; use dom::bindings::utils::DOMClass;
use js; use js;
@ -102,7 +102,7 @@ impl<T: Float + FromJSValConvertible<Config=()>> FromJSValConvertible for Finite
} }
} }
impl <T: Reflectable + IDLInterface> FromJSValConvertible for Root<T> { impl <T: DomObject + IDLInterface> FromJSValConvertible for Root<T> {
type Config = (); type Config = ();
unsafe fn from_jsval(_cx: *mut JSContext, unsafe fn from_jsval(_cx: *mut JSContext,
@ -404,7 +404,7 @@ pub unsafe fn private_from_proto_check<F>(mut obj: *mut JSObject,
/// Get a `*const T` for a DOM object accessible from a `JSObject`. /// Get a `*const T` for a DOM object accessible from a `JSObject`.
pub fn native_from_object<T>(obj: *mut JSObject) -> Result<*const T, ()> pub fn native_from_object<T>(obj: *mut JSObject) -> Result<*const T, ()>
where T: Reflectable + IDLInterface where T: DomObject + IDLInterface
{ {
unsafe { unsafe {
private_from_proto_check(obj, T::derives).map(|ptr| ptr as *const T) private_from_proto_check(obj, T::derives).map(|ptr| ptr as *const T)
@ -418,7 +418,7 @@ pub fn native_from_object<T>(obj: *mut JSObject) -> Result<*const T, ()>
/// not a reflector for a DOM object of the given type (as defined by the /// not a reflector for a DOM object of the given type (as defined by the
/// proto_id and proto_depth). /// proto_id and proto_depth).
pub fn root_from_object<T>(obj: *mut JSObject) -> Result<Root<T>, ()> pub fn root_from_object<T>(obj: *mut JSObject) -> Result<Root<T>, ()>
where T: Reflectable + IDLInterface where T: DomObject + IDLInterface
{ {
native_from_object(obj).map(|ptr| unsafe { Root::from_ref(&*ptr) }) native_from_object(obj).map(|ptr| unsafe { Root::from_ref(&*ptr) })
} }
@ -426,7 +426,7 @@ pub fn root_from_object<T>(obj: *mut JSObject) -> Result<Root<T>, ()>
/// Get a `*const T` for a DOM object accessible from a `HandleValue`. /// Get a `*const T` for a DOM object accessible from a `HandleValue`.
/// Caller is responsible for throwing a JS exception if needed in case of error. /// Caller is responsible for throwing a JS exception if needed in case of error.
pub fn native_from_handlevalue<T>(v: HandleValue) -> Result<*const T, ()> pub fn native_from_handlevalue<T>(v: HandleValue) -> Result<*const T, ()>
where T: Reflectable + IDLInterface where T: DomObject + IDLInterface
{ {
if !v.get().is_object() { if !v.get().is_object() {
return Err(()); return Err(());
@ -437,7 +437,7 @@ pub fn native_from_handlevalue<T>(v: HandleValue) -> Result<*const T, ()>
/// Get a `Root<T>` for a DOM object accessible from a `HandleValue`. /// Get a `Root<T>` for a DOM object accessible from a `HandleValue`.
/// Caller is responsible for throwing a JS exception if needed in case of error. /// Caller is responsible for throwing a JS exception if needed in case of error.
pub fn root_from_handlevalue<T>(v: HandleValue) -> Result<Root<T>, ()> pub fn root_from_handlevalue<T>(v: HandleValue) -> Result<Root<T>, ()>
where T: Reflectable + IDLInterface where T: DomObject + IDLInterface
{ {
if !v.get().is_object() { if !v.get().is_object() {
return Err(()); return Err(());
@ -447,12 +447,12 @@ pub fn root_from_handlevalue<T>(v: HandleValue) -> Result<Root<T>, ()>
/// Get a `Root<T>` for a DOM object accessible from a `HandleObject`. /// Get a `Root<T>` for a DOM object accessible from a `HandleObject`.
pub fn root_from_handleobject<T>(obj: HandleObject) -> Result<Root<T>, ()> pub fn root_from_handleobject<T>(obj: HandleObject) -> Result<Root<T>, ()>
where T: Reflectable + IDLInterface where T: DomObject + IDLInterface
{ {
root_from_object(obj.get()) root_from_object(obj.get())
} }
impl<T: Reflectable> ToJSValConvertible for Root<T> { impl<T: DomObject> ToJSValConvertible for Root<T> {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) { unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
self.reflector().to_jsval(cx, rval); self.reflector().to_jsval(cx, rval);
} }

View file

@ -8,12 +8,12 @@ pub use dom::bindings::codegen::InheritTypes::*;
use dom::bindings::conversions::{DerivedFrom, IDLInterface}; use dom::bindings::conversions::{DerivedFrom, IDLInterface};
use dom::bindings::conversions::get_dom_class; use dom::bindings::conversions::get_dom_class;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use std::mem; use std::mem;
/// A trait to hold the cast functions of IDL interfaces that either derive /// A trait to hold the cast functions of IDL interfaces that either derive
/// or are derived from other interfaces. /// or are derived from other interfaces.
pub trait Castable: IDLInterface + Reflectable + Sized { pub trait Castable: IDLInterface + DomObject + Sized {
/// Check whether a DOM object implements one of its deriving interfaces. /// Check whether a DOM object implements one of its deriving interfaces.
fn is<T>(&self) -> bool fn is<T>(&self) -> bool
where T: DerivedFrom<Self> where T: DerivedFrom<Self>

View file

@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndVal
use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult; use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, Root}; use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, Reflectable, MutReflectable, reflect_dom_object}; use dom::bindings::reflector::{Reflector, DomObject, MutDomObject, reflect_dom_object};
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use js::conversions::ToJSValConvertible; use js::conversions::ToJSValConvertible;
@ -52,36 +52,36 @@ pub trait Iterable {
#[privatize] #[privatize]
#[derive(JSTraceable)] #[derive(JSTraceable)]
#[derive(HeapSizeOf)] #[derive(HeapSizeOf)]
pub struct IterableIterator<T: Reflectable + JSTraceable + Iterable> { pub struct IterableIterator<T: DomObject + JSTraceable + Iterable> {
reflector: Reflector, reflector: Reflector,
iterable: JS<T>, iterable: JS<T>,
type_: IteratorType, type_: IteratorType,
index: Cell<u32>, index: Cell<u32>,
} }
impl<T: Reflectable + JSTraceable + Iterable> Reflectable for IterableIterator<T> { impl<T: DomObject + JSTraceable + Iterable> DomObject for IterableIterator<T> {
fn reflector<'a>(&'a self) -> &'a Reflector { fn reflector<'a>(&'a self) -> &'a Reflector {
&self.reflector &self.reflector
} }
} }
impl<T: Reflectable + JSTraceable + Iterable> MutReflectable for IterableIterator<T> { impl<T: DomObject + JSTraceable + Iterable> MutDomObject for IterableIterator<T> {
fn init_reflector(&mut self, obj: *mut JSObject) { fn init_reflector(&mut self, obj: *mut JSObject) {
self.reflector.set_jsobject(obj); self.reflector.set_jsobject(obj);
} }
} }
impl<T: Reflectable + JSTraceable + Iterable> ToJSValConvertible for IterableIterator<T> { impl<T: DomObject + JSTraceable + Iterable> ToJSValConvertible for IterableIterator<T> {
#[allow(unsafe_code)] #[allow(unsafe_code)]
unsafe fn to_jsval(&self, unsafe fn to_jsval(&self,
cx: *mut JSContext, cx: *mut JSContext,
rval: MutableHandleValue) { rval: MutableHandleValue) {
let object = Reflectable::reflector(self).get_jsobject(); let object = DomObject::reflector(self).get_jsobject();
object.to_jsval(cx, rval) object.to_jsval(cx, rval)
} }
} }
impl<T: Reflectable + JSTraceable + Iterable> IterableIterator<T> { impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
/// Create a new iterator instance for the provided iterable DOM interface. /// Create a new iterator instance for the provided iterable DOM interface.
pub fn new(iterable: &T, pub fn new(iterable: &T,
type_: IteratorType, type_: IteratorType,

View file

@ -26,7 +26,7 @@
use core::nonzero::NonZero; use core::nonzero::NonZero;
use dom::bindings::conversions::DerivedFrom; use dom::bindings::conversions::DerivedFrom;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::reflector::{Reflectable, Reflector}; use dom::bindings::reflector::{DomObject, Reflector};
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
use dom::bindings::trace::trace_reflector; use dom::bindings::trace::trace_reflector;
use dom::node::Node; use dom::node::Node;
@ -76,7 +76,7 @@ impl<T> JS<T> {
} }
} }
impl<T: Reflectable> JS<T> { impl<T: DomObject> JS<T> {
/// Create a JS<T> from a &T /// Create a JS<T> from a &T
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn from_ref(obj: &T) -> JS<T> { pub fn from_ref(obj: &T) -> JS<T> {
@ -87,14 +87,14 @@ impl<T: Reflectable> JS<T> {
} }
} }
impl<'root, T: Reflectable + 'root> RootedReference<'root> for JS<T> { impl<'root, T: DomObject + 'root> RootedReference<'root> for JS<T> {
type Ref = &'root T; type Ref = &'root T;
fn r(&'root self) -> &'root T { fn r(&'root self) -> &'root T {
&self &self
} }
} }
impl<T: Reflectable> Deref for JS<T> { impl<T: DomObject> Deref for JS<T> {
type Target = T; type Target = T;
fn deref(&self) -> &T { fn deref(&self) -> &T {
@ -105,7 +105,7 @@ impl<T: Reflectable> Deref for JS<T> {
} }
} }
unsafe impl<T: Reflectable> JSTraceable for JS<T> { unsafe impl<T: DomObject> JSTraceable for JS<T> {
unsafe fn trace(&self, trc: *mut JSTracer) { unsafe fn trace(&self, trc: *mut JSTracer) {
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
let trace_str = format!("for {} on heap", type_name::<T>()); let trace_str = format!("for {} on heap", type_name::<T>());
@ -158,7 +158,7 @@ impl<T: Castable> LayoutJS<T> {
} }
} }
impl<T: Reflectable> LayoutJS<T> { impl<T: DomObject> LayoutJS<T> {
/// Get the reflector. /// Get the reflector.
pub unsafe fn get_jsobject(&self) -> *mut JSObject { pub unsafe fn get_jsobject(&self) -> *mut JSObject {
debug_assert!(thread_state::get().is_layout()); debug_assert!(thread_state::get().is_layout());
@ -240,7 +240,7 @@ pub trait HeapGCValue: JSTraceable {
impl HeapGCValue for Heap<JSVal> { impl HeapGCValue for Heap<JSVal> {
} }
impl<T: Reflectable> HeapGCValue for JS<T> { impl<T: DomObject> HeapGCValue for JS<T> {
} }
/// A holder that provides interior mutability for GC-managed JSVals. /// A holder that provides interior mutability for GC-managed JSVals.
@ -297,7 +297,7 @@ pub struct MutHeap<T: HeapGCValue> {
val: UnsafeCell<T>, val: UnsafeCell<T>,
} }
impl<T: Reflectable> MutHeap<JS<T>> { impl<T: DomObject> MutHeap<JS<T>> {
/// Create a new `MutHeap`. /// Create a new `MutHeap`.
pub fn new(initial: &T) -> MutHeap<JS<T>> { pub fn new(initial: &T) -> MutHeap<JS<T>> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
@ -330,7 +330,7 @@ impl<T: HeapGCValue> HeapSizeOf for MutHeap<T> {
} }
} }
impl<T: Reflectable> PartialEq for MutHeap<JS<T>> { impl<T: DomObject> PartialEq for MutHeap<JS<T>> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
unsafe { unsafe {
*self.val.get() == *other.val.get() *self.val.get() == *other.val.get()
@ -338,7 +338,7 @@ impl<T: Reflectable> PartialEq for MutHeap<JS<T>> {
} }
} }
impl<T: Reflectable + PartialEq> PartialEq<T> for MutHeap<JS<T>> { impl<T: DomObject + PartialEq> PartialEq<T> for MutHeap<JS<T>> {
fn eq(&self, other: &T) -> bool { fn eq(&self, other: &T) -> bool {
unsafe { unsafe {
**self.val.get() == *other **self.val.get() == *other
@ -358,7 +358,7 @@ pub struct MutNullableHeap<T: HeapGCValue> {
ptr: UnsafeCell<Option<T>>, ptr: UnsafeCell<Option<T>>,
} }
impl<T: Reflectable> MutNullableHeap<JS<T>> { impl<T: DomObject> MutNullableHeap<JS<T>> {
/// Create a new `MutNullableHeap`. /// Create a new `MutNullableHeap`.
pub fn new(initial: Option<&T>) -> MutNullableHeap<JS<T>> { pub fn new(initial: Option<&T>) -> MutNullableHeap<JS<T>> {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
@ -416,7 +416,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
} }
} }
impl<T: Reflectable> PartialEq for MutNullableHeap<JS<T>> { impl<T: DomObject> PartialEq for MutNullableHeap<JS<T>> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
unsafe { unsafe {
*self.ptr.get() == *other.ptr.get() *self.ptr.get() == *other.ptr.get()
@ -424,7 +424,7 @@ impl<T: Reflectable> PartialEq for MutNullableHeap<JS<T>> {
} }
} }
impl<'a, T: Reflectable> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> { impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> {
fn eq(&self, other: &Option<&T>) -> bool { fn eq(&self, other: &Option<&T>) -> bool {
unsafe { unsafe {
*self.ptr.get() == other.map(JS::from_ref) *self.ptr.get() == other.map(JS::from_ref)
@ -449,7 +449,7 @@ impl<T: HeapGCValue> HeapSizeOf for MutNullableHeap<T> {
} }
} }
impl<T: Reflectable> LayoutJS<T> { impl<T: DomObject> LayoutJS<T> {
/// Returns an unsafe pointer to the interior of this JS object. This is /// Returns an unsafe pointer to the interior of this JS object. This is
/// the only method that be safely accessed from layout. (The fact that /// the only method that be safely accessed from layout. (The fact that
/// this is unsafe is what necessitates the layout wrappers.) /// this is unsafe is what necessitates the layout wrappers.)
@ -475,14 +475,14 @@ pub trait RootedReference<'root> {
fn r(&'root self) -> Self::Ref; fn r(&'root self) -> Self::Ref;
} }
impl<'root, T: JSTraceable + Reflectable + 'root> RootedReference<'root> for [JS<T>] { impl<'root, T: JSTraceable + DomObject + 'root> RootedReference<'root> for [JS<T>] {
type Ref = &'root [&'root T]; type Ref = &'root [&'root T];
fn r(&'root self) -> &'root [&'root T] { fn r(&'root self) -> &'root [&'root T] {
unsafe { mem::transmute(self) } unsafe { mem::transmute(self) }
} }
} }
impl<'root, T: Reflectable + 'root> RootedReference<'root> for Rc<T> { impl<'root, T: DomObject + 'root> RootedReference<'root> for Rc<T> {
type Ref = &'root T; type Ref = &'root T;
fn r(&'root self) -> &'root T { fn r(&'root self) -> &'root T {
self self
@ -566,7 +566,7 @@ pub unsafe fn trace_roots(tracer: *mut JSTracer) {
/// for the same JS value. `Root`s cannot outlive the associated /// for the same JS value. `Root`s cannot outlive the associated
/// `RootCollection` object. /// `RootCollection` object.
#[allow_unrooted_interior] #[allow_unrooted_interior]
pub struct Root<T: Reflectable> { pub struct Root<T: DomObject> {
/// Reference to rooted value that must not outlive this container /// Reference to rooted value that must not outlive this container
ptr: NonZero<*const T>, ptr: NonZero<*const T>,
/// List that ensures correct dynamic root ordering /// List that ensures correct dynamic root ordering
@ -594,7 +594,7 @@ impl<T: Castable> Root<T> {
} }
} }
impl<T: Reflectable> Root<T> { impl<T: DomObject> Root<T> {
/// Create a new stack-bounded root for the provided JS-owned value. /// Create a new stack-bounded root for the provided JS-owned value.
/// It cannot outlive its associated `RootCollection`, and it gives /// It cannot outlive its associated `RootCollection`, and it gives
/// out references which cannot outlive this new `Root`. /// out references which cannot outlive this new `Root`.
@ -616,14 +616,14 @@ impl<T: Reflectable> Root<T> {
} }
} }
impl<'root, T: Reflectable + 'root> RootedReference<'root> for Root<T> { impl<'root, T: DomObject + 'root> RootedReference<'root> for Root<T> {
type Ref = &'root T; type Ref = &'root T;
fn r(&'root self) -> &'root T { fn r(&'root self) -> &'root T {
self self
} }
} }
impl<T: Reflectable> Deref for Root<T> { impl<T: DomObject> Deref for Root<T> {
type Target = T; type Target = T;
fn deref(&self) -> &T { fn deref(&self) -> &T {
debug_assert!(thread_state::get().is_script()); debug_assert!(thread_state::get().is_script());
@ -631,25 +631,25 @@ impl<T: Reflectable> Deref for Root<T> {
} }
} }
impl<T: Reflectable + HeapSizeOf> HeapSizeOf for Root<T> { impl<T: DomObject + HeapSizeOf> HeapSizeOf for Root<T> {
fn heap_size_of_children(&self) -> usize { fn heap_size_of_children(&self) -> usize {
(**self).heap_size_of_children() (**self).heap_size_of_children()
} }
} }
impl<T: Reflectable> PartialEq for Root<T> { impl<T: DomObject> PartialEq for Root<T> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
self.ptr == other.ptr self.ptr == other.ptr
} }
} }
impl<T: Reflectable> Clone for Root<T> { impl<T: DomObject> Clone for Root<T> {
fn clone(&self) -> Root<T> { fn clone(&self) -> Root<T> {
Root::from_ref(&*self) Root::from_ref(&*self)
} }
} }
impl<T: Reflectable> Drop for Root<T> { impl<T: DomObject> Drop for Root<T> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
(*self.root_list).unroot(self.reflector()); (*self.root_list).unroot(self.reflector());

View file

@ -24,7 +24,7 @@
use core::nonzero::NonZero; use core::nonzero::NonZero;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflectable, Reflector}; use dom::bindings::reflector::{DomObject, Reflector};
use dom::bindings::trace::trace_reflector; use dom::bindings::trace::trace_reflector;
use dom::promise::Promise; use dom::promise::Promise;
use js::jsapi::JSTracer; use js::jsapi::JSTracer;
@ -55,7 +55,7 @@ pub struct TrustedReference(*const libc::c_void);
unsafe impl Send for TrustedReference {} unsafe impl Send for TrustedReference {}
impl TrustedReference { impl TrustedReference {
fn new<T: Reflectable>(ptr: *const T) -> TrustedReference { fn new<T: DomObject>(ptr: *const T) -> TrustedReference {
TrustedReference(ptr as *const libc::c_void) TrustedReference(ptr as *const libc::c_void)
} }
} }
@ -122,7 +122,7 @@ impl TrustedPromise {
/// DOM object is guaranteed to live at least as long as the last outstanding /// DOM object is guaranteed to live at least as long as the last outstanding
/// `Trusted<T>` instance. /// `Trusted<T>` instance.
#[allow_unrooted_interior] #[allow_unrooted_interior]
pub struct Trusted<T: Reflectable> { pub struct Trusted<T: DomObject> {
/// A pointer to the Rust DOM object of type T, but void to allow /// A pointer to the Rust DOM object of type T, but void to allow
/// sending `Trusted<T>` between threads, regardless of T's sendability. /// sending `Trusted<T>` between threads, regardless of T's sendability.
refcount: Arc<TrustedReference>, refcount: Arc<TrustedReference>,
@ -130,9 +130,9 @@ pub struct Trusted<T: Reflectable> {
phantom: PhantomData<T>, phantom: PhantomData<T>,
} }
unsafe impl<T: Reflectable> Send for Trusted<T> {} unsafe impl<T: DomObject> Send for Trusted<T> {}
impl<T: Reflectable> Trusted<T> { impl<T: DomObject> Trusted<T> {
/// Create a new `Trusted<T>` instance from an existing DOM pointer. The DOM object will /// Create a new `Trusted<T>` instance from an existing DOM pointer. The DOM object will
/// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's /// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's
/// lifetime. /// lifetime.
@ -164,7 +164,7 @@ impl<T: Reflectable> Trusted<T> {
} }
} }
impl<T: Reflectable> Clone for Trusted<T> { impl<T: DomObject> Clone for Trusted<T> {
fn clone(&self) -> Trusted<T> { fn clone(&self) -> Trusted<T> {
Trusted { Trusted {
refcount: self.refcount.clone(), refcount: self.refcount.clone(),
@ -200,7 +200,7 @@ impl LiveDOMReferences {
table.entry(&*promise).or_insert(vec![]).push(promise) table.entry(&*promise).or_insert(vec![]).push(promise)
} }
fn addref<T: Reflectable>(&self, ptr: *const T) -> Arc<TrustedReference> { fn addref<T: DomObject>(&self, ptr: *const T) -> Arc<TrustedReference> {
let mut table = self.reflectable_table.borrow_mut(); let mut table = self.reflectable_table.borrow_mut();
let capacity = table.capacity(); let capacity = table.capacity();
let len = table.len(); let len = table.len();

View file

@ -18,7 +18,7 @@ pub fn reflect_dom_object<T, U>(
global: &U, global: &U,
wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box<T>) -> Root<T>) wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box<T>) -> Root<T>)
-> Root<T> -> Root<T>
where T: Reflectable, U: DerivedFrom<GlobalScope> where T: DomObject, U: DerivedFrom<GlobalScope>
{ {
let global_scope = global.upcast(); let global_scope = global.upcast();
unsafe { unsafe {
@ -77,18 +77,18 @@ impl Reflector {
} }
/// A trait to provide access to the `Reflector` for a DOM object. /// A trait to provide access to the `Reflector` for a DOM object.
pub trait Reflectable { pub trait DomObject {
/// Returns the receiver's reflector. /// Returns the receiver's reflector.
fn reflector(&self) -> &Reflector; fn reflector(&self) -> &Reflector;
/// Returns the global scope of the realm that the Reflectable was created in. /// Returns the global scope of the realm that the DomObject was created in.
fn global(&self) -> Root<GlobalScope> where Self: Sized { fn global(&self) -> Root<GlobalScope> where Self: Sized {
GlobalScope::from_reflector(self) GlobalScope::from_reflector(self)
} }
} }
/// A trait to initialize the `Reflector` for a DOM object. /// A trait to initialize the `Reflector` for a DOM object.
pub trait MutReflectable: Reflectable { pub trait MutDomObject: DomObject {
/// Initializes the Reflector /// Initializes the Reflector
fn init_reflector(&mut self, obj: *mut JSObject); fn init_reflector(&mut self, obj: *mut JSObject);
} }

View file

@ -38,7 +38,7 @@ use dom::abstractworker::SharedRt;
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::js::{JS, Root}; use dom::bindings::js::{JS, Root};
use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::{Reflectable, Reflector}; use dom::bindings::reflector::{DomObject, Reflector};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::bindings::utils::WindowProxyHandler; use dom::bindings::utils::WindowProxyHandler;
use dom::document::PendingRestyle; use dom::document::PendingRestyle;
@ -426,7 +426,7 @@ unsafe impl<T> JSTraceable for IpcReceiver<T> where T: Deserialize + Serialize {
} }
} }
unsafe impl<T: Reflectable> JSTraceable for Trusted<T> { unsafe impl<T: DomObject> JSTraceable for Trusted<T> {
#[inline] #[inline]
unsafe fn trace(&self, _: *mut JSTracer) { unsafe fn trace(&self, _: *mut JSTracer) {
// Do nothing // Do nothing
@ -635,9 +635,9 @@ impl RootedTraceableSet {
/// Roots any JSTraceable thing /// Roots any JSTraceable thing
/// ///
/// If you have a valid Reflectable, use Root. /// If you have a valid DomObject, use Root.
/// If you have GC things like *mut JSObject or JSVal, use rooted!. /// If you have GC things like *mut JSObject or JSVal, use rooted!.
/// If you have an arbitrary number of Reflectables to root, use rooted_vec!. /// If you have an arbitrary number of DomObjects to root, use rooted_vec!.
/// If you know what you're doing, use this. /// If you know what you're doing, use this.
#[derive(JSTraceable)] #[derive(JSTraceable)]
pub struct RootedTraceable<'a, T: 'a + JSTraceable> { pub struct RootedTraceable<'a, T: 'a + JSTraceable> {
@ -690,7 +690,7 @@ pub struct RootedVec<'a, T: 'a + JSTraceable> {
root: &'a mut RootableVec<T>, root: &'a mut RootableVec<T>,
} }
impl<'a, T: JSTraceable + Reflectable> RootedVec<'a, JS<T>> { impl<'a, T: JSTraceable + DomObject> RootedVec<'a, JS<T>> {
/// Create a vector of items of type T that is rooted for /// Create a vector of items of type T that is rooted for
/// the lifetime of this struct /// the lifetime of this struct
pub fn new<I: Iterator<Item = Root<T>>>(root: &'a mut RootableVec<JS<T>>, iter: I) pub fn new<I: Iterator<Item = Root<T>>>(root: &'a mut RootableVec<JS<T>>, iter: I)

View file

@ -13,7 +13,7 @@
use core::nonzero::NonZero; use core::nonzero::NonZero;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
use heapsize::HeapSizeOf; use heapsize::HeapSizeOf;
use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot}; use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot};
@ -46,7 +46,7 @@ pub struct WeakBox<T: WeakReferenceable> {
} }
/// Trait implemented by weak-referenceable interfaces. /// Trait implemented by weak-referenceable interfaces.
pub trait WeakReferenceable: Reflectable + Sized { pub trait WeakReferenceable: DomObject + Sized {
/// Downgrade a DOM object reference to a weak one. /// Downgrade a DOM object reference to a weak one.
fn downgrade(&self) -> WeakRef<Self> { fn downgrade(&self) -> WeakRef<Self> {
unsafe { unsafe {

View file

@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::codegen::UnionTypes::BlobOrString;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::{JS, Root}; use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use encoding::all::UTF_8; use encoding::all::UTF_8;

View file

@ -17,7 +17,7 @@ use dom::bindings::error::Error::{self, NotFound, Security, Type};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bluetoothadvertisingdata::BluetoothAdvertisingData; use dom::bluetoothadvertisingdata::BluetoothAdvertisingData;
use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothdevice::BluetoothDevice;
@ -53,7 +53,7 @@ const SERVICE_ERROR: &'static str = "'services', if present, must contain at lea
const OPTIONS_ERROR: &'static str = "Fields of 'options' conflict with each other. const OPTIONS_ERROR: &'static str = "Fields of 'options' conflict with each other.
Either 'acceptAllDevices' member must be true, or 'filters' member must be set to a value."; Either 'acceptAllDevices' member must be true, or 'filters' member must be set to a value.";
struct BluetoothContext<T: AsyncBluetoothListener + Reflectable> { struct BluetoothContext<T: AsyncBluetoothListener + DomObject> {
promise: Option<TrustedPromise>, promise: Option<TrustedPromise>,
receiver: Trusted<T>, receiver: Trusted<T>,
} }
@ -62,9 +62,9 @@ pub trait AsyncBluetoothListener {
fn handle_response(&self, result: BluetoothResponse, cx: *mut JSContext, promise: &Rc<Promise>); fn handle_response(&self, result: BluetoothResponse, cx: *mut JSContext, promise: &Rc<Promise>);
} }
impl<Listener: AsyncBluetoothListener + Reflectable> PreInvoke for BluetoothContext<Listener> {} impl<Listener: AsyncBluetoothListener + DomObject> PreInvoke for BluetoothContext<Listener> {}
impl<Listener: AsyncBluetoothListener + Reflectable> BluetoothResponseListener for BluetoothContext<Listener> { impl<Listener: AsyncBluetoothListener + DomObject> BluetoothResponseListener for BluetoothContext<Listener> {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
fn response(&mut self, response: BluetoothResponseResult) { fn response(&mut self, response: BluetoothResponseResult) {
let promise = self.promise.take().expect("bt promise is missing").root(); let promise = self.promise.take().expect("bt promise is missing").root();
@ -174,7 +174,7 @@ impl Bluetooth {
} }
} }
pub fn response_async<T: AsyncBluetoothListener + Reflectable + 'static>( pub fn response_async<T: AsyncBluetoothListener + DomObject + 'static>(
promise: &Rc<Promise>, promise: &Rc<Promise>,
receiver: &T) -> IpcSender<BluetoothResponseResult> { receiver: &T) -> IpcSender<BluetoothResponseResult> {
let (action_sender, action_receiver) = ipc::channel().unwrap(); let (action_sender, action_receiver) = ipc::channel().unwrap();

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMet
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::js::{JS, Root, MutHeap, MutNullableHeap}; use dom::bindings::js::{JS, Root, MutHeap, MutNullableHeap};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bluetooth::Bluetooth; use dom::bluetooth::Bluetooth;
use dom::bluetoothadvertisingdata::BluetoothAdvertisingData; use dom::bluetoothadvertisingdata::BluetoothAdvertisingData;

View file

@ -17,7 +17,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security}; use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString}; use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties;

View file

@ -14,7 +14,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::error::Error::{self, InvalidModification, Network, Security}; use dom::bindings::error::Error::{self, InvalidModification, Network, Security};
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString}; use dom::bindings::str::{ByteString, DOMString};
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH}; use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH};

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot
use dom::bindings::error::Error::{self, Network, Security}; use dom::bindings::error::Error::{self, Network, Security};
use dom::bindings::error::ErrorResult; use dom::bindings::error::ErrorResult;
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothdevice::BluetoothDevice;
use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};

View file

@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::Error::{self, Network, Security}; use dom::bindings::error::Error::{self, Network, Security};
use dom::bindings::js::{JS, MutHeap, Root}; use dom::bindings::js::{JS, MutHeap, Root};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetooth::{AsyncBluetoothListener, response_async};
use dom::bluetoothdevice::BluetoothDevice; use dom::bluetoothdevice::BluetoothDevice;

View file

@ -6,7 +6,7 @@ use dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor}; use dom::bindings::proxyhandler::{fill_property_descriptor, get_property_descriptor};
use dom::bindings::reflector::{Reflectable, MutReflectable, Reflector}; use dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::WindowProxyHandler; use dom::bindings::utils::WindowProxyHandler;
use dom::bindings::utils::get_array_index_from_id; use dom::bindings::utils::get_array_index_from_id;

View file

@ -23,7 +23,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, Root}; use dom::bindings::js::{JS, LayoutJS, Root};
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle};
use dom::canvaspattern::CanvasPattern; use dom::canvaspattern::CanvasPattern;

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMet
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssrule::CSSRule; use dom::cssrule::CSSRule;
use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::cssrulelist::{CSSRuleList, RulesSource};

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding;
use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::csskeyframerule::CSSKeyframeRule; use dom::csskeyframerule::CSSKeyframeRule;
use dom::cssrule::{CSSRule, SpecificCSSRule}; use dom::cssrule::{CSSRule, SpecificCSSRule};

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding;
use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssgroupingrule::CSSGroupingRule; use dom::cssgroupingrule::CSSGroupingRule;
use dom::cssrule::SpecificCSSRule; use dom::cssrule::SpecificCSSRule;

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSRuleListBinding;
use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods;
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::csskeyframerule::CSSKeyframeRule; use dom::csskeyframerule::CSSKeyframeRule;
use dom::cssrule::CSSRule; use dom::cssrule::CSSRule;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods
use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::js::{JS, Root, MutNullableHeap}; use dom::bindings::js::{JS, Root, MutNullableHeap};
use dom::bindings::reflector::{reflect_dom_object, Reflectable}; use dom::bindings::reflector::{reflect_dom_object, DomObject};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssrulelist::{CSSRuleList, RulesSource}; use dom::cssrulelist::{CSSRuleList, RulesSource};
use dom::element::Element; use dom::element::Element;

View file

@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use dom::bindings::error::{ErrorInfo, ErrorResult}; use dom::bindings::error::{ErrorInfo, ErrorResult};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, RootCollection}; use dom::bindings::js::{Root, RootCollection};
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::structuredclone::StructuredCloneData;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;

View file

@ -28,7 +28,7 @@ use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
use dom::bindings::js::RootedReference; use dom::bindings::js::RootedReference;
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type};
use dom::bindings::xmlname::XMLName::InvalidXMLName; use dom::bindings::xmlname::XMLName::InvalidXMLName;

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use dom::bindings::error; use dom::bindings::error;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::{reflect_dom_object, Reflectable, Reflector}; use dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use dom::dommatrix::DOMMatrix; use dom::dommatrix::DOMMatrix;
use dom::dompoint::DOMPoint; use dom::dompoint::DOMPoint;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMetho
use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit; use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::js::{Root, JS}; use dom::bindings::js::{Root, JS};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::dompoint::DOMPoint; use dom::dompoint::DOMPoint;
use dom::domrect::DOMRect; use dom::domrect::DOMRect;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;

View file

@ -7,7 +7,7 @@ use dom::bindings::callback::ExceptionHandling::Report;
use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root, RootedReference}; use dom::bindings::js::{JS, Root, RootedReference};
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::document::Document; use dom::document::Document;
use dom::event::{Event, EventPhase}; use dom::event::{Event, EventPhase};
use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase}; use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase};

View file

@ -9,7 +9,7 @@ use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::Event; use dom::event::Event;
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;

View file

@ -18,7 +18,7 @@ use dom::bindings::codegen::UnionTypes::EventOrString;
use dom::bindings::error::{Error, Fallible, report_pending_exception}; use dom::bindings::error::{Error, Fallible, report_pending_exception};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflectable, Reflector}; use dom::bindings::reflector::{DomObject, Reflector};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::element::Element; use dom::element::Element;
use dom::errorevent::ErrorEvent; use dom::errorevent::ErrorEvent;
@ -142,7 +142,7 @@ pub enum CompiledEventListener {
impl CompiledEventListener { impl CompiledEventListener {
#[allow(unsafe_code)] #[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm // https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm
pub fn call_or_handle_event<T: Reflectable>(&self, pub fn call_or_handle_event<T: DomObject>(&self,
object: &T, object: &T,
event: &Event, event: &Event,
exception_handle: ExceptionHandling) { exception_handle: ExceptionHandling) {

View file

@ -11,7 +11,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::blob::Blob; use dom::blob::Blob;
use dom::domexception::{DOMErrorName, DOMException}; use dom::domexception::{DOMErrorName, DOMException};

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::UnionTypes::FileOrUSVString;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::iterable::Iterable; use dom::bindings::iterable::Iterable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::blob::{Blob, BlobImpl}; use dom::blob::{Blob, BlobImpl};
use dom::file::File; use dom::file::File;

View file

@ -9,7 +9,7 @@ use dom::bindings::conversions::root_from_object;
use dom::bindings::error::{ErrorInfo, report_pending_exception}; use dom::bindings::error::{ErrorInfo, report_pending_exception};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::crypto::Crypto; use dom::crypto::Crypto;
use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope;
@ -124,7 +124,7 @@ impl GlobalScope {
/// Returns the global scope of the realm that the given DOM object's reflector /// Returns the global scope of the realm that the given DOM object's reflector
/// was created in. /// was created in.
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn from_reflector<T: Reflectable>(reflector: &T) -> Root<Self> { pub fn from_reflector<T: DomObject>(reflector: &T) -> Root<Self> {
unsafe { GlobalScope::from_object(*reflector.reflector().get_jsobject()) } unsafe { GlobalScope::from_object(*reflector.reflector().get_jsobject()) }
} }

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding;
use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods; use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods;
use dom::bindings::codegen::UnionTypes::RadioNodeListOrElement; use dom::bindings::codegen::UnionTypes::RadioNodeListOrElement;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::element::Element; use dom::element::Element;
use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlcollection::{CollectionFilter, HTMLCollection};

View file

@ -15,7 +15,7 @@ use dom::bindings::conversions::DerivedFrom;
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::blob::Blob; use dom::blob::Blob;
use dom::document::Document; use dom::document::Document;
@ -845,7 +845,7 @@ impl<'a> FormSubmitter<'a> {
} }
} }
pub trait FormControl: DerivedFrom<Element> + Reflectable { pub trait FormControl: DerivedFrom<Element> + DomObject {
// FIXME: This is wrong (https://github.com/servo/servo/issues/3553) // FIXME: This is wrong (https://github.com/servo/servo/issues/3553)
// but we need html5ever to do it correctly // but we need html5ever to do it correctly
fn form_owner(&self) -> Option<Root<HTMLFormElement>> { fn form_owner(&self) -> Option<Root<HTMLFormElement>> {

View file

@ -21,7 +21,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::browsingcontext::BrowsingContext; use dom::browsingcontext::BrowsingContext;
use dom::customevent::CustomEvent; use dom::customevent::CustomEvent;

View file

@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMet
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet; use dom::cssstylesheet::CSSStyleSheet;
use dom::document::Document; use dom::document::Document;

View file

@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, MutNullableHeap, JS}; use dom::bindings::js::{Root, MutNullableHeap, JS};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::element::{Element, AttributeMutation}; use dom::element::{Element, AttributeMutation};

View file

@ -14,7 +14,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root}; use dom::bindings::js::{JS, Root};
use dom::bindings::js::RootedReference; use dom::bindings::js::RootedReference;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
use dom::element::{AttributeMutation, Element, ElementCreator}; use dom::element::{AttributeMutation, Element, ElementCreator};

View file

@ -126,7 +126,7 @@
//! not allowed. In particular, any mutable fields use `Cell` or `DOMRefCell` //! not allowed. In particular, any mutable fields use `Cell` or `DOMRefCell`
//! to manage their mutability. //! to manage their mutability.
//! //!
//! `Reflector` and `Reflectable` //! `Reflector` and `DomObject`
//! ============================= //! =============================
//! //!
//! Every DOM object has a `Reflector` as its first (transitive) member field. //! Every DOM object has a `Reflector` as its first (transitive) member field.
@ -136,7 +136,7 @@
//! the DOM object in the reflector, and initializes the pointer to the reflector //! the DOM object in the reflector, and initializes the pointer to the reflector
//! in the `Reflector` field. //! in the `Reflector` field.
//! //!
//! The `Reflectable` trait provides a `reflector()` method that returns the //! The `DomObject` trait provides a `reflector()` method that returns the
//! DOM object's `Reflector`. It is implemented automatically for DOM structs //! DOM object's `Reflector`. It is implemented automatically for DOM structs
//! through the `#[dom_struct]` attribute. //! through the `#[dom_struct]` attribute.
//! //!

View file

@ -5,7 +5,7 @@
use dom::bindings::codegen::Bindings::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding;
use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflector, Reflectable, reflect_dom_object}; use dom::bindings::reflector::{Reflector, DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bluetooth::Bluetooth; use dom::bluetooth::Bluetooth;
use dom::mimetypearray::MimeTypeArray; use dom::mimetypearray::MimeTypeArray;

View file

@ -24,7 +24,7 @@ use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId};
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap}; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::js::RootedReference; use dom::bindings::js::RootedReference;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::bindings::xmlname::namespace_from_domstring; use dom::bindings::xmlname::namespace_from_domstring;
use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers};
@ -800,7 +800,7 @@ impl Node {
pub fn insert_cell_or_row<F, G, I>(&self, index: i32, get_items: F, new_child: G) -> Fallible<Root<HTMLElement>> pub fn insert_cell_or_row<F, G, I>(&self, index: i32, get_items: F, new_child: G) -> Fallible<Root<HTMLElement>>
where F: Fn() -> Root<HTMLCollection>, where F: Fn() -> Root<HTMLCollection>,
G: Fn() -> Root<I>, G: Fn() -> Root<I>,
I: DerivedFrom<Node> + DerivedFrom<HTMLElement> + Reflectable, I: DerivedFrom<Node> + DerivedFrom<HTMLElement> + DomObject,
{ {
if index < -1 { if index < -1 {
return Err(Error::IndexSize); return Err(Error::IndexSize);
@ -1345,7 +1345,7 @@ impl Node {
document: &Document, document: &Document,
wrap_fn: unsafe extern "Rust" fn(*mut JSContext, &GlobalScope, Box<N>) -> Root<N>) wrap_fn: unsafe extern "Rust" fn(*mut JSContext, &GlobalScope, Box<N>) -> Root<N>)
-> Root<N> -> Root<N>
where N: DerivedFrom<Node> + Reflectable where N: DerivedFrom<Node> + DomObject
{ {
let window = document.window(); let window = document.window();
reflect_dom_object(node, window, wrap_fn) reflect_dom_object(node, window, wrap_fn)
@ -2373,11 +2373,11 @@ impl NodeMethods for Node {
} }
} }
pub fn document_from_node<T: DerivedFrom<Node> + Reflectable>(derived: &T) -> Root<Document> { pub fn document_from_node<T: DerivedFrom<Node> + DomObject>(derived: &T) -> Root<Document> {
derived.upcast().owner_doc() derived.upcast().owner_doc()
} }
pub fn window_from_node<T: DerivedFrom<Node> + Reflectable>(derived: &T) -> Root<Window> { pub fn window_from_node<T: DerivedFrom<Node> + DomObject>(derived: &T) -> Root<Window> {
let document = document_from_node(derived); let document = document_from_node(derived);
Root::from_ref(document.window()) Root::from_ref(document.window())
} }

View file

@ -16,7 +16,7 @@ use dom::bindings::codegen::Bindings::PromiseBinding::AnyCallback;
use dom::bindings::conversions::root_from_object; use dom::bindings::conversions::root_from_object;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::MutHeapJSVal; use dom::bindings::js::MutHeapJSVal;
use dom::bindings::reflector::{Reflectable, MutReflectable, Reflector}; use dom::bindings::reflector::{DomObject, MutDomObject, Reflector};
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use dom::promisenativehandler::PromiseNativeHandler; use dom::promisenativehandler::PromiseNativeHandler;
use js::conversions::ToJSValConvertible; use js::conversions::ToJSValConvertible;

View file

@ -18,7 +18,7 @@ use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect;
use dom::bindings::codegen::Bindings::RequestBinding::RequestType; use dom::bindings::codegen::Bindings::RequestBinding::RequestType;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::str::{ByteString, DOMString, USVString};
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use dom::headers::{Guard, Headers}; use dom::headers::{Guard, Headers};

View file

@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, Respons
use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit;
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, USVString}; use dom::bindings::str::{ByteString, USVString};
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use dom::headers::{Headers, Guard}; use dom::headers::{Headers, Guard};

View file

@ -10,7 +10,7 @@ use dom::bindings::error::{ErrorResult, Error};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::USVString; use dom::bindings::str::USVString;
use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::structuredclone::StructuredCloneData;
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;

View file

@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWor
use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions;
use dom::bindings::error::Error; use dom::bindings::error::Error;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::USVString; use dom::bindings::str::USVString;
use dom::client::Client; use dom::client::Client;
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;

View file

@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding;
use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding::ServiceWorkerGlobalScopeMethods; use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding::ServiceWorkerGlobalScopeMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, RootCollection}; use dom::bindings::js::{Root, RootCollection};
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::Event; use dom::event::Event;
use dom::eventtarget::EventTarget; use dom::eventtarget::EventTarget;

View file

@ -8,7 +8,7 @@ use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;

View file

@ -25,7 +25,7 @@ use dom::bindings::js::Root;
use dom::bindings::mozmap::MozMap; use dom::bindings::mozmap::MozMap;
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::refcounted::TrustedPromise; use dom::bindings::refcounted::TrustedPromise;
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString}; use dom::bindings::str::{ByteString, DOMString, USVString};
use dom::bindings::weakref::MutableWeakRef; use dom::bindings::weakref::MutableWeakRef;
use dom::blob::{Blob, BlobImpl}; use dom::blob::{Blob, BlobImpl};

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::TestRunnerBinding;
use dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods; use dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods;
use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::error::{Error, ErrorResult};
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::ipc::{self, IpcSender};

View file

@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods};
use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString}; use dom::bindings::str::{DOMString, USVString};
use dom::blob::Blob; use dom::blob::Blob;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;

View file

@ -7,7 +7,7 @@ use canvas_traits::CanvasMsg;
use dom::bindings::codegen::Bindings::WebGLProgramBinding; use dom::bindings::codegen::Bindings::WebGLProgramBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::webglactiveinfo::WebGLActiveInfo; use dom::webglactiveinfo::WebGLActiveInfo;
use dom::webglobject::WebGLObject; use dom::webglobject::WebGLObject;

View file

@ -14,7 +14,7 @@ use dom::bindings::conversions::{array_buffer_view_to_vec, array_buffer_view_to_
use dom::bindings::error::{Error, Fallible}; use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable}; use dom::event::{Event, EventBubbles, EventCancelable};
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;

View file

@ -13,7 +13,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{DOMString, USVString, is_token}; use dom::bindings::str::{DOMString, USVString, is_token};
use dom::blob::{Blob, BlobImpl}; use dom::blob::{Blob, BlobImpl};
use dom::closeevent::CloseEvent; use dom::closeevent::CloseEvent;

View file

@ -22,7 +22,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::structuredclone::StructuredCloneData;
use dom::bindings::utils::{GlobalStaticData, WindowProxyHandler}; use dom::bindings::utils::{GlobalStaticData, WindowProxyHandler};

View file

@ -12,7 +12,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible, ErrorInfo};
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::structuredclone::StructuredCloneData;
use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope;

View file

@ -12,7 +12,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exceptio
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::crypto::Crypto; use dom::crypto::Crypto;
use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope;

View file

@ -17,7 +17,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutHeapJSVal, MutNullableHeap}; use dom::bindings::js::{JS, MutHeapJSVal, MutNullableHeap};
use dom::bindings::js::{Root, RootedReference}; use dom::bindings::js::{Root, RootedReference};
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object}; use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::str::{ByteString, DOMString, USVString, is_token}; use dom::bindings::str::{ByteString, DOMString, USVString, is_token};
use dom::blob::{Blob, BlobImpl}; use dom::blob::{Blob, BlobImpl};
use dom::document::{Document, IsHTMLDocument}; use dom::document::{Document, IsHTMLDocument};

View file

@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMRespon
use dom::bindings::error::Error; use dom::bindings::error::Error;
use dom::bindings::js::Root; use dom::bindings::js::Root;
use dom::bindings::refcounted::{Trusted, TrustedPromise}; use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use dom::headers::Guard; use dom::headers::Guard;
use dom::promise::Promise; use dom::promise::Promise;

View file

@ -5,7 +5,7 @@
//! Routines for handling measuring the memory usage of arbitrary DOM nodes. //! Routines for handling measuring the memory usage of arbitrary DOM nodes.
use dom::bindings::conversions::get_dom_class; use dom::bindings::conversions::get_dom_class;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use heapsize::{HeapSizeOf, heap_size_of}; use heapsize::{HeapSizeOf, heap_size_of};
use std::os::raw::c_void; use std::os::raw::c_void;
@ -13,7 +13,7 @@ use std::os::raw::c_void;
// associated box in order to stash their pointers in a reserved slot of their // associated box in order to stash their pointers in a reserved slot of their
// JS reflector. // JS reflector.
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn heap_size_of_self_and_children<T: Reflectable + HeapSizeOf>(obj: &T) -> usize { pub fn heap_size_of_self_and_children<T: DomObject + HeapSizeOf>(obj: &T) -> usize {
unsafe { unsafe {
let class = get_dom_class(obj.reflector().get_jsobject().get()).unwrap(); let class = get_dom_class(obj.reflector().get_jsobject().get()).unwrap();
(class.heap_size_of)(obj as *const T as *const c_void) (class.heap_size_of)(obj as *const T as *const c_void)

View file

@ -36,7 +36,7 @@ use dom::bindings::js::{JS, MutNullableHeap, Root, RootCollection};
use dom::bindings::js::{RootCollectionPtr, RootedReference}; use dom::bindings::js::{RootCollectionPtr, RootedReference};
use dom::bindings::num::Finite; use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable; use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::WRAP_CALLBACKS; use dom::bindings::utils::WRAP_CALLBACKS;

View file

@ -11,7 +11,7 @@ use dom::bindings::cell::DOMRefCell;
use dom::bindings::error::Error; use dom::bindings::error::Error;
use dom::bindings::js::JS; use dom::bindings::js::JS;
use dom::bindings::refcounted::Trusted; use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::client::Client; use dom::client::Client;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use dom::promise::Promise; use dom::promise::Promise;

View file

@ -5,7 +5,7 @@
use dom::bindings::callback::ExceptionHandling::Report; use dom::bindings::callback::ExceptionHandling::Report;
use dom::bindings::cell::DOMRefCell; use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::FunctionBinding::Function; use dom::bindings::codegen::Bindings::FunctionBinding::Function;
use dom::bindings::reflector::Reflectable; use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::eventsource::EventSourceTimeoutCallback; use dom::eventsource::EventSourceTimeoutCallback;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
@ -64,7 +64,7 @@ struct OneshotTimer {
// This enum is required to work around the fact that trait objects do not support generic methods. // This enum is required to work around the fact that trait objects do not support generic methods.
// A replacement trait would have a method such as // A replacement trait would have a method such as
// `invoke<T: Reflectable>(self: Box<Self>, this: &T, js_timers: &JsTimers);`. // `invoke<T: DomObject>(self: Box<Self>, this: &T, js_timers: &JsTimers);`.
#[derive(JSTraceable, HeapSizeOf)] #[derive(JSTraceable, HeapSizeOf)]
pub enum OneshotTimerCallback { pub enum OneshotTimerCallback {
XhrTimeout(XHRTimeoutCallback), XhrTimeout(XHRTimeoutCallback),
@ -74,7 +74,7 @@ pub enum OneshotTimerCallback {
} }
impl OneshotTimerCallback { impl OneshotTimerCallback {
fn invoke<T: Reflectable>(self, this: &T, js_timers: &JsTimers) { fn invoke<T: DomObject>(self, this: &T, js_timers: &JsTimers) {
match self { match self {
OneshotTimerCallback::XhrTimeout(callback) => callback.invoke(), OneshotTimerCallback::XhrTimeout(callback) => callback.invoke(),
OneshotTimerCallback::EventSourceTimeout(callback) => callback.invoke(), OneshotTimerCallback::EventSourceTimeout(callback) => callback.invoke(),
@ -482,7 +482,7 @@ fn clamp_duration(nesting_level: u32, unclamped: MsDuration) -> MsDuration {
impl JsTimerTask { impl JsTimerTask {
// see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps // see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn invoke<T: Reflectable>(self, this: &T, timers: &JsTimers) { pub fn invoke<T: DomObject>(self, this: &T, timers: &JsTimers) {
// step 4.1 can be ignored, because we proactively prevent execution // step 4.1 can be ignored, because we proactively prevent execution
// of this task when its scheduled execution is canceled. // of this task when its scheduled execution is canceled.