diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/workers/interfaces/WorkerGlobalScope | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/workers/interfaces/WorkerGlobalScope')
16 files changed, 450 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html new file mode 100644 index 000000000..d65695632 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html @@ -0,0 +1,29 @@ +<!-- +onmessage = function(e) { + postMessage(1); + throw new Error(); +} +close(); +/* +--> +<!doctype html> +<title>close() and incoming message</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var worker = new Worker('#'); +worker.onmessage = function(e) { + assert_unreached("Got message"); +}; +worker.onerror = function(e) { + assert_unreached("Got error"); +}; +worker.postMessage(1); +setTimeout(done, 2000); +</script> +<!-- +*/ +//--> + + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.html new file mode 100644 index 000000000..983c422cc --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.html @@ -0,0 +1,27 @@ +<!-- +postMessage(1); +close(); +postMessage(2); +/* +--> +<!doctype html> +<title>close() and sending messages</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + var i = 0; + worker.onmessage = this.step_func(function(e) { + i++; + assert_equals(e.data, i); + if (i == 2) { + this.done(); + } + }); +}); +</script> +<!-- +*/ +//--> diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.html new file mode 100644 index 000000000..1d7d178d2 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.html @@ -0,0 +1,34 @@ +<!-- +var interval1 = setInterval(function() { + clearInterval(interval1); + postMessage(1); + throw new Error(); +}, 10); +close(); +var interval2 = setInterval(function() { + clearInterval(interval2); + postMessage(1); + throw new Error(); +}, 10); +/* +--> +<!doctype html> +<title>close() and setInterval</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var worker = new Worker('#'); +worker.onmessage = function(e) { + assert_unreached("Got message"); +}; +worker.onerror = function(e) { + assert_unreached("Got error"); +}; +setTimeout(done, 2000); +</script> +<!-- +*/ +//--> + + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.html new file mode 100644 index 000000000..c2fa10dfc --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.html @@ -0,0 +1,28 @@ +<!-- +function x() { + postMessage(1); + throw new Error(); +} +setTimeout(x, 0); +close(); +setTimeout(x, 0); +/* +--> +<!doctype html> +<title>close() and setTimeout</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var worker = new Worker('#'); +worker.onmessage = function(e) { + assert_unreached("Got message"); +}; +worker.onerror = function(e) { + assert_unreached("Got error"); +}; +setTimeout(done, 2000); +</script> +<!-- +*/ +//--> diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/helper-redirect.py b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/helper-redirect.py new file mode 100644 index 000000000..eb1599a57 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/helper-redirect.py @@ -0,0 +1,3 @@ +def main(request, response): + response.status = 302 + response.headers.append("Location", "post-location-members.js?a") diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.html new file mode 100644 index 000000000..31ddf37a1 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.html @@ -0,0 +1,31 @@ +<!-- +postMessage([null, location.href, location.protocol, location.host, + location.hostname, location.port, location.pathname, + location.search, location.hash]); +/* +--> +<!doctype html> +<title>members of WorkerLocation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + worker.onmessage = this.step_func(function(e) { + assert_equals(e.data[0], null); + assert_equals(e.data[1], location.href + '#', 'href'); + assert_equals(e.data[2], location.protocol, 'protocol'); + assert_equals(e.data[3], location.host, 'host'); + assert_equals(e.data[4], location.hostname, 'hostname'); + assert_equals(e.data[5], location.port, 'port'); + assert_equals(e.data[6], location.pathname, 'pathname'); + assert_equals(e.data[7], location.search, 'search'); + assert_equals(e.data[8], '', 'hash'); + this.done(); + }); +}); +</script> +<!-- +*/ +//--> diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/post-location-members.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/post-location-members.js new file mode 100644 index 000000000..e850b76b6 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/post-location-members.js @@ -0,0 +1,8 @@ +postMessage([location.href, + location.protocol, + location.host, + location.hostname, + location.port, + location.pathname, + location.search, + location.hash]);
\ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.html new file mode 100644 index 000000000..2fd16a4c1 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.html @@ -0,0 +1,28 @@ +<!-- +/* +--> +<!doctype html> +<title>location with a worker in separate file that redirects</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('helper-redirect.py?fail'); + worker.onmessage = this.step_func_done(function(e) { + assert_equals(e.data[0], location.href.replace(/\/[^\/]+$/, '/post-location-members.js?a')); + assert_equals(e.data[1], location.protocol); + assert_equals(e.data[2], location.host); + assert_equals(e.data[3], location.hostname); + assert_equals(e.data[4], location.port); + assert_equals(e.data[5], location.pathname.replace(/\/[^\/]+$/, '/post-location-members.js')); + assert_equals(e.data[6], '?a'); + assert_equals(e.data[7], ''); + }); +}); +</script> +<!-- +*/ +//--> + + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/returns-same-object.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/returns-same-object.html new file mode 100644 index 000000000..40559c166 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/returns-same-object.html @@ -0,0 +1,21 @@ +<!-- +postMessage(location === location); +/* +--> +<!doctype html> +<title>location === location</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + worker.onmessage = this.step_func(function(e) { + assert_true(e.data); + this.done(); + }); +}); +</script> +<!-- +*/ +//--> diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.html new file mode 100644 index 000000000..d2f470ffc --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.html @@ -0,0 +1,43 @@ +<!-- +var exceptions = []; +try { location.href = 1; } catch(e) { exceptions.push('href'); } +try { location.protocol = 1; } catch(e) { exceptions.push('protocol'); } +try { location.host = 1; } catch(e) { exceptions.push('host'); } +try { location.hostname = 1; } catch(e) { exceptions.push('hostname');} +try { location.port = 1; } catch(e) { exceptions.push('port'); } +try { location.pathname = 1; } catch(e) { exceptions.push('pathname'); } +try { location.search = 1; } catch(e) { exceptions.push('search'); } +try { location.hash = 1; } catch(e) { exceptions.push('hash'); } + +postMessage([null, location.href, location.protocol, location.host, + location.hostname, location.port, location.pathname, + location.search, location.hash, exceptions]); +/* +--> +<!doctype html> +<title>setting members of WorkerLocation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + worker.onmessage = this.step_func(function(e) { + assert_equals(e.data[0], null); + assert_equals(e.data[1], location.href + '#', 'href'); + assert_equals(e.data[2], location.protocol, 'protocol'); + assert_equals(e.data[3], location.host, 'host'); + assert_equals(e.data[4], location.hostname, 'hostname'); + assert_equals(e.data[5], location.port, 'port'); + assert_equals(e.data[6], location.pathname, 'pathname'); + assert_equals(e.data[7], location.search, 'search'); + assert_equals(e.data[8], '', 'hash'); + assert_array_equals(e.data[9], [], 'number of exceptions'); + this.done(); + }); +}); +</script> +<!-- +*/ +//--> + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/worker-separate-file.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/worker-separate-file.html new file mode 100644 index 000000000..ac8e64dcc --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/worker-separate-file.html @@ -0,0 +1,28 @@ +<!-- +/* +--> +<!doctype html> +<title>location with a worker in separate file</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('post-location-members.js?a#b?c'); + worker.onmessage = this.step_func(function(e) { + assert_equals(e.data[0], location.href.replace(/\/[^\/]+$/, '/post-location-members.js?a#b?c')); + assert_equals(e.data[1], location.protocol); + assert_equals(e.data[2], location.host); + assert_equals(e.data[3], location.hostname); + assert_equals(e.data[4], location.port); + assert_equals(e.data[5], location.pathname.replace(/\/[^\/]+$/, '/post-location-members.js')); + assert_equals(e.data[6], '?a'); + assert_equals(e.data[7], '#b?c'); + this.done(); + }); +}); +</script> +<!-- +*/ +//--> + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/exception-in-onerror.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/exception-in-onerror.html new file mode 100644 index 000000000..4b5af71d5 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/exception-in-onerror.html @@ -0,0 +1,32 @@ +<!-- +onerror = function(a, b, c, d) { + y(); // the error is "not handled" +} +function x() { + y(); +} +x(); +/* +--> +<!doctype html> +<title>onerror, "not handled" with an error in the onerror function</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + worker.onerror = this.step_func(function(e) { + assert_true(e instanceof ErrorEvent, 'e instanceof ErrorEvent'); + assert_equals(typeof e.message, 'string', 'typeof e.message'); + assert_equals(e.filename, document.URL+'#', 'e.filename'); + assert_equals(typeof e.lineno, 'number', 'typeof e.lineno'); + assert_equals(typeof e.colno, 'number', 'typeof e.column'); + e.preventDefault(); // "handled" + this.done(); + }); +}); +</script> +<!-- +*/ +//--> diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.html new file mode 100644 index 000000000..56fee8e06 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.html @@ -0,0 +1,36 @@ +<!-- +onerror = function(a, b, c, d) { + postMessage([a, b, c, d]); + return true; // the error is "handled" +} +function x() { + y(); +} +x(); +/* +--> +<!doctype html> +<title>onerror, "handled"</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + worker.onmessage = this.step_func(function(e) { + assert_equals(typeof e.data[0], 'string', 'first argument'); + assert_equals(e.data[1], document.URL+'#', 'second argument'); + assert_equals(typeof e.data[2], 'number', 'third argument'); + assert_equals(typeof e.data[3], 'number', 'fourth argument'); + setTimeout(this.step_func(function() { + this.done(); + }), 100); + }); + worker.onerror = this.step_func(function(e) { + assert_unreached(); + }); +}); +</script> +<!-- +*/ +//-->
\ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.html new file mode 100644 index 000000000..f6107ada4 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.html @@ -0,0 +1,32 @@ +<!-- +onerror = function(a, b, c, d) { + return false; // the error is "not handled" +} +function x() { + y(); +} +x(); +/* +--> +<!doctype html> +<title>onerror, "not handled"</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + worker.onerror = this.step_func(function(e) { + assert_true(e instanceof ErrorEvent, 'e instanceof ErrorEvent'); + assert_equals(typeof e.message, 'string', 'typeof e.message'); + assert_equals(e.filename, document.URL+'#', 'e.filename'); + assert_equals(typeof e.lineno, 'number', 'typeof e.lineno'); + assert_equals(typeof e.colno, 'number', 'typeof e.column'); + e.preventDefault(); // "handled" + this.done(); + }); +}); +</script> +<!-- +*/ +//--> diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.html new file mode 100644 index 000000000..b6a61e235 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.html @@ -0,0 +1,31 @@ +<!-- +function x() { + y(); +} +x(); +/* +--> +<!doctype html> +<title>onerror, "not handled" with only window.onerror defined</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +setup({ + allow_uncaught_exception: true, +}); +async_test(function() { + var worker = new Worker('#'); + window.onerror = this.step_func(function(a, b, c, d) { + assert_equals(typeof a, 'string', 'first argument'); + assert_equals(b, document.URL+'#', 'second argument'); + assert_equals(typeof c, 'number', 'third argument'); + assert_equals(typeof d, 'number', 'fourth argument'); + this.done(); + return true; // "handled" + }); +}); +</script> +<!-- +*/ +//--> diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/self.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/self.html new file mode 100644 index 000000000..39c2c36c0 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/self.html @@ -0,0 +1,39 @@ +<!-- +var results = []; +function check(func, msg) { + try { + results.push([func(), msg]); + } catch(ex) { + results.push([String(ex), msg]); + } +} +check(function() { return self === self; }, 'self === self'); +check(function() { return self instanceof WorkerGlobalScope; }, 'self instanceof WorkerGlobalScope'); +check(function() { return 'self' in self; }, '\'self\' in self'); +check(function() { + var x = self; + self = 1; + return x === self; +}, 'self = 1'); +postMessage(results); +/* +--> +<!doctype html> +<title>self</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +async_test(function() { + var worker = new Worker('#'); + worker.onmessage = this.step_func(function(e) { + for (var i = 0; i < e.data.length; ++i) { + assert_true(e.data[i][0], e.data[i][1]); + } + this.done(); + }); +}); +</script> +<!-- +*/ +//-->
\ No newline at end of file |