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