aboutsummaryrefslogtreecommitdiff
path: root/tools/reproduceriter.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-09-13 13:56:32 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-09-13 13:56:32 -0700
commit46b2bbfd1772870b36ec5d4fb53a0d8522f4e3d9 (patch)
tree194d27fa58f20f017df332dc4addb7e04278c9a5 /tools/reproduceriter.py
parent103314ffafc441a432b5d964015496bc492a81bc (diff)
fix handling of multiple worker modules in shell replay
Diffstat (limited to 'tools/reproduceriter.py')
-rwxr-xr-xtools/reproduceriter.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/reproduceriter.py b/tools/reproduceriter.py
index cc43e89a..5eb02fb7 100755
--- a/tools/reproduceriter.py
+++ b/tools/reproduceriter.py
@@ -316,10 +316,10 @@ if (typeof nagivator == 'undefined') {
return { play: function(){} };
};
var Worker = function(path) {
- //var Module = undefined; // hide main code
path = fixPath(path);
var workerCode = read(path);
- print('loaded worker ' + path + ' : ' + workerCode.substring(0, 50));
+ workerCode = workerCode.replace(/Module/g, 'zzModuleyy' + (Worker.id++)); // prevent collision with the global Module object. Note that this becomes global, so we need unique ids
+ print('loading worker ' + path + ' : ' + workerCode.substring(0, 50));
eval(workerCode); // will implement onmessage()
this.terminate = function(){};
@@ -337,12 +337,18 @@ if (typeof nagivator == 'undefined') {
}
};
};
+ Worker.id = 0;
var screen = {
width: 800,
height: 600,
availWidth: 800,
availHeight: 600,
};
+ var console = {
+ log: function(x) {
+ print(x);
+ },
+ };
}
var Recorder = (function() {