From 96679298d847c60d5ad9af9a0e3209ff52c4e946 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 26 Apr 2017 09:30:00 -0400 Subject: [PATCH] Test [[CanBlock]] in various agents Follows https://github.com/whatwg/html/pull/2521. Worklets are not tested at this time as their API is still in flux. --- .../canblock-dedicatedworker.html | 13 ++++++++++++ .../canblock-serviceworker.https.html | 14 +++++++++++++ .../canblock-sharedworker.html | 13 ++++++++++++ .../canblock-window.html | 21 +++++++++++++++++++ .../worker-that-requires-failure.js | 13 ++++++++++++ .../worker-that-requires-success.js | 11 ++++++++++ 6 files changed, 85 insertions(+) create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-dedicatedworker.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-sharedworker.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-window.html create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-failure.js create mode 100644 html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-success.js diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-dedicatedworker.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-dedicatedworker.html new file mode 100644 index 00000000000000..0d559999f3faf8 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-dedicatedworker.html @@ -0,0 +1,13 @@ + + +[[CanBlock]] in a dedicated worker agent + + + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html new file mode 100644 index 00000000000000..6bfd29e8c74b50 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html @@ -0,0 +1,14 @@ + + +[[CanBlock]] in a service worker agent + + + + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-sharedworker.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-sharedworker.html new file mode 100644 index 00000000000000..beb7c6467b2417 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-sharedworker.html @@ -0,0 +1,13 @@ + + +[[CanBlock]] in a shared worker agent + + + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-window.html b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-window.html new file mode 100644 index 00000000000000..369ce77b0b62af --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-window.html @@ -0,0 +1,21 @@ + + +[[CanBlock]] in a similar-origin window agent + + + + + + + diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-failure.js b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-failure.js new file mode 100644 index 00000000000000..586c8ba3876465 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-failure.js @@ -0,0 +1,13 @@ +"use strict"; +importScripts("/resources/testharness.js"); + +test(() => { + const sab = new SharedArrayBuffer(16); + const ta = new Int32Array(sab); + + assert_throws(new TypeError(), () => { + Atomics.wait(ta, 0, 0, 10); + }); +}, `[[CanBlock]] in a ${self.constructor.name}`); + +done(); diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-success.js b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-success.js new file mode 100644 index 00000000000000..2ed54143ee5572 --- /dev/null +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/worker-that-requires-success.js @@ -0,0 +1,11 @@ +"use strict"; +importScripts("/resources/testharness.js"); + +test(() => { + const sab = new SharedArrayBuffer(16); + const ta = new Int32Array(sab); + + assert_equals(Atomics.wait(ta, 0, 0, 10), "timed-out"); +}, `[[CanBlock]] in a ${self.constructor.name}`); + +done();