mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Preference-gate crypto.subtle
(#34295)
* Update Crypto idl bindings Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Pref-gate Crypto.subtle attribute Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
79a2f070ed
commit
c73e4baca2
2 changed files with 8 additions and 16 deletions
|
@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::USVString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::subtlecrypto::SubtleCrypto;
|
use crate::dom::subtlecrypto::SubtleCrypto;
|
||||||
use crate::script_runtime::JSContext;
|
use crate::script_runtime::JSContext;
|
||||||
|
@ -72,7 +72,7 @@ impl CryptoMethods for Crypto {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/webcrypto/#Crypto-method-randomUUID
|
// https://w3c.github.io/webcrypto/#Crypto-method-randomUUID
|
||||||
fn RandomUUID(&self) -> USVString {
|
fn RandomUUID(&self) -> DOMString {
|
||||||
let uuid = Uuid::new_v4();
|
let uuid = Uuid::new_v4();
|
||||||
uuid.hyphenated()
|
uuid.hyphenated()
|
||||||
.encode_lower(&mut Uuid::encode_buffer())
|
.encode_lower(&mut Uuid::encode_buffer())
|
||||||
|
|
|
@ -3,25 +3,17 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
/*
|
/*
|
||||||
* The origin of this IDL file is
|
* The origin of this IDL file is
|
||||||
* https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#crypto-interface
|
* https://w3c.github.io/webcrypto/#crypto-interface
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Exposed=(Window,Worker)]
|
partial interface mixin WindowOrWorkerGlobalScope {
|
||||||
interface mixin GlobalCrypto {
|
[SameObject] readonly attribute Crypto crypto;
|
||||||
readonly attribute Crypto crypto;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Window includes GlobalCrypto;
|
|
||||||
WorkerGlobalScope includes GlobalCrypto;
|
|
||||||
|
|
||||||
[Exposed=(Window,Worker)]
|
[Exposed=(Window,Worker)]
|
||||||
interface Crypto {
|
interface Crypto {
|
||||||
[SecureContext] readonly attribute SubtleCrypto subtle;
|
[SecureContext, Pref="dom.crypto.subtle.enabled"] readonly attribute SubtleCrypto subtle;
|
||||||
[Throws]
|
[Throws] ArrayBufferView getRandomValues(ArrayBufferView array);
|
||||||
ArrayBufferView getRandomValues(ArrayBufferView array);
|
[SecureContext] DOMString randomUUID();
|
||||||
|
|
||||||
[SecureContext]
|
|
||||||
// UTF8String is not observably different from USVString
|
|
||||||
USVString randomUUID();
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue