mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement window.crypto.getRandomValues()
This commit is contained in:
parent
73b52c095a
commit
92874a89d2
14 changed files with 138 additions and 0 deletions
|
@ -11,6 +11,7 @@ use dom::bindings::global::GlobalRef;
|
|||
use dom::bindings::js::{JS, Root, MutNullableHeap};
|
||||
use dom::bindings::utils::Reflectable;
|
||||
use dom::console::Console;
|
||||
use dom::crypto::Crypto;
|
||||
use dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScopeHelpers;
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::workerlocation::WorkerLocation;
|
||||
|
@ -49,6 +50,7 @@ pub struct WorkerGlobalScope {
|
|||
location: MutNullableHeap<JS<WorkerLocation>>,
|
||||
navigator: MutNullableHeap<JS<WorkerNavigator>>,
|
||||
console: MutNullableHeap<JS<Console>>,
|
||||
crypto: MutNullableHeap<JS<Crypto>>,
|
||||
timers: TimerManager,
|
||||
devtools_chan: Option<DevtoolsControlChan>,
|
||||
}
|
||||
|
@ -68,6 +70,7 @@ impl WorkerGlobalScope {
|
|||
location: Default::default(),
|
||||
navigator: Default::default(),
|
||||
console: Default::default(),
|
||||
crypto: Default::default(),
|
||||
timers: TimerManager::new(),
|
||||
devtools_chan: devtools_chan,
|
||||
}
|
||||
|
@ -157,6 +160,10 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
|
|||
self.console.or_init(|| Console::new(GlobalRef::Worker(self)))
|
||||
}
|
||||
|
||||
fn Crypto(self) -> Root<Crypto> {
|
||||
self.crypto.or_init(|| Crypto::new(GlobalRef::Worker(self)))
|
||||
}
|
||||
|
||||
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
||||
base64_btoa(btoa)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue