Bug 1686029 [wpt PR 27131] - Mark performance.measureMemory web-platform tests as...
[gecko.git] / testing / web-platform / tests / measure-memory / iframe.cross-site.https.window.js
blob1b4dfc70b7e10ef4a304513b8b7446ea27df41c6
1 // META: script=/common/get-host-info.sub.js
2 // META: script=./resources/common.js
3 // META: timeout=long
4 'use strict';
6 assert_true(self.crossOriginIsolated);
8 promise_test(async testCase => {
9   const {iframes, windows} = await build([
10     {
11       id: 'cross-site-1',
12       children: [
13         {
14           id: 'same-origin-2',
15         },
16         {
17           id: 'cross-origin-3',
18         },
19         {
20           id: 'cross-site-4',
21         }
22       ],
23     },
24   ]);
25   try {
26     const result = await performance.measureMemory();
27     checkMeasureMemory(result, [
28       {
29         url: window.location.href,
30         scope: 'Window',
31         container: null,
32       },
33       {
34         url: 'cross-origin-url',
35         scope: 'cross-origin-aggregated',
36         container: {
37           id: 'cross-site-1',
38           src: iframes['cross-site-1'].src,
39         },
40       },
41       {
42         url: windows['same-origin-2'].location.href,
43         scope: 'Window',
44         container: {
45           id: 'cross-site-1',
46           src: iframes['cross-site-1'].src,
47         },
48       },
49     ]);
50   } catch (error) {
51     if (!(error instanceof DOMException)) {
52       throw error;
53     }
54     assert_equals(error.name, 'SecurityError');
55   }
56 }, 'performance.measureMemory URLs within a cross-site iframe.');