Bug 1686029 [wpt PR 27131] - Mark performance.measureMemory web-platform tests as...
[gecko.git] / testing / web-platform / tests / measure-memory / window-open.mix.https.window.js
blob6a913a88a4876ae096b989658384c8848b14f227
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: 'same-origin-1',
12       children: [
13         {
14           id: 'same-origin-2',
15           window_open: true,
16           children: [
17             {
18               id: 'same-origin-3',
19               window_open: true,
20             },
21           ],
22         },
23         {
24           id: 'cross-origin-4',
25           children: [
26             {
27               id: 'same-origin-5',
28               window_open: true,
29             },
30           ],
31         },
32         {
33           id: 'cross-site-6',
34           children: [
35             {
36               id: 'same-origin-7',
37               window_open: true,
38             },
39           ],
40         },
41         {
42           id: 'same-origin-8',
43           children: [
44             {
45               id: 'cross-origin-9',
46               window_open: true,
47               children: [
48                 {
49                   id: 'same-origin-10',
50                 },
51                 {
52                   id: 'same-origin-11',
53                   window_open: true,
54                 },
55               ],
56             },
57             {
58               id: 'cross-site-12',
59               window_open: true,
60               children: [
61                 {
62                   id: 'same-origin-13',
63                 },
64                 {
65                   id: 'same-origin-14',
66                   window_open: true,
67                 },
68               ],
69             },
70           ],
71         },
72       ]
73     },
74   ]);
75   const result = await performance.measureMemory();
76   checkMeasureMemory(result, [
77     {
78       url: window.location.href,
79       scope: 'Window',
80       container: null,
81     },
82     {
83       url: windows['same-origin-1'].location.href,
84       scope: 'Window',
85       container: {
86         id: 'same-origin-1',
87         src: iframes['same-origin-1'].src,
88       },
89     },
90     {
91       url: windows['same-origin-2'].location.href,
92       scope: 'Window',
93       container: null,
94     },
95     {
96       url: windows['same-origin-3'].location.href,
97       scope: 'Window',
98       container: null,
99     },
100     {
101       url: 'cross-origin-url',
102       scope: 'cross-origin-aggregated',
103       container: {
104         id: 'cross-origin-4',
105         src: iframes['cross-origin-4'].src,
106       },
107     },
108     {
109       url: windows['same-origin-5'].location.href,
110       scope: 'Window',
111       container: null,
112     },
113     {
114       url: 'cross-origin-url',
115       scope: 'cross-origin-aggregated',
116       container: {
117         id: 'cross-site-6',
118         src: iframes['cross-site-6'].src,
119       },
120     },
121     {
122       url: windows['same-origin-7'].location.href,
123       scope: 'Window',
124       container: null,
125     },
126     {
127       url: windows['same-origin-8'].location.href,
128       scope: 'Window',
129       container: {
130         id: 'same-origin-8',
131         src: iframes['same-origin-8'].src,
132       },
133     },
134   ]);
135 }, 'performance.measureMemory does not leak URLs in cross-origin iframes and windows.');