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
|
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1592620",
title: "Blocklist to disable hostname obfuscation"
});
async function testBlocklist(options, blocklistEntry, shouldBeObfuscated) {
let test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
if (blocklistEntry !== null) {
await SpecialPowers.pushPrefEnv({
set: [
["media.peerconnection.ice.obfuscate_host_addresses.blocklist",
blocklistEntry]
]
});
}
test.chain.insertAfter('PC_LOCAL_WAIT_FOR_ICE_CONNECTED', [
async function CHECK_LOCAL_CANDIDATES() {
const stats = await test.pcLocal.getStats();
stats.forEach(s => {
if (s.type === 'local-candidate') {
if (shouldBeObfuscated) {
ok(s.address.includes(".local"), "address should be obfuscated");
} else {
ok(!s.address.includes(".local"), "address should not be obfuscated");
}
}
});
}]);
await test.run();
}
runNetworkTest(async (options) => {
await SpecialPowers.pushPrefEnv({
set: [["media.peerconnection.ice.obfuscate_host_addresses", true]]
});
await testBlocklist(options, null, true);
await testBlocklist(options, "", true);
await testBlocklist(options, "example.com", true);
await testBlocklist(options, "mochi.test", false);
await testBlocklist(options, "example.com,mochi.test", false);
await testBlocklist(options, "*.test", false);
});
</script>
</pre>
</body>
</html>
|