mirror of
https://github.com/servo/servo.git
synced 2025-09-17 10:28:22 +01:00
Update web-platform-tests to revision 5e3ea8f49fee68c327388bfd1dd1375a8ce12a0e.
This commit is contained in:
parent
12195a5c4a
commit
bfb96b9448
1166 changed files with 35123 additions and 900 deletions
30
tests/wpt/web-platform-tests/resources/LICENSE
Normal file
30
tests/wpt/web-platform-tests/resources/LICENSE
Normal file
|
@ -0,0 +1,30 @@
|
|||
W3C 3-clause BSD License
|
||||
|
||||
http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of works must retain the original copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the original copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the W3C nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this work without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
Binary file not shown.
|
@ -1,3 +1,3 @@
|
|||
importScripts("testharness.js");
|
||||
importScripts("../testharness.js");
|
||||
|
||||
throw new Error("This failure is expected.");
|
|
@ -1,4 +1,4 @@
|
|||
importScripts("testharness.js");
|
||||
importScripts("../testharness.js");
|
||||
|
||||
test(
|
||||
function(test) {
|
|
@ -7,8 +7,8 @@
|
|||
<body onload="load_test_attr.done()">
|
||||
<h1>Sample HTML5 API Tests</h1>
|
||||
<div id="log"></div>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
setup_run = false;
|
||||
setup(function() {
|
|
@ -7,8 +7,8 @@
|
|||
<h1>Async Tests and Promises</h1>
|
||||
<p>This test assumes ECMAScript 6 Promise support. Some failures are expected.</p>
|
||||
<div id="log"></div>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
test(function() {
|
|
@ -2,8 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Example with iframe that notifies containing document via callbacks</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
</head>
|
||||
<body onload="start_test_in_iframe()">
|
||||
<h1>Callbacks From Tests Running In An IFRAME</h1>
|
|
@ -2,8 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Example with iframe that notifies containing document via cross document messaging</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Notifications From Tests Running In An IFRAME</h1>
|
|
@ -8,8 +8,8 @@
|
|||
<p>This test demonstrates the use of <tt>promise_test</tt>. Assumes ECMAScript 6
|
||||
Promise support. Some failures are expected.</p>
|
||||
<div id="log"></div>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
test(
|
||||
function() {
|
|
@ -2,8 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Dedicated Worker Tests</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dedicated Web Worker Tests</h1>
|
|
@ -2,8 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Example with a shared worker</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Shared Web Worker Tests</h1>
|
|
@ -2,8 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Example with a service worker</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Service Worker Tests</h1>
|
|
@ -7,8 +7,8 @@
|
|||
<h1>Sample HTML5 API Tests</h1>
|
||||
<p>There should be two results</p>
|
||||
<div id="log"></div>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
setup({explicit_done:true})
|
||||
test(function() {assert_true(true)}, "Test defined before onload");
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Sample HTML5 API Tests</title>
|
||||
</head>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
|
||||
<body onload="load_test_attr.done()">
|
||||
<h1>Sample HTML5 API Tests</h1>
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Harness Handling Uncaught Exception</title>
|
||||
</head>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
|
||||
<body>
|
||||
<h1>Harness Handling Uncaught Exception</h1>
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>Harness Ignoring Uncaught Exception</title>
|
||||
</head>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
|
||||
<body>
|
||||
<h1>Harness Ignoring Uncaught Exception</h1>
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Example with file_is_test</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
onload = function() {
|
||||
assert_true(true);
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Example with file_is_test (should fail)</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
onload = function() {
|
||||
assert_true(false);
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Example single page test with no body</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
assert_true(true);
|
||||
done();
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Example single page test with no asserts</title>
|
||||
<script src="testharness.js"></script>
|
||||
<script src="testharnessreport.js"></script>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
<script>
|
||||
done();
|
||||
</script>
|
|
@ -517,19 +517,27 @@ policies and contribution forms [3].
|
|||
|
||||
function promise_test(func, name, properties) {
|
||||
var test = async_test(name, properties);
|
||||
Promise.resolve(test.step(func, test, test))
|
||||
.then(
|
||||
function() {
|
||||
test.done();
|
||||
})
|
||||
.catch(test.step_func(
|
||||
function(value) {
|
||||
if (value instanceof AssertionError) {
|
||||
throw value;
|
||||
}
|
||||
assert(false, "promise_test", null,
|
||||
"Unhandled rejection with value: ${value}", {value:value});
|
||||
}));
|
||||
// If there is no promise tests queue make one.
|
||||
test.step(function() {
|
||||
if (!tests.promise_tests) {
|
||||
tests.promise_tests = Promise.resolve();
|
||||
}
|
||||
});
|
||||
tests.promise_tests = tests.promise_tests.then(function() {
|
||||
return Promise.resolve(test.step(func, test, test))
|
||||
.then(
|
||||
function() {
|
||||
test.done();
|
||||
})
|
||||
.catch(test.step_func(
|
||||
function(value) {
|
||||
if (value instanceof AssertionError) {
|
||||
throw value;
|
||||
}
|
||||
assert(false, "promise_test", null,
|
||||
"Unhandled rejection with value: ${value}", {value:value});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function promise_rejects(test, expected, promise) {
|
||||
|
@ -2048,28 +2056,11 @@ policies and contribution forms [3].
|
|||
log.removeChild(log.lastChild);
|
||||
}
|
||||
|
||||
var script_prefix = null;
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var src;
|
||||
if (scripts[i].src) {
|
||||
src = scripts[i].src;
|
||||
} else if (scripts[i].href) {
|
||||
//SVG case
|
||||
src = scripts[i].href.baseVal;
|
||||
}
|
||||
|
||||
var matches = src && src.match(/^(.*\/|)testharness\.js$/);
|
||||
if (matches) {
|
||||
script_prefix = matches[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (script_prefix !== null) {
|
||||
var harness_url = get_harness_url();
|
||||
if (harness_url !== null) {
|
||||
var stylesheet = output_document.createElementNS(xhtml_ns, "link");
|
||||
stylesheet.setAttribute("rel", "stylesheet");
|
||||
stylesheet.setAttribute("href", script_prefix + "testharness.css");
|
||||
stylesheet.setAttribute("href", harness_url + "testharness.css");
|
||||
var heads = output_document.getElementsByTagName("head");
|
||||
if (heads.length) {
|
||||
heads[0].appendChild(stylesheet);
|
||||
|
@ -2425,6 +2416,7 @@ policies and contribution forms [3].
|
|||
|
||||
AssertionError.prototype.get_stack = function() {
|
||||
var stack = new Error().stack;
|
||||
// IE11 does not initialize 'Error.stack' until the object is thrown.
|
||||
if (!stack) {
|
||||
try {
|
||||
throw new Error();
|
||||
|
@ -2432,18 +2424,30 @@ policies and contribution forms [3].
|
|||
stack = e.stack;
|
||||
}
|
||||
}
|
||||
|
||||
var lines = stack.split("\n");
|
||||
var rv = [];
|
||||
var re = /\/resources\/testharness\.js/;
|
||||
|
||||
// Create a pattern to match stack frames originating within testharness.js. These include the
|
||||
// script URL, followed by the line/col (e.g., '/resources/testharness.js:120:21').
|
||||
var re = new RegExp((get_script_url() || "\\btestharness.js") + ":\\d+:\\d+");
|
||||
|
||||
// Some browsers include a preamble that specifies the type of the error object. Skip this by
|
||||
// advancing until we find the first stack frame originating from testharness.js.
|
||||
var i = 0;
|
||||
// Fire remove any preamble that doesn't match the regexp
|
||||
while (!re.test(lines[i])) {
|
||||
i++
|
||||
while (!re.test(lines[i]) && i < lines.length) {
|
||||
i++;
|
||||
}
|
||||
// Then remove top frames in testharness.js itself
|
||||
while (re.test(lines[i])) {
|
||||
i++
|
||||
|
||||
// Then skip the top frames originating from testharness.js to begin the stack at the test code.
|
||||
while (re.test(lines[i]) && i < lines.length) {
|
||||
i++;
|
||||
}
|
||||
|
||||
// Paranoid check that we didn't skip all frames. If so, return the original stack unmodified.
|
||||
if (i >= lines.length) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
return lines.slice(i).join("\n");
|
||||
}
|
||||
|
||||
|
@ -2491,7 +2495,7 @@ policies and contribution forms [3].
|
|||
Array.prototype.push.apply(array, items);
|
||||
}
|
||||
|
||||
function forEach (array, callback, thisObj)
|
||||
function forEach(array, callback, thisObj)
|
||||
{
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
if (array.hasOwnProperty(i)) {
|
||||
|
@ -2535,11 +2539,46 @@ policies and contribution forms [3].
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the 'src' URL of the first <script> tag in the page to include the file 'testharness.js'. */
|
||||
function get_script_url()
|
||||
{
|
||||
if (!('document' in self)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var src;
|
||||
if (scripts[i].src) {
|
||||
src = scripts[i].src;
|
||||
} else if (scripts[i].href) {
|
||||
//SVG case
|
||||
src = scripts[i].href.baseVal;
|
||||
}
|
||||
|
||||
var matches = src && src.match(/^(.*\/|)testharness\.js$/);
|
||||
if (matches) {
|
||||
return src;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** Returns the URL path at which the files for testharness.js are assumed to reside (e.g., '/resources/').
|
||||
The path is derived from inspecting the 'src' of the <script> tag that included 'testharness.js'. */
|
||||
function get_harness_url()
|
||||
{
|
||||
var script_url = get_script_url();
|
||||
|
||||
// Exclude the 'testharness.js' file from the returned path, but '+ 1' to include the trailing slash.
|
||||
return script_url ? script_url.slice(0, script_url.lastIndexOf('/') + 1) : undefined;
|
||||
}
|
||||
|
||||
function supports_post_message(w)
|
||||
{
|
||||
var supports;
|
||||
var type;
|
||||
// Given IE implements postMessage across nested iframes but not across
|
||||
// Given IE implements postMessage across nested iframes but not across
|
||||
// windows or tabs, you can't infer cross-origin communication from the presence
|
||||
// of postMessage on the current window object only.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue