3 <script src=
"worker_utils.js"></script>
10 document
.getElementById("result").innerHTML
+= message
+ "<br>";
13 var url
= document
.location
.toString();
14 var num_workers
= parseInt(url
.substr(url
.search("count=") + 6));
15 var client_id
= parseInt(url
.substr(url
.search("client_id=") + 10));
18 log("No count= parameter provided - test aborted");
21 for (var i
= 0; i
< num_workers
; ++i
) {
25 var workers_created
= 0;
26 function createWorker(i
) {
27 var worker_id
= !!client_id
? client_id
* num_workers
+ i
: i
;
28 var worker
= new SharedWorker("worker_common.js?id=" + worker_id
);
29 worker
.port
.postMessage("eval num_clients");
30 worker
.port
.onmessage = function(event
) {
32 log("worker " + worker_id
+ " started - num_clients = " + event
.data
);
33 if (workers_created
== num_workers
) {
34 // created the last worker
35 log("SUCCESS: all workers created");