diff options
author | Inteon <42113979+inteon@users.noreply.github.com> | 2021-02-16 14:20:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 14:20:21 +0100 |
commit | e2a91190c38f494c2666d3362d247f698718d2f8 (patch) | |
tree | 418a399b922f064d43fcef91ec34e4acec9d9198 /core/runtime.rs | |
parent | c6b3982e782432af5d9e6f6359f522d34e663cf0 (diff) |
feat: add structured cloning to Deno.core (#9458)
This commit adds two new "Deno.core" APIs:
- "Deno.core.serialize"
- "Deno.core.deserialize"
These APIs are used to provide structured cloning of values
and will be used for further web worker implementation.
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 05d76b4d5..9db1669cd 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -2039,6 +2039,22 @@ pub mod tests { } #[test] + fn test_serialize_deserialize() { + run_in_task(|mut cx| { + let (mut runtime, _dispatch_count) = setup(Mode::Async); + runtime + .execute( + "serialize_deserialize_test.js", + include_str!("serialize_deserialize_test.js"), + ) + .unwrap(); + if let Poll::Ready(Err(_)) = runtime.poll_event_loop(&mut cx) { + unreachable!(); + } + }); + } + + #[test] fn will_snapshot() { let snapshot = { let mut runtime = JsRuntime::new(RuntimeOptions { |