mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,3 @@
|
|||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(['1', self.name]);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage([e.data === '', e instanceof MessageEvent, e.ports.length == 1]);
|
||||
};
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>connect event</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker('#');
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_true(e.data[0], "e.data === ''");
|
||||
assert_true(e.data[1], "e instanceof MessageEvent");
|
||||
assert_true(e.data[2], "e.ports.length == 1");
|
||||
this.done();
|
||||
}), false);
|
||||
worker.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,17 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>creating a dummy shared worker with name "foo"</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-sharedworker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var worker = new SharedWorker('#', 'foo');
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,17 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>creating a dummy shared worker</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-sharedworker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var worker = new SharedWorker('#');
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,17 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>creating a dummy shared worker with explicit name ""</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-sharedworker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var worker = new SharedWorker('#', '');
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
var expected = 'self location close onerror importScripts navigator addEventListener removeEventListener dispatchEvent name applicationCache onconnect setTimeout clearTimeout setInterval clearInterval'.split(' ');
|
||||
var log = '';
|
||||
for (var i = 0; i < expected.length; ++i) {
|
||||
if (!(expected[i] in self))
|
||||
log += expected[i] + ' did not exist\n';
|
||||
}
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(log);
|
||||
};
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>members of SharedWorkerGlobalScope</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker('#');
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
}), false);
|
||||
worker.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!--
|
||||
var prt;
|
||||
function handleCall(e) {
|
||||
var log = [];
|
||||
for (var i = 0; i < e.data.length; ++i) {
|
||||
if (!(e.data[i] in self))
|
||||
log.push(e.data[i]);
|
||||
}
|
||||
prt.postMessage('These were missing: '+log.join(', '));
|
||||
}
|
||||
onconnect = function(e) {
|
||||
prt = e.ports[0];
|
||||
prt.onmessage = handleCall;
|
||||
};
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>expected interface objects/constructors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var expected = 'XMLHttpRequest WebSocket EventSource MessageChannel Worker SharedWorker ApplicationCache'.split(' ');
|
||||
var supported = [];
|
||||
for (var i = 0; i < expected.length; ++i) {
|
||||
if (expected[i] in window)
|
||||
supported.push(expected[i]);
|
||||
}
|
||||
var worker = new SharedWorker('#');
|
||||
worker.port.start();
|
||||
worker.port.postMessage(supported);
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
}), false);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,24 @@
|
|||
<!--
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(self.name);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>self.name</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker('#', 'hello');
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data, 'hello');
|
||||
this.done();
|
||||
}), false);
|
||||
worker.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>no arguments</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#sharedworker">
|
||||
<link rel=help href="http://dev.w3.org/2006/webapi/WebIDL/#es-interface-call">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
var worker = new SharedWorker();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,3 @@
|
|||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(['null', self.name]);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(['FAIL', self.name]);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>null as arguments</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker(null, null);
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data[0], 'null', 'first arg');
|
||||
assert_equals(e.data[1], 'null', 'second arg');
|
||||
this.done();
|
||||
}), false);
|
||||
worker.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(['FAIL', self.name]);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>1 as arguments</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker(1, 1);
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data[0], '1', 'first arg');
|
||||
assert_equals(e.data[1], '1', 'second arg');
|
||||
this.done();
|
||||
}), false);
|
||||
worker.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(true);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>worker.port.onmessage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker('#', '');
|
||||
worker.port.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>worker.port</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#sharedworker">
|
||||
<link rel=help href="http://www.whatwg.org/html/#messageport">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var worker = new SharedWorker('#', '');
|
||||
assert_true('port' in worker, "port");
|
||||
assert_true('postMessage' in worker.port, "postMessage");
|
||||
assert_true('start' in worker.port, "start");
|
||||
assert_true('close' in worker.port, "close");
|
||||
assert_true('onmessage' in worker.port, "onmessage");
|
||||
assert_true('addEventListener' in worker.port, "addEventListener");
|
||||
assert_true('removeEventListener' in worker.port, "removeEventListener");
|
||||
assert_true('dispatchEvent' in worker.port, "dispatchEvent");
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting worker.port</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#sharedworker">
|
||||
<link rel=help href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-attribute-setter">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var worker = new SharedWorker('#', '');
|
||||
var x = worker.port;
|
||||
worker.port = 1;
|
||||
assert_equals(worker.port, x);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,48 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>same-origin checks</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-sharedworker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// Needed to prevent a race condition if a worker throws an exception that may or may
|
||||
// not propogate to the window before the tests finish
|
||||
setup({allow_uncaught_exception: 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:""', ''); });
|
||||
}, "javascript_url");
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new SharedWorker('about:blank', ''); });
|
||||
}, "about_blank");
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new SharedWorker('http://www.opera.com/', ''); });
|
||||
}, "opera_com");
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new SharedWorker(location.protocol+'//'+location.hostname+':81/', ''); });
|
||||
}, "port_81");
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':80/', ''); });
|
||||
}, "https_port_80");
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':8000/', ''); });
|
||||
}, "https_port_8000");
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new SharedWorker('http://'+location.hostname+':8012/', ''); });
|
||||
}, "http_port_8012");
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,59 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting members of worker.port</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup(function() {
|
||||
window.worker = new SharedWorker('#', '');
|
||||
});
|
||||
test(function() {
|
||||
worker.port.postMessage = 1;
|
||||
assert_equals(worker.port.postMessage, 1);
|
||||
}, 'postMessage');
|
||||
test(function() {
|
||||
worker.port.start = 1;
|
||||
assert_equals(worker.port.start, 1);
|
||||
}, 'start');
|
||||
test(function() {
|
||||
worker.port.close = 1;
|
||||
assert_equals(worker.port.close, 1);
|
||||
}, 'close');
|
||||
test(function() {
|
||||
var f = function(){};
|
||||
worker.port.onmessage = f;
|
||||
assert_equals(worker.port.onmessage, f, 'function(){}');
|
||||
worker.port.onmessage = 1;
|
||||
assert_equals(worker.port.onmessage, null, '1');
|
||||
worker.port.onmessage = f;
|
||||
worker.port.onmessage = ';';
|
||||
assert_equals(worker.port.onmessage, null, '";"');
|
||||
worker.port.onmessage = f;
|
||||
worker.port.onmessage = {handleEvent:function(){}};
|
||||
assert_equals(worker.port.onmessage, null, '{handleEvent:function(){}}');
|
||||
worker.port.onmessage = f;
|
||||
worker.port.onmessage = null;
|
||||
assert_equals(worker.port.onmessage, null, 'null');
|
||||
worker.port.onmessage = f;
|
||||
worker.port.onmessage = undefined;
|
||||
assert_equals(worker.port.onmessage, null, 'undefined');
|
||||
}, 'onmessage');
|
||||
test(function() {
|
||||
worker.port.addEventListener = 1;
|
||||
assert_equals(worker.port.addEventListener, 1);
|
||||
}, 'addEventListener');
|
||||
test(function() {
|
||||
worker.port.removeEventListener = 1;
|
||||
assert_equals(worker.port.removeEventListener, 1);
|
||||
}, 'removeEventListener');
|
||||
test(function() {
|
||||
worker.port.despatchEvent = 1;
|
||||
assert_equals(worker.port.despatchEvent, 1);
|
||||
}, 'despatchEvent');
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,3 @@
|
|||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(['undefined', self.name]);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(['FAIL', self.name]);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>undefined as arguments</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker(undefined, undefined);
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data[0], 'undefined', 'first arg');
|
||||
assert_equals(e.data[1], 'undefined', 'second arg');
|
||||
this.done();
|
||||
}), false);
|
||||
worker.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
var unexpected = 'open print stop getComputedStyle getSelection releaseEvents captureEvents alert confirm prompt addEventStream removeEventStream back forward attachEvent detachEvent navigate DOMParser XMLSerializer XPathEvaluator XSLTProcessor opera Image Option frames Audio SVGUnitTypes SVGZoomAndPan java netscape sun Packages ByteArray closed defaultStatus document event frameElement history innerHeight innerWidth opener outerHeight outerWidth pageXOffset pageYOffset parent screen screenLeft screenTop screenX screenY status top window length'.split(' '); // iterated window in opera and removed expected ones
|
||||
var log = '';
|
||||
for (var i = 0; i < unexpected.length; ++i) {
|
||||
if (unexpected[i] in self)
|
||||
log += unexpected[i] + ' ';
|
||||
}
|
||||
onconnect = function(e) {
|
||||
e.ports[0].postMessage(log);
|
||||
};
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>unexpected members/interface objects/constructors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new SharedWorker('#');
|
||||
worker.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
}), false);
|
||||
worker.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,19 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>resolving broken url</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-sharedworker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws("SyntaxError", function() {
|
||||
var worker = new SharedWorker('http://foo bar');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1 @@
|
|||
postMessage('1');
|
|
@ -0,0 +1,41 @@
|
|||
<!--
|
||||
for (;) // should cause onerror to be invoked, but onerror is null, so
|
||||
// the error is "not handled". should fire an ErrorEvent on the
|
||||
// worker.
|
||||
break;
|
||||
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">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(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');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
var expected = [
|
||||
'postMessage', 'onmessage', /* DedicatedWorkerGlobalScope */
|
||||
'self', 'location', 'close', 'onerror', 'onoffline', 'ononline', /* WorkerGlobalScope */
|
||||
'addEventListener', 'removeEventListener', 'dispatchEvent', /* EventListener */
|
||||
'importScripts', 'navigator', /* WorkerUtils */
|
||||
'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', /* WindowTimers */
|
||||
'btoa', 'atob' /* WindowBase64 */
|
||||
];
|
||||
for (var i = 0; i < expected.length; ++i) {
|
||||
if (!(expected[i] in self)) {
|
||||
postMessage(expected[i] + ' did not exist');
|
||||
}
|
||||
}
|
||||
postMessage('done');
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>members of DedicatedWorkerGlobalScope</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-worker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../workers.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var worker = new Worker('#');
|
||||
listenForMessages(t, worker);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
postMessage('FAIL');
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>1 as argument</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-worker">
|
||||
<link rel=help href="http://dev.w3.org/2006/webapi/WebIDL/#es-DOMString">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var worker = new Worker(1);
|
||||
worker.addEventListener('message', t.step_func_done(function(e) {
|
||||
assert_equals(e.data, '1')
|
||||
}), false);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
postMessage('FAIL');
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>null as argument</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-worker">
|
||||
<link rel=help href="http://dev.w3.org/2006/webapi/WebIDL/#es-DOMString">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var worker = new Worker(null);
|
||||
worker.addEventListener('message', t.step_func_done(function(e) {
|
||||
assert_equals(e.data, 'null')
|
||||
}), false);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
postMessage('FAIL');
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>undefined as argument</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-worker">
|
||||
<link rel=help href="http://dev.w3.org/2006/webapi/WebIDL/#es-DOMString">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var worker = new Worker(undefined);
|
||||
worker.addEventListener('message', t.step_func_done(function(e) {
|
||||
assert_equals(e.data, 'undefined')
|
||||
}), false);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
for (var i = 0; i < e.data.length; ++i) {
|
||||
if (!(e.data[i] in self)) {
|
||||
postMessage(e.data[i] + ' did not exist');
|
||||
}
|
||||
}
|
||||
postMessage('done');
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>expected interface objects/constructors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../workers.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var expected = ['XMLHttpRequest', 'WebSocket', 'EventSource', 'MessageChannel', 'Worker', 'SharedWorker'];
|
||||
var supported = expected.filter(function(iface) { return iface in window; });
|
||||
var worker = new Worker('#');
|
||||
listenForMessages(t, worker);
|
||||
worker.postMessage(supported);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>without arguments</title>
|
||||
<link rel=help href="http://dev.w3.org/2006/webapi/WebIDL/#es-interface-call">
|
||||
<link rel=help href="http://www.whatwg.org/html/#dedicated-workers-and-the-worker-interface">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() { new Worker(); });
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage('null');
|
|
@ -0,0 +1,22 @@
|
|||
<!--
|
||||
postMessage('ok');
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>resolve the empty string</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var worker = new Worker('');
|
||||
worker.addEventListener('message', t.step_func_done(function(e) {
|
||||
assert_equals(e.data, 'ok');
|
||||
}), false);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,51 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>same-origin checks; the script is in a script element</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-worker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// Needed to prevent a race condition if a worker throws an exception that may or may
|
||||
// not propogate to the window before the tests finish
|
||||
setup({allow_uncaught_exception: true});
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker('unsupported:'); });
|
||||
}, "unsupported_scheme");
|
||||
|
||||
async_test(function() {
|
||||
var worker = new Worker('data:,postMessage(1);');
|
||||
worker.onmessage = this.step_func_done(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
});
|
||||
}, "data_url");
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker('about:blank'); });
|
||||
}, "about_blank");
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker('http://www.example.invalid/'); });
|
||||
}, "example_invalid");
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker(location.protocol+'//'+location.hostname+':81/'); });
|
||||
}, "port_81");
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':80/'); });
|
||||
}, "https_port_80");
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':8000/'); });
|
||||
}, "https_port_8000");
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker('http://'+location.hostname+':8012/'); });
|
||||
}, "http_post_8012");
|
||||
|
||||
test(function() {
|
||||
assert_throws("SecurityError", function() { new Worker('javascript:""'); });
|
||||
}, "javascript_url");
|
||||
</script>
|
|
@ -0,0 +1,45 @@
|
|||
<!--
|
||||
(function f() {
|
||||
postMessage(1);
|
||||
setTimeout(f, 0);
|
||||
})();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>terminate()</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-worker-terminate">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../workers.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var worker = new Worker('#');
|
||||
var i = 0;
|
||||
var expected;
|
||||
|
||||
worker.onmessage = t.step_func(function() {
|
||||
i++;
|
||||
});
|
||||
|
||||
setTimeout(t.step_func(function() {
|
||||
expected = i;
|
||||
start_time = Date.now();
|
||||
//Hang the main thread for a bit to give the worker the chance to post some more messages
|
||||
while(Date.now() - start_time < 500) {
|
||||
//pass
|
||||
}
|
||||
worker.terminate();
|
||||
|
||||
setTimeout(t.step_func(function() {
|
||||
assert_equals(i, expected);
|
||||
t.done();
|
||||
}), 100);
|
||||
|
||||
}), 100);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1 @@
|
|||
postMessage('undefined');
|
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
var unexpected = ['open', 'print', 'stop', 'getComputedStyle', 'getSelection', 'releaseEvents', 'captureEvents', 'alert', 'confirm', 'prompt', 'addEventStream', 'removeEventStream', 'back', 'forward', 'attachEvent', 'detachEvent', 'navigate', 'DOMParser', 'XMLSerializer', 'XPathEvaluator', 'XSLTProcessor', 'opera', 'Image', 'Option', 'frames', 'Audio', 'SVGUnitTypes', 'SVGZoomAndPan', 'java', 'netscape', 'sun', 'Packages', 'ByteArray', 'closed', 'defaultStatus', 'document', 'event', 'frameElement', 'history', 'innerHeight', 'innerWidth', 'name', 'opener', 'outerHeight', 'outerWidth', 'pageXOffset', 'pageYOffset', 'parent', 'screen', 'screenLeft', 'screenTop', 'screenX', 'screenY', 'status', 'top', 'window', 'length']; // iterated window in opera and removed expected ones
|
||||
for (var i = 0; i < unexpected.length; ++i) {
|
||||
if (unexpected[i] in self) {
|
||||
postMessage(unexpected[i] + ' existed');
|
||||
}
|
||||
}
|
||||
postMessage('done');
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>unexpected members/interface objects/constructors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../workers.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(function() {
|
||||
var worker = new Worker('#');
|
||||
listenForMessages(t, worker);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>unresolvable url</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-worker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws("SyntaxError", function() { new Worker('http://invalid url/'); });
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue