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
|
// META: script=/common/dispatcher/dispatcher.js
// META: script=/common/utils.js
// META: script=resources/support.sub.js
// META: timeout=long
//
// Spec: https://wicg.github.io/private-network-access/
//
// These tests verify that non-secure contexts cannot navigate to less-public
// address spaces via window.open to an existing window.
setup(() => {
// Making sure we are in a non secure context, as expected.
assert_false(window.isSecureContext);
});
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_LOCAL },
target: { server: Server.HTTP_LOCAL },
expected: NavigationTestResult.SUCCESS,
}), "local to local: no preflight required.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_LOCAL },
target: { server: Server.HTTP_PRIVATE },
expected: NavigationTestResult.SUCCESS,
}), "local to private: no preflight required.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_LOCAL },
target: { server: Server.HTTP_PUBLIC },
expected: NavigationTestResult.SUCCESS,
}), "local to public: no preflight required.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_PRIVATE },
target: { server: Server.HTTP_LOCAL },
expected: NavigationTestResult.FAILURE,
}), "private to local: failure.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_PRIVATE },
target: { server: Server.HTTP_PRIVATE },
expected: NavigationTestResult.SUCCESS,
}), "private to private: no preflight required.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_PRIVATE },
target: { server: Server.HTTP_PUBLIC },
expected: NavigationTestResult.SUCCESS,
}), "private to public: no preflight required.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_PUBLIC },
target: { server: Server.HTTP_LOCAL },
expected: NavigationTestResult.FAILURE,
}), "public to local: failure.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_PUBLIC },
target: { server: Server.HTTP_PRIVATE },
expected: NavigationTestResult.FAILURE,
}), "public to private: failure.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: { server: Server.HTTP_PUBLIC },
target: { server: Server.HTTP_PUBLIC },
expected: NavigationTestResult.SUCCESS,
}), "public to public: no preflight required.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: {
server: Server.HTTP_LOCAL,
treatAsPublic: true,
},
target: { server: Server.HTTP_LOCAL },
expected: NavigationTestResult.FAILURE,
}), "treat-as-public-address to local: failure.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: {
server: Server.HTTP_LOCAL,
treatAsPublic: true,
},
target: { server: Server.HTTP_PRIVATE },
expected: NavigationTestResult.FAILURE,
}), "treat-as-public-address to private: failure.");
promise_test_parallel(t => windowOpenExistingTest(t, {
source: {
server: Server.HTTP_LOCAL,
treatAsPublic: true,
},
target: { server: Server.HTTP_PUBLIC },
expected: NavigationTestResult.SUCCESS,
}), "treat-as-public-address to public: no preflight required.");
|