test_network_basics_worker.html (845B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Test for Network in workers API</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 </head> 8 <body> 9 <p id="display"></p> 10 <div id="content" style="display: none"> 11 </div> 12 <pre id="test"> 13 <script type="application/javascript"> 14 15 /** Test for Network Information API */ 16 function test() { 17 let w = new Worker('worker_network_basics.js'); 18 w.onmessage = function(e) { 19 if (e.data.type == 'status') { 20 ok(e.data.status, e.data.msg); 21 } else if (e.data.type == 'finish') { 22 SimpleTest.finish(); 23 } else { 24 ok(false, "Unknown message type"); 25 } 26 } 27 } 28 29 SimpleTest.waitForExplicitFinish(); 30 SpecialPowers.pushPrefEnv({'set': [["dom.netinfo.enabled", true]]}, test); 31 32 </script> 33 </pre> 34 </body> 35 </html>