Update web-platform-tests to revision 5a754b40cd49c0404863c431b58cc311dc5d167c

This commit is contained in:
Ms2ger 2015-11-17 09:56:30 +01:00
parent 8950345e0e
commit 32efe41299
107 changed files with 4243 additions and 435 deletions

View file

@ -12,35 +12,54 @@
// not propogate to the window before the tests finish
setup({allow_uncaught_exception: true});
function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
}
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('unsupported:', ''); });
}, "unsupported_scheme");
async_test(function() {
var worker = new SharedWorker('data:,onconnect = function(e) { e.ports[0].postMessage(1); }', '');
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, 1);
});
}, "data_url");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('javascript:""', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'javascript:""');
}, "javascript_url");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('about:blank', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'about:blank');
}, "about_blank");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('http://www.opera.com/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'http://www.opera.com/');
}, "opera_com");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker(location.protocol+'//'+location.hostname+':81/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, location.protocol+'//'+location.hostname+':81/');
}, "port_81");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':80/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'https://'+location.hostname+':80/');
}, "https_port_80");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':8000/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'https://'+location.hostname+':8000/');
}, "https_port_8000");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('http://'+location.hostname+':8012/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'http://'+location.hostname+':8012/');
}, "http_port_8012");
</script>
<!--

View file

@ -10,6 +10,17 @@
// not propogate to the window before the tests finish
setup({allow_uncaught_exception: true});
function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
}
test(function() {
assert_throws("SecurityError", function() { new Worker('unsupported:'); });
}, "unsupported_scheme");
@ -21,31 +32,32 @@ async_test(function() {
});
}, "data_url");
test(function() {
assert_throws("SecurityError", function() { new Worker('about:blank'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'about:blank');
}, "about_blank");
test(function() {
assert_throws("SecurityError", function() { new Worker('http://www.example.invalid/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'http://www.example.invalid/');
}, "example_invalid");
test(function() {
assert_throws("SecurityError", function() { new Worker(location.protocol+'//'+location.hostname+':81/'); });
async_test(function(t) {
testSharedWorkerHelper(t, location.protocol+'//'+location.hostname+':81/');
}, "port_81");
test(function() {
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':80/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'https://'+location.hostname+':80/');
}, "https_port_80");
test(function() {
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':8000/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'https://'+location.hostname+':8000/');
}, "https_port_8000");
test(function() {
assert_throws("SecurityError", function() { new Worker('http://'+location.hostname+':8012/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'http://'+location.hostname+':8012/');
}, "http_post_8012");
test(function() {
assert_throws("SecurityError", function() { new Worker('javascript:""'); });
async_test(function(t) {
testSharedWorkerHelper(t,'javascript:""');
}, "javascript_url");
</script>