summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/structured-clone/structured-clone-cross-realm-method.html
blob: d80010e0df78ad7eabc1b60f8c2259713f4e9bf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!doctype html>
<title>self.structuredClone() uses this's relevant Realm for deserialization</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/structured-data.html#structured-cloning">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<body>
<script>
const iframe = document.createElement("iframe");
iframe.onload = () => {
  const otherWindow = iframe.contentWindow;
  for (const key of ["Object", "Array", "Date", "RegExp"]) {
    test(() => {
      const cloned = otherWindow.structuredClone.call(window, new otherWindow[key]);
      assert_true(cloned instanceof window[key]);
    }, `${key} instance`);
  }
};
document.body.append(iframe);
</script>