Make setZeroTimeout use window.setTimeout

This commit is contained in:
Anthony Ramine 2018-08-27 17:54:24 +02:00
parent cb2f83cf8e
commit 6089e45b7d
21 changed files with 335 additions and 98 deletions

View file

@ -10619,17 +10619,13 @@
"conformance/context/context-creation-and-destruction.html": [
[
"/_webgl/conformance/context/context-creation-and-destruction.html",
{
"timeout": "long"
}
{}
]
],
"conformance/context/context-creation.html": [
[
"/_webgl/conformance/context/context-creation.html",
{
"timeout": "long"
}
{}
]
],
"conformance/context/context-eviction-with-garbage-collection.html": [
@ -27610,11 +27606,11 @@
"testharness"
],
"conformance/context/context-creation-and-destruction.html": [
"3ad7a02d79cfbae4b9d7b6f6ee16cdc5d1a829dd",
"a3912fcf7eaaf2992ec4a82de0c7262d929b035d",
"testharness"
],
"conformance/context/context-creation.html": [
"237258cc9d956acf6b821967c8010db22804e6df",
"d8685e48fcb8e5f74132501fa31e00163212be54",
"testharness"
],
"conformance/context/context-eviction-with-garbage-collection.html": [
@ -46634,7 +46630,7 @@
"support"
],
"js/webgl-test-utils.js": [
"5ab8b2cfd0794f3c15d7afad0fe98b0f75cff38b",
"0ef194eacc296f083fe86a03cdbdb5f72317b516",
"support"
],
"py/lint/LICENSE": [

View file

@ -1,5 +0,0 @@
[context-creation-and-destruction.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,5 +0,0 @@
[context-creation.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,5 +1,53 @@
[oes-texture-float-with-canvas.html]
expected: TIMEOUT
expected: ERROR
[Overall test]
expected: NOTRUN
[WebGL test #31: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #19: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #12: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #15: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #14: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #40: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #34: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #20: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #39: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #11: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #17: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #35: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #37: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #32: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #38: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #18: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL

View file

@ -1,5 +1,53 @@
[oes-texture-half-float-with-canvas.html]
expected: TIMEOUT
expected: ERROR
[Overall test]
expected: NOTRUN
[WebGL test #31: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #19: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #12: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #15: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #14: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #40: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #34: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #20: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #39: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #11: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #17: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #35: shouldBe 0,127,0,127\nat (0, 16) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #37: shouldBe 127,0,0,127\nat (0, 16) expected: 127,0,0,127 was 255,0,0,255]
expected: FAIL
[WebGL test #32: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #38: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL
[WebGL test #18: shouldBe 0,127,0,127\nat (0, 0) expected: 0,127,0,127 was 0,255,0,255]
expected: FAIL

View file

@ -1,5 +0,0 @@
[webgl-compressed-texture-size-limit.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,5 +0,0 @@
[tex-2d-alpha-alpha-unsigned_byte.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,5 +1,5 @@
[tex-2d-luminance-luminance-unsigned_byte.html]
expected: TIMEOUT
expected: ERROR
[WebGL test #1: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
@ -9,3 +9,93 @@
[WebGL test #0: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #21: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #4: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #9: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL
[WebGL test #28: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #7: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #12: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #29: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL
[WebGL test #13: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL
[WebGL test #22: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #20: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #30: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #27: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL
[WebGL test #15: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL
[WebGL test #3: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #17: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #14: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #5: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #24: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #31: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL
[WebGL test #25: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL
[WebGL test #8: shouldBe 127,127,127,255\nat (0, 16) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #2: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #10: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #18: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #6: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #23: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #19: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #16: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #26: shouldBe 127,127,127,255\nat (0, 0) expected: 127,127,127,255 was 26,26,26,255]
expected: FAIL
[WebGL test #11: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 89,89,89,255]
expected: FAIL

View file

@ -1,5 +1,5 @@
[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html]
expected: TIMEOUT
expected: ERROR
[WebGL test #1: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
@ -9,3 +9,93 @@
[WebGL test #0: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #31: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #21: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #8: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #15: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #4: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #9: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #7: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #20: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #30: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #22: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #10: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #5: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #13: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #3: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #17: shouldBe 0,0,0,255\nat (0, 0) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #11: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #14: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #25: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #24: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #28: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #12: shouldBe 127,127,127,127\nat (0, 16) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #27: shouldBe 0,0,0,127\nat (0, 16) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #26: shouldBe 127,127,127,127\nat (0, 0) expected: 127,127,127,127 was 26,26,26,128]
expected: FAIL
[WebGL test #2: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #29: shouldBe 0,0,0,127\nat (0, 0) expected: 0,0,0,127 was 89,89,89,128]
expected: FAIL
[WebGL test #18: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #6: shouldBe 255,255,255,255\nat (0, 0) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL
[WebGL test #23: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #19: shouldBe 0,0,0,255\nat (0, 16) expected: 0,0,0,255 was 182,182,182,255]
expected: FAIL
[WebGL test #16: shouldBe 255,255,255,255\nat (0, 16) expected: 255,255,255,255 was 54,54,54,255]
expected: FAIL

View file

@ -1,5 +1,5 @@
[tex-2d-rgb-rgb-unsigned_byte.html]
expected: TIMEOUT
expected: ERROR
[Overall test]
expected: NOTRUN

View file

@ -1,5 +1,5 @@
[tex-2d-rgb-rgb-unsigned_short_5_6_5.html]
expected: TIMEOUT
expected: ERROR
[Overall test]
expected: NOTRUN

View file

@ -1,5 +1,5 @@
[tex-2d-rgba-rgba-unsigned_byte.html]
expected: TIMEOUT
expected: ERROR
[Overall test]
expected: NOTRUN

View file

@ -1,5 +1,5 @@
[tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html]
expected: TIMEOUT
expected: ERROR
[Overall test]
expected: NOTRUN

View file

@ -1,5 +1,5 @@
[tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html]
expected: TIMEOUT
expected: ERROR
[Overall test]
expected: NOTRUN

View file

@ -1,5 +0,0 @@
[texture-size-limit.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -29,7 +29,6 @@
<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>

View file

@ -29,7 +29,6 @@
<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>

View file

@ -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.

View file

@ -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'

View 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.

View file

@ -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