mirror of
https://github.com/servo/servo.git
synced 2025-08-19 04:15:33 +01:00
Make setZeroTimeout use window.setTimeout
This commit is contained in:
parent
cb2f83cf8e
commit
6089e45b7d
21 changed files with 335 additions and 98 deletions
|
@ -13,7 +13,8 @@ KHRONOS_REPO_URL = "https://github.com/KhronosGroup/WebGL.git"
|
|||
PATCHES = [
|
||||
("js-test-pre.patch", "js/js-test-pre.js"),
|
||||
("unit.patch", "conformance/more/unit.js"),
|
||||
("timeout.patch", None)
|
||||
("timeout.patch", None),
|
||||
("set-zero-timeout.patch", "js/webgl-test-utils.js"),
|
||||
]
|
||||
|
||||
# Fix for 'UnicodeDecodeError: 'ascii' codec can't decode byte'
|
||||
|
|
40
tests/wpt/webgl/tools/set-zero-timeout.patch
Normal file
40
tests/wpt/webgl/tools/set-zero-timeout.patch
Normal file
|
@ -0,0 +1,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.
|
|
@ -10,30 +10,6 @@ index de45ce308c..11a83ac00a 100644
|
|||
<title>WebGL Enable Vertex Attrib Zero Test</title>
|
||||
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
|
||||
<script src=/resources/testharness.js></script>
|
||||
diff --git i/conformance/context/context-creation-and-destruction.html w/conformance/context/context-creation-and-destruction.html
|
||||
index a02dd2d14c..47099e57bd 100644
|
||||
--- i/conformance/context/context-creation-and-destruction.html
|
||||
+++ w/conformance/context/context-creation-and-destruction.html
|
||||
@@ -29,6 +29,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
+<meta name="timeout" content="long">
|
||||
<title>Test that contexts are freed and garbage collected reasonably</title>
|
||||
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
|
||||
<script src=/resources/testharness.js></script>
|
||||
diff --git i/conformance/context/context-creation.html w/conformance/context/context-creation.html
|
||||
index 04b138daf4..703bcfa8dc 100644
|
||||
--- i/conformance/context/context-creation.html
|
||||
+++ w/conformance/context/context-creation.html
|
||||
@@ -29,6 +29,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
+<meta name="timeout" content="long">
|
||||
<title>Test that you can create large numbers of WebGL contexts.</title>
|
||||
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
|
||||
<script src=/resources/testharness.js></script>
|
||||
diff --git i/conformance/context/context-eviction-with-garbage-collection.html w/conformance/context/context-eviction-with-garbage-collection.html
|
||||
index 3989c7679a..b52e3a9e9f 100644
|
||||
--- i/conformance/context/context-eviction-with-garbage-collection.html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue