From b429779be490553b53b7a32dcb4903c45b88ad34 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Thu, 8 Dec 2016 12:41:08 -0800 Subject: [PATCH] servo: Merge #14495 - Rename `Reflectable` to `DomObject` (from frewsxcv:reflectable-domobject); r=jdm Fixes https://github.com/servo/servo/issues/8473. Source-Repo: https://github.com/servo/servo Source-Revision: b192ae9db7082346a4a6a985c5557d4cea75d50e --- servo/components/plugins/lib.rs | 2 +- servo/components/plugins/reflector.rs | 10 ++-- servo/components/script/body.rs | 20 ++++---- servo/components/script/devtools.rs | 2 +- .../script/docs/JS-Servos-only-GC.md | 2 +- servo/components/script/dom/abstractworker.rs | 6 +-- .../script/dom/abstractworkerglobalscope.rs | 12 ++--- .../script/dom/bindings/callback.rs | 8 ++-- .../dom/bindings/codegen/CodegenRust.py | 8 ++-- .../script/dom/bindings/conversions.rs | 16 +++---- .../script/dom/bindings/inheritance.rs | 4 +- .../script/dom/bindings/iterable.rs | 14 +++--- servo/components/script/dom/bindings/js.rs | 48 +++++++++---------- .../script/dom/bindings/refcounted.rs | 14 +++--- .../script/dom/bindings/reflector.rs | 8 ++-- servo/components/script/dom/bindings/trace.rs | 10 ++-- .../components/script/dom/bindings/weakref.rs | 4 +- servo/components/script/dom/blob.rs | 2 +- servo/components/script/dom/bluetooth.rs | 10 ++-- .../components/script/dom/bluetoothdevice.rs | 2 +- .../dom/bluetoothremotegattcharacteristic.rs | 2 +- .../dom/bluetoothremotegattdescriptor.rs | 2 +- .../script/dom/bluetoothremotegattserver.rs | 2 +- .../script/dom/bluetoothremotegattservice.rs | 2 +- .../components/script/dom/browsingcontext.rs | 2 +- .../script/dom/canvasrenderingcontext2d.rs | 2 +- .../components/script/dom/cssgroupingrule.rs | 2 +- .../components/script/dom/csskeyframesrule.rs | 2 +- servo/components/script/dom/cssmediarule.rs | 2 +- servo/components/script/dom/cssrulelist.rs | 2 +- servo/components/script/dom/cssstylesheet.rs | 2 +- .../script/dom/dedicatedworkerglobalscope.rs | 2 +- servo/components/script/dom/document.rs | 2 +- .../script/dom/dommatrixreadonly.rs | 2 +- servo/components/script/dom/domquad.rs | 2 +- .../components/script/dom/eventdispatcher.rs | 2 +- servo/components/script/dom/eventsource.rs | 2 +- servo/components/script/dom/eventtarget.rs | 10 ++-- servo/components/script/dom/filereader.rs | 2 +- servo/components/script/dom/formdata.rs | 2 +- servo/components/script/dom/globalscope.rs | 4 +- .../script/dom/htmlformcontrolscollection.rs | 2 +- .../components/script/dom/htmlformelement.rs | 4 +- .../script/dom/htmliframeelement.rs | 2 +- .../components/script/dom/htmllinkelement.rs | 2 +- .../components/script/dom/htmlmediaelement.rs | 2 +- .../script/dom/htmlscriptelement.rs | 2 +- servo/components/script/dom/mod.rs | 4 +- servo/components/script/dom/navigator.rs | 2 +- servo/components/script/dom/node.rs | 10 ++-- servo/components/script/dom/promise.rs | 2 +- servo/components/script/dom/request.rs | 2 +- servo/components/script/dom/response.rs | 2 +- servo/components/script/dom/serviceworker.rs | 2 +- .../script/dom/serviceworkercontainer.rs | 2 +- .../script/dom/serviceworkerglobalscope.rs | 2 +- servo/components/script/dom/storage.rs | 2 +- servo/components/script/dom/testbinding.rs | 2 +- servo/components/script/dom/testrunner.rs | 2 +- servo/components/script/dom/url.rs | 2 +- servo/components/script/dom/webglprogram.rs | 2 +- .../script/dom/webglrenderingcontext.rs | 2 +- servo/components/script/dom/websocket.rs | 2 +- servo/components/script/dom/window.rs | 2 +- servo/components/script/dom/worker.rs | 2 +- .../script/dom/workerglobalscope.rs | 2 +- servo/components/script/dom/xmlhttprequest.rs | 2 +- servo/components/script/fetch.rs | 2 +- servo/components/script/mem.rs | 4 +- servo/components/script/script_thread.rs | 2 +- servo/components/script/serviceworkerjob.rs | 2 +- servo/components/script/timers.rs | 8 ++-- 72 files changed, 168 insertions(+), 168 deletions(-) diff --git a/servo/components/plugins/lib.rs b/servo/components/plugins/lib.rs index 4fd80252c34b..ee559ecbda06 100644 --- a/servo/components/plugins/lib.rs +++ b/servo/components/plugins/lib.rs @@ -35,7 +35,7 @@ use syntax::symbol::Symbol; /// Handles the auto-deriving for `#[derive(JSTraceable)]` pub mod jstraceable; pub mod lints; -/// Autogenerates implementations of Reflectable on DOM structs +/// Autogenerates implementations of DomObject on DOM structs pub mod reflector; /// Utilities for writing plugins mod utils; diff --git a/servo/components/plugins/reflector.rs b/servo/components/plugins/reflector.rs index 27f8054fd54d..768e65e59eb0 100644 --- a/servo/components/plugins/reflector.rs +++ b/servo/components/plugins/reflector.rs @@ -25,14 +25,14 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: Some(f) => { let field_name = f.ident; 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 { &self.$field_name } } ); 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) { self.$field_name.set_jsobject(obj); } @@ -45,14 +45,14 @@ pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: None => { let field_name = def.fields()[0].ident; 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 { self.$field_name.reflector() } } ); 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) { 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, cx: *mut ::js::jsapi::JSContext, 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) } } diff --git a/servo/components/script/body.rs b/servo/components/script/body.rs index c5b6008c363e..1967d69cf505 100644 --- a/servo/components/script/body.rs +++ b/servo/components/script/body.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::FormDataBinding::FormDataMethods; use dom::bindings::error::{Error, Fallible}; use dom::bindings::js::Root; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::USVString; use dom::blob::{Blob, BlobImpl}; use dom::formdata::FormData; @@ -41,7 +41,7 @@ pub enum FetchedData { // https://fetch.spec.whatwg.org/#concept-body-consume-body #[allow(unrooted_must_root)] -pub fn consume_body(object: &T, body_type: BodyType) -> Rc { +pub fn consume_body(object: &T, body_type: BodyType) -> Rc { let promise = Promise::new(&object.global()); // Step 1 @@ -63,9 +63,9 @@ pub fn consume_body(object: &T, body_type: Body // https://fetch.spec.whatwg.org/#concept-body-consume-body #[allow(unrooted_must_root)] -pub fn consume_body_with_promise(object: &T, - body_type: BodyType, - promise: &Promise) { +pub fn consume_body_with_promise(object: &T, + body_type: BodyType, + promise: &Promise) { // Step 5 let body = match object.take_body() { Some(body) => body, @@ -93,11 +93,11 @@ pub fn consume_body_with_promise(object: &T, // https://fetch.spec.whatwg.org/#concept-body-package-data #[allow(unsafe_code)] -fn run_package_data_algorithm(object: &T, - bytes: Vec, - body_type: BodyType, - mime_type: Ref>) - -> Fallible { +fn run_package_data_algorithm(object: &T, + bytes: Vec, + body_type: BodyType, + mime_type: Ref>) + -> Fallible { let global = object.global(); let cx = global.get_cx(); let mime = &*mime_type; diff --git a/servo/components/script/devtools.rs b/servo/components/script/devtools.rs index 1b1ef4596d6d..b0f585d8db83 100644 --- a/servo/components/script/devtools.rs +++ b/servo/components/script/devtools.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str}; use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::document::AnimationFrameCallback; use dom::element::Element; diff --git a/servo/components/script/docs/JS-Servos-only-GC.md b/servo/components/script/docs/JS-Servos-only-GC.md index c8129241a847..e2ca71dad8b8 100644 --- a/servo/components/script/docs/JS-Servos-only-GC.md +++ b/servo/components/script/docs/JS-Servos-only-GC.md @@ -181,7 +181,7 @@ pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Ref } } -impl JSTraceable for JS { +impl JSTraceable for JS { unsafe fn trace(&self, trc: *mut JSTracer) { trace_reflector(trc, "", unsafe { (**self.ptr).reflector() }); } diff --git a/servo/components/script/dom/abstractworker.rs b/servo/components/script/dom/abstractworker.rs index 6c5abd0d0207..ee8ee31abc05 100644 --- a/servo/components/script/dom/abstractworker.rs +++ b/servo/components/script/dom/abstractworker.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::structuredclone::StructuredCloneData; use js::jsapi::{JSRuntime, JS_RequestInterruptCallback}; use js::rust::Runtime; @@ -17,11 +17,11 @@ pub enum WorkerScriptMsg { DOMMessage(StructuredCloneData) } -pub struct SimpleWorkerErrorHandler { +pub struct SimpleWorkerErrorHandler { pub addr: Trusted, } -impl SimpleWorkerErrorHandler { +impl SimpleWorkerErrorHandler { pub fn new(addr: Trusted) -> SimpleWorkerErrorHandler { SimpleWorkerErrorHandler { addr: addr diff --git a/servo/components/script/dom/abstractworkerglobalscope.rs b/servo/components/script/dom/abstractworkerglobalscope.rs index dc4bf15c89e7..7c79a9191654 100644 --- a/servo/components/script/dom/abstractworkerglobalscope.rs +++ b/servo/components/script/dom/abstractworkerglobalscope.rs @@ -4,7 +4,7 @@ use dom::abstractworker::WorkerScriptMsg; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::trace::JSTraceable; use script_runtime::{ScriptChan, CommonScriptMsg, ScriptPort}; 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 /// Worker object will remain alive. #[derive(JSTraceable, Clone)] -pub struct SendableWorkerScriptChan { +pub struct SendableWorkerScriptChan { pub sender: Sender<(Trusted, CommonScriptMsg)>, pub worker: Trusted, } -impl ScriptChan for SendableWorkerScriptChan { +impl ScriptChan for SendableWorkerScriptChan { fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { self.sender.send((self.worker.clone(), msg)).map_err(|_| ()) } @@ -35,12 +35,12 @@ impl ScriptChan for SendableWorkerScript /// worker event loop messages. While this SendableWorkerScriptChan is alive, the associated /// Worker object will remain alive. #[derive(JSTraceable, Clone)] -pub struct WorkerThreadWorkerChan { +pub struct WorkerThreadWorkerChan { pub sender: Sender<(Trusted, WorkerScriptMsg)>, pub worker: Trusted, } -impl ScriptChan for WorkerThreadWorkerChan { +impl ScriptChan for WorkerThreadWorkerChan { fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> { self.sender .send((self.worker.clone(), WorkerScriptMsg::Common(msg))) @@ -55,7 +55,7 @@ impl ScriptChan for WorkerThreadWorkerCh } } -impl ScriptPort for Receiver<(Trusted, WorkerScriptMsg)> { +impl ScriptPort for Receiver<(Trusted, WorkerScriptMsg)> { fn recv(&self) -> Result { match self.recv().map(|(_, msg)| msg) { Ok(WorkerScriptMsg::Common(script_msg)) => Ok(script_msg), diff --git a/servo/components/script/dom/bindings/callback.rs b/servo/components/script/dom/bindings/callback.rs index 709dab310496..a5f82f1f303f 100644 --- a/servo/components/script/dom/bindings/callback.rs +++ b/servo/components/script/dom/bindings/callback.rs @@ -5,7 +5,7 @@ //! Base classes to work with IDL callbacks. use dom::bindings::error::{Error, Fallible, report_pending_exception}; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::globalscope::GlobalScope; use js::jsapi::{Heap, MutableHandleObject, RootedObject}; use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject}; @@ -132,9 +132,9 @@ impl CallbackInterface { } /// Wraps the reflector for `p` into the compartment of `cx`. -pub fn wrap_call_this_object(cx: *mut JSContext, - p: &T, - rval: MutableHandleObject) { +pub fn wrap_call_this_object(cx: *mut JSContext, + p: &T, + rval: MutableHandleObject) { rval.set(p.reflector().get_jsobject().get()); assert!(!rval.get().is_null()); diff --git a/servo/components/script/dom/bindings/codegen/CodegenRust.py b/servo/components/script/dom/bindings/codegen/CodegenRust.py index 28d0d9af459e..dc39048ab401 100644 --- a/servo/components/script/dom/bindings/codegen/CodegenRust.py +++ b/servo/components/script/dom/bindings/codegen/CodegenRust.py @@ -5528,8 +5528,8 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'dom::bindings::js::RootedReference', 'dom::bindings::namespace::NamespaceObjectClass', 'dom::bindings::namespace::create_namespace_object', - 'dom::bindings::reflector::MutReflectable', - 'dom::bindings::reflector::Reflectable', + 'dom::bindings::reflector::MutDomObject', + 'dom::bindings::reflector::DomObject', 'dom::bindings::utils::DOMClass', 'dom::bindings::utils::DOMJSClass', 'dom::bindings::utils::DOM_PROTO_UNFORGEABLE_HOLDER_SLOT', @@ -6294,7 +6294,7 @@ class CGCallback(CGClass): }) return [ClassMethod(method.name + '_', method.returnType, args, bodyInHeader=True, - templateArgs=["T: Reflectable"], + templateArgs=["T: DomObject"], body=bodyWithThis, visibility='pub'), ClassMethod(method.name + '__', method.returnType, argsWithoutThis, @@ -6917,7 +6917,7 @@ class GlobalGenRoots(): CGGeneric("use dom::bindings::inheritance::Castable;\n"), CGGeneric("use dom::bindings::js::{JS, LayoutJS, Root};\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 std::mem;\n\n")] allprotos = [] diff --git a/servo/components/script/dom/bindings/conversions.rs b/servo/components/script/dom/bindings/conversions.rs index ba67ad11a7ef..adfe242b5f8f 100644 --- a/servo/components/script/dom/bindings/conversions.rs +++ b/servo/components/script/dom/bindings/conversions.rs @@ -35,7 +35,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; 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::utils::DOMClass; use js; @@ -102,7 +102,7 @@ impl> FromJSValConvertible for Finite } } -impl FromJSValConvertible for Root { +impl FromJSValConvertible for Root { type Config = (); unsafe fn from_jsval(_cx: *mut JSContext, @@ -404,7 +404,7 @@ pub unsafe fn private_from_proto_check(mut obj: *mut JSObject, /// Get a `*const T` for a DOM object accessible from a `JSObject`. pub fn native_from_object(obj: *mut JSObject) -> Result<*const T, ()> - where T: Reflectable + IDLInterface + where T: DomObject + IDLInterface { unsafe { private_from_proto_check(obj, T::derives).map(|ptr| ptr as *const T) @@ -418,7 +418,7 @@ pub fn native_from_object(obj: *mut JSObject) -> Result<*const T, ()> /// not a reflector for a DOM object of the given type (as defined by the /// proto_id and proto_depth). pub fn root_from_object(obj: *mut JSObject) -> Result, ()> - where T: Reflectable + IDLInterface + where T: DomObject + IDLInterface { native_from_object(obj).map(|ptr| unsafe { Root::from_ref(&*ptr) }) } @@ -426,7 +426,7 @@ pub fn root_from_object(obj: *mut JSObject) -> Result, ()> /// 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. pub fn native_from_handlevalue(v: HandleValue) -> Result<*const T, ()> - where T: Reflectable + IDLInterface + where T: DomObject + IDLInterface { if !v.get().is_object() { return Err(()); @@ -437,7 +437,7 @@ pub fn native_from_handlevalue(v: HandleValue) -> Result<*const T, ()> /// Get a `Root` for a DOM object accessible from a `HandleValue`. /// Caller is responsible for throwing a JS exception if needed in case of error. pub fn root_from_handlevalue(v: HandleValue) -> Result, ()> - where T: Reflectable + IDLInterface + where T: DomObject + IDLInterface { if !v.get().is_object() { return Err(()); @@ -447,12 +447,12 @@ pub fn root_from_handlevalue(v: HandleValue) -> Result, ()> /// Get a `Root` for a DOM object accessible from a `HandleObject`. pub fn root_from_handleobject(obj: HandleObject) -> Result, ()> - where T: Reflectable + IDLInterface + where T: DomObject + IDLInterface { root_from_object(obj.get()) } -impl ToJSValConvertible for Root { +impl ToJSValConvertible for Root { unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) { self.reflector().to_jsval(cx, rval); } diff --git a/servo/components/script/dom/bindings/inheritance.rs b/servo/components/script/dom/bindings/inheritance.rs index f4f1274ac6e4..d97843bf42ae 100644 --- a/servo/components/script/dom/bindings/inheritance.rs +++ b/servo/components/script/dom/bindings/inheritance.rs @@ -8,12 +8,12 @@ pub use dom::bindings::codegen::InheritTypes::*; use dom::bindings::conversions::{DerivedFrom, IDLInterface}; use dom::bindings::conversions::get_dom_class; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use std::mem; /// A trait to hold the cast functions of IDL interfaces that either derive /// 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. fn is(&self) -> bool where T: DerivedFrom diff --git a/servo/components/script/dom/bindings/iterable.rs b/servo/components/script/dom/bindings/iterable.rs index a0d281a0afc4..35e83880b4f7 100644 --- a/servo/components/script/dom/bindings/iterable.rs +++ b/servo/components/script/dom/bindings/iterable.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndVal use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult; use dom::bindings::error::Fallible; 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::globalscope::GlobalScope; use js::conversions::ToJSValConvertible; @@ -52,36 +52,36 @@ pub trait Iterable { #[privatize] #[derive(JSTraceable)] #[derive(HeapSizeOf)] -pub struct IterableIterator { +pub struct IterableIterator { reflector: Reflector, iterable: JS, type_: IteratorType, index: Cell, } -impl Reflectable for IterableIterator { +impl DomObject for IterableIterator { fn reflector<'a>(&'a self) -> &'a Reflector { &self.reflector } } -impl MutReflectable for IterableIterator { +impl MutDomObject for IterableIterator { fn init_reflector(&mut self, obj: *mut JSObject) { self.reflector.set_jsobject(obj); } } -impl ToJSValConvertible for IterableIterator { +impl ToJSValConvertible for IterableIterator { #[allow(unsafe_code)] unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) { - let object = Reflectable::reflector(self).get_jsobject(); + let object = DomObject::reflector(self).get_jsobject(); object.to_jsval(cx, rval) } } -impl IterableIterator { +impl IterableIterator { /// Create a new iterator instance for the provided iterable DOM interface. pub fn new(iterable: &T, type_: IteratorType, diff --git a/servo/components/script/dom/bindings/js.rs b/servo/components/script/dom/bindings/js.rs index 9ddf3fc46fcc..fa7999ebcb1f 100644 --- a/servo/components/script/dom/bindings/js.rs +++ b/servo/components/script/dom/bindings/js.rs @@ -26,7 +26,7 @@ use core::nonzero::NonZero; use dom::bindings::conversions::DerivedFrom; 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::trace_reflector; use dom::node::Node; @@ -76,7 +76,7 @@ impl JS { } } -impl JS { +impl JS { /// Create a JS from a &T #[allow(unrooted_must_root)] pub fn from_ref(obj: &T) -> JS { @@ -87,14 +87,14 @@ impl JS { } } -impl<'root, T: Reflectable + 'root> RootedReference<'root> for JS { +impl<'root, T: DomObject + 'root> RootedReference<'root> for JS { type Ref = &'root T; fn r(&'root self) -> &'root T { &self } } -impl Deref for JS { +impl Deref for JS { type Target = T; fn deref(&self) -> &T { @@ -105,7 +105,7 @@ impl Deref for JS { } } -unsafe impl JSTraceable for JS { +unsafe impl JSTraceable for JS { unsafe fn trace(&self, trc: *mut JSTracer) { #[cfg(debug_assertions)] let trace_str = format!("for {} on heap", type_name::()); @@ -158,7 +158,7 @@ impl LayoutJS { } } -impl LayoutJS { +impl LayoutJS { /// Get the reflector. pub unsafe fn get_jsobject(&self) -> *mut JSObject { debug_assert!(thread_state::get().is_layout()); @@ -240,7 +240,7 @@ pub trait HeapGCValue: JSTraceable { impl HeapGCValue for Heap { } -impl HeapGCValue for JS { +impl HeapGCValue for JS { } /// A holder that provides interior mutability for GC-managed JSVals. @@ -297,7 +297,7 @@ pub struct MutHeap { val: UnsafeCell, } -impl MutHeap> { +impl MutHeap> { /// Create a new `MutHeap`. pub fn new(initial: &T) -> MutHeap> { debug_assert!(thread_state::get().is_script()); @@ -330,7 +330,7 @@ impl HeapSizeOf for MutHeap { } } -impl PartialEq for MutHeap> { +impl PartialEq for MutHeap> { fn eq(&self, other: &Self) -> bool { unsafe { *self.val.get() == *other.val.get() @@ -338,7 +338,7 @@ impl PartialEq for MutHeap> { } } -impl PartialEq for MutHeap> { +impl PartialEq for MutHeap> { fn eq(&self, other: &T) -> bool { unsafe { **self.val.get() == *other @@ -358,7 +358,7 @@ pub struct MutNullableHeap { ptr: UnsafeCell>, } -impl MutNullableHeap> { +impl MutNullableHeap> { /// Create a new `MutNullableHeap`. pub fn new(initial: Option<&T>) -> MutNullableHeap> { debug_assert!(thread_state::get().is_script()); @@ -416,7 +416,7 @@ impl MutNullableHeap> { } } -impl PartialEq for MutNullableHeap> { +impl PartialEq for MutNullableHeap> { fn eq(&self, other: &Self) -> bool { unsafe { *self.ptr.get() == *other.ptr.get() @@ -424,7 +424,7 @@ impl PartialEq for MutNullableHeap> { } } -impl<'a, T: Reflectable> PartialEq> for MutNullableHeap> { +impl<'a, T: DomObject> PartialEq> for MutNullableHeap> { fn eq(&self, other: &Option<&T>) -> bool { unsafe { *self.ptr.get() == other.map(JS::from_ref) @@ -449,7 +449,7 @@ impl HeapSizeOf for MutNullableHeap { } } -impl LayoutJS { +impl LayoutJS { /// 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 /// this is unsafe is what necessitates the layout wrappers.) @@ -475,14 +475,14 @@ pub trait RootedReference<'root> { fn r(&'root self) -> Self::Ref; } -impl<'root, T: JSTraceable + Reflectable + 'root> RootedReference<'root> for [JS] { +impl<'root, T: JSTraceable + DomObject + 'root> RootedReference<'root> for [JS] { type Ref = &'root [&'root T]; fn r(&'root self) -> &'root [&'root T] { unsafe { mem::transmute(self) } } } -impl<'root, T: Reflectable + 'root> RootedReference<'root> for Rc { +impl<'root, T: DomObject + 'root> RootedReference<'root> for Rc { type Ref = &'root T; fn r(&'root self) -> &'root T { self @@ -566,7 +566,7 @@ pub unsafe fn trace_roots(tracer: *mut JSTracer) { /// for the same JS value. `Root`s cannot outlive the associated /// `RootCollection` object. #[allow_unrooted_interior] -pub struct Root { +pub struct Root { /// Reference to rooted value that must not outlive this container ptr: NonZero<*const T>, /// List that ensures correct dynamic root ordering @@ -594,7 +594,7 @@ impl Root { } } -impl Root { +impl Root { /// Create a new stack-bounded root for the provided JS-owned value. /// It cannot outlive its associated `RootCollection`, and it gives /// out references which cannot outlive this new `Root`. @@ -616,14 +616,14 @@ impl Root { } } -impl<'root, T: Reflectable + 'root> RootedReference<'root> for Root { +impl<'root, T: DomObject + 'root> RootedReference<'root> for Root { type Ref = &'root T; fn r(&'root self) -> &'root T { self } } -impl Deref for Root { +impl Deref for Root { type Target = T; fn deref(&self) -> &T { debug_assert!(thread_state::get().is_script()); @@ -631,25 +631,25 @@ impl Deref for Root { } } -impl HeapSizeOf for Root { +impl HeapSizeOf for Root { fn heap_size_of_children(&self) -> usize { (**self).heap_size_of_children() } } -impl PartialEq for Root { +impl PartialEq for Root { fn eq(&self, other: &Self) -> bool { self.ptr == other.ptr } } -impl Clone for Root { +impl Clone for Root { fn clone(&self) -> Root { Root::from_ref(&*self) } } -impl Drop for Root { +impl Drop for Root { fn drop(&mut self) { unsafe { (*self.root_list).unroot(self.reflector()); diff --git a/servo/components/script/dom/bindings/refcounted.rs b/servo/components/script/dom/bindings/refcounted.rs index 41cc60b02101..dcf116265434 100644 --- a/servo/components/script/dom/bindings/refcounted.rs +++ b/servo/components/script/dom/bindings/refcounted.rs @@ -24,7 +24,7 @@ use core::nonzero::NonZero; 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::promise::Promise; use js::jsapi::JSTracer; @@ -55,7 +55,7 @@ pub struct TrustedReference(*const libc::c_void); unsafe impl Send for TrustedReference {} impl TrustedReference { - fn new(ptr: *const T) -> TrustedReference { + fn new(ptr: *const T) -> TrustedReference { 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 /// `Trusted` instance. #[allow_unrooted_interior] -pub struct Trusted { +pub struct Trusted { /// A pointer to the Rust DOM object of type T, but void to allow /// sending `Trusted` between threads, regardless of T's sendability. refcount: Arc, @@ -130,9 +130,9 @@ pub struct Trusted { phantom: PhantomData, } -unsafe impl Send for Trusted {} +unsafe impl Send for Trusted {} -impl Trusted { +impl Trusted { /// Create a new `Trusted` instance from an existing DOM pointer. The DOM object will /// be prevented from being GCed for the duration of the resulting `Trusted` object's /// lifetime. @@ -164,7 +164,7 @@ impl Trusted { } } -impl Clone for Trusted { +impl Clone for Trusted { fn clone(&self) -> Trusted { Trusted { refcount: self.refcount.clone(), @@ -200,7 +200,7 @@ impl LiveDOMReferences { table.entry(&*promise).or_insert(vec![]).push(promise) } - fn addref(&self, ptr: *const T) -> Arc { + fn addref(&self, ptr: *const T) -> Arc { let mut table = self.reflectable_table.borrow_mut(); let capacity = table.capacity(); let len = table.len(); diff --git a/servo/components/script/dom/bindings/reflector.rs b/servo/components/script/dom/bindings/reflector.rs index 05f262dab01c..eebea3a618ab 100644 --- a/servo/components/script/dom/bindings/reflector.rs +++ b/servo/components/script/dom/bindings/reflector.rs @@ -18,7 +18,7 @@ pub fn reflect_dom_object( global: &U, wrap_fn: unsafe fn(*mut JSContext, &GlobalScope, Box) -> Root) -> Root - where T: Reflectable, U: DerivedFrom + where T: DomObject, U: DerivedFrom { let global_scope = global.upcast(); unsafe { @@ -77,18 +77,18 @@ impl Reflector { } /// A trait to provide access to the `Reflector` for a DOM object. -pub trait Reflectable { +pub trait DomObject { /// Returns the receiver's 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 where Self: Sized { GlobalScope::from_reflector(self) } } /// A trait to initialize the `Reflector` for a DOM object. -pub trait MutReflectable: Reflectable { +pub trait MutDomObject: DomObject { /// Initializes the Reflector fn init_reflector(&mut self, obj: *mut JSObject); } diff --git a/servo/components/script/dom/bindings/trace.rs b/servo/components/script/dom/bindings/trace.rs index 6da8e9a1c5fe..4c650719bffe 100644 --- a/servo/components/script/dom/bindings/trace.rs +++ b/servo/components/script/dom/bindings/trace.rs @@ -38,7 +38,7 @@ use dom::abstractworker::SharedRt; use dom::bindings::cell::DOMRefCell; use dom::bindings::js::{JS, Root}; 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::utils::WindowProxyHandler; use dom::document::PendingRestyle; @@ -426,7 +426,7 @@ unsafe impl JSTraceable for IpcReceiver where T: Deserialize + Serialize { } } -unsafe impl JSTraceable for Trusted { +unsafe impl JSTraceable for Trusted { #[inline] unsafe fn trace(&self, _: *mut JSTracer) { // Do nothing @@ -635,9 +635,9 @@ impl RootedTraceableSet { /// 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 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. #[derive(JSTraceable)] pub struct RootedTraceable<'a, T: 'a + JSTraceable> { @@ -690,7 +690,7 @@ pub struct RootedVec<'a, T: 'a + JSTraceable> { root: &'a mut RootableVec, } -impl<'a, T: JSTraceable + Reflectable> RootedVec<'a, JS> { +impl<'a, T: JSTraceable + DomObject> RootedVec<'a, JS> { /// Create a vector of items of type T that is rooted for /// the lifetime of this struct pub fn new>>(root: &'a mut RootableVec>, iter: I) diff --git a/servo/components/script/dom/bindings/weakref.rs b/servo/components/script/dom/bindings/weakref.rs index 68feff791801..234fc58260ef 100644 --- a/servo/components/script/dom/bindings/weakref.rs +++ b/servo/components/script/dom/bindings/weakref.rs @@ -13,7 +13,7 @@ use core::nonzero::NonZero; use dom::bindings::js::Root; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::trace::JSTraceable; use heapsize::HeapSizeOf; use js::jsapi::{JSTracer, JS_GetReservedSlot, JS_SetReservedSlot}; @@ -46,7 +46,7 @@ pub struct WeakBox { } /// 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. fn downgrade(&self) -> WeakRef { unsafe { diff --git a/servo/components/script/dom/blob.rs b/servo/components/script/dom/blob.rs index a2ceed8b046f..06ec986386c5 100644 --- a/servo/components/script/dom/blob.rs +++ b/servo/components/script/dom/blob.rs @@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::UnionTypes::BlobOrString; use dom::bindings::error::{Error, Fallible}; 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::globalscope::GlobalScope; use encoding::all::UTF_8; diff --git a/servo/components/script/dom/bluetooth.rs b/servo/components/script/dom/bluetooth.rs index 61a9588dfabe..5a657eb64590 100644 --- a/servo/components/script/dom/bluetooth.rs +++ b/servo/components/script/dom/bluetooth.rs @@ -17,7 +17,7 @@ use dom::bindings::error::Error::{self, NotFound, Security, Type}; use dom::bindings::error::Fallible; use dom::bindings::js::{JS, MutHeap, Root}; 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::bluetoothadvertisingdata::BluetoothAdvertisingData; 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. Either 'acceptAllDevices' member must be true, or 'filters' member must be set to a value."; -struct BluetoothContext { +struct BluetoothContext { promise: Option, receiver: Trusted, } @@ -62,9 +62,9 @@ pub trait AsyncBluetoothListener { fn handle_response(&self, result: BluetoothResponse, cx: *mut JSContext, promise: &Rc); } -impl PreInvoke for BluetoothContext {} +impl PreInvoke for BluetoothContext {} -impl BluetoothResponseListener for BluetoothContext { +impl BluetoothResponseListener for BluetoothContext { #[allow(unrooted_must_root)] fn response(&mut self, response: BluetoothResponseResult) { let promise = self.promise.take().expect("bt promise is missing").root(); @@ -174,7 +174,7 @@ impl Bluetooth { } } -pub fn response_async( +pub fn response_async( promise: &Rc, receiver: &T) -> IpcSender { let (action_sender, action_receiver) = ipc::channel().unwrap(); diff --git a/servo/components/script/dom/bluetoothdevice.rs b/servo/components/script/dom/bluetoothdevice.rs index 5bd3bd8233d3..b257b82f3434 100644 --- a/servo/components/script/dom/bluetoothdevice.rs +++ b/servo/components/script/dom/bluetoothdevice.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMet use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods; use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; 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::bluetooth::Bluetooth; use dom::bluetoothadvertisingdata::BluetoothAdvertisingData; diff --git a/servo/components/script/dom/bluetoothremotegattcharacteristic.rs b/servo/components/script/dom/bluetoothremotegattcharacteristic.rs index ecbb77b64a26..eb41e6ec1db3 100644 --- a/servo/components/script/dom/bluetoothremotegattcharacteristic.rs +++ b/servo/components/script/dom/bluetoothremotegattcharacteristic.rs @@ -17,7 +17,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security}; use dom::bindings::inheritance::Castable; 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::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties; diff --git a/servo/components/script/dom/bluetoothremotegattdescriptor.rs b/servo/components/script/dom/bluetoothremotegattdescriptor.rs index 8f092c6cad5f..c31fae99070e 100644 --- a/servo/components/script/dom/bluetoothremotegattdescriptor.rs +++ b/servo/components/script/dom/bluetoothremotegattdescriptor.rs @@ -14,7 +14,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods; use dom::bindings::error::Error::{self, InvalidModification, Network, Security}; 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::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH}; diff --git a/servo/components/script/dom/bluetoothremotegattserver.rs b/servo/components/script/dom/bluetoothremotegattserver.rs index f325414e2304..d9d57ae51f1a 100644 --- a/servo/components/script/dom/bluetoothremotegattserver.rs +++ b/servo/components/script/dom/bluetoothremotegattserver.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::Bluetoot use dom::bindings::error::Error::{self, Network, Security}; use dom::bindings::error::ErrorResult; 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::bluetoothdevice::BluetoothDevice; use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID}; diff --git a/servo/components/script/dom/bluetoothremotegattservice.rs b/servo/components/script/dom/bluetoothremotegattservice.rs index 60fcc694ed86..f4aed154c7c5 100644 --- a/servo/components/script/dom/bluetoothremotegattservice.rs +++ b/servo/components/script/dom/bluetoothremotegattservice.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::error::Error::{self, Network, Security}; 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::bluetooth::{AsyncBluetoothListener, response_async}; use dom::bluetoothdevice::BluetoothDevice; diff --git a/servo/components/script/dom/browsingcontext.rs b/servo/components/script/dom/browsingcontext.rs index 2434ab768192..76b8badbe76a 100644 --- a/servo/components/script/dom/browsingcontext.rs +++ b/servo/components/script/dom/browsingcontext.rs @@ -6,7 +6,7 @@ use dom::bindings::conversions::{ToJSValConvertible, root_from_handleobject}; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; 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::utils::WindowProxyHandler; use dom::bindings::utils::get_array_index_from_id; diff --git a/servo/components/script/dom/canvasrenderingcontext2d.rs b/servo/components/script/dom/canvasrenderingcontext2d.rs index 390a321fe5e4..32b65439f154 100644 --- a/servo/components/script/dom/canvasrenderingcontext2d.rs +++ b/servo/components/script/dom/canvasrenderingcontext2d.rs @@ -23,7 +23,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, LayoutJS, Root}; 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::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::canvaspattern::CanvasPattern; diff --git a/servo/components/script/dom/cssgroupingrule.rs b/servo/components/script/dom/cssgroupingrule.rs index 7176dda8d121..e8651c551d38 100644 --- a/servo/components/script/dom/cssgroupingrule.rs +++ b/servo/components/script/dom/cssgroupingrule.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMet use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; 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::cssrule::CSSRule; use dom::cssrulelist::{CSSRuleList, RulesSource}; diff --git a/servo/components/script/dom/csskeyframesrule.rs b/servo/components/script/dom/csskeyframesrule.rs index 259819189a9b..46ed79435c13 100644 --- a/servo/components/script/dom/csskeyframesrule.rs +++ b/servo/components/script/dom/csskeyframesrule.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding; use dom::bindings::codegen::Bindings::CSSKeyframesRuleBinding::CSSKeyframesRuleMethods; use dom::bindings::inheritance::Castable; 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::csskeyframerule::CSSKeyframeRule; use dom::cssrule::{CSSRule, SpecificCSSRule}; diff --git a/servo/components/script/dom/cssmediarule.rs b/servo/components/script/dom/cssmediarule.rs index 7f4f43f3d5b2..0e1fc145e7d1 100644 --- a/servo/components/script/dom/cssmediarule.rs +++ b/servo/components/script/dom/cssmediarule.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::CSSMediaRuleBinding; use dom::bindings::codegen::Bindings::CSSMediaRuleBinding::CSSMediaRuleMethods; 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::cssgroupingrule::CSSGroupingRule; use dom::cssrule::SpecificCSSRule; diff --git a/servo/components/script/dom/cssrulelist.rs b/servo/components/script/dom/cssrulelist.rs index 9c55f5618069..988f839a87a3 100644 --- a/servo/components/script/dom/cssrulelist.rs +++ b/servo/components/script/dom/cssrulelist.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSRuleListBinding; use dom::bindings::codegen::Bindings::CSSRuleListBinding::CSSRuleListMethods; use dom::bindings::error::{Error, ErrorResult, Fallible}; 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::cssrule::CSSRule; use dom::cssstylesheet::CSSStyleSheet; diff --git a/servo/components/script/dom/cssstylesheet.rs b/servo/components/script/dom/cssstylesheet.rs index 93aefa8f8525..106b9b5805d5 100644 --- a/servo/components/script/dom/cssstylesheet.rs +++ b/servo/components/script/dom/cssstylesheet.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::CSSStyleSheetBinding::CSSStyleSheetMethods use dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use dom::bindings::error::{ErrorResult, Fallible}; 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::cssrulelist::{CSSRuleList, RulesSource}; use dom::element::Element; diff --git a/servo/components/script/dom/dedicatedworkerglobalscope.rs b/servo/components/script/dom/dedicatedworkerglobalscope.rs index 6fbbd25f97bd..96ee1f871eba 100644 --- a/servo/components/script/dom/dedicatedworkerglobalscope.rs +++ b/servo/components/script/dom/dedicatedworkerglobalscope.rs @@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull; use dom::bindings::error::{ErrorInfo, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::js::{Root, RootCollection}; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::globalscope::GlobalScope; diff --git a/servo/components/script/dom/document.rs b/servo/components/script/dom/document.rs index 468f127f7ad4..d0dbe75ebd34 100644 --- a/servo/components/script/dom/document.rs +++ b/servo/components/script/dom/document.rs @@ -28,7 +28,7 @@ use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::js::RootedReference; use dom::bindings::num::Finite; 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::xmlname::{namespace_from_domstring, validate_and_extract, xml_name_type}; use dom::bindings::xmlname::XMLName::InvalidXMLName; diff --git a/servo/components/script/dom/dommatrixreadonly.rs b/servo/components/script/dom/dommatrixreadonly.rs index fa7c819a1ba3..978fa96ce6b1 100644 --- a/servo/components/script/dom/dommatrixreadonly.rs +++ b/servo/components/script/dom/dommatrixreadonly.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit; use dom::bindings::error; use dom::bindings::error::Fallible; 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::dompoint::DOMPoint; use dom::globalscope::GlobalScope; diff --git a/servo/components/script/dom/domquad.rs b/servo/components/script/dom/domquad.rs index 7d80dc9d8fdf..37d0b3428182 100644 --- a/servo/components/script/dom/domquad.rs +++ b/servo/components/script/dom/domquad.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMetho use dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit; use dom::bindings::error::Fallible; 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::domrect::DOMRect; use dom::globalscope::GlobalScope; diff --git a/servo/components/script/dom/eventdispatcher.rs b/servo/components/script/dom/eventdispatcher.rs index cb7107e92e54..d5e4bf513380 100644 --- a/servo/components/script/dom/eventdispatcher.rs +++ b/servo/components/script/dom/eventdispatcher.rs @@ -7,7 +7,7 @@ use dom::bindings::callback::ExceptionHandling::Report; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, Root, RootedReference}; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::document::Document; use dom::event::{Event, EventPhase}; use dom::eventtarget::{CompiledEventListener, EventTarget, ListenerPhase}; diff --git a/servo/components/script/dom/eventsource.rs b/servo/components/script/dom/eventsource.rs index c667267cd832..cedaa8fd39be 100644 --- a/servo/components/script/dom/eventsource.rs +++ b/servo/components/script/dom/eventsource.rs @@ -9,7 +9,7 @@ use dom::bindings::error::{Error, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; 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::event::Event; use dom::eventtarget::EventTarget; diff --git a/servo/components/script/dom/eventtarget.rs b/servo/components/script/dom/eventtarget.rs index d29d7a0e2ffc..579b88220654 100644 --- a/servo/components/script/dom/eventtarget.rs +++ b/servo/components/script/dom/eventtarget.rs @@ -18,7 +18,7 @@ use dom::bindings::codegen::UnionTypes::EventOrString; use dom::bindings::error::{Error, Fallible, report_pending_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; -use dom::bindings::reflector::{Reflectable, Reflector}; +use dom::bindings::reflector::{DomObject, Reflector}; use dom::bindings::str::DOMString; use dom::element::Element; use dom::errorevent::ErrorEvent; @@ -142,10 +142,10 @@ pub enum CompiledEventListener { impl CompiledEventListener { #[allow(unsafe_code)] // https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm - pub fn call_or_handle_event(&self, - object: &T, - event: &Event, - exception_handle: ExceptionHandling) { + pub fn call_or_handle_event(&self, + object: &T, + event: &Event, + exception_handle: ExceptionHandling) { // Step 3 match *self { CompiledEventListener::Listener(ref listener) => { diff --git a/servo/components/script/dom/filereader.rs b/servo/components/script/dom/filereader.rs index 7197de9a2fa3..bb57ad5d9de7 100644 --- a/servo/components/script/dom/filereader.rs +++ b/servo/components/script/dom/filereader.rs @@ -11,7 +11,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutNullableHeap, Root}; 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::blob::Blob; use dom::domexception::{DOMErrorName, DOMException}; diff --git a/servo/components/script/dom/formdata.rs b/servo/components/script/dom/formdata.rs index a971bb48f21c..58b548aa4758 100644 --- a/servo/components/script/dom/formdata.rs +++ b/servo/components/script/dom/formdata.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::UnionTypes::FileOrUSVString; use dom::bindings::error::Fallible; use dom::bindings::iterable::Iterable; 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::blob::{Blob, BlobImpl}; use dom::file::File; diff --git a/servo/components/script/dom/globalscope.rs b/servo/components/script/dom/globalscope.rs index 7cd092e06830..19436804b19b 100644 --- a/servo/components/script/dom/globalscope.rs +++ b/servo/components/script/dom/globalscope.rs @@ -9,7 +9,7 @@ use dom::bindings::conversions::root_from_object; use dom::bindings::error::{ErrorInfo, report_pending_exception}; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutNullableHeap, Root}; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::crypto::Crypto; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; @@ -124,7 +124,7 @@ impl GlobalScope { /// Returns the global scope of the realm that the given DOM object's reflector /// was created in. #[allow(unsafe_code)] - pub fn from_reflector(reflector: &T) -> Root { + pub fn from_reflector(reflector: &T) -> Root { unsafe { GlobalScope::from_object(*reflector.reflector().get_jsobject()) } } diff --git a/servo/components/script/dom/htmlformcontrolscollection.rs b/servo/components/script/dom/htmlformcontrolscollection.rs index 6fc52e099e7c..1009e5f11424 100644 --- a/servo/components/script/dom/htmlformcontrolscollection.rs +++ b/servo/components/script/dom/htmlformcontrolscollection.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding; use dom::bindings::codegen::Bindings::HTMLFormControlsCollectionBinding::HTMLFormControlsCollectionMethods; use dom::bindings::codegen::UnionTypes::RadioNodeListOrElement; 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::element::Element; use dom::htmlcollection::{CollectionFilter, HTMLCollection}; diff --git a/servo/components/script/dom/htmlformelement.rs b/servo/components/script/dom/htmlformelement.rs index f98e44129b17..90abdbafefde 100755 --- a/servo/components/script/dom/htmlformelement.rs +++ b/servo/components/script/dom/htmlformelement.rs @@ -15,7 +15,7 @@ use dom::bindings::conversions::DerivedFrom; use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId}; use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::blob::Blob; use dom::document::Document; @@ -845,7 +845,7 @@ impl<'a> FormSubmitter<'a> { } } -pub trait FormControl: DerivedFrom + Reflectable { +pub trait FormControl: DerivedFrom + DomObject { // FIXME: This is wrong (https://github.com/servo/servo/issues/3553) // but we need html5ever to do it correctly fn form_owner(&self) -> Option> { diff --git a/servo/components/script/dom/htmliframeelement.rs b/servo/components/script/dom/htmliframeelement.rs index 87674c835d02..0f55f3c6be31 100644 --- a/servo/components/script/dom/htmliframeelement.rs +++ b/servo/components/script/dom/htmliframeelement.rs @@ -21,7 +21,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root}; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::browsingcontext::BrowsingContext; use dom::customevent::CustomEvent; diff --git a/servo/components/script/dom/htmllinkelement.rs b/servo/components/script/dom/htmllinkelement.rs index e158caac17e6..1985e511c4df 100644 --- a/servo/components/script/dom/htmllinkelement.rs +++ b/servo/components/script/dom/htmllinkelement.rs @@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::HTMLLinkElementBinding::HTMLLinkElementMet use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutNullableHeap, Root, RootedReference}; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::cssstylesheet::CSSStyleSheet; use dom::document::Document; diff --git a/servo/components/script/dom/htmlmediaelement.rs b/servo/components/script/dom/htmlmediaelement.rs index 4d68edf35847..778c0d6b5604 100644 --- a/servo/components/script/dom/htmlmediaelement.rs +++ b/servo/components/script/dom/htmlmediaelement.rs @@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods; use dom::bindings::inheritance::Castable; use dom::bindings::js::{Root, MutNullableHeap, JS}; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{Element, AttributeMutation}; diff --git a/servo/components/script/dom/htmlscriptelement.rs b/servo/components/script/dom/htmlscriptelement.rs index 255137a939de..bccde70bb88c 100644 --- a/servo/components/script/dom/htmlscriptelement.rs +++ b/servo/components/script/dom/htmlscriptelement.rs @@ -14,7 +14,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, Root}; use dom::bindings::js::RootedReference; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::document::Document; use dom::element::{AttributeMutation, Element, ElementCreator}; diff --git a/servo/components/script/dom/mod.rs b/servo/components/script/dom/mod.rs index 9a0190cb57ef..5bc19eab627b 100644 --- a/servo/components/script/dom/mod.rs +++ b/servo/components/script/dom/mod.rs @@ -126,7 +126,7 @@ //! not allowed. In particular, any mutable fields use `Cell` or `DOMRefCell` //! to manage their mutability. //! -//! `Reflector` and `Reflectable` +//! `Reflector` and `DomObject` //! ============================= //! //! 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 //! 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 //! through the `#[dom_struct]` attribute. //! diff --git a/servo/components/script/dom/navigator.rs b/servo/components/script/dom/navigator.rs index bea18dfe61b0..9318e437ad5a 100644 --- a/servo/components/script/dom/navigator.rs +++ b/servo/components/script/dom/navigator.rs @@ -5,7 +5,7 @@ use dom::bindings::codegen::Bindings::NavigatorBinding; use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; 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::bluetooth::Bluetooth; use dom::mimetypearray::MimeTypeArray; diff --git a/servo/components/script/dom/node.rs b/servo/components/script/dom/node.rs index 5f979bd8c9f2..983f11f478cd 100644 --- a/servo/components/script/dom/node.rs +++ b/servo/components/script/dom/node.rs @@ -24,7 +24,7 @@ use dom::bindings::inheritance::{SVGElementTypeId, SVGGraphicsElementTypeId}; use dom::bindings::js::{JS, LayoutJS, MutNullableHeap}; use dom::bindings::js::Root; 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::xmlname::namespace_from_domstring; use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers}; @@ -800,7 +800,7 @@ impl Node { pub fn insert_cell_or_row(&self, index: i32, get_items: F, new_child: G) -> Fallible> where F: Fn() -> Root, G: Fn() -> Root, - I: DerivedFrom + DerivedFrom + Reflectable, + I: DerivedFrom + DerivedFrom + DomObject, { if index < -1 { return Err(Error::IndexSize); @@ -1345,7 +1345,7 @@ impl Node { document: &Document, wrap_fn: unsafe extern "Rust" fn(*mut JSContext, &GlobalScope, Box) -> Root) -> Root - where N: DerivedFrom + Reflectable + where N: DerivedFrom + DomObject { let window = document.window(); reflect_dom_object(node, window, wrap_fn) @@ -2373,11 +2373,11 @@ impl NodeMethods for Node { } } -pub fn document_from_node + Reflectable>(derived: &T) -> Root { +pub fn document_from_node + DomObject>(derived: &T) -> Root { derived.upcast().owner_doc() } -pub fn window_from_node + Reflectable>(derived: &T) -> Root { +pub fn window_from_node + DomObject>(derived: &T) -> Root { let document = document_from_node(derived); Root::from_ref(document.window()) } diff --git a/servo/components/script/dom/promise.rs b/servo/components/script/dom/promise.rs index 0afcfcba266b..89bbd088f2cc 100644 --- a/servo/components/script/dom/promise.rs +++ b/servo/components/script/dom/promise.rs @@ -16,7 +16,7 @@ use dom::bindings::codegen::Bindings::PromiseBinding::AnyCallback; use dom::bindings::conversions::root_from_object; use dom::bindings::error::{Error, Fallible}; 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::promisenativehandler::PromiseNativeHandler; use js::conversions::ToJSValConvertible; diff --git a/servo/components/script/dom/request.rs b/servo/components/script/dom/request.rs index 33a28da99eae..cb338d65b296 100644 --- a/servo/components/script/dom/request.rs +++ b/servo/components/script/dom/request.rs @@ -18,7 +18,7 @@ use dom::bindings::codegen::Bindings::RequestBinding::RequestRedirect; use dom::bindings::codegen::Bindings::RequestBinding::RequestType; use dom::bindings::error::{Error, Fallible}; 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::globalscope::GlobalScope; use dom::headers::{Guard, Headers}; diff --git a/servo/components/script/dom/response.rs b/servo/components/script/dom/response.rs index 949bfdb0d47d..278ead3c36db 100644 --- a/servo/components/script/dom/response.rs +++ b/servo/components/script/dom/response.rs @@ -11,7 +11,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding::{ResponseMethods, Respons use dom::bindings::codegen::Bindings::XMLHttpRequestBinding::BodyInit; use dom::bindings::error::{Error, Fallible}; 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::globalscope::GlobalScope; use dom::headers::{Headers, Guard}; diff --git a/servo/components/script/dom/serviceworker.rs b/servo/components/script/dom/serviceworker.rs index 63971d7e42e9..91de2b1c107d 100644 --- a/servo/components/script/dom/serviceworker.rs +++ b/servo/components/script/dom/serviceworker.rs @@ -10,7 +10,7 @@ use dom::bindings::error::{ErrorResult, Error}; use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; 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::structuredclone::StructuredCloneData; use dom::eventtarget::EventTarget; diff --git a/servo/components/script/dom/serviceworkercontainer.rs b/servo/components/script/dom/serviceworkercontainer.rs index 9d8d73b1c439..e5662f56deee 100644 --- a/servo/components/script/dom/serviceworkercontainer.rs +++ b/servo/components/script/dom/serviceworkercontainer.rs @@ -6,7 +6,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::{ServiceWor use dom::bindings::codegen::Bindings::ServiceWorkerContainerBinding::RegistrationOptions; use dom::bindings::error::Error; 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::client::Client; use dom::eventtarget::EventTarget; diff --git a/servo/components/script/dom/serviceworkerglobalscope.rs b/servo/components/script/dom/serviceworkerglobalscope.rs index b39faeb5694d..4daf07fff207 100644 --- a/servo/components/script/dom/serviceworkerglobalscope.rs +++ b/servo/components/script/dom/serviceworkerglobalscope.rs @@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding; use dom::bindings::codegen::Bindings::ServiceWorkerGlobalScopeBinding::ServiceWorkerGlobalScopeMethods; use dom::bindings::inheritance::Castable; use dom::bindings::js::{Root, RootCollection}; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::event::Event; use dom::eventtarget::EventTarget; diff --git a/servo/components/script/dom/storage.rs b/servo/components/script/dom/storage.rs index 6b85241e04f0..45966a687a86 100644 --- a/servo/components/script/dom/storage.rs +++ b/servo/components/script/dom/storage.rs @@ -8,7 +8,7 @@ use dom::bindings::error::{Error, ErrorResult}; use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; 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::event::{Event, EventBubbles, EventCancelable}; use dom::globalscope::GlobalScope; diff --git a/servo/components/script/dom/testbinding.rs b/servo/components/script/dom/testbinding.rs index 08daf6eefa7b..6b0c619749ae 100644 --- a/servo/components/script/dom/testbinding.rs +++ b/servo/components/script/dom/testbinding.rs @@ -25,7 +25,7 @@ use dom::bindings::js::Root; use dom::bindings::mozmap::MozMap; use dom::bindings::num::Finite; 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::weakref::MutableWeakRef; use dom::blob::{Blob, BlobImpl}; diff --git a/servo/components/script/dom/testrunner.rs b/servo/components/script/dom/testrunner.rs index 0bae004c90c2..0e3b9e11a5fb 100644 --- a/servo/components/script/dom/testrunner.rs +++ b/servo/components/script/dom/testrunner.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::TestRunnerBinding; use dom::bindings::codegen::Bindings::TestRunnerBinding::TestRunnerMethods; use dom::bindings::error::{Error, ErrorResult}; 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::globalscope::GlobalScope; use ipc_channel::ipc::{self, IpcSender}; diff --git a/servo/components/script/dom/url.rs b/servo/components/script/dom/url.rs index 50fe85a507b5..2f3e3c3f9233 100644 --- a/servo/components/script/dom/url.rs +++ b/servo/components/script/dom/url.rs @@ -7,7 +7,7 @@ use dom::bindings::codegen::Bindings::BlobBinding::BlobMethods; use dom::bindings::codegen::Bindings::URLBinding::{self, URLMethods}; use dom::bindings::error::{Error, ErrorResult, Fallible}; 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::blob::Blob; use dom::globalscope::GlobalScope; diff --git a/servo/components/script/dom/webglprogram.rs b/servo/components/script/dom/webglprogram.rs index 2e5188269fac..3f18c0e313b2 100644 --- a/servo/components/script/dom/webglprogram.rs +++ b/servo/components/script/dom/webglprogram.rs @@ -7,7 +7,7 @@ use canvas_traits::CanvasMsg; use dom::bindings::codegen::Bindings::WebGLProgramBinding; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; 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::webglactiveinfo::WebGLActiveInfo; use dom::webglobject::WebGLObject; diff --git a/servo/components/script/dom/webglrenderingcontext.rs b/servo/components/script/dom/webglrenderingcontext.rs index 76bfd9e10ce6..98b160095d58 100644 --- a/servo/components/script/dom/webglrenderingcontext.rs +++ b/servo/components/script/dom/webglrenderingcontext.rs @@ -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::inheritance::Castable; 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::event::{Event, EventBubbles, EventCancelable}; use dom::globalscope::GlobalScope; diff --git a/servo/components/script/dom/websocket.rs b/servo/components/script/dom/websocket.rs index d3486b7ad22b..0953f7898a20 100644 --- a/servo/components/script/dom/websocket.rs +++ b/servo/components/script/dom/websocket.rs @@ -13,7 +13,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; 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::blob::{Blob, BlobImpl}; use dom::closeevent::CloseEvent; diff --git a/servo/components/script/dom/window.rs b/servo/components/script/dom/window.rs index 77a569ef65a7..282979dc7bfb 100644 --- a/servo/components/script/dom/window.rs +++ b/servo/components/script/dom/window.rs @@ -22,7 +22,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::utils::{GlobalStaticData, WindowProxyHandler}; diff --git a/servo/components/script/dom/worker.rs b/servo/components/script/dom/worker.rs index 011159715f86..2d6581b9e434 100644 --- a/servo/components/script/dom/worker.rs +++ b/servo/components/script/dom/worker.rs @@ -12,7 +12,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible, ErrorInfo}; use dom::bindings::inheritance::Castable; use dom::bindings::js::Root; 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::structuredclone::StructuredCloneData; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; diff --git a/servo/components/script/dom/workerglobalscope.rs b/servo/components/script/dom/workerglobalscope.rs index 7b140b14d8f4..430757bce53a 100644 --- a/servo/components/script/dom/workerglobalscope.rs +++ b/servo/components/script/dom/workerglobalscope.rs @@ -12,7 +12,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible, report_pending_exceptio use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutNullableHeap, Root}; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::crypto::Crypto; use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope; diff --git a/servo/components/script/dom/xmlhttprequest.rs b/servo/components/script/dom/xmlhttprequest.rs index b7706114ad11..7e92d843ed67 100644 --- a/servo/components/script/dom/xmlhttprequest.rs +++ b/servo/components/script/dom/xmlhttprequest.rs @@ -17,7 +17,7 @@ use dom::bindings::inheritance::Castable; use dom::bindings::js::{JS, MutHeapJSVal, MutNullableHeap}; use dom::bindings::js::{Root, RootedReference}; 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::blob::{Blob, BlobImpl}; use dom::document::{Document, IsHTMLDocument}; diff --git a/servo/components/script/fetch.rs b/servo/components/script/fetch.rs index 70a92910caaa..3345c7b7e34e 100644 --- a/servo/components/script/fetch.rs +++ b/servo/components/script/fetch.rs @@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::ResponseBinding::ResponseType as DOMRespon use dom::bindings::error::Error; use dom::bindings::js::Root; use dom::bindings::refcounted::{Trusted, TrustedPromise}; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::globalscope::GlobalScope; use dom::headers::Guard; use dom::promise::Promise; diff --git a/servo/components/script/mem.rs b/servo/components/script/mem.rs index 9e10140392e3..b40a78ec5698 100644 --- a/servo/components/script/mem.rs +++ b/servo/components/script/mem.rs @@ -5,7 +5,7 @@ //! Routines for handling measuring the memory usage of arbitrary DOM nodes. use dom::bindings::conversions::get_dom_class; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use heapsize::{HeapSizeOf, heap_size_of}; 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 // JS reflector. #[allow(unsafe_code)] -pub fn heap_size_of_self_and_children(obj: &T) -> usize { +pub fn heap_size_of_self_and_children(obj: &T) -> usize { unsafe { let class = get_dom_class(obj.reflector().get_jsobject().get()).unwrap(); (class.heap_size_of)(obj as *const T as *const c_void) diff --git a/servo/components/script/script_thread.rs b/servo/components/script/script_thread.rs index 983d6fc8e368..ad8c3d09e575 100644 --- a/servo/components/script/script_thread.rs +++ b/servo/components/script/script_thread.rs @@ -36,7 +36,7 @@ use dom::bindings::js::{JS, MutNullableHeap, Root, RootCollection}; use dom::bindings::js::{RootCollectionPtr, RootedReference}; use dom::bindings::num::Finite; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::bindings::trace::JSTraceable; use dom::bindings::utils::WRAP_CALLBACKS; diff --git a/servo/components/script/serviceworkerjob.rs b/servo/components/script/serviceworkerjob.rs index e82d40b6bef4..1eb489ac4a95 100644 --- a/servo/components/script/serviceworkerjob.rs +++ b/servo/components/script/serviceworkerjob.rs @@ -11,7 +11,7 @@ use dom::bindings::cell::DOMRefCell; use dom::bindings::error::Error; use dom::bindings::js::JS; use dom::bindings::refcounted::Trusted; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::client::Client; use dom::globalscope::GlobalScope; use dom::promise::Promise; diff --git a/servo/components/script/timers.rs b/servo/components/script/timers.rs index 6b67d6959e3b..db0adfa9557b 100644 --- a/servo/components/script/timers.rs +++ b/servo/components/script/timers.rs @@ -5,7 +5,7 @@ use dom::bindings::callback::ExceptionHandling::Report; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::FunctionBinding::Function; -use dom::bindings::reflector::Reflectable; +use dom::bindings::reflector::DomObject; use dom::bindings::str::DOMString; use dom::eventsource::EventSourceTimeoutCallback; 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. // A replacement trait would have a method such as -// `invoke(self: Box, this: &T, js_timers: &JsTimers);`. +// `invoke(self: Box, this: &T, js_timers: &JsTimers);`. #[derive(JSTraceable, HeapSizeOf)] pub enum OneshotTimerCallback { XhrTimeout(XHRTimeoutCallback), @@ -74,7 +74,7 @@ pub enum OneshotTimerCallback { } impl OneshotTimerCallback { - fn invoke(self, this: &T, js_timers: &JsTimers) { + fn invoke(self, this: &T, js_timers: &JsTimers) { match self { OneshotTimerCallback::XhrTimeout(callback) => callback.invoke(), OneshotTimerCallback::EventSourceTimeout(callback) => callback.invoke(), @@ -482,7 +482,7 @@ fn clamp_duration(nesting_level: u32, unclamped: MsDuration) -> MsDuration { impl JsTimerTask { // see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps #[allow(unsafe_code)] - pub fn invoke(self, this: &T, timers: &JsTimers) { + pub fn invoke(self, this: &T, timers: &JsTimers) { // step 4.1 can be ignored, because we proactively prevent execution // of this task when its scheduled execution is canceled.