|
5 | 5 | <link rel=" author" title=" Domenic Denicola" href=" mailto:[email protected]" >
|
6 | 6 | <script src="/resources/testharness.js"></script>
|
7 | 7 | <script src="/resources/testharnessreport.js"></script>
|
8 |
| - |
9 |
| -<div id="log"></div> |
10 |
| - |
| 8 | +<body> |
11 | 9 | <script>
|
12 | 10 | "use strict";
|
13 | 11 | document.domain = "{{host}}";
|
|
16 | 14 | const iframe = document.createElement("iframe");
|
17 | 15 | t.add_cleanup(() => iframe.remove());
|
18 | 16 | iframe.src = "//{{domains[www1]}}:{{location[port]}}/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/iframe-domain-failure.sub.html";
|
19 |
| - let domain = null; |
20 |
| - let childCrossOriginIsolated = null; |
| 17 | + let domain; |
| 18 | + let childCrossOriginIsolated; |
21 | 19 | window.onmessage = t.step_func((e) => {
|
22 | 20 | if (e.data.name === "domain") {
|
23 | 21 | domain = e.data.value;
|
|
27 | 25 | childCrossOriginIsolated = e.data.value;
|
28 | 26 | return;
|
29 | 27 | }
|
| 28 | + if (e.data.name === "hasSharedArrayBuffer") { |
| 29 | + const hasSharedArrayBuffer = e.data.value; |
| 30 | + |
| 31 | + // document.domain mutation is no-op because the surrounding agent |
| 32 | + // cluster's cross-origin isolated is true. |
| 33 | + assert_equals(domain, "{{domains[www1]}}"); |
| 34 | + |
| 35 | + // crossOriginIsolated is false in the nested frame because the frame is |
| 36 | + // cross-origin and hence the cross-origin isolated capability is false. |
| 37 | + // We use assert_equals instead of assert_false here to see if |
| 38 | + // `childCrossOriginIsolated` is set. |
| 39 | + assert_equals(childCrossOriginIsolated, false); |
| 40 | + |
| 41 | + assert_false(hasSharedArrayBuffer); |
| 42 | + t.done(); |
| 43 | + return; |
| 44 | + } |
30 | 45 | assert_unreached("Got a message event, expected a messageerror event");
|
31 | 46 | });
|
32 |
| - window.onmessageerror = t.step_func_done(() => { |
33 |
| - // crossOriginIsolated is false in the nested frame because the frame is |
34 |
| - // cross-origin and hence the cross-origin isolated capability is false. |
35 |
| - assert_equals(childCrossOriginIsolated, false); |
36 |
| - // But document.domain mutation is no-op because the surrounding agent |
37 |
| - // cluster's cross-origin isolated is true. |
38 |
| - assert_equals(domain, "{{domains[www1]}}"); |
39 |
| - }); |
40 | 47 | document.body.append(iframe);
|
41 | 48 | }, "SharedArrayBuffer and a same-origin-domain (but not same-origin) iframe");
|
42 | 49 | </script>
|
0 commit comments