1 onmessage = function(evt) {
2 if (evt.data.indexOf("postBack ") == 0) {
4 postMessage("FAILURE: No MessagePort with postBack command");
6 var strings = evt.data.split(" ", 2);
7 var numItems = parseInt(strings[1]);
8 postMessage("PASS: Received request for " + numItems + " messages");
9 for (var i = 0 ; i < numItems ; i++) {
11 evt.ports[0].postMessage(msg);
13 postMessage("postBackDone");
15 postMessage("FAILURE: unknown message: " + evt.data);