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:
Simon Wülker 2024-11-19 23:54:59 +01:00 committed by GitHub
parent 79a2f070ed
commit c73e4baca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 16 deletions

View file

@ -14,7 +14,7 @@ use crate::dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods;
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
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::subtlecrypto::SubtleCrypto;
use crate::script_runtime::JSContext;
@ -72,7 +72,7 @@ impl CryptoMethods for Crypto {
}
// https://w3c.github.io/webcrypto/#Crypto-method-randomUUID
fn RandomUUID(&self) -> USVString {
fn RandomUUID(&self) -> DOMString {
let uuid = Uuid::new_v4();
uuid.hyphenated()
.encode_lower(&mut Uuid::encode_buffer())

View file

@ -3,25 +3,17 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* 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)]
interface mixin GlobalCrypto {
readonly attribute Crypto crypto;
partial interface mixin WindowOrWorkerGlobalScope {
[SameObject] readonly attribute Crypto crypto;
};
Window includes GlobalCrypto;
WorkerGlobalScope includes GlobalCrypto;
[Exposed=(Window,Worker)]
interface Crypto {
[SecureContext] readonly attribute SubtleCrypto subtle;
[Throws]
ArrayBufferView getRandomValues(ArrayBufferView array);
[SecureContext]
// UTF8String is not observably different from USVString
USVString randomUUID();
[SecureContext, Pref="dom.crypto.subtle.enabled"] readonly attribute SubtleCrypto subtle;
[Throws] ArrayBufferView getRandomValues(ArrayBufferView array);
[SecureContext] DOMString randomUUID();
};