diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/media/webrtc/tests/mochitests/test_dataChannel_hostnameObfuscation.html | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_dataChannel_hostnameObfuscation.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_dataChannel_hostnameObfuscation.html | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_dataChannel_hostnameObfuscation.html b/dom/media/webrtc/tests/mochitests/test_dataChannel_hostnameObfuscation.html new file mode 100644 index 0000000000..d0790fb9c9 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_dataChannel_hostnameObfuscation.html @@ -0,0 +1,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> |