aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/crypto.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2016-08-29 00:35:17 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2016-08-30 19:07:13 +0200
commit6e1523f4ae61c16578a462c2e5335cbc95a6ef04 (patch)
tree61afce9c9fdf4d1158ce5836b155aa58ac0e19c8 /components/script/dom/crypto.rs
parent3e32948a39ced28c12f38ce115abcb56e67e72d9 (diff)
downloadservo-6e1523f4ae61c16578a462c2e5335cbc95a6ef04.tar.gz
servo-6e1523f4ae61c16578a462c2e5335cbc95a6ef04.zip
Compile WebIDL return type "object" to NonZero<*mut JSObject>
Diffstat (limited to 'components/script/dom/crypto.rs')
-rw-r--r--components/script/dom/crypto.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs
index 6e0351d37ee..165a3834227 100644
--- a/components/script/dom/crypto.rs
+++ b/components/script/dom/crypto.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use core::nonzero::NonZero;
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::CryptoBinding;
use dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods;
@@ -43,7 +44,8 @@ impl CryptoMethods for Crypto {
fn GetRandomValues(&self,
_cx: *mut JSContext,
input: *mut JSObject)
- -> Fallible<*mut JSObject> {
+ -> Fallible<NonZero<*mut JSObject>> {
+ assert!(!input.is_null());
let mut data = match unsafe { array_buffer_view_data::<u8>(input) } {
Some(data) => data,
None => {
@@ -62,7 +64,7 @@ impl CryptoMethods for Crypto {
self.rng.borrow_mut().fill_bytes(&mut data);
- Ok(input)
+ Ok(unsafe { NonZero::new(input) })
}
}