File: feature-policy-frame-policy-allowed-for-some-override.https.sub.html

package info (click to toggle)
firefox 144.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,637,504 kB
  • sloc: cpp: 7,576,692; javascript: 6,430,831; ansic: 3,748,119; python: 1,398,978; xml: 628,810; asm: 438,679; java: 186,194; sh: 63,212; makefile: 19,159; objc: 13,086; perl: 12,986; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (83 lines) | stat: -rw-r--r-- 4,324 bytes parent folder | download | duplicates (22)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
  <meta name="timeout" content="long">
  <script src=/resources/testharness.js></script>
  <script src=/resources/testharnessreport.js></script>
</head>
<body>
  <script src=/feature-policy/resources/featurepolicy.js></script>
  <!-- Feature-Policy: fullscreen 'self' cross_origin https://www.example.com; -->
  <script>
  'use strict';
  var same_origin = 'https://{{domains[]}}:{{ports[https][0]}}';
  var cross_origin = 'https://{{domains[www]}}:{{ports[https][0]}}';
  var cross_origin1 = 'https://{{domains[www1]}}:{{ports[https][0]}}';
  var same_origin_src = '/feature-policy/resources/feature-policy-allowedfeatures.html';
  var cross_origin_src = cross_origin + same_origin_src;
  var cross_origin_src1 = cross_origin1 + same_origin_src;
  var data_src = 'data:text/html,<h1>data: URL</h1>';
  // Test feature policy with same_origin_src and cross_origin_src.
  var policies = [
    {allow: "*", sameOriginTestExpect: true, crossOriginTestExpect: true, crossOrigin1TestExpect: false, dataOriginTestExpect: false},
    {allow: "'self'", sameOriginTestExpect: true, crossOriginTestExpect: false, crossOrigin1TestExpect: false, dataOriginTestExpect: false},
    {allow: "'none'", sameOriginTestExpect: false, crossOriginTestExpect: false, crossOrigin1TestExpect: false, dataOriginTestExpect: false},
    {allow: "'self' " + cross_origin + " https://www.example.com", sameOriginTestExpect: true, crossOriginTestExpect: true, crossOrigin1TestExpect: false, dataOriginTestExpect: false}];

  // Test that the allow attribute overrides allowfullscreen.
  for (var i = 0; i < policies.length; i++) {
    test(function() {
      test_frame_policy(
        'fullscreen', same_origin_src, undefined,
        policies[i].sameOriginTestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on same origin iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
    test(function() {
      test_frame_policy(
        'fullscreen', cross_origin_src, undefined,
        policies[i].crossOriginTestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on cross origin iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
    test(function() {
      test_frame_policy(
        'fullscreen', cross_origin_src1, undefined,
        policies[i].crossOrigin1TestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on another cross origin iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
    test(function() {
      test_frame_policy(
        'fullscreen', undefined, true, policies[i].sameOriginTestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on srcdoc iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
    test(function() {
      test_frame_policy(
        'fullscreen', same_origin_src, true, policies[i].sameOriginTestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on srcdoc + same origin iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
    test(function() {
      test_frame_policy(
        'fullscreen', cross_origin_src, true, policies[i].sameOriginTestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on srcdoc + cross origin iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
    test(function() {
      test_frame_policy(
        'fullscreen', cross_origin_src1, true, policies[i].sameOriginTestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on srcdoc + another cross origin iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
    test(function() {
      test_frame_policy(
        'fullscreen', data_src, undefined, policies[i].dataOriginTestExpect,
        'fullscreen ' + policies[i].allow + ';', /*allowfullscreen*/true);
    }, 'Test frame policy on data: URL cross origin iframe with allow = "' + policies[i].allow +
       '" and allowfullscreen.');
  }
  </script>
</body>
</html>