Index: LayoutTests/storage/resources/database-worker.js |
=================================================================== |
--- LayoutTests/storage/resources/database-worker.js (revision 0) |
+++ LayoutTests/storage/resources/database-worker.js (revision 0) |
@@ -0,0 +1,29 @@ |
+var window = { |
+ layoutTestController: { |
+ notifyDone: function() { postMessage("notifyDone"); } |
+ } |
+}; |
+var layoutTestController = window.layoutTestController; |
+ |
+function log(s) { |
+ postMessage("log:" + s); |
+} |
+ |
+onmessage = function(event) { |
+ try { |
+ if (event.data.indexOf("importScripts:") == 0) { |
+ var scripts = event.data.substring("importScripts:".length).split(","); |
+ for (var i in scripts) { |
+ scripts[i] = "../" + scripts[i]; |
+ } |
+ importScripts(scripts); |
+ } else if (event.data == "runTest") { |
+ runTest(); // Must be defined by some imported script. |
+ } else { |
+ log("Received unexpected message: " + event.data); |
+ } |
+ } catch (ex) { |
+ log("Worker caught exception: " + ex); |
+ window.layoutTestController.notifyDone(); |
+ } |
+} |