summaryrefslogtreecommitdiffstats
path: root/dom/network/tests/test_tcpsocket_enabled_no_perm.html
blob: ae1313113fbbd21e83a27f8e4d1dc88bed7c86e6 (plain)
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
<!DOCTYPE HTML>
<html>
<head>
  <title>Test to ensure TCPSocket permission enabled and no tcp-socket perm does not allow open</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">

/** Test to ensure TCPSocket preference being turned on does not enable
  navigator.mozTCPSocket.
**/
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
function runTest() {
  is('TCPSocket' in this, false, "TCPSocket should not be accessible if dom.mozTCPSocket.enabled is true");
  is('TCPServerSocket' in this, false, "TCPServerSocket should not be accessible if dom.mozTCPSocket.enabled is true");
  is('mozTCPSocket' in navigator, false, "mozTCPSocket should not be accessible if dom.mozTCPSocket.enabled is true");

  SimpleTest.finish();
}
</script>
</pre>
</body>
</html>