mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix tyvar_behind_raw_pointer warnings
https://github.com/rust-lang/rust/issues/46906
This commit is contained in:
parent
cee2aadd82
commit
4d459bce32
20 changed files with 55 additions and 53 deletions
|
@ -2539,7 +2539,7 @@ def CopyUnforgeablePropertiesToInstance(descriptor):
|
|||
# reflector, so we can make sure we don't get confused by named getters.
|
||||
if descriptor.proxy:
|
||||
copyCode += """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
ensure_expando_object(cx, obj.handle(), expando.handle_mut());
|
||||
"""
|
||||
obj = "expando"
|
||||
|
@ -2554,7 +2554,7 @@ ensure_expando_object(cx, obj.handle(), expando.handle_mut());
|
|||
else:
|
||||
copyFunc = "JS_InitializePropertiesFromCompatibleNativeObject"
|
||||
copyCode += """\
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut());
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
|
||||
unforgeable_holder.handle_mut().set(
|
||||
JS_GetReservedSlot(proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT).to_object());
|
||||
assert!(%(copyFunc)s(cx, %(obj)s.handle(), unforgeable_holder.handle()));
|
||||
|
@ -2586,7 +2586,7 @@ let scope = scope.reflector().get_jsobject();
|
|||
assert!(!scope.get().is_null());
|
||||
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
|
||||
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
let _ac = JSAutoCompartment::new(cx, scope.get());
|
||||
GetProtoObject(cx, scope, proto.handle_mut());
|
||||
assert!(!proto.is_null());
|
||||
|
@ -2631,7 +2631,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
|
|||
let raw = Box::into_raw(object);
|
||||
let _rt = RootedTraceable::new(&*raw);
|
||||
|
||||
rooted!(in(cx) let mut obj = ptr::null_mut());
|
||||
rooted!(in(cx) let mut obj = ptr::null_mut::<JSObject>());
|
||||
create_global_object(
|
||||
cx,
|
||||
&Class.base,
|
||||
|
@ -2643,7 +2643,7 @@ assert!(!obj.is_null());
|
|||
(*raw).init_reflector(obj.get());
|
||||
|
||||
let _ac = JSAutoCompartment::new(cx, obj.get());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
GetProtoObject(cx, obj.handle(), proto.handle_mut());
|
||||
assert!(JS_SplicePrototype(cx, obj.handle(), proto.handle()));
|
||||
let mut immutable = false;
|
||||
|
@ -2771,7 +2771,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
|||
return CGGeneric("""\
|
||||
rooted!(in(cx) let proto = %(proto)s);
|
||||
assert!(!proto.is_null());
|
||||
rooted!(in(cx) let mut namespace = ptr::null_mut());
|
||||
rooted!(in(cx) let mut namespace = ptr::null_mut::<JSObject>());
|
||||
create_namespace_object(cx, global, proto.handle(), &NAMESPACE_OBJECT_CLASS,
|
||||
%(methods)s, %(name)s, namespace.handle_mut());
|
||||
assert!(!namespace.is_null());
|
||||
|
@ -2784,7 +2784,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
|||
if self.descriptor.interface.isCallback():
|
||||
assert not self.descriptor.interface.ctor() and self.descriptor.interface.hasConstants()
|
||||
return CGGeneric("""\
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut());
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut::<JSObject>());
|
||||
create_callback_interface_object(cx, global, sConstants, %(name)s, interface.handle_mut());
|
||||
assert!(!interface.is_null());
|
||||
assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
||||
|
@ -2807,7 +2807,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
|||
toBindingNamespace(parentName))
|
||||
|
||||
code = [CGGeneric("""\
|
||||
rooted!(in(cx) let mut prototype_proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
|
||||
%s;
|
||||
assert!(!prototype_proto.is_null());""" % getPrototypeProto)]
|
||||
|
||||
|
@ -2835,7 +2835,7 @@ assert!(!prototype_proto.is_null());""" % getPrototypeProto)]
|
|||
proto_properties = properties
|
||||
|
||||
code.append(CGGeneric("""
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut());
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut::<JSObject>());
|
||||
create_interface_prototype_object(cx,
|
||||
prototype_proto.handle(),
|
||||
&PrototypeClass,
|
||||
|
@ -2862,7 +2862,7 @@ assert!((*cache)[PrototypeList::ID::%(id)s as usize].is_null());
|
|||
if parentName:
|
||||
parentName = toBindingNamespace(parentName)
|
||||
code.append(CGGeneric("""
|
||||
rooted!(in(cx) let mut interface_proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
|
||||
%s::GetConstructorObject(cx, global, interface_proto.handle_mut());""" % parentName))
|
||||
else:
|
||||
code.append(CGGeneric("""
|
||||
|
@ -2870,7 +2870,7 @@ rooted!(in(cx) let interface_proto = JS_GetFunctionPrototype(cx, global));"""))
|
|||
code.append(CGGeneric("""\
|
||||
assert!(!interface_proto.is_null());
|
||||
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut());
|
||||
rooted!(in(cx) let mut interface = ptr::null_mut::<JSObject>());
|
||||
create_noncallback_interface_object(cx,
|
||||
global,
|
||||
interface_proto.handle(),
|
||||
|
@ -2973,7 +2973,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
|||
holderClass = "&Class.base as *const JSClass"
|
||||
holderProto = "prototype.handle()"
|
||||
code.append(CGGeneric("""
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut());
|
||||
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
|
||||
unforgeable_holder.handle_mut().set(
|
||||
JS_NewObjectWithoutMetadata(cx, %(holderClass)s, %(holderProto)s));
|
||||
assert!(!unforgeable_holder.is_null());
|
||||
|
@ -3151,7 +3151,7 @@ if !ConstructorEnabled(cx, global) {
|
|||
return;
|
||||
}
|
||||
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
%s(cx, global, proto.handle_mut());
|
||||
assert!(!proto.is_null());""" % (function,))
|
||||
|
||||
|
@ -4941,7 +4941,7 @@ if %s {
|
|||
|
||||
# FIXME(#11868) Should assign to desc.obj, desc.get() is a copy.
|
||||
return get + """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
//if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {
|
||||
if !expando.is_null() {
|
||||
|
@ -5071,7 +5071,7 @@ class CGDOMJSProxyHandler_ownPropertyKeys(CGAbstractExternMethod):
|
|||
|
||||
body += dedent(
|
||||
"""
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
GetPropertyKeys(cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props);
|
||||
|
@ -5114,7 +5114,7 @@ class CGDOMJSProxyHandler_getOwnEnumerablePropertyKeys(CGAbstractExternMethod):
|
|||
|
||||
body += dedent(
|
||||
"""
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
GetPropertyKeys(cx, expando.handle(), JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, props);
|
||||
|
@ -5173,7 +5173,7 @@ if %s {
|
|||
named = ""
|
||||
|
||||
return indexed + """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
let ok = JS_HasPropertyById(cx, expando.handle(), id, bp);
|
||||
|
@ -5200,7 +5200,7 @@ class CGDOMJSProxyHandler_get(CGAbstractExternMethod):
|
|||
# https://heycam.github.io/webidl/#LegacyPlatformObjectGetOwnProperty
|
||||
def getBody(self):
|
||||
getFromExpando = """\
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if !expando.is_null() {
|
||||
let mut hasProp = false;
|
||||
|
@ -5406,7 +5406,7 @@ if args.callee() == new_target.get() {
|
|||
}
|
||||
|
||||
// Step 6
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut());
|
||||
rooted!(in(cx) let mut prototype = ptr::null_mut::<JSObject>());
|
||||
{
|
||||
rooted!(in(cx) let mut proto_val = UndefinedValue());
|
||||
let _ac = JSAutoCompartment::new(cx, new_target.get());
|
||||
|
@ -6594,7 +6594,7 @@ class CGCallback(CGClass):
|
|||
|
||||
bodyWithThis = string.Template(
|
||||
setupCall +
|
||||
"rooted!(in(s.get_context()) let mut thisObjJS = ptr::null_mut());\n"
|
||||
"rooted!(in(s.get_context()) let mut thisObjJS = ptr::null_mut::<JSObject>());\n"
|
||||
"wrap_call_this_object(s.get_context(), thisObj, thisObjJS.handle_mut());\n"
|
||||
"if thisObjJS.is_null() {\n"
|
||||
" return Err(JSFailed);\n"
|
||||
|
@ -6605,7 +6605,7 @@ class CGCallback(CGClass):
|
|||
})
|
||||
bodyWithoutThis = string.Template(
|
||||
setupCall +
|
||||
"rooted!(in(s.get_context()) let thisObjJS = ptr::null_mut());\n"
|
||||
"rooted!(in(s.get_context()) let thisObjJS = ptr::null_mut::<JSObject>());\n"
|
||||
"return ${methodName}(${callArgs});").substitute({
|
||||
"callArgs": ", ".join(argnamesWithoutThis),
|
||||
"methodName": 'self.' + method.name,
|
||||
|
|
|
@ -81,7 +81,7 @@ use html5ever::LocalName;
|
|||
use html5ever::interface::QualName;
|
||||
use js::glue::UnwrapObject;
|
||||
use js::jsapi::{CallArgs, CurrentGlobalOrNull};
|
||||
use js::jsapi::{JSAutoCompartment, JSContext};
|
||||
use js::jsapi::{JSAutoCompartment, JSContext, JSObject};
|
||||
use js::jsapi::HandleObject;
|
||||
use js::jsapi::MutableHandleObject;
|
||||
use script_thread::ScriptThread;
|
||||
|
@ -111,7 +111,7 @@ pub unsafe fn html_constructor<T>(window: &Window, call_args: &CallArgs) -> Fall
|
|||
|
||||
{
|
||||
let _ac = JSAutoCompartment::new(window.get_cx(), callee.get());
|
||||
rooted!(in(window.get_cx()) let mut constructor = ptr::null_mut());
|
||||
rooted!(in(window.get_cx()) let mut constructor = ptr::null_mut::<JSObject>());
|
||||
rooted!(in(window.get_cx()) let global_object = CurrentGlobalOrNull(window.get_cx()));
|
||||
|
||||
if definition.is_autonomous() {
|
||||
|
|
|
@ -186,7 +186,7 @@ pub unsafe fn create_interface_prototype_object(
|
|||
create_object(cx, proto, class, regular_methods, regular_properties, constants, rval);
|
||||
|
||||
if !unscopable_names.is_empty() {
|
||||
rooted!(in(cx) let mut unscopable_obj = ptr::null_mut());
|
||||
rooted!(in(cx) let mut unscopable_obj = ptr::null_mut::<JSObject>());
|
||||
create_unscopable_object(cx, unscopable_names, unscopable_obj.handle_mut());
|
||||
|
||||
let unscopable_symbol = GetWellKnownSymbol(cx, SymbolCode::unscopables);
|
||||
|
@ -231,7 +231,7 @@ pub unsafe fn create_named_constructors(
|
|||
global: HandleObject,
|
||||
named_constructors: &[(ConstructorClassHook, &[u8], u32)],
|
||||
interface_prototype_object: HandleObject) {
|
||||
rooted!(in(cx) let mut constructor = ptr::null_mut());
|
||||
rooted!(in(cx) let mut constructor = ptr::null_mut::<JSObject>());
|
||||
|
||||
for &(native, name, arity) in named_constructors {
|
||||
assert!(*name.last().unwrap() == b'\0');
|
||||
|
|
|
@ -16,7 +16,7 @@ use dom::bindings::trace::JSTraceable;
|
|||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::jsapi::{HandleValue, Heap, JSContext, MutableHandleObject};
|
||||
use js::jsapi::{HandleValue, Heap, JSContext, MutableHandleObject, JSObject};
|
||||
use js::jsval::UndefinedValue;
|
||||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
|
@ -76,7 +76,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
|
|||
pub fn Next(&self, cx: *mut JSContext) -> Fallible<NonNullJSObjectPtr> {
|
||||
let index = self.index.get();
|
||||
rooted!(in(cx) let mut value = UndefinedValue());
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut());
|
||||
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
|
||||
let result = if index >= self.iterable.get_iterable_length() {
|
||||
dict_return(cx, rval.handle_mut(), true, value.handle())
|
||||
} else {
|
||||
|
|
|
@ -32,7 +32,7 @@ pub unsafe extern "C" fn shadow_check_callback(cx: *mut JSContext,
|
|||
-> DOMProxyShadowsResult {
|
||||
// TODO: support OverrideBuiltins when #12978 is fixed.
|
||||
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(object, expando.handle_mut());
|
||||
if !expando.get().is_null() {
|
||||
let mut has_own = false;
|
||||
|
@ -73,7 +73,7 @@ pub unsafe extern "C" fn get_property_descriptor(cx: *mut JSContext,
|
|||
return true;
|
||||
}
|
||||
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
if !GetObjectProto(cx, proxy, proto.handle_mut()) {
|
||||
// FIXME(#11868) Should assign to desc.obj, desc.get() is a copy.
|
||||
desc.get().obj = ptr::null_mut();
|
||||
|
@ -95,7 +95,7 @@ pub unsafe extern "C" fn define_property(cx: *mut JSContext,
|
|||
return true;
|
||||
}
|
||||
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
ensure_expando_object(cx, proxy, expando.handle_mut());
|
||||
JS_DefinePropertyById(cx, expando.handle(), id, desc, result)
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ pub unsafe extern "C" fn delete(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
bp: *mut ObjectOpResult)
|
||||
-> bool {
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut());
|
||||
rooted!(in(cx) let mut expando = ptr::null_mut::<JSObject>());
|
||||
get_expando_object(proxy, expando.handle_mut());
|
||||
if expando.is_null() {
|
||||
(*bp).code_ = 0 /* OkCode */;
|
||||
|
|
|
@ -134,7 +134,7 @@ pub unsafe fn get_property_on_prototype(cx: *mut JSContext,
|
|||
found: *mut bool,
|
||||
vp: MutableHandleValue)
|
||||
-> bool {
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
if !JS_GetPrototype(cx, proxy, proto.handle_mut()) || proto.is_null() {
|
||||
*found = false;
|
||||
return true;
|
||||
|
@ -287,7 +287,7 @@ pub unsafe fn has_property_on_prototype(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
found: &mut bool)
|
||||
-> bool {
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||
if !JS_GetPrototype(cx, proxy, proto.handle_mut()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use html5ever::{LocalName, Namespace, Prefix};
|
|||
use js::conversions::ToJSValConvertible;
|
||||
use js::glue::UnwrapObject;
|
||||
use js::jsapi::{Construct1, IsCallable, IsConstructor, HandleValueArray, HandleObject, MutableHandleValue};
|
||||
use js::jsapi::{Heap, JS_GetProperty, JS_SameValue, JSAutoCompartment, JSContext};
|
||||
use js::jsapi::{Heap, JS_GetProperty, JS_SameValue, JSAutoCompartment, JSContext, JSObject};
|
||||
use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
|
||||
use microtask::Microtask;
|
||||
use script_thread::ScriptThread;
|
||||
|
@ -436,7 +436,7 @@ impl CustomElementDefinition {
|
|||
let cx = window.get_cx();
|
||||
// Step 2
|
||||
rooted!(in(cx) let constructor = ObjectValue(self.constructor.callback()));
|
||||
rooted!(in(cx) let mut element = ptr::null_mut());
|
||||
rooted!(in(cx) let mut element = ptr::null_mut::<JSObject>());
|
||||
{
|
||||
// Go into the constructor's compartment
|
||||
let _ac = JSAutoCompartment::new(cx, self.constructor.callback());
|
||||
|
@ -545,7 +545,7 @@ fn run_upgrade_constructor(constructor: &Rc<Function>, element: &Element) -> Err
|
|||
rooted!(in(cx) let constructor_val = ObjectValue(constructor.callback()));
|
||||
rooted!(in(cx) let mut element_val = UndefinedValue());
|
||||
unsafe { element.to_jsval(cx, element_val.handle_mut()); }
|
||||
rooted!(in(cx) let mut construct_result = ptr::null_mut());
|
||||
rooted!(in(cx) let mut construct_result = ptr::null_mut::<JSObject>());
|
||||
{
|
||||
// Go into the constructor's compartment
|
||||
let _ac = JSAutoCompartment::new(cx, constructor.callback());
|
||||
|
|
|
@ -34,7 +34,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use fnv::FnvHasher;
|
||||
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
|
||||
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment, JSFunction};
|
||||
use js::rust::{AutoObjectVectorWrapper, CompileOptionsWrapper};
|
||||
use libc::{c_char, size_t};
|
||||
use servo_atoms::Atom;
|
||||
|
@ -443,7 +443,7 @@ impl EventTarget {
|
|||
let scopechain = AutoObjectVectorWrapper::new(cx);
|
||||
|
||||
let _ac = JSAutoCompartment::new(cx, window.reflector().get_jsobject().get());
|
||||
rooted!(in(cx) let mut handler = ptr::null_mut());
|
||||
rooted!(in(cx) let mut handler = ptr::null_mut::<JSFunction>());
|
||||
let rv = unsafe {
|
||||
CompileFunction(cx,
|
||||
scopechain.ptr,
|
||||
|
|
|
@ -26,6 +26,7 @@ use hyper::mime::{Attr, Mime};
|
|||
use js::jsapi::Heap;
|
||||
use js::jsapi::JSAutoCompartment;
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsapi::JSObject;
|
||||
use js::jsval::{self, JSVal};
|
||||
use js::typedarray::{ArrayBuffer, CreateWith};
|
||||
use servo_atoms::Atom;
|
||||
|
@ -261,7 +262,7 @@ impl FileReader {
|
|||
fn perform_readasarraybuffer(result: &DomRefCell<Option<FileReaderResult>>,
|
||||
cx: *mut JSContext, _: ReadMetaData, bytes: &[u8]) {
|
||||
unsafe {
|
||||
rooted!(in(cx) let mut array_buffer = ptr::null_mut());
|
||||
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
|
||||
assert!(ArrayBuffer::create(cx, CreateWith::Slice(bytes), array_buffer.handle_mut()).is_ok());
|
||||
|
||||
*result.borrow_mut() = Some(FileReaderResult::ArrayBuffer(Heap::default()));
|
||||
|
|
|
@ -93,7 +93,7 @@ impl Gamepad {
|
|||
);
|
||||
|
||||
let cx = global.get_cx();
|
||||
rooted!(in (cx) let mut array = ptr::null_mut());
|
||||
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
|
||||
unsafe {
|
||||
let _ = Float64Array::create(cx, CreateWith::Slice(&state.axes), array.handle_mut());
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ impl ImageData {
|
|||
let len = width * height * 4;
|
||||
unsafe {
|
||||
let cx = global.get_cx();
|
||||
rooted!(in (cx) let mut js_object = ptr::null_mut());
|
||||
rooted!(in (cx) let mut js_object = ptr::null_mut::<JSObject>());
|
||||
let data = match data {
|
||||
Some(ref mut d) => {
|
||||
d.resize(len as usize, 0);
|
||||
|
@ -103,7 +103,7 @@ impl ImageData {
|
|||
} else {
|
||||
let len = width * height * 4;
|
||||
let cx = global.get_cx();
|
||||
rooted!(in (cx) let mut array = ptr::null_mut());
|
||||
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
|
||||
Uint8ClampedArray::create(cx, CreateWith::Length(len), array.handle_mut()).unwrap();
|
||||
(*imagedata).data.set(array.get());
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ use js::jsapi::Heap;
|
|||
use js::jsapi::IsCallable;
|
||||
use js::jsapi::IsConstructor;
|
||||
use js::jsapi::JSAutoCompartment;
|
||||
use js::jsapi::JSObject;
|
||||
use js::jsapi::JS_ClearPendingException;
|
||||
use js::jsapi::JS_IsExceptionPending;
|
||||
use js::jsapi::JS_NewArrayObject;
|
||||
|
@ -240,7 +241,7 @@ impl PaintWorkletGlobalScope {
|
|||
Entry::Vacant(entry) => {
|
||||
// Step 5.2-5.3
|
||||
let args = HandleValueArray::new();
|
||||
rooted!(in(cx) let mut result = null_mut());
|
||||
rooted!(in(cx) let mut result = null_mut::<JSObject>());
|
||||
unsafe { Construct1(cx, class_constructor.handle(), &args, result.handle_mut()); }
|
||||
paint_instance.set(ObjectValue(result.get()));
|
||||
if unsafe { JS_IsExceptionPending(cx) } {
|
||||
|
|
|
@ -72,7 +72,7 @@ impl Promise {
|
|||
#[allow(unsafe_code)]
|
||||
pub fn new(global: &GlobalScope) -> Rc<Promise> {
|
||||
let cx = global.get_cx();
|
||||
rooted!(in(cx) let mut obj = ptr::null_mut());
|
||||
rooted!(in(cx) let mut obj = ptr::null_mut::<JSObject>());
|
||||
unsafe {
|
||||
Promise::create_js_promise(cx, HandleObject::null(), obj.handle_mut());
|
||||
Promise::new_with_js_promise(obj.handle(), cx)
|
||||
|
|
|
@ -11,7 +11,7 @@ use dom::bindings::root::DomRoot;
|
|||
use dom::bindings::str::{DOMString, USVString};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
use js::typedarray::{Uint8Array, CreateWith};
|
||||
use std::ptr;
|
||||
|
||||
|
@ -50,7 +50,7 @@ impl TextEncoderMethods for TextEncoder {
|
|||
unsafe fn Encode(&self, cx: *mut JSContext, input: USVString) -> NonNullJSObjectPtr {
|
||||
let encoded = input.0.as_bytes();
|
||||
|
||||
rooted!(in(cx) let mut js_object = ptr::null_mut());
|
||||
rooted!(in(cx) let mut js_object = ptr::null_mut::<JSObject>());
|
||||
assert!(Uint8Array::create(cx, CreateWith::Slice(&encoded), js_object.handle_mut()).is_ok());
|
||||
|
||||
NonNullJSObjectPtr::new_unchecked(js_object.get())
|
||||
|
|
|
@ -43,7 +43,7 @@ impl VREyeParameters {
|
|||
let fov = VRFieldOfView::new(&global, parameters.field_of_view.clone());
|
||||
|
||||
let cx = global.get_cx();
|
||||
rooted!(in (cx) let mut array = ptr::null_mut());
|
||||
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
|
||||
unsafe {
|
||||
let _ = Float32Array::create(cx, CreateWith::Slice(¶meters.offset), array.handle_mut());
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ impl VRFrameData {
|
|||
|
||||
#[allow(unsafe_code)]
|
||||
fn create_typed_array(cx: *mut JSContext, src: &[f32], dst: &Heap<*mut JSObject>) {
|
||||
rooted!(in (cx) let mut array = ptr::null_mut());
|
||||
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
|
||||
unsafe {
|
||||
let _ = Float32Array::create(cx, CreateWith::Slice(src), array.handle_mut());
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ unsafe fn update_or_create_typed_array(cx: *mut JSContext,
|
|||
match src {
|
||||
Some(data) => {
|
||||
if dst.get().is_null() {
|
||||
rooted!(in (cx) let mut array = ptr::null_mut());
|
||||
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
|
||||
let _ = Float32Array::create(cx, CreateWith::Slice(data), array.handle_mut());
|
||||
(*dst).set(array.get());
|
||||
} else {
|
||||
|
|
|
@ -38,7 +38,7 @@ impl VRStageParameters {
|
|||
#[allow(unsafe_code)]
|
||||
pub fn new(parameters: WebVRStageParameters, global: &GlobalScope) -> DomRoot<VRStageParameters> {
|
||||
let cx = global.get_cx();
|
||||
rooted!(in (cx) let mut array = ptr::null_mut());
|
||||
rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>());
|
||||
unsafe {
|
||||
let _ = Float32Array::create(cx, CreateWith::Slice(¶meters.sitting_to_standing_transform),
|
||||
array.handle_mut());
|
||||
|
|
|
@ -22,7 +22,7 @@ use dom::globalscope::GlobalScope;
|
|||
use dom::messageevent::MessageEvent;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use js::jsapi::JSAutoCompartment;
|
||||
use js::jsapi::{JSAutoCompartment, JSObject};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::typedarray::{ArrayBuffer, CreateWith};
|
||||
use net_traits::{CoreResourceMsg, FetchChannels};
|
||||
|
@ -510,7 +510,7 @@ impl TaskOnce for MessageReceivedTask {
|
|||
blob.to_jsval(cx, message.handle_mut());
|
||||
}
|
||||
BinaryType::Arraybuffer => {
|
||||
rooted!(in(cx) let mut array_buffer = ptr::null_mut());
|
||||
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
|
||||
assert!(ArrayBuffer::create(cx,
|
||||
CreateWith::Slice(&data),
|
||||
array_buffer.handle_mut())
|
||||
|
|
|
@ -1129,7 +1129,7 @@ impl XMLHttpRequest {
|
|||
|
||||
// Step 2
|
||||
let bytes = self.response.borrow();
|
||||
rooted!(in(cx) let mut array_buffer = ptr::null_mut());
|
||||
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
|
||||
ArrayBuffer::create(cx, CreateWith::Slice(&bytes), array_buffer.handle_mut()).ok().and_then(|()| {
|
||||
self.response_arraybuffer.set(array_buffer.get());
|
||||
Some(NonNullJSObjectPtr::new_unchecked(array_buffer.get()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue