aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorTaym Haddadi <haddadi.taym@gmail.com>2024-08-08 12:12:45 +0200
committerGitHub <noreply@github.com>2024-08-08 10:12:45 +0000
commit08eb4faf4d2805283137a19739b092cd7ddff600 (patch)
tree89a3c6966bacc0c06ee9ced07b509036528f1e55 /components/script/dom/window.rs
parentf989d3776eca7c4a21f03a406a11c1b1228b285e (diff)
downloadservo-08eb4faf4d2805283137a19739b092cd7ddff600.tar.gz
servo-08eb4faf4d2805283137a19739b092cd7ddff600.zip
Initial structuredClone implementation (#32960)
* Initial structuredClone implementation Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Rename PostMessageOptions to StructuredSerializeOptions Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update wpt test 2020 layout result Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove dublicated StructuredClone implementation Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove comment from StructuredSerializeOptions webidl Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 1448adb8c5a..90ba17a9cbf 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -77,6 +77,7 @@ use webrender_api::units::{DeviceIntPoint, DeviceIntSize, LayoutPixel};
use webrender_api::{DocumentId, ExternalScrollId};
use webrender_traits::WebRenderScriptApi;
+use super::bindings::codegen::Bindings::MessagePortBinding::StructuredSerializeOptions;
use super::bindings::trace::HashMapTracedValues;
use crate::dom::bindings::cell::{DomRefCell, Ref};
use crate::dom::bindings::codegen::Bindings::DocumentBinding::{
@@ -1560,6 +1561,17 @@ impl WindowMethods for Window {
.map(|(k, _v)| DOMString::from(&***k))
.collect()
}
+
+ /// <https://html.spec.whatwg.org/multipage/#dom-structuredclone>
+ fn StructuredClone(
+ &self,
+ cx: JSContext,
+ value: HandleValue,
+ options: RootedTraceableBox<StructuredSerializeOptions>,
+ ) -> Fallible<js::jsval::JSVal> {
+ self.upcast::<GlobalScope>()
+ .structured_clone(cx, value, options)
+ }
}
impl Window {