4 <title>Test to ensure TCPSocket permission enabled and open works with tcp-socket perm
</title>
5 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
10 <div id=
"content" style=
"display: none">
13 <script type=
"application/javascript">
15 /** Test to ensure TCPSocket permission being turned on enables
16 navigator.mozTCPSocket, and mozTCPSocket.open works when
17 the tcp-socket permission has been granted.
19 SimpleTest.waitForExplicitFinish();
20 SpecialPowers.pushPrefEnv({
"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
22 SpecialPowers.addPermission(
"tcp-socket", true, document);
24 ok('mozTCPSocket' in navigator,
"navigator.mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
26 ok(navigator.mozTCPSocket.open('localhost',
80),
"navigator.mozTCPSocket.open should work for content that has the tcp-socket permission");