mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Update web-platform-tests to revision 4d96cccabc2feacd48e1dab9afc22b8af2225572
This commit is contained in:
parent
0d236288cc
commit
c66c6af0ba
1067 changed files with 63768 additions and 10900 deletions
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Workers: Worker ErrorEvent - bubbles, cancelable</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
async_test(function(t) {
|
||||
var worker = new Worker('./support/ErrorEvent.js');
|
||||
worker.onerror = t.step_func_done(function(e) {
|
||||
assert_false(e.bubbles, "onerror on worker doesn't bubble");
|
||||
assert_true(e.cancelable, "onerror on worker is cancelable");
|
||||
});
|
||||
worker.postMessage("Error Message");
|
||||
}, "ErrorEvent on worker doesn't bubble and is cancelable");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Base URL in workers: importScripts</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker("../beta/importScripts.py");
|
||||
worker.onmessage = this.step_func_done(function(e) {
|
||||
assert_equals(e.data, "gamma");
|
||||
});
|
||||
worker.onerror = this.unreached_func("Got error event");
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Base URL in workers: new SharedWorker()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker("../beta/sharedworker.py");
|
||||
worker.onmessage = this.step_func_done(function(e) {
|
||||
assert_equals(e.data, "gamma");
|
||||
});
|
||||
worker.onerror = this.unreached_func("Got error event");
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Base URL in workers: new Worker()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker("../beta/worker.py");
|
||||
worker.onmessage = this.step_func_done(function(e) {
|
||||
assert_equals(e.data, "gamma");
|
||||
});
|
||||
worker.onerror = this.unreached_func("Got error event");
|
||||
});
|
||||
</script>
|
14
tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr.html
Normal file
14
tests/wpt/web-platform-tests/workers/baseurl/alpha/xhr.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Base URL in workers: XHR</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker("../beta/xhr.py");
|
||||
worker.onmessage = this.step_func_done(function(e) {
|
||||
assert_equals(e.data, "gamma\n");
|
||||
});
|
||||
worker.onerror = this.unreached_func("Got error event");
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
def main(request, response):
|
||||
return (302, "Moved"), [("Location", "../gamma/importScripts.js")], "postMessage('executed redirecting script');"
|
||||
|
|
@ -0,0 +1 @@
|
|||
postMessage('beta');
|
|
@ -0,0 +1,3 @@
|
|||
def main(request, response):
|
||||
return (302, "Moved"), [("Location", "../gamma/sharedworker.js")], "postMessage('executed redirecting script');"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
onconnect = function(e) {
|
||||
e.source.postMessage('beta');
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
postMessage("beta");
|
|
@ -0,0 +1 @@
|
|||
beta
|
|
@ -0,0 +1,3 @@
|
|||
def main(request, response):
|
||||
return (302, "Moved"), [("Location", "../gamma/worker.js")], "postMessage('executed redirecting script');"
|
||||
|
3
tests/wpt/web-platform-tests/workers/baseurl/beta/xhr.py
Normal file
3
tests/wpt/web-platform-tests/workers/baseurl/beta/xhr.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
def main(request, response):
|
||||
return (302, "Moved"), [("Location", "../gamma/xhr.js")], "postMessage('executed redirecting script');"
|
||||
|
|
@ -0,0 +1 @@
|
|||
importScripts("script.js");
|
|
@ -0,0 +1 @@
|
|||
postMessage('gamma');
|
|
@ -0,0 +1,4 @@
|
|||
var worker = new SharedWorker("subsharedworker.js");
|
||||
worker.port.onmessage = function(e) {
|
||||
postMessage(e.data);
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
onconnect = function(e) {
|
||||
e.source.postMessage('gamma');
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
postMessage("gamma");
|
|
@ -0,0 +1 @@
|
|||
gamma
|
|
@ -0,0 +1,4 @@
|
|||
var worker = new Worker("subworker.js");
|
||||
worker.onmessage = function(e) {
|
||||
postMessage(e.data);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
var x = new XMLHttpRequest();
|
||||
x.open("GET", "test.txt", false);
|
||||
x.send();
|
||||
postMessage(x.response);
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Workers: SharedWorker - throw URLMismatchError</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
test(function() {
|
||||
var worker = new SharedWorker('shared-worker.js', 'name');
|
||||
|
||||
assert_throws("URLMismatchError", function() {
|
||||
new SharedWorker('some-other-url.js', 'name');
|
||||
});
|
||||
|
||||
}, "Create SharedWorker with different URLs but same name");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,6 @@
|
|||
onconnect = function(e) {
|
||||
var port = e.ports[0];
|
||||
port.onmessage = function(e) {
|
||||
port.postMessage('ping');
|
||||
}
|
||||
}
|
|
@ -8,32 +8,39 @@ postMessage(1); // shouldn't do anything since the script doesn't compile
|
|||
-->
|
||||
<!doctype html>
|
||||
<title>AbstractWorker.onerror</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#runtime-script-errors-0">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/#runtime-script-errors-2">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/#report-the-error">
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
setup({allow_uncaught_exception:true});
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onerror = function(a, b, c) {
|
||||
t.step(function() {
|
||||
assert_equals('' + a, '[object ErrorEvent]');
|
||||
assert_true("message" in a, 'ErrorEvent.message');
|
||||
assert_equals(typeof a.message, "string", 'ErrorEvent.message');
|
||||
assert_equals(a.filename, document.URL + '#', 'ErrorEvent.filename');
|
||||
assert_true("lineno" in a, 'ErrorEvent.lineno');
|
||||
assert_equals(typeof a.lineno, "number", 'ErrorEvent.lineno');
|
||||
assert_equals(b, undefined, 'unexpected second argument to onerror');
|
||||
assert_equals(c, undefined, 'unexpected third argument to onerror');
|
||||
});
|
||||
t.done();
|
||||
}
|
||||
worker.onmessage = function(e) {
|
||||
t.step(function() {
|
||||
assert_unreached('onmessage was invoked but worker script shouldn\'t have compiled');
|
||||
});
|
||||
}
|
||||
var error;
|
||||
worker.onerror = this.step_func(function(a, b, c) {
|
||||
error = a;
|
||||
assert_equals('' + a, '[object ErrorEvent]');
|
||||
assert_true("message" in a, 'ErrorEvent.message');
|
||||
assert_equals(typeof a.message, "string", 'ErrorEvent.message');
|
||||
assert_equals(a.filename, document.URL + '#', 'ErrorEvent.filename');
|
||||
assert_true("lineno" in a, 'ErrorEvent.lineno');
|
||||
assert_equals(typeof a.lineno, "number", 'ErrorEvent.lineno');
|
||||
assert_equals(b, undefined, 'unexpected second argument to onerror');
|
||||
assert_equals(c, undefined, 'unexpected third argument to onerror');
|
||||
});
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_unreached('onmessage was invoked but worker script shouldn\'t have compiled');
|
||||
});
|
||||
window.onerror = this.step_func_done(function(a, b, c, d, e, f) {
|
||||
assert_equals(a, error.message, 'message');
|
||||
assert_equals(b, error.filename, 'filename');
|
||||
assert_equals(c, error.lineno, 'lineno');
|
||||
assert_equals(d, error.colno, 'colno');
|
||||
assert_equals(e, error.error, 'error');
|
||||
assert_equals(f, undefined, 'unexpected sixth argument to onerror');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Workers: Worker - Blob url</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
async_test(function(t) {
|
||||
var blob = new Blob(["onmessage = function(event) { postMessage(event.data); }"], {type: "text/plain"});
|
||||
var worker = new Worker(window.URL.createObjectURL(blob));
|
||||
var data = "Blob URL";
|
||||
worker.postMessage(data);
|
||||
worker.onmessage = t.step_func(function(event) {
|
||||
assert_equals(event.data, data, "event.data");
|
||||
t.done();
|
||||
});
|
||||
}, "Worker supports Blob url");
|
||||
|
||||
</script>
|
|
@ -13,23 +13,22 @@ var newDate;
|
|||
</script>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var iframe = document.querySelector('iframe');
|
||||
onload = t.step_func(function() {
|
||||
onload = function() {
|
||||
iframe.src = "001-1.html?" + Math.random();
|
||||
});
|
||||
var start_test = t.step_func(function() {
|
||||
};
|
||||
var start_test = function() {
|
||||
window[0].document.links[0].click();
|
||||
});
|
||||
var after_load = t.step_func(function() {
|
||||
};
|
||||
var after_load = function() {
|
||||
history.back();
|
||||
newDate = new Date();
|
||||
setTimeout(this.step_func(function() {
|
||||
setTimeout(function() {
|
||||
assert_greater_than(Number(date), Number(newDate));
|
||||
assert_equals(window[0].document.title, '001-1');
|
||||
this.done();
|
||||
}), 500);
|
||||
});
|
||||
done();
|
||||
}, 2000);
|
||||
};
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
|
|
|
@ -12,14 +12,14 @@ setup({allow_uncaught_exception: true});
|
|||
async_test(function() {
|
||||
var worker = new Worker('404_worker');
|
||||
worker.onerror = this.step_func(function(e) { this.done(); });
|
||||
}, 'worker', {timeout:500});
|
||||
}, 'worker');
|
||||
|
||||
async_test(function() {
|
||||
var shared = new SharedWorker('404_shared');
|
||||
// NOTE: this handler will not fire, as runtime scripting errors
|
||||
// are not forwarded to SharedWorker objects, but instead reported to the user directly.
|
||||
shared.onerror = this.step_func(function(e) { assert_unreached(); }, shared, 'error');
|
||||
setTimeout(this.step_func(function() { this.done(); }), 500);
|
||||
setTimeout(this.step_func(function() { this.done(); }), 1000);
|
||||
}, 'shared');
|
||||
</script>
|
||||
<!--
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue