Fix build break
[chromium-blink-merge.git] / content / test / data / workers / many_shared_workers.html
blobdf0090426cf6da49296be6c6e6870ce1f1b9921c
1 <html>
2 <head>
3 <script src="worker_utils.js"></script>
4 </head>
5 <body>
6 <div id=result></div>
7 <script>
8 function log(message)
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));
17 if (!num_workers) {
18 log("No count= parameter provided - test aborted");
21 for (var i = 0; i < num_workers ; ++i) {
22 createWorker(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) {
31 workers_created++;
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");
36 onSuccess();
40 </script>
42 </body>
43 </html>