mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
script creates methods taking '*mut JSContext' unsafe
rebase + marked the necessary new code as unsafe
This commit is contained in:
parent
9fd6f0acd5
commit
b372e7c98f
28 changed files with 274 additions and 226 deletions
|
@ -41,12 +41,12 @@ impl Crypto {
|
|||
impl CryptoMethods for Crypto {
|
||||
#[allow(unsafe_code)]
|
||||
// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#Crypto-method-getRandomValues
|
||||
fn GetRandomValues(&self,
|
||||
unsafe fn GetRandomValues(&self,
|
||||
_cx: *mut JSContext,
|
||||
input: *mut JSObject)
|
||||
-> Fallible<NonZero<*mut JSObject>> {
|
||||
assert!(!input.is_null());
|
||||
let mut data = match unsafe { array_buffer_view_data::<u8>(input) } {
|
||||
let mut data = match array_buffer_view_data::<u8>(input) {
|
||||
Some(data) => data,
|
||||
None => {
|
||||
return Err(Error::Type("Argument to Crypto.getRandomValues is not an ArrayBufferView"
|
||||
|
@ -64,7 +64,7 @@ impl CryptoMethods for Crypto {
|
|||
|
||||
self.rng.borrow_mut().fill_bytes(&mut data);
|
||||
|
||||
Ok(unsafe { NonZero::new(input) })
|
||||
Ok(NonZero::new(input))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue