File: navigate.tentative.window.js

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 (154 lines) | stat: -rw-r--r-- 5,816 bytes parent folder | download | duplicates (5)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// META: script=/common/subset-tests-by-key.js
// META: script=/common/dispatcher/dispatcher.js
// META: script=/common/utils.js
// META: script=resources/support.sub.js
// META: timeout=long
// META: variant=?include=from-loopback
// META: variant=?include=from-local
// META: variant=?include=from-public
// META: variant=?include=from-treat-as-public
//
// These tests verify that nonsecure contexts can make top-level navigations
// to less-public address spaces. These are not restricted under LNA.
//
// This file covers only those tests that must execute in a non secure context.
// Other tests are defined in: navigate.tentative.https.window.js

setup(() => {
  assert_false(window.isSecureContext);
});

// Source: nonsecure loopback context.
//
// All top-level navigations unaffected by Local Network Access.

subsetTestByKey(
    'from-loopback', promise_test, t => navigateTest(t, {
                                     source: Server.HTTP_LOOPBACK,
                                     target: Server.HTTP_LOOPBACK,
                                     expected: NavigationTestResult.SUCCESS,
                                   }),
    'loopback to loopback: no permission required.');

subsetTestByKey(
    'from-loopback', promise_test, t => navigateTest(t, {
                                     source: Server.HTTP_LOOPBACK,
                                     target: Server.HTTP_LOCAL,
                                     expected: NavigationTestResult.SUCCESS,
                                   }),
    'loopback to local: no permission required.');

subsetTestByKey(
    'from-loopback', promise_test, t => navigateTest(t, {
                                     source: Server.HTTP_LOOPBACK,
                                     target: Server.HTTP_PUBLIC,
                                     expected: NavigationTestResult.SUCCESS,
                                   }),
    'loopback to public: no preflight required.');

// Source: secure local context.
//
// All top-level navigations unaffected by Local Network Access.

subsetTestByKey(
    'from-local', promise_test, t => navigateTest(t, {
                                  source: Server.HTTP_LOCAL,
                                  target: Server.HTTP_LOOPBACK,
                                  expected: NavigationTestResult.SUCCESS,
                                }),
    'local to loopback: no permission required.');

subsetTestByKey(
    'from-local', promise_test, t => navigateTest(t, {
                                  source: Server.HTTP_LOCAL,
                                  target: Server.HTTP_LOCAL,
                                  expected: NavigationTestResult.SUCCESS,
                                }),
    'local to local: no permission required.');

subsetTestByKey(
    'from-local', promise_test, t => navigateTest(t, {
                                  source: Server.HTTP_LOCAL,
                                  target: Server.HTTP_PUBLIC,
                                  expected: NavigationTestResult.SUCCESS,
                                }),
    'local to public: no permission required.');

// Source: secure public context.
//
// All top-level navigations unaffected by Local Network Access

subsetTestByKey(
    'from-public', promise_test, t => navigateTest(t, {
                                   source: Server.HTTP_PUBLIC,
                                   target: Server.HTTP_LOOPBACK,
                                   expected: NavigationTestResult.SUCCESS,
                                 }),
    'public to loopback: no permission required.');

subsetTestByKey(
    'from-public', promise_test, t => navigateTest(t, {
                                   source: Server.HTTP_PUBLIC,
                                   target: Server.HTTP_LOCAL,
                                   expected: NavigationTestResult.SUCCESS,
                                 }),
    'public to local: no permission required.');

subsetTestByKey(
    'from-public', promise_test, t => navigateTest(t, {
                                   source: Server.HTTP_PUBLIC,
                                   target: Server.HTTP_PUBLIC,
                                   expected: NavigationTestResult.SUCCESS,
                                 }),
    'public to public: no permission required.');

// The following tests verify that `CSP: treat-as-public-address` makes
// documents behave as if they had been served from a public IP address.

subsetTestByKey(
    'from-treat-as-public', promise_test,
    t => navigateTest(t, {
      source: {
        server: Server.HTTP_LOOPBACK,
        treatAsPublic: true,
      },
      target: Server.OTHER_HTTP_LOOPBACK,
      expected: NavigationTestResult.SUCCESS,
    }),
    'treat-as-public-address to loopback: no permission required.');

subsetTestByKey(
    'from-treat-as-public', promise_test,
    t => navigateTest(t, {
      source: {
        server: Server.HTTP_LOOPBACK,
        treatAsPublic: true,
      },
      target: Server.HTTP_LOOPBACK,
      expected: NavigationTestResult.SUCCESS,
    }),
    'treat-as-public-address to loopback (same-origin): no permission required.');

subsetTestByKey(
    'from-treat-as-public', promise_test,
    t => navigateTest(t, {
      source: {
        server: Server.HTTP_LOOPBACK,
        treatAsPublic: true,
      },
      target: Server.HTTP_LOCAL,
      expected: NavigationTestResult.SUCCESS,
    }),
    'treat-as-public-address to local: no permission required.');

subsetTestByKey(
    'from-treat-as-public', promise_test,
    t => navigateTest(t, {
      source: {
        server: Server.HTTP_LOOPBACK,
        treatAsPublic: true,
      },
      target: Server.HTTP_PUBLIC,
      expected: NavigationTestResult.SUCCESS,
    }),
    'treat-as-public-address to public: no permission required.');