mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
6300e820b4
commit
3d320fa96a
603 changed files with 1739 additions and 1648 deletions
|
@ -16,9 +16,8 @@ use std::sync::Arc;
|
|||
#[cfg(feature = "webgpu")]
|
||||
use js::jsapi::NewExternalArrayBuffer;
|
||||
use js::jsapi::{
|
||||
GetArrayBufferByteLength, Heap, IsDetachedArrayBufferObject, JSObject,
|
||||
JS_GetArrayBufferViewBuffer, JS_GetArrayBufferViewByteLength, JS_IsArrayBufferViewObject,
|
||||
JS_IsTypedArrayObject,
|
||||
GetArrayBufferByteLength, Heap, IsDetachedArrayBufferObject, JS_GetArrayBufferViewBuffer,
|
||||
JS_GetArrayBufferViewByteLength, JS_IsArrayBufferViewObject, JS_IsTypedArrayObject, JSObject,
|
||||
};
|
||||
use js::rust::wrappers::DetachArrayBuffer;
|
||||
use js::rust::{CustomAutoRooterGuard, Handle, MutableHandleObject};
|
||||
|
|
|
@ -16,17 +16,17 @@ use js::jsval::{JSVal, ObjectValue, UndefinedValue};
|
|||
use js::rust::wrappers::{JS_GetProperty, JS_WrapObject};
|
||||
use js::rust::{MutableHandleValue, Runtime};
|
||||
|
||||
use crate::DomTypes;
|
||||
use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods;
|
||||
use crate::dom::bindings::error::{report_pending_exception, Error, Fallible};
|
||||
use crate::dom::bindings::error::{Error, Fallible, report_pending_exception};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::settings_stack::{GenericAutoEntryScript, GenericAutoIncumbentScript};
|
||||
use crate::dom::bindings::utils::AsCCharPtrPtr;
|
||||
use crate::dom::document::DocumentHelpers;
|
||||
use crate::dom::globalscope::GlobalScopeHelpers;
|
||||
use crate::realms::{enter_realm, InRealm};
|
||||
use crate::realms::{InRealm, enter_realm};
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
use crate::DomTypes;
|
||||
|
||||
/// The exception handling used for a call.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::cell::{BorrowError, BorrowMutError};
|
|||
pub(crate) use std::cell::{Ref, RefCell, RefMut};
|
||||
|
||||
#[cfg(feature = "refcell_backtrace")]
|
||||
pub(crate) use accountable_refcell::{ref_filter_map, Ref, RefCell, RefMut};
|
||||
pub(crate) use accountable_refcell::{Ref, RefCell, RefMut, ref_filter_map};
|
||||
#[cfg(not(feature = "refcell_backtrace"))]
|
||||
pub(crate) use ref_filter_map::ref_filter_map;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std::ptr;
|
||||
|
||||
use html5ever::interface::QualName;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName};
|
||||
use html5ever::{LocalName, local_name, namespace_url, ns};
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::glue::{UnwrapObjectDynamic, UnwrapObjectStatic};
|
||||
use js::jsapi::{CallArgs, CurrentGlobalOrNull, JSAutoRealm, JSObject};
|
||||
|
@ -40,7 +40,7 @@ use crate::dom::bindings::codegen::Bindings::{
|
|||
};
|
||||
use crate::dom::bindings::codegen::PrototypeList;
|
||||
use crate::dom::bindings::conversions::DerivedFrom;
|
||||
use crate::dom::bindings::error::{throw_constructor_without_new, throw_dom_exception, Error};
|
||||
use crate::dom::bindings::error::{Error, throw_constructor_without_new, throw_dom_exception};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::interface::get_desired_proto;
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
|
|
|
@ -39,7 +39,7 @@ pub(crate) use js::conversions::{
|
|||
};
|
||||
use js::error::throw_type_error;
|
||||
use js::glue::GetProxyReservedSlot;
|
||||
use js::jsapi::{Heap, IsWindowProxy, JSContext, JSObject, JS_IsExceptionPending};
|
||||
use js::jsapi::{Heap, IsWindowProxy, JS_IsExceptionPending, JSContext, JSObject};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::wrappers::{IsArrayObject, JS_GetProperty, JS_HasProperty};
|
||||
use js::rust::{HandleId, HandleObject, HandleValue, MutableHandleValue};
|
||||
|
|
|
@ -22,7 +22,7 @@ pub(crate) use script_bindings::error::*;
|
|||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::bindings::codegen::PrototypeList::proto_id_to_name;
|
||||
use crate::dom::bindings::conversions::{
|
||||
root_from_object, ConversionResult, FromJSValConvertible, ToJSValConvertible,
|
||||
ConversionResult, FromJSValConvertible, ToJSValConvertible, root_from_object,
|
||||
};
|
||||
use crate::dom::bindings::str::USVString;
|
||||
use crate::dom::domexception::{DOMErrorName, DOMException};
|
||||
|
|
|
@ -12,7 +12,7 @@ use js::jsapi::JSObject;
|
|||
use js::jsval::UndefinedValue;
|
||||
|
||||
use crate::dom::bindings::utils::finalize_global as do_finalize_global;
|
||||
use crate::dom::bindings::weakref::{WeakBox, WeakReferenceable, DOM_WEAK_SLOT};
|
||||
use crate::dom::bindings::weakref::{DOM_WEAK_SLOT, WeakBox, WeakReferenceable};
|
||||
|
||||
pub(crate) unsafe fn finalize_common<T>(this: *const T) {
|
||||
if !this.is_null() {
|
||||
|
|
|
@ -10,7 +10,7 @@ pub(crate) mod base {
|
|||
pub(crate) use js::error::throw_type_error;
|
||||
pub(crate) use js::jsapi::{
|
||||
CurrentGlobalOrNull, HandleValue as RawHandleValue, HandleValueArray, Heap, IsCallable,
|
||||
JSContext, JSObject, JS_NewObject,
|
||||
JS_NewObject, JSContext, JSObject,
|
||||
};
|
||||
pub(crate) use js::jsval::{JSVal, NullValue, ObjectOrNullValue, ObjectValue, UndefinedValue};
|
||||
pub(crate) use js::panic::maybe_resume_unwind;
|
||||
|
@ -18,8 +18,8 @@ pub(crate) mod base {
|
|||
pub(crate) use js::rust::{HandleObject, HandleValue, MutableHandleObject, MutableHandleValue};
|
||||
|
||||
pub(crate) use crate::dom::bindings::callback::{
|
||||
wrap_call_this_value, CallSetup, CallbackContainer, CallbackFunction, CallbackInterface,
|
||||
CallbackObject, ExceptionHandling, ThisReflector,
|
||||
CallSetup, CallbackContainer, CallbackFunction, CallbackInterface, CallbackObject,
|
||||
ExceptionHandling, ThisReflector, wrap_call_this_value,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||
ChannelCountMode, ChannelCountModeValues, ChannelInterpretation,
|
||||
|
@ -28,11 +28,11 @@ pub(crate) mod base {
|
|||
pub(crate) use crate::dom::bindings::codegen::DomTypes::DomTypes;
|
||||
pub(crate) use crate::dom::bindings::codegen::{GenericUnionTypes, UnionTypes};
|
||||
pub(crate) use crate::dom::bindings::conversions::{
|
||||
root_from_handlevalue, ConversionBehavior, ConversionResult, FromJSValConvertible,
|
||||
StringificationBehavior, ToJSValConvertible,
|
||||
ConversionBehavior, ConversionResult, FromJSValConvertible, StringificationBehavior,
|
||||
ToJSValConvertible, root_from_handlevalue,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::error::Error::JSFailed;
|
||||
pub(crate) use crate::dom::bindings::error::{throw_dom_exception, Fallible};
|
||||
pub(crate) use crate::dom::bindings::error::{Fallible, throw_dom_exception};
|
||||
pub(crate) use crate::dom::bindings::num::Finite;
|
||||
pub(crate) use crate::dom::bindings::proxyhandler::CrossOriginProperties;
|
||||
pub(crate) use crate::dom::bindings::reflector::{DomGlobalGeneric, DomObject};
|
||||
|
@ -40,7 +40,7 @@ pub(crate) mod base {
|
|||
pub(crate) use crate::dom::bindings::str::{ByteString, DOMString, USVString};
|
||||
pub(crate) use crate::dom::bindings::trace::RootedTraceableBox;
|
||||
pub(crate) use crate::dom::bindings::utils::{
|
||||
get_dictionary_property, set_dictionary_property, DomHelpers, ThreadUnsafeOnceLock,
|
||||
DomHelpers, ThreadUnsafeOnceLock, get_dictionary_property, set_dictionary_property,
|
||||
};
|
||||
pub(crate) use crate::dom::globalscope::{GlobalScope, GlobalScopeHelpers};
|
||||
pub(crate) use crate::dom::promise::PromiseHelpers;
|
||||
|
@ -58,44 +58,45 @@ pub(crate) mod module {
|
|||
SetProxyReservedSlot,
|
||||
};
|
||||
pub(crate) use js::jsapi::{
|
||||
JSJitInfo_OpType, JSJitInfo__bindgen_ty_1, JSJitInfo__bindgen_ty_2,
|
||||
JSJitInfo__bindgen_ty_3, JSJitMethodCallArgs, JSJitSetterCallArgs, JSNativeWrapper,
|
||||
JSPropertySpec, JSPropertySpec_Accessor, JSPropertySpec_AccessorsOrValue,
|
||||
JSPropertySpec_AccessorsOrValue_Accessors, JSPropertySpec_Kind, JSPropertySpec_Name,
|
||||
JSPropertySpec_ValueWrapper, JSPropertySpec_ValueWrapper_Type,
|
||||
JSPropertySpec_ValueWrapper__bindgen_ty_1, JSTracer, JSTypedMethodJitInfo, JSValueType,
|
||||
JS_AtomizeAndPinString, JS_ForwardGetPropertyTo, JS_GetPropertyDescriptorById,
|
||||
JS_HasPropertyById, JS_NewPlainObject, JS_SetReservedSlot,
|
||||
MutableHandle as RawMutableHandle, MutableHandleIdVector as RawMutableHandleIdVector,
|
||||
MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue,
|
||||
ObjectOpResult, PropertyDescriptor, SymbolCode, UndefinedHandleValue,
|
||||
__BindgenBitfieldUnit, jsid, CallArgs, GCContext, GetRealmErrorPrototype,
|
||||
__BindgenBitfieldUnit, CallArgs, GCContext, GetRealmErrorPrototype,
|
||||
GetRealmFunctionPrototype, GetRealmIteratorPrototype, GetRealmObjectPrototype,
|
||||
GetWellKnownSymbol, Handle as RawHandle, HandleId as RawHandleId,
|
||||
HandleObject as RawHandleObject, JSAutoRealm, JSClass, JSClassOps, JSFunctionSpec,
|
||||
JSJitGetterCallArgs, JSJitInfo, JSJitInfo_AliasSet, JSJitInfo_ArgType,
|
||||
JSCLASS_FOREGROUND_FINALIZE, JSCLASS_RESERVED_SLOTS_SHIFT, JSITER_HIDDEN, JSITER_OWNONLY,
|
||||
JSITER_SYMBOLS, JSPROP_ENUMERATE, JSPROP_PERMANENT, JSPROP_READONLY,
|
||||
HandleObject as RawHandleObject, JS_AtomizeAndPinString, JS_ForwardGetPropertyTo,
|
||||
JS_GetPropertyDescriptorById, JS_HasPropertyById, JS_NewPlainObject, JS_SetReservedSlot,
|
||||
JSAutoRealm, JSCLASS_FOREGROUND_FINALIZE, JSCLASS_RESERVED_SLOTS_SHIFT, JSClass,
|
||||
JSClassOps, JSFunctionSpec, JSITER_HIDDEN, JSITER_OWNONLY, JSITER_SYMBOLS,
|
||||
JSJitGetterCallArgs, JSJitInfo, JSJitInfo__bindgen_ty_1, JSJitInfo__bindgen_ty_2,
|
||||
JSJitInfo__bindgen_ty_3, JSJitInfo_AliasSet, JSJitInfo_ArgType, JSJitInfo_OpType,
|
||||
JSJitMethodCallArgs, JSJitSetterCallArgs, JSNativeWrapper, JSPROP_ENUMERATE,
|
||||
JSPROP_PERMANENT, JSPROP_READONLY, JSPropertySpec, JSPropertySpec_Accessor,
|
||||
JSPropertySpec_AccessorsOrValue, JSPropertySpec_AccessorsOrValue_Accessors,
|
||||
JSPropertySpec_Kind, JSPropertySpec_Name, JSPropertySpec_ValueWrapper,
|
||||
JSPropertySpec_ValueWrapper__bindgen_ty_1, JSPropertySpec_ValueWrapper_Type, JSTracer,
|
||||
JSTypedMethodJitInfo, JSValueType, MutableHandle as RawMutableHandle,
|
||||
MutableHandleIdVector as RawMutableHandleIdVector,
|
||||
MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue,
|
||||
ObjectOpResult, PropertyDescriptor, SymbolCode, UndefinedHandleValue, jsid,
|
||||
};
|
||||
pub(crate) use js::jsval::PrivateValue;
|
||||
pub(crate) use js::panic::wrap_panic;
|
||||
pub(crate) use js::rust::wrappers::{
|
||||
int_to_jsid, AppendToIdVector, Call, GetPropertyKeys, JS_CopyOwnPropertiesAndPrivateFields,
|
||||
AppendToIdVector, Call, GetPropertyKeys, JS_CopyOwnPropertiesAndPrivateFields,
|
||||
JS_DefineProperty, JS_DefinePropertyById2, JS_GetProperty,
|
||||
JS_InitializePropertiesFromCompatibleNativeObject, JS_NewObjectWithGivenProto,
|
||||
JS_NewObjectWithoutMetadata, JS_SetImmutablePrototype, JS_SetProperty, JS_SetPrototype,
|
||||
JS_WrapObject, NewProxyObject, RUST_INTERNED_STRING_TO_JSID, RUST_SYMBOL_TO_JSID,
|
||||
int_to_jsid,
|
||||
};
|
||||
pub(crate) use js::rust::{
|
||||
get_context_realm, get_object_class, get_object_realm, CustomAutoRooterGuard, GCMethods,
|
||||
Handle, MutableHandle,
|
||||
CustomAutoRooterGuard, GCMethods, Handle, MutableHandle, get_context_realm,
|
||||
get_object_class, get_object_realm,
|
||||
};
|
||||
pub(crate) use js::typedarray::{
|
||||
ArrayBuffer, ArrayBufferView, Float32Array, Float64Array, Uint8Array, Uint8ClampedArray,
|
||||
};
|
||||
pub(crate) use js::{
|
||||
jsapi, typedarray, JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL,
|
||||
JSCLASS_RESERVED_SLOTS_MASK, JS_CALLEE,
|
||||
JS_CALLEE, JSCLASS_GLOBAL_SLOT_COUNT, JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL,
|
||||
JSCLASS_RESERVED_SLOTS_MASK, jsapi, typedarray,
|
||||
};
|
||||
pub(crate) use script_bindings::constant::{ConstantSpec, ConstantVal};
|
||||
pub(crate) use servo_config::pref;
|
||||
|
@ -115,11 +116,11 @@ pub(crate) mod module {
|
|||
push_new_element_queue,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::conversions::{
|
||||
is_array_like, jsid_to_string, native_from_handlevalue, native_from_object_static,
|
||||
IDLInterface, StringificationBehavior, ToJSValConvertible, DOM_OBJECT_SLOT,
|
||||
DOM_OBJECT_SLOT, IDLInterface, StringificationBehavior, ToJSValConvertible, is_array_like,
|
||||
jsid_to_string, native_from_handlevalue, native_from_object_static,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::error::{
|
||||
throw_constructor_without_new, Error, ErrorResult,
|
||||
Error, ErrorResult, throw_constructor_without_new,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::finalize::{
|
||||
finalize_common, finalize_global, finalize_weak_referenceable,
|
||||
|
@ -127,16 +128,17 @@ pub(crate) mod module {
|
|||
pub(crate) use crate::dom::bindings::guard::{Condition, Guard};
|
||||
pub(crate) use crate::dom::bindings::inheritance::Castable;
|
||||
pub(crate) use crate::dom::bindings::interface::{
|
||||
create_callback_interface_object, create_global_object, create_interface_prototype_object,
|
||||
create_named_constructors, create_noncallback_interface_object, define_dom_interface,
|
||||
define_guarded_methods, define_guarded_properties, get_desired_proto,
|
||||
get_per_interface_object_handle, is_exposed_in, ConstructorClassHook,
|
||||
InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass, ProtoOrIfaceIndex,
|
||||
ConstructorClassHook, InterfaceConstructorBehavior, NonCallbackInterfaceObjectClass,
|
||||
ProtoOrIfaceIndex, create_callback_interface_object, create_global_object,
|
||||
create_interface_prototype_object, create_named_constructors,
|
||||
create_noncallback_interface_object, define_dom_interface, define_guarded_methods,
|
||||
define_guarded_properties, get_desired_proto, get_per_interface_object_handle,
|
||||
is_exposed_in,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::iterable::{Iterable, IteratorType};
|
||||
pub(crate) use crate::dom::bindings::like::{Maplike, Setlike};
|
||||
pub(crate) use crate::dom::bindings::namespace::{
|
||||
create_namespace_object, NamespaceObjectClass,
|
||||
NamespaceObjectClass, create_namespace_object,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::proxyhandler;
|
||||
pub(crate) use crate::dom::bindings::proxyhandler::{
|
||||
|
@ -149,13 +151,13 @@ pub(crate) mod module {
|
|||
pub(crate) use crate::dom::bindings::root::{Dom, DomSlice, MaybeUnreflectedDom, Root};
|
||||
pub(crate) use crate::dom::bindings::trace::JSTraceable;
|
||||
pub(crate) use crate::dom::bindings::utils::{
|
||||
enumerate_global, exception_to_promise, generic_getter, generic_lenient_getter,
|
||||
generic_lenient_setter, generic_method, generic_setter, generic_static_promise_method,
|
||||
get_array_index_from_id, get_property_on_prototype, has_property_on_prototype,
|
||||
resolve_global, trace_global, AsVoidPtr, DOMClass, DOMJSClass, ProtoOrIfaceArray,
|
||||
DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, JSCLASS_DOM_GLOBAL,
|
||||
AsVoidPtr, DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, DOMClass, DOMJSClass, JSCLASS_DOM_GLOBAL,
|
||||
ProtoOrIfaceArray, enumerate_global, exception_to_promise, generic_getter,
|
||||
generic_lenient_getter, generic_lenient_setter, generic_method, generic_setter,
|
||||
generic_static_promise_method, get_array_index_from_id, get_property_on_prototype,
|
||||
has_property_on_prototype, resolve_global, trace_global,
|
||||
};
|
||||
pub(crate) use crate::dom::bindings::weakref::{WeakReferenceable, DOM_WEAK_SLOT};
|
||||
pub(crate) use crate::dom::bindings::weakref::{DOM_WEAK_SLOT, WeakReferenceable};
|
||||
pub(crate) use crate::dom::types::{AnalyserNode, AudioNode, BaseAudioContext, EventTarget};
|
||||
pub(crate) use crate::mem::malloc_size_of_including_raw_self;
|
||||
pub(crate) use crate::realms::{AlreadyInRealm, InRealm};
|
||||
|
|
|
@ -12,14 +12,15 @@ use js::error::throw_type_error;
|
|||
use js::glue::UncheckedUnwrapObject;
|
||||
use js::jsapi::JS::CompartmentIterResult;
|
||||
use js::jsapi::{
|
||||
jsid, CallArgs, CheckedUnwrapStatic, Compartment, CompartmentSpecifier, CurrentGlobalOrNull,
|
||||
CallArgs, CheckedUnwrapStatic, Compartment, CompartmentSpecifier, CurrentGlobalOrNull,
|
||||
GetFunctionRealm, GetNonCCWObjectGlobal, GetRealmGlobalOrNull, GetWellKnownSymbol,
|
||||
HandleObject as RawHandleObject, IsSharableCompartment, IsSystemCompartment, JSAutoRealm,
|
||||
JSClass, JSClassOps, JSContext, JSFunctionSpec, JSObject, JSPropertySpec, JSString, JSTracer,
|
||||
HandleObject as RawHandleObject, IsSharableCompartment, IsSystemCompartment,
|
||||
JS_AtomizeAndPinString, JS_GetFunctionObject, JS_GetProperty, JS_IterateCompartments,
|
||||
JS_NewFunction, JS_NewGlobalObject, JS_NewObject, JS_NewPlainObject, JS_NewStringCopyN,
|
||||
JS_SetReservedSlot, JS_WrapObject, ObjectOps, OnNewGlobalHookOption, SymbolCode,
|
||||
TrueHandleValue, Value, JSFUN_CONSTRUCTOR, JSPROP_PERMANENT, JSPROP_READONLY, JSPROP_RESOLVING,
|
||||
JS_SetReservedSlot, JS_WrapObject, JSAutoRealm, JSClass, JSClassOps, JSContext,
|
||||
JSFUN_CONSTRUCTOR, JSFunctionSpec, JSObject, JSPROP_PERMANENT, JSPROP_READONLY,
|
||||
JSPROP_RESOLVING, JSPropertySpec, JSString, JSTracer, ObjectOps, OnNewGlobalHookOption,
|
||||
SymbolCode, TrueHandleValue, Value, jsid,
|
||||
};
|
||||
use js::jsval::{JSVal, NullValue, PrivateValue};
|
||||
use js::rust::wrappers::{
|
||||
|
@ -28,19 +29,19 @@ use js::rust::wrappers::{
|
|||
JS_NewObjectWithGivenProto, RUST_SYMBOL_TO_JSID,
|
||||
};
|
||||
use js::rust::{
|
||||
define_methods, define_properties, get_object_class, is_dom_class, maybe_wrap_object,
|
||||
HandleObject, HandleValue, MutableHandleObject, RealmOptions,
|
||||
HandleObject, HandleValue, MutableHandleObject, RealmOptions, define_methods,
|
||||
define_properties, get_object_class, is_dom_class, maybe_wrap_object,
|
||||
};
|
||||
use script_bindings::constant::{define_constants, ConstantSpec};
|
||||
use script_bindings::constant::{ConstantSpec, define_constants};
|
||||
use servo_url::MutableOrigin;
|
||||
|
||||
use crate::dom::bindings::codegen::InterfaceObjectMap::Globals;
|
||||
use crate::dom::bindings::codegen::PrototypeList;
|
||||
use crate::dom::bindings::conversions::{get_dom_class, DOM_OBJECT_SLOT};
|
||||
use crate::dom::bindings::conversions::{DOM_OBJECT_SLOT, get_dom_class};
|
||||
use crate::dom::bindings::guard::Guard;
|
||||
use crate::dom::bindings::principals::ServoJSPrincipals;
|
||||
use crate::dom::bindings::utils::{
|
||||
get_proto_or_iface_array, DOMJSClass, ProtoOrIfaceArray, DOM_PROTOTYPE_SLOT, JSCLASS_DOM_GLOBAL,
|
||||
DOM_PROTOTYPE_SLOT, DOMJSClass, JSCLASS_DOM_GLOBAL, ProtoOrIfaceArray, get_proto_or_iface_array,
|
||||
};
|
||||
use crate::script_runtime::JSContext as SafeJSContext;
|
||||
|
||||
|
|
|
@ -20,17 +20,17 @@ use script_bindings::conversions::IDLInterface;
|
|||
pub(crate) use script_bindings::iterable::*;
|
||||
use script_bindings::utils::DOMClass;
|
||||
|
||||
use crate::DomTypes;
|
||||
use crate::dom::bindings::codegen::Bindings::IterableIteratorBinding::{
|
||||
IterableKeyAndValueResult, IterableKeyOrValueResult,
|
||||
};
|
||||
use crate::dom::bindings::error::Fallible;
|
||||
use crate::dom::bindings::reflector::{
|
||||
reflect_dom_object, DomGlobalGeneric, DomObjectIteratorWrap, DomObjectWrap, Reflector,
|
||||
DomGlobalGeneric, DomObjectIteratorWrap, DomObjectWrap, Reflector, reflect_dom_object,
|
||||
};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot, Root};
|
||||
use crate::dom::bindings::trace::{JSTraceable, NoTrace, RootedTraceableBox};
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
use crate::DomTypes;
|
||||
|
||||
/// An iterator over the iterable entries of a given DOM interface.
|
||||
#[dom_struct]
|
||||
|
@ -52,14 +52,14 @@ impl<D: DomTypes, T: DomObjectIteratorWrap<D> + JSTraceable + Iterable> Iterable
|
|||
}
|
||||
|
||||
impl<
|
||||
D: DomTypes,
|
||||
T: DomObjectIteratorWrap<D>
|
||||
+ JSTraceable
|
||||
+ Iterable
|
||||
+ DomGlobalGeneric<D>
|
||||
+ IDLInterface
|
||||
+ IteratorDerives,
|
||||
> IDLInterface for IterableIterator<D, T>
|
||||
D: DomTypes,
|
||||
T: DomObjectIteratorWrap<D>
|
||||
+ JSTraceable
|
||||
+ Iterable
|
||||
+ DomGlobalGeneric<D>
|
||||
+ IDLInterface
|
||||
+ IteratorDerives,
|
||||
> IDLInterface for IterableIterator<D, T>
|
||||
{
|
||||
fn derives(class: &'static DOMClass) -> bool {
|
||||
<T as IteratorDerives>::derives(class)
|
||||
|
|
|
@ -12,8 +12,8 @@ use js::glue::{
|
|||
JSPrincipalsCallbacks,
|
||||
};
|
||||
use js::jsapi::{
|
||||
JSContext, JSPrincipals, JSStructuredCloneReader, JSStructuredCloneWriter, JS_DropPrincipals,
|
||||
JS_HoldPrincipals, JS_ReadUint32Pair,
|
||||
JS_DropPrincipals, JS_HoldPrincipals, JS_ReadUint32Pair, JSContext, JSPrincipals,
|
||||
JSStructuredCloneReader, JSStructuredCloneWriter,
|
||||
};
|
||||
use js::rust::Runtime;
|
||||
use servo_url::MutableOrigin;
|
||||
|
@ -111,7 +111,7 @@ impl ServoJSPrincipalsRef<'_> {
|
|||
impl Clone for ServoJSPrincipalsRef<'_> {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
Self(ManuallyDrop::new(ServoJSPrincipals(self.0 .0)), PhantomData)
|
||||
Self(ManuallyDrop::new(ServoJSPrincipals(self.0.0)), PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,27 +17,27 @@ use js::glue::{
|
|||
};
|
||||
use js::jsapi;
|
||||
use js::jsapi::{
|
||||
jsid, DOMProxyShadowsResult, GetObjectRealmOrNull, GetRealmPrincipals, GetStaticPrototype,
|
||||
DOMProxyShadowsResult, GetObjectRealmOrNull, GetRealmPrincipals, GetStaticPrototype,
|
||||
GetWellKnownSymbol, Handle as RawHandle, HandleId as RawHandleId,
|
||||
HandleObject as RawHandleObject, HandleValue as RawHandleValue, JSAutoRealm, JSContext,
|
||||
JSErrNum, JSFunctionSpec, JSObject, JSPropertySpec, JS_AtomizeAndPinString,
|
||||
JS_DefinePropertyById, JS_GetOwnPropertyDescriptorById, JS_IsExceptionPending,
|
||||
HandleObject as RawHandleObject, HandleValue as RawHandleValue, JS_AtomizeAndPinString,
|
||||
JS_DefinePropertyById, JS_GetOwnPropertyDescriptorById, JS_IsExceptionPending, JSAutoRealm,
|
||||
JSContext, JSErrNum, JSFunctionSpec, JSObject, JSPropertySpec,
|
||||
MutableHandle as RawMutableHandle, MutableHandleIdVector as RawMutableHandleIdVector,
|
||||
MutableHandleObject as RawMutableHandleObject, MutableHandleValue as RawMutableHandleValue,
|
||||
ObjectOpResult, PropertyDescriptor, SetDOMProxyInformation, SymbolCode,
|
||||
ObjectOpResult, PropertyDescriptor, SetDOMProxyInformation, SymbolCode, jsid,
|
||||
};
|
||||
use js::jsid::SymbolId;
|
||||
use js::jsval::{ObjectValue, UndefinedValue};
|
||||
use js::rust::wrappers::{
|
||||
AppendToIdVector, JS_AlreadyHasOwnPropertyById, JS_NewObjectWithGivenProto,
|
||||
SetDataPropertyDescriptor, RUST_INTERNED_STRING_TO_JSID,
|
||||
RUST_INTERNED_STRING_TO_JSID, SetDataPropertyDescriptor,
|
||||
};
|
||||
use js::rust::{
|
||||
get_context_realm, Handle, HandleObject, HandleValue, MutableHandle, MutableHandleObject,
|
||||
Handle, HandleObject, HandleValue, MutableHandle, MutableHandleObject, get_context_realm,
|
||||
};
|
||||
|
||||
use crate::dom::bindings::conversions::{is_dom_proxy, jsid_to_string, jsstring_to_str};
|
||||
use crate::dom::bindings::error::{throw_dom_exception, Error};
|
||||
use crate::dom::bindings::error::{Error, throw_dom_exception};
|
||||
use crate::dom::bindings::principals::ServoJSPrincipalsRef;
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
|
|
|
@ -13,8 +13,8 @@ use indexmap::IndexMap;
|
|||
use js::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
|
||||
use js::jsapi::glue::JS_GetOwnPropertyDescriptorById;
|
||||
use js::jsapi::{
|
||||
HandleId as RawHandleId, JSContext, JS_NewPlainObject, PropertyDescriptor, JSITER_HIDDEN,
|
||||
JSITER_OWNONLY, JSITER_SYMBOLS, JSPROP_ENUMERATE,
|
||||
HandleId as RawHandleId, JS_NewPlainObject, JSContext, JSITER_HIDDEN, JSITER_OWNONLY,
|
||||
JSITER_SYMBOLS, JSPROP_ENUMERATE, PropertyDescriptor,
|
||||
};
|
||||
use js::jsval::{ObjectValue, UndefinedValue};
|
||||
use js::rust::wrappers::{GetPropertyKeys, JS_DefineUCProperty2, JS_GetPropertyById, JS_IdToValue};
|
||||
|
@ -145,7 +145,7 @@ where
|
|||
let key = match K::from_id(cx, id.handle())? {
|
||||
ConversionResult::Success(key) => key,
|
||||
ConversionResult::Failure(message) => {
|
||||
return Ok(ConversionResult::Failure(message))
|
||||
return Ok(ConversionResult::Failure(message));
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -157,7 +157,7 @@ where
|
|||
let property = match V::from_jsval(cx, property.handle(), config.clone())? {
|
||||
ConversionResult::Success(property) => property,
|
||||
ConversionResult::Failure(message) => {
|
||||
return Ok(ConversionResult::Failure(message))
|
||||
return Ok(ConversionResult::Failure(message));
|
||||
},
|
||||
};
|
||||
map.insert(key, property);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
use js::rust::HandleObject;
|
||||
|
||||
use crate::DomTypes;
|
||||
use crate::dom::bindings::conversions::DerivedFrom;
|
||||
use crate::dom::bindings::iterable::{Iterable, IterableIterator};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot, Root};
|
||||
|
@ -13,7 +14,6 @@ use crate::dom::bindings::trace::JSTraceable;
|
|||
use crate::dom::globalscope::{GlobalScope, GlobalScopeHelpers};
|
||||
use crate::realms::AlreadyInRealm;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
use crate::DomTypes;
|
||||
|
||||
/// Create the reflector for a new DOM object and yield ownership to the
|
||||
/// reflector.
|
||||
|
|
|
@ -9,12 +9,12 @@ use std::thread;
|
|||
use js::jsapi::{GetScriptedCallerGlobal, HideScriptedCaller, JSTracer, UnhideScriptedCaller};
|
||||
use js::rust::Runtime;
|
||||
|
||||
use crate::DomTypes;
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::trace::JSTraceable;
|
||||
use crate::dom::bindings::utils::DomHelpers;
|
||||
use crate::dom::globalscope::{GlobalScope, GlobalScopeHelpers};
|
||||
use crate::script_runtime::CanGc;
|
||||
use crate::DomTypes;
|
||||
|
||||
thread_local!(pub(super) static STACK: RefCell<Vec<StackEntry<crate::DomTypeHolder>>> = const {
|
||||
RefCell::new(Vec::new())
|
||||
|
|
|
@ -420,13 +420,8 @@ impl FromInputValueString for &str {
|
|||
Done,
|
||||
Error,
|
||||
}
|
||||
let next_state = |valid: bool, next: State| -> State {
|
||||
if valid {
|
||||
next
|
||||
} else {
|
||||
State::Error
|
||||
}
|
||||
};
|
||||
let next_state =
|
||||
|valid: bool, next: State| -> State { if valid { next } else { State::Error } };
|
||||
|
||||
let state = self.chars().fold(State::HourHigh, |state, c| {
|
||||
match state {
|
||||
|
|
|
@ -14,20 +14,19 @@ use js::glue::{
|
|||
NewJSAutoStructuredCloneBuffer, WriteBytesToJSStructuredCloneData,
|
||||
};
|
||||
use js::jsapi::{
|
||||
CloneDataPolicy, HandleObject as RawHandleObject, JSContext, JSObject,
|
||||
CloneDataPolicy, HandleObject as RawHandleObject, JS_ClearPendingException, JS_ReadUint32Pair,
|
||||
JS_STRUCTURED_CLONE_VERSION, JS_WriteUint32Pair, JSContext, JSObject,
|
||||
JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter,
|
||||
JS_ClearPendingException, JS_ReadUint32Pair, JS_WriteUint32Pair,
|
||||
MutableHandleObject as RawMutableHandleObject, StructuredCloneScope, TransferableOwnership,
|
||||
JS_STRUCTURED_CLONE_VERSION,
|
||||
};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::wrappers::{JS_ReadStructuredClone, JS_WriteStructuredClone};
|
||||
use js::rust::{CustomAutoRooterGuard, HandleValue, MutableHandleValue};
|
||||
use script_traits::StructuredSerializedData;
|
||||
use script_traits::serializable::BlobImpl;
|
||||
use script_traits::transferable::MessagePortImpl;
|
||||
use script_traits::StructuredSerializedData;
|
||||
|
||||
use crate::dom::bindings::conversions::{root_from_object, ToJSValConvertible};
|
||||
use crate::dom::bindings::conversions::{ToJSValConvertible, root_from_object};
|
||||
use crate::dom::bindings::error::{Error, Fallible};
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
|
@ -36,7 +35,7 @@ use crate::dom::bindings::transferable::Transferable;
|
|||
use crate::dom::blob::Blob;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::messageport::MessagePort;
|
||||
use crate::realms::{enter_realm, AlreadyInRealm, InRealm};
|
||||
use crate::realms::{AlreadyInRealm, InRealm, enter_realm};
|
||||
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
||||
|
||||
// TODO: Should we add Min and Max const to https://github.com/servo/rust-mozjs/blob/master/src/consts.rs?
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
//! `JSTraceable` to a datatype.
|
||||
|
||||
use std::cell::OnceCell;
|
||||
use std::collections::hash_map::RandomState;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::RandomState;
|
||||
use std::fmt::Display;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::mem;
|
||||
|
@ -53,9 +53,9 @@ use servo_arc::Arc as ServoArc;
|
|||
use smallvec::SmallVec;
|
||||
use style::author_styles::AuthorStyles;
|
||||
use style::stylesheet_set::{AuthorStylesheetSet, DocumentStylesheetSet};
|
||||
use tendril::TendrilSink;
|
||||
use tendril::fmt::UTF8;
|
||||
use tendril::stream::LossyDecoder;
|
||||
use tendril::TendrilSink;
|
||||
#[cfg(feature = "webxr")]
|
||||
use webxr_api::{Finger, Hand};
|
||||
|
||||
|
|
|
@ -12,19 +12,21 @@ use std::sync::OnceLock;
|
|||
use std::thread::LocalKey;
|
||||
use std::{ptr, slice, str};
|
||||
|
||||
use js::JS_CALLEE;
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::glue::{
|
||||
CallJitGetterOp, CallJitMethodOp, CallJitSetterOp, IsWrapper, JS_GetReservedSlot,
|
||||
UnwrapObjectDynamic, UnwrapObjectStatic, RUST_FUNCTION_VALUE_TO_JITINFO,
|
||||
RUST_FUNCTION_VALUE_TO_JITINFO, UnwrapObjectDynamic, UnwrapObjectStatic,
|
||||
};
|
||||
use js::jsapi::{
|
||||
AtomToLinearString, CallArgs, DOMCallbacks, ExceptionStackBehavior, GetLinearStringCharAt,
|
||||
GetLinearStringLength, GetNonCCWObjectGlobal, HandleId as RawHandleId,
|
||||
HandleObject as RawHandleObject, Heap, JSAtom, JSContext, JSJitInfo, JSObject, JSTracer,
|
||||
JS_ClearPendingException, JS_DeprecatedStringHasLatin1Chars, JS_EnumerateStandardClasses,
|
||||
JS_FreezeObject, JS_GetLatin1StringCharsAndLength, JS_IsExceptionPending, JS_IsGlobalObject,
|
||||
JS_ResolveStandardClass, MutableHandleIdVector as RawMutableHandleIdVector,
|
||||
MutableHandleValue as RawMutableHandleValue, ObjectOpResult, StringIsArrayIndex,
|
||||
HandleObject as RawHandleObject, Heap, JS_ClearPendingException,
|
||||
JS_DeprecatedStringHasLatin1Chars, JS_EnumerateStandardClasses, JS_FreezeObject,
|
||||
JS_GetLatin1StringCharsAndLength, JS_IsExceptionPending, JS_IsGlobalObject,
|
||||
JS_ResolveStandardClass, JSAtom, JSContext, JSJitInfo, JSObject, JSTracer,
|
||||
MutableHandleIdVector as RawMutableHandleIdVector, MutableHandleValue as RawMutableHandleValue,
|
||||
ObjectOpResult, StringIsArrayIndex,
|
||||
};
|
||||
use js::jsval::{JSVal, UndefinedValue};
|
||||
use js::rust::wrappers::{
|
||||
|
@ -33,25 +35,24 @@ use js::rust::wrappers::{
|
|||
JS_SetPendingException, JS_SetProperty,
|
||||
};
|
||||
use js::rust::{
|
||||
get_object_class, is_dom_class, GCMethods, Handle, HandleId, HandleObject, HandleValue,
|
||||
MutableHandleValue, ToString,
|
||||
GCMethods, Handle, HandleId, HandleObject, HandleValue, MutableHandleValue, ToString,
|
||||
get_object_class, is_dom_class,
|
||||
};
|
||||
use js::JS_CALLEE;
|
||||
|
||||
use crate::DomTypes;
|
||||
use crate::dom::bindings::codegen::InterfaceObjectMap;
|
||||
use crate::dom::bindings::codegen::PrototypeList::{self, PROTO_OR_IFACE_LENGTH};
|
||||
use crate::dom::bindings::constructor::call_html_constructor;
|
||||
use crate::dom::bindings::conversions::{
|
||||
jsstring_to_str, private_from_proto_check, DerivedFrom, PrototypeCheck,
|
||||
DerivedFrom, PrototypeCheck, jsstring_to_str, private_from_proto_check,
|
||||
};
|
||||
use crate::dom::bindings::error::{throw_dom_exception, throw_invalid_this, Error};
|
||||
use crate::dom::bindings::error::{Error, throw_dom_exception, throw_invalid_this};
|
||||
use crate::dom::bindings::reflector::DomObject;
|
||||
use crate::dom::bindings::settings_stack::{self, StackEntry};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::bindings::trace::trace_object;
|
||||
use crate::dom::windowproxy::WindowProxyHandler;
|
||||
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
||||
use crate::DomTypes;
|
||||
|
||||
/// A OnceLock wrapping a type that is not considered threadsafe by the Rust compiler, but
|
||||
/// will be used in a threadsafe manner (it will not be mutated, after being initialized).
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Functions for validating and extracting qualified XML names.
|
||||
|
||||
use html5ever::{namespace_url, ns, LocalName, Namespace, Prefix};
|
||||
use html5ever::{LocalName, Namespace, Prefix, namespace_url, ns};
|
||||
|
||||
use crate::dom::bindings::error::{Error, Fallible};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue