mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Implement window.crypto.getRandomValues()
This commit is contained in:
parent
73b52c095a
commit
92874a89d2
14 changed files with 138 additions and 0 deletions
|
@ -19,6 +19,7 @@ use dom::bindings::num::Finite;
|
|||
use dom::bindings::utils::{GlobalStaticData, Reflectable, WindowProxyHandler};
|
||||
use dom::browsercontext::BrowserContext;
|
||||
use dom::console::Console;
|
||||
use dom::crypto::Crypto;
|
||||
use dom::document::{Document, DocumentHelpers};
|
||||
use dom::element::Element;
|
||||
use dom::eventtarget::{EventTarget, EventTargetHelpers, EventTargetTypeId};
|
||||
|
@ -100,6 +101,7 @@ pub struct Window {
|
|||
script_chan: Box<ScriptChan+Send>,
|
||||
control_chan: ScriptControlChan,
|
||||
console: MutNullableHeap<JS<Console>>,
|
||||
crypto: MutNullableHeap<JS<Crypto>>,
|
||||
navigator: MutNullableHeap<JS<Navigator>>,
|
||||
image_cache_task: ImageCacheTask,
|
||||
image_cache_chan: ImageCacheChan,
|
||||
|
@ -360,6 +362,10 @@ impl<'a> WindowMethods for &'a Window {
|
|||
self.console.or_init(|| Console::new(GlobalRef::Window(self)))
|
||||
}
|
||||
|
||||
fn Crypto(self) -> Root<Crypto> {
|
||||
self.crypto.or_init(|| Crypto::new(GlobalRef::Window(self)))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#dom-frameelement
|
||||
fn GetFrameElement(self) -> Option<Root<Element>> {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
|
@ -981,6 +987,7 @@ impl Window {
|
|||
image_cache_chan: image_cache_chan,
|
||||
control_chan: control_chan,
|
||||
console: Default::default(),
|
||||
crypto: Default::default(),
|
||||
compositor: DOMRefCell::new(compositor),
|
||||
page: page,
|
||||
navigator: Default::default(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue