aboutsummaryrefslogtreecommitdiff
path: root/tools/reproduceriter.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-09-12 14:31:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-09-12 14:31:52 -0700
commit341ea63b6f109adf914689d9d9a399b363419ba1 (patch)
tree8ac1940e74e9a764e96edf3528dac1baf1caa2ec /tools/reproduceriter.py
parent97bee9986d71a28a964602af4c0e85b245822145 (diff)
events and audio in shell replay
Diffstat (limited to 'tools/reproduceriter.py')
-rwxr-xr-xtools/reproduceriter.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/tools/reproduceriter.py b/tools/reproduceriter.py
index 5f428fd6..255dbb2d 100755
--- a/tools/reproduceriter.py
+++ b/tools/reproduceriter.py
@@ -172,6 +172,20 @@ if (typeof nagivator == 'undefined') {
};
var setTimeout = window.setTimeout;
var document = {
+ eventListeners: {},
+ addEventListener: function(id, func) {
+ var listeners = document.eventListeners[id];
+ if (!listeners) {
+ listeners = document.eventListeners[id] = [];
+ }
+ listeners.push(func);
+ },
+ callEventListeners: function(id) {
+ var listeners = document.eventListeners[id];
+ if (listeners) {
+ listeners.forEach(function(listener) { listener() });
+ }
+ },
getElementById: function(id) {
switch(id) {
case 'canvas': {
@@ -181,19 +195,25 @@ if (typeof nagivator == 'undefined') {
case 'experimental-webgl': {
return {
getExtension: function() { return 1 },
- requestPointerLock: function() {
- throw 'pointerLock';
- },
};
}
default: throw 'canvas.getContext: ' + which;
}
},
+ requestPointerLock: function() {
+ document.callEventListeners('pointerlockchange');
+ },
};
}
default: throw 'getElementById: ' + id;
}
},
+ createElement: function(what) {
+ switch (what) {
+ case 'canvas': return document.getElementById(what);
+ default: throw 'createElement ' + what;
+ }
+ },
querySelector: function() {
return {
classList: {
@@ -244,6 +264,9 @@ if (typeof nagivator == 'undefined') {
},
};
};
+ var Audio = function() {
+ return { play: function(){} };
+ };
}
var Recorder = (function() {