summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/measure-memory/iframe.cross-site.https.window.js
blob: a4c50a5687e4bc75c6e127874a56668e8354a19b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// META: script=/common/get-host-info.sub.js
// META: script=./resources/checker.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';

promise_test(async testCase => {
  assert_true(self.crossOriginIsolated);

  const {iframes, windows} = await build([
    {
      id: 'cross-site-1',
      children: [
        {
          id: 'same-origin-2',
        },
        {
          id: 'cross-origin-3',
        },
        {
          id: 'cross-site-4',
        }
      ],
    },
  ]);
  try {
    const result = await performance.measureUserAgentSpecificMemory();
    checkMeasureMemory(result, [
      {
        url: window.location.href,
        scope: 'Window',
        container: null,
      },
      {
        url: 'cross-origin-url',
        scope: 'cross-origin-aggregated',
        container: {
          id: 'cross-site-1',
          src: iframes['cross-site-1'].src,
        },
      },
      {
        url: windows['same-origin-2'].location.href,
        scope: 'Window',
        container: {
          id: 'cross-site-1',
          src: iframes['cross-site-1'].src,
        },
      },
    ]);
  } catch (error) {
    if (!(error instanceof DOMException)) {
      throw error;
    }
    assert_equals(error.name, 'SecurityError');
  }
}, 'performance.measureUserAgentSpecificMemory URLs within a cross-site iframe.');