@@ -7,8 +7,6 @@ pub use crate::util::{inner_u32, inner_u64};
7
7
#[ cfg( not( all( target_arch = "wasm32" , any( target_os = "unknown" , target_os = "none" ) ) ) ) ]
8
8
compile_error ! ( "`wasm_js` backend can be enabled only for OS-less WASM targets!" ) ;
9
9
10
- #[ cfg( target_feature = "atomics" ) ]
11
- use js_sys:: Uint8Array ;
12
10
use wasm_bindgen:: { prelude:: wasm_bindgen, JsValue } ;
13
11
14
12
// Maximum buffer size allowed in `Crypto.getRandomValuesSize` is 65536 bytes.
@@ -40,7 +38,7 @@ fn inner(crypto: &Crypto, dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
40
38
let buf_len_u32 = buf_len
41
39
. try_into ( )
42
40
. expect ( "buffer length is bounded by MAX_BUFFER_SIZE" ) ;
43
- let buf = Uint8Array :: new_with_length ( buf_len_u32) ;
41
+ let buf = js_sys :: Uint8Array :: new_with_length ( buf_len_u32) ;
44
42
for chunk in dest. chunks_mut ( buf_len) {
45
43
let chunk_len = chunk
46
44
. len ( )
@@ -77,5 +75,5 @@ extern "C" {
77
75
fn get_random_values ( this : & Crypto , buf : & mut [ MaybeUninit < u8 > ] ) -> Result < ( ) , JsValue > ;
78
76
#[ cfg( target_feature = "atomics" ) ]
79
77
#[ wasm_bindgen( method, js_name = getRandomValues, catch) ]
80
- fn get_random_values ( this : & Crypto , buf : & Uint8Array ) -> Result < ( ) , JsValue > ;
78
+ fn get_random_values ( this : & Crypto , buf : & js_sys :: Uint8Array ) -> Result < ( ) , JsValue > ;
81
79
}
0 commit comments