mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject>
This commit is contained in:
parent
897a5b39c5
commit
52eda6082f
22 changed files with 79 additions and 111 deletions
|
@ -6,7 +6,6 @@ use dom::bindings::cell::DomRefCell;
|
|||
use dom::bindings::codegen::Bindings::CryptoBinding;
|
||||
use dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods;
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
use dom::bindings::nonnull::NonNullJSObjectPtr;
|
||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::bindings::root::DomRoot;
|
||||
use dom::globalscope::GlobalScope;
|
||||
|
@ -14,6 +13,7 @@ use dom_struct::dom_struct;
|
|||
use js::jsapi::{JSContext, JSObject};
|
||||
use js::jsapi::Type;
|
||||
use servo_rand::{ServoRng, Rng};
|
||||
use std::ptr::NonNull;
|
||||
|
||||
unsafe_no_jsmanaged_fields!(ServoRng);
|
||||
|
||||
|
@ -44,7 +44,7 @@ impl CryptoMethods for Crypto {
|
|||
unsafe fn GetRandomValues(&self,
|
||||
_cx: *mut JSContext,
|
||||
input: *mut JSObject)
|
||||
-> Fallible<NonNullJSObjectPtr> {
|
||||
-> Fallible<NonNull<JSObject>> {
|
||||
assert!(!input.is_null());
|
||||
typedarray!(in(_cx) let mut array_buffer_view: ArrayBufferView = input);
|
||||
let (array_type, mut data) = match array_buffer_view.as_mut() {
|
||||
|
@ -65,7 +65,7 @@ impl CryptoMethods for Crypto {
|
|||
|
||||
self.rng.borrow_mut().fill_bytes(&mut data);
|
||||
|
||||
Ok(NonNullJSObjectPtr::new_unchecked(input))
|
||||
Ok(NonNull::new_unchecked(input))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue