test_worker_performance_entries.html (1186B)
1 <!-- Any copyright is dedicated to the Public Domain. 2 - http://creativecommons.org/publicdomain/zero/1.0/ --> 3 <!DOCTYPE HTML> 4 <html> 5 <head> 6 <title>PerformanceResouceTiming in workers</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 9 </head> 10 <body> 11 <script class="testbody" type="text/javascript"> 12 13 SimpleTest.waitForExplicitFinish(); 14 15 // The worker assumes it will take some amount of time to load a resource. 16 // With a low enough precision, the duration to load a resource may clamp 17 // down to zero. 18 var reduceTimePrecisionPrevPrefValue = SpecialPowers.getBoolPref("privacy.reduceTimerPrecision"); 19 SpecialPowers.setBoolPref("privacy.reduceTimerPrecision", false); 20 21 var worker = new Worker('test_worker_performance_entries.js'); 22 worker.onmessage = function(event) { 23 if (event.data.type == "check") { 24 ok(event.data.status, event.data.msg); 25 return; 26 } 27 28 if (event.data.type == "finish") { 29 SpecialPowers.setBoolPref("privacy.reduceTimerPrecision", reduceTimePrecisionPrevPrefValue); 30 SimpleTest.finish(); 31 return; 32 } 33 34 ok(false, "?!?"); 35 } 36 37 </script> 38 </body> 39 </html>