OLD | NEW |
(Empty) | |
| 1 var window = { |
| 2 layoutTestController: { |
| 3 notifyDone: function() { postMessage("notifyDone"); } |
| 4 } |
| 5 }; |
| 6 var layoutTestController = window.layoutTestController; |
| 7 |
| 8 function log(s) { |
| 9 postMessage("log:" + s); |
| 10 } |
| 11 |
| 12 onmessage = function(event) { |
| 13 try { |
| 14 if (event.data.indexOf("importScripts:") == 0) { |
| 15 var scripts = event.data.substring("importScripts:".length).split(","); |
| 16 for (var i in scripts) { |
| 17 scripts[i] = "../" + scripts[i]; |
| 18 } |
| 19 importScripts(scripts); |
| 20 } else if (event.data == "runTest") { |
| 21 runTest(); // Must be defined by some imported script. |
| 22 } else { |
| 23 log("Received unexpected message: " + event.data); |
| 24 } |
| 25 } catch (ex) { |
| 26 log("Worker caught exception: " + ex); |
| 27 window.layoutTestController.notifyDone(); |
| 28 } |
| 29 } |
OLD | NEW |