3 function do_magic(data) {
6 .then(function (cache) {
8 "http://mochi.test:888/foo",
9 new Response(data.type + "-" + count++)
18 setTimeout(function () {
25 onmessage = function (e) {
26 if (e.data.type == "page1") {
27 if (e.data.count > 0) {
28 var a = new Worker("worker_suspended.js");
29 a.postMessage({ type: "page1", count: e.data - 1 });
30 a.onmessage = function () {
34 do_magic({ type: e.data.type, loop: true });
36 } else if (e.data.type == "page2") {
37 do_magic({ type: e.data.type, loop: false });