blob: 94b4ae8bbe206b423553fafc5a7939adc94668e5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
--- js/webgl-test-utils.js
+++ js/webgl-test-utils.js
@@ -2876,34 +2876,9 @@ var waitForComposite = function(callback) {
countDown();
};
-var setZeroTimeout = (function() {
- // See https://dbaron.org/log/20100309-faster-timeouts
-
- var timeouts = [];
- var messageName = "zero-timeout-message";
-
- // Like setTimeout, but only takes a function argument. There's
- // no time argument (always zero) and no arguments (you have to
- // use a closure).
- function setZeroTimeout(fn) {
- timeouts.push(fn);
- window.postMessage(messageName, "*");
- }
-
- function handleMessage(event) {
- if (event.source == window && event.data == messageName) {
- event.stopPropagation();
- if (timeouts.length > 0) {
- var fn = timeouts.shift();
- fn();
- }
- }
- }
-
- window.addEventListener("message", handleMessage, true);
-
- return setZeroTimeout;
-})();
+var setZeroTimeout = function(handler) {
+ window.setTimeout(handler, 0);
+}
/**
* Runs an array of functions, yielding to the browser between each step.
|