mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #6505 - ttaubert:issue/4666-crypto-getRandomValues, r=Ms2ger
Implement crypto.getRandomValues() Didn't touch mozjs or rust-mozjs because implementing that in the code generator didn't seem too easy. I'm using the same workaround that the TextDecoder does. Using the OsRng should be the right choice here? As the OS keeps state for us we wouldn't need to have a global rng instance to keep around. Fixes #4666. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6505) <!-- Reviewable:end -->
This commit is contained in:
commit
c022262826
14 changed files with 138 additions and 0 deletions
|
@ -62,6 +62,10 @@ pub enum Error {
|
|||
DataClone,
|
||||
/// NoModificationAllowedError DOMException
|
||||
NoModificationAllowed,
|
||||
/// QuotaExceededError DOMException
|
||||
QuotaExceeded,
|
||||
/// TypeMismatchError DOMException
|
||||
TypeMismatch,
|
||||
|
||||
/// TypeError JavaScript Error
|
||||
Type(DOMString),
|
||||
|
@ -101,6 +105,8 @@ pub fn throw_dom_exception(cx: *mut JSContext, global: GlobalRef,
|
|||
Error::InvalidNodeType => DOMErrorName::InvalidNodeTypeError,
|
||||
Error::DataClone => DOMErrorName::DataCloneError,
|
||||
Error::NoModificationAllowed => DOMErrorName::NoModificationAllowedError,
|
||||
Error::QuotaExceeded => DOMErrorName::QuotaExceededError,
|
||||
Error::TypeMismatch => DOMErrorName::TypeMismatchError,
|
||||
Error::Type(message) => {
|
||||
assert!(unsafe { JS_IsExceptionPending(cx) } == 0);
|
||||
throw_type_error(cx, &message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue