diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/bindings/buffer_source.rs | 12 | ||||
-rw-r--r-- | components/script/dom/bindings/frozenarray.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/interface.rs | 10 | ||||
-rw-r--r-- | components/script/dom/bindings/namespace.rs | 13 | ||||
-rw-r--r-- | components/script/dom/bindings/proxyhandler.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/utils.rs | 4 | ||||
-rw-r--r-- | components/script/dom/customelementregistry.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 6 | ||||
-rw-r--r-- | components/script/dom/webgl2renderingcontext.rs | 11 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 2 | ||||
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 7 | ||||
-rw-r--r-- | components/script/script_module.rs | 9 | ||||
-rw-r--r-- | components/script_bindings/codegen/CodegenRust.py | 6 |
13 files changed, 56 insertions, 32 deletions
diff --git a/components/script/dom/bindings/buffer_source.rs b/components/script/dom/bindings/buffer_source.rs index d3879f2bcff..054711ef874 100644 --- a/components/script/dom/bindings/buffer_source.rs +++ b/components/script/dom/bindings/buffer_source.rs @@ -620,13 +620,15 @@ unsafe impl<T> crate::dom::bindings::trace::JSTraceable for HeapBufferSource<T> pub(crate) fn create_buffer_source<T>( cx: JSContext, data: &[T::Element], - dest: MutableHandleObject, + mut dest: MutableHandleObject, _can_gc: CanGc, ) -> Result<TypedArray<T, *mut JSObject>, ()> where T: TypedArrayElement + TypedArrayElementCreator, { - let res = unsafe { TypedArray::<T, *mut JSObject>::create(*cx, CreateWith::Slice(data), dest) }; + let res = unsafe { + TypedArray::<T, *mut JSObject>::create(*cx, CreateWith::Slice(data), dest.reborrow()) + }; if res.is_err() { Err(()) @@ -638,13 +640,15 @@ where fn create_buffer_source_with_length<T>( cx: JSContext, len: usize, - dest: MutableHandleObject, + mut dest: MutableHandleObject, _can_gc: CanGc, ) -> Result<TypedArray<T, *mut JSObject>, ()> where T: TypedArrayElement + TypedArrayElementCreator, { - let res = unsafe { TypedArray::<T, *mut JSObject>::create(*cx, CreateWith::Length(len), dest) }; + let res = unsafe { + TypedArray::<T, *mut JSObject>::create(*cx, CreateWith::Length(len), dest.reborrow()) + }; if res.is_err() { Err(()) diff --git a/components/script/dom/bindings/frozenarray.rs b/components/script/dom/bindings/frozenarray.rs index a9fb40ad0b4..17470682912 100644 --- a/components/script/dom/bindings/frozenarray.rs +++ b/components/script/dom/bindings/frozenarray.rs @@ -36,7 +36,7 @@ impl CachedFrozenArray { } let array = f(); - to_frozen_array(array.as_slice(), cx, retval, can_gc); + to_frozen_array(array.as_slice(), cx, retval.reborrow(), can_gc); // Safety: need to create the Heap value in its final memory location before setting it. *self.frozen_value.borrow_mut() = Some(Heap::default()); diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index a8d08a7727b..2b6cc27c1f9 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -241,7 +241,7 @@ pub(crate) fn create_interface_prototype_object( regular_properties: &[Guard<&'static [JSPropertySpec]>], constants: &[Guard<&[ConstantSpec]>], unscopable_names: &[&CStr], - rval: MutableHandleObject, + mut rval: MutableHandleObject, ) { create_object( cx, @@ -251,7 +251,7 @@ pub(crate) fn create_interface_prototype_object( regular_methods, regular_properties, constants, - rval, + rval.reborrow(), ); if !unscopable_names.is_empty() { @@ -289,7 +289,7 @@ pub(crate) fn create_noncallback_interface_object( name: &CStr, length: u32, legacy_window_alias_names: &[&CStr], - rval: MutableHandleObject, + mut rval: MutableHandleObject, ) { create_object( cx, @@ -299,7 +299,7 @@ pub(crate) fn create_noncallback_interface_object( static_methods, static_properties, constants, - rval, + rval.reborrow(), ); unsafe { assert!(JS_LinkConstructorAndPrototype( @@ -694,7 +694,7 @@ pub(crate) fn get_desired_proto( global.handle(), ProtoOrIfaceIndex::ID(proto_id), creator, - desired_proto, + desired_proto.reborrow(), ); if desired_proto.is_null() { return Err(()); diff --git a/components/script/dom/bindings/namespace.rs b/components/script/dom/bindings/namespace.rs index 2eca9dbd3f2..46079a787c9 100644 --- a/components/script/dom/bindings/namespace.rs +++ b/components/script/dom/bindings/namespace.rs @@ -45,8 +45,17 @@ pub(crate) fn create_namespace_object( methods: &[Guard<&'static [JSFunctionSpec]>], constants: &[Guard<&'static [ConstantSpec]>], name: &CStr, - rval: MutableHandleObject, + mut rval: MutableHandleObject, ) { - create_object(cx, global, proto, &class.0, methods, &[], constants, rval); + create_object( + cx, + global, + proto, + &class.0, + methods, + &[], + constants, + rval.reborrow(), + ); define_on_global_object(cx, global, name, rval.handle()); } diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index e4bd0875d54..4d29d965333 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -172,7 +172,7 @@ pub(crate) unsafe fn ensure_expando_object( mut expando: MutableHandleObject, ) { assert!(is_dom_proxy(obj.get())); - get_expando_object(obj, expando); + get_expando_object(obj, expando.reborrow()); if expando.is_null() { expando.set(JS_NewObjectWithGivenProto( cx, diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index c5c61425a3b..9431c79d000 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -122,10 +122,10 @@ pub(crate) use script_bindings::utils::{DOMClass, DOMJSClass}; pub(crate) fn to_frozen_array<T: ToJSValConvertible>( convertibles: &[T], cx: SafeJSContext, - rval: MutableHandleValue, + mut rval: MutableHandleValue, _can_gc: CanGc, ) { - unsafe { convertibles.to_jsval(*cx, rval) }; + unsafe { convertibles.to_jsval(*cx, rval.reborrow()) }; rooted!(in(*cx) let obj = rval.to_object()); unsafe { JS_FreezeObject(*cx, RawHandleObject::from(obj.handle())) }; diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index a9e787068f1..8738ce883d2 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -139,7 +139,7 @@ impl CustomElementRegistry { fn check_prototype( &self, constructor: HandleObject, - prototype: MutableHandleValue, + mut prototype: MutableHandleValue, ) -> ErrorResult { unsafe { // Step 10.1 @@ -147,7 +147,7 @@ impl CustomElementRegistry { *GlobalScope::get_cx(), constructor, c"prototype".as_ptr(), - prototype, + prototype.reborrow(), ) { return Err(Error::JSFailed); } diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 930a07ffb68..f2e55e3e91e 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -20,7 +20,7 @@ use js::jsapi::{ NewUCRegExpObject, ObjectIsDate, RegExpFlag_Unicode, RegExpFlags, }; use js::jsval::UndefinedValue; -use js::rust::jsapi_wrapped::{CheckRegExpSyntax, ExecuteRegExpNoStatics, ObjectIsRegExp}; +use js::rust::wrappers::{CheckRegExpSyntax, ExecuteRegExpNoStatics, ObjectIsRegExp}; use js::rust::{HandleObject, MutableHandleObject}; use net_traits::blob_url_store::get_blob_origin; use net_traits::filemanager_thread::FileManagerThreadMsg; @@ -3010,7 +3010,7 @@ fn check_js_regex_syntax(cx: SafeJSContext, pattern: &str) -> bool { RegExpFlags { flags_: RegExpFlag_Unicode, }, - &mut exception.handle_mut(), + exception.handle_mut(), ); if !valid { @@ -3063,7 +3063,7 @@ fn matches_js_regex(cx: SafeJSContext, regex_obj: HandleObject, value: &str) -> value.len(), &mut index, true, - &mut rval.handle_mut(), + rval.handle_mut(), ); if ok { diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index 11f37525d64..d64a7f70376 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -1216,14 +1216,21 @@ impl WebGL2RenderingContextMethods<crate::DomTypeHolder> for WebGL2RenderingCont ); handle_potential_webgl_error!( self.base, - self.get_specific_fb_attachment_param(cx, &fb, target, attachment, pname, rval), + self.get_specific_fb_attachment_param( + cx, + &fb, + target, + attachment, + pname, + rval.reborrow() + ), rval.set(NullValue()) ) } else { // The default framebuffer is bound to the target handle_potential_webgl_error!( self.base, - self.get_default_fb_attachment_param(attachment, pname, rval), + self.get_default_fb_attachment_param(attachment, pname, rval.reborrow()), rval.set(NullValue()) ) } diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 9944e7bf47f..1e51ac4baf9 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -3552,7 +3552,7 @@ impl WebGLRenderingContextMethods<crate::DomTypeHolder> for WebGLRenderingContex constants::VERTEX_ATTRIB_ARRAY_STRIDE => retval.set(Int32Value(data.stride as i32)), constants::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING => unsafe { if let Some(buffer) = data.buffer() { - buffer.to_jsval(*cx, retval); + buffer.to_jsval(*cx, retval.reborrow()); } else { retval.set(NullValue()); } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index fca2eea4f58..10836cd12c9 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -1441,7 +1441,12 @@ impl XMLHttpRequest { let json_text = decode_to_utf16_with_bom_removal(&bytes, UTF_8); // Step 5 unsafe { - if !JS_ParseJSON(*cx, json_text.as_ptr(), json_text.len() as u32, rval) { + if !JS_ParseJSON( + *cx, + json_text.as_ptr(), + json_text.len() as u32, + rval.reborrow(), + ) { JS_ClearPendingException(*cx); return rval.set(NullValue()); } diff --git a/components/script/script_module.rs b/components/script/script_module.rs index 9840624193b..a3259b156ba 100644 --- a/components/script/script_module.rs +++ b/components/script/script_module.rs @@ -27,8 +27,7 @@ use js::jsapi::{ ThrowOnModuleEvaluationFailure, Value, }; use js::jsval::{JSVal, PrivateValue, UndefinedValue}; -use js::rust::jsapi_wrapped::JS_GetPendingException; -use js::rust::wrappers::JS_SetPendingException; +use js::rust::wrappers::{JS_GetPendingException, JS_SetPendingException}; use js::rust::{ CompileOptionsWrapper, Handle, HandleObject as RustHandleObject, HandleValue, IntoHandle, MutableHandleObject as RustMutableHandleObject, transform_str_to_source_text, @@ -488,7 +487,7 @@ impl ModuleTree { warn!("fail to compile module script of {}", url); rooted!(in(*cx) let mut exception = UndefinedValue()); - assert!(JS_GetPendingException(*cx, &mut exception.handle_mut())); + assert!(JS_GetPendingException(*cx, exception.handle_mut())); JS_ClearPendingException(*cx); return Err(RethrowError(RootedTraceableBox::from_box(Heap::boxed( @@ -531,7 +530,7 @@ impl ModuleTree { warn!("fail to link & instantiate module"); rooted!(in(*cx) let mut exception = UndefinedValue()); - assert!(JS_GetPendingException(*cx, &mut exception.handle_mut())); + assert!(JS_GetPendingException(*cx, exception.handle_mut())); JS_ClearPendingException(*cx); Err(RethrowError(RootedTraceableBox::from_box(Heap::boxed( @@ -577,7 +576,7 @@ impl ModuleTree { warn!("fail to evaluate module"); rooted!(in(*cx) let mut exception = UndefinedValue()); - assert!(JS_GetPendingException(*cx, &mut exception.handle_mut())); + assert!(JS_GetPendingException(*cx, exception.handle_mut())); JS_ClearPendingException(*cx); Err(RethrowError(RootedTraceableBox::from_box(Heap::boxed( diff --git a/components/script_bindings/codegen/CodegenRust.py b/components/script_bindings/codegen/CodegenRust.py index 6b5c77c2c20..aef6b670fd2 100644 --- a/components/script_bindings/codegen/CodegenRust.py +++ b/components/script_bindings/codegen/CodegenRust.py @@ -6394,13 +6394,13 @@ let cx = SafeJSContext::from_ptr(cx); {maybeCrossOriginGet} let proxy_lt = Handle::from_raw(proxy); -let vp_lt = MutableHandle::from_raw(vp); +let mut vp_lt = MutableHandle::from_raw(vp); let id_lt = Handle::from_raw(id); let receiver_lt = Handle::from_raw(receiver); {getIndexedOrExpando} let mut found = false; -if !get_property_on_prototype(*cx, proxy_lt, receiver_lt, id_lt, &mut found, vp_lt) {{ +if !get_property_on_prototype(*cx, proxy_lt, receiver_lt, id_lt, &mut found, vp_lt.reborrow()) {{ return false; }} @@ -7285,7 +7285,7 @@ impl{self.generic} Clone for {self.makeClassName(self.dictionary)}{self.genericS memberInserts = [memberInsert(m) for m in self.memberInfo] if d.parent: - memberInserts = [CGGeneric("self.parent.to_jsobject(cx, obj);\n")] + memberInserts + memberInserts = [CGGeneric("self.parent.to_jsobject(cx, obj.reborrow());\n")] + memberInserts selfName = self.makeClassName(d) if self.membersNeedTracing(): |