test_class_static_block_worker.html (856B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test class static fields</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script type="application/javascript"> 8 // Make sure static classes parse in regular context too: 9 class B { 10 static { this.x = 12; } 11 } 12 is(B.x, 12, "static block set class value"); 13 console.log("script"); 14 function go() { 15 SimpleTest.waitForExplicitFinish(); 16 17 let worker = new Worker('class_static_worker.js'); 18 19 console.log("message") 20 worker.onmessage = function(e) { 21 22 is(e.data, 12, "correctly allocated class-static containing-class in worker"); 23 SimpleTest.finish(); 24 } 25 worker.postMessage("get"); 26 info("Messages posted"); 27 } 28 go(); 29 </script> 30 </head> 31 32 </html>