From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../EventTarget.worker.js | 23 ++++++ .../DedicatedWorkerGlobalScope/onmessage.worker.js | 40 ++++++++++ .../postMessage/event-ports-dedicated.html | 15 ++++ .../postMessage/event-ports-dedicated.js | 3 + .../imagedata-cloned-canvas-in-array.html | 22 ++++++ .../imagedata-cloned-canvas-in-array.js | 10 +++ .../postMessage/message-event.html | 23 ++++++ .../postMessage/message-event.js | 1 + .../postMessage/return-value.worker.js | 8 ++ .../postMessage/second-argument-dictionary.html | 16 ++++ .../postMessage/second-argument-dictionary.js | 7 ++ .../postMessage/second-argument-null-in-array.html | 14 ++++ .../postMessage/second-argument-null-in-array.js | 5 ++ .../postMessage/second-argument-null.html | 14 ++++ .../postMessage/second-argument-null.js | 5 ++ .../postMessage/second-argument-undefined.html | 14 ++++ .../postMessage/second-argument-undefined.js | 5 ++ .../postMessage/setting-postMessage.html | 14 ++++ .../postMessage/setting-postMessage.js | 3 + .../postMessage/structured-clone-imagedata.html | 18 +++++ .../postMessage/structured-clone-imagedata.js | 5 ++ .../postMessage/structured-clone-message.html | 38 +++++++++ .../postMessage/structured-clone-message.js | 14 ++++ .../SharedWorkerGlobalScope/name/getting.html | 17 ++++ .../SharedWorkerGlobalScope/name/getting.js | 9 +++ .../SharedWorkerGlobalScope/name/setting.html | 15 ++++ .../SharedWorkerGlobalScope/name/setting.js | 4 + .../SharedWorkerGlobalScope/onconnect.html | 14 ++++ .../SharedWorkerGlobalScope/onconnect.js | 19 +++++ .../WorkerGlobalScope/close/incoming-message.html | 18 +++++ .../WorkerGlobalScope/close/incoming-message.js | 5 ++ .../WorkerGlobalScope/close/sending-messages.html | 18 +++++ .../WorkerGlobalScope/close/sending-messages.js | 3 + .../WorkerGlobalScope/close/setInterval.html | 17 ++++ .../WorkerGlobalScope/close/setInterval.js | 11 +++ .../WorkerGlobalScope/close/setTimeout.html | 17 ++++ .../WorkerGlobalScope/close/setTimeout.js | 7 ++ .../WorkerGlobalScope/location/helper-redirect.py | 3 + .../WorkerGlobalScope/location/members.html | 22 ++++++ .../WorkerGlobalScope/location/members.js | 3 + .../location/post-location-members.js | 8 ++ .../location/redirect-module.html | 20 +++++ .../location/redirect-sharedworker.html | 9 +++ .../WorkerGlobalScope/location/redirect.html | 28 +++++++ .../WorkerGlobalScope/location/redirect.js | 7 ++ .../location/returns-same-object.any.js | 5 ++ .../location/setting-members.html | 23 ++++++ .../WorkerGlobalScope/location/setting-members.js | 13 ++++ .../location/worker-separate-file.html | 28 +++++++ .../onerror/exception-in-onerror.html | 91 ++++++++++++++++++++++ .../WorkerGlobalScope/onerror/handled.html | 22 ++++++ .../WorkerGlobalScope/onerror/handled.js | 8 ++ .../onerror/message-classic-DOMException.html | 7 ++ .../onerror/message-classic-Error.html | 7 ++ .../WorkerGlobalScope/onerror/message-helper.js | 61 +++++++++++++++ .../onerror/message-module-DOMException.html | 7 ++ .../onerror/message-module-Error.html | 7 ++ .../WorkerGlobalScope/onerror/not-handled.html | 28 +++++++ .../WorkerGlobalScope/onerror/not-handled.js | 7 ++ .../onerror/propagate-to-window-onerror.html | 21 +++++ .../onerror/propagate-to-window-onerror.js | 4 + .../interfaces/WorkerGlobalScope/onerror/throw.js | 34 ++++++++ .../interfaces/WorkerGlobalScope/self.any.js | 19 +++++ .../interfaces/WorkerUtils/WindowTimers/001.html | 14 ++++ .../interfaces/WorkerUtils/WindowTimers/001.js | 1 + .../interfaces/WorkerUtils/WindowTimers/002.html | 13 ++++ .../interfaces/WorkerUtils/WindowTimers/002.js | 2 + .../interfaces/WorkerUtils/WindowTimers/003.html | 14 ++++ .../interfaces/WorkerUtils/WindowTimers/003.js | 1 + .../interfaces/WorkerUtils/WindowTimers/004.html | 13 ++++ .../interfaces/WorkerUtils/WindowTimers/004.js | 4 + .../interfaces/WorkerUtils/WindowTimers/005.html | 14 ++++ .../interfaces/WorkerUtils/WindowTimers/005.js | 3 + .../WorkerUtils/importScripts/001.worker.js | 7 ++ .../WorkerUtils/importScripts/002.worker.js | 11 +++ .../interfaces/WorkerUtils/importScripts/003.html | 14 ++++ .../interfaces/WorkerUtils/importScripts/003.js | 8 ++ .../interfaces/WorkerUtils/importScripts/004.html | 15 ++++ .../interfaces/WorkerUtils/importScripts/004.js | 13 ++++ .../interfaces/WorkerUtils/importScripts/005.html | 15 ++++ .../interfaces/WorkerUtils/importScripts/005.js | 9 +++ .../interfaces/WorkerUtils/importScripts/006.html | 17 ++++ .../interfaces/WorkerUtils/importScripts/006.js | 11 +++ .../interfaces/WorkerUtils/importScripts/007.html | 17 ++++ .../interfaces/WorkerUtils/importScripts/007.js | 2 + .../interfaces/WorkerUtils/importScripts/008.html | 14 ++++ .../interfaces/WorkerUtils/importScripts/008.js | 3 + .../interfaces/WorkerUtils/importScripts/009.html | 20 +++++ .../interfaces/WorkerUtils/importScripts/009.js | 3 + .../interfaces/WorkerUtils/importScripts/010.html | 17 ++++ .../interfaces/WorkerUtils/importScripts/010.js | 11 +++ .../interfaces/WorkerUtils/importScripts/011.html | 17 ++++ .../interfaces/WorkerUtils/importScripts/011.js | 11 +++ .../interfaces/WorkerUtils/importScripts/012.html | 17 ++++ .../interfaces/WorkerUtils/importScripts/012.js | 11 +++ .../workers/interfaces/WorkerUtils/importScripts/1 | 1 + .../interfaces/WorkerUtils/importScripts/1.headers | 1 + .../WorkerUtils/importScripts/blob-url.worker.js | 40 ++++++++++ .../WorkerUtils/importScripts/catch.sub.any.js | 47 +++++++++++ .../interfaces/WorkerUtils/importScripts/null | 1 + .../WorkerUtils/importScripts/null.headers | 1 + .../report-error-cross-origin.sub.any.js | 8 ++ .../importScripts/report-error-helper.js | 80 +++++++++++++++++++ ...eport-error-redirect-to-cross-origin.sub.any.js | 9 +++ .../report-error-same-origin.sub.any.js | 7 ++ ...report-error-setTimeout-cross-origin.sub.any.js | 8 ++ ...-setTimeout-redirect-to-cross-origin.sub.any.js | 9 +++ .../report-error-setTimeout-same-origin.sub.any.js | 7 ++ .../interfaces/WorkerUtils/importScripts/undefined | 1 + .../WorkerUtils/importScripts/undefined.headers | 1 + .../interfaces/WorkerUtils/navigator/002.html | 14 ++++ .../interfaces/WorkerUtils/navigator/002.js | 1 + .../interfaces/WorkerUtils/navigator/003.html | 14 ++++ .../interfaces/WorkerUtils/navigator/003.js | 1 + .../interfaces/WorkerUtils/navigator/004.html | 14 ++++ .../interfaces/WorkerUtils/navigator/004.js | 1 + .../interfaces/WorkerUtils/navigator/005.html | 14 ++++ .../interfaces/WorkerUtils/navigator/005.js | 1 + .../interfaces/WorkerUtils/navigator/006.html | 14 ++++ .../interfaces/WorkerUtils/navigator/006.js | 1 + .../interfaces/WorkerUtils/navigator/007.html | 14 ++++ .../interfaces/WorkerUtils/navigator/007.js | 9 +++ .../interfaces/WorkerUtils/navigator/language.html | 14 ++++ .../interfaces/WorkerUtils/navigator/language.js | 1 + 124 files changed, 1659 insertions(+) create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/EventTarget.worker.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/onmessage.worker.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/return-value.worker.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.js create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.html create mode 100644 testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.js create mode 100644 testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.html create mode 100644 testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.js create mode 100644 testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.html create mode 100644 testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.js create mode 100644 testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.html create mode 100644 testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/helper-redirect.py create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/post-location-members.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect-module.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/returns-same-object.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/worker-separate-file.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/exception-in-onerror.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-DOMException.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-Error.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-helper.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-DOMException.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-Error.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/throw.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/self.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1 create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1.headers create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/blob-url.worker.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/catch.sub.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null.headers create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-cross-origin.sub.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-helper.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-redirect-to-cross-origin.sub.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-same-origin.sub.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-cross-origin.sub.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-redirect-to-cross-origin.sub.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-same-origin.sub.any.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined.headers create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.js create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.html create mode 100644 testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.js (limited to 'testing/web-platform/tests/workers/interfaces') diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/EventTarget.worker.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/EventTarget.worker.js new file mode 100644 index 0000000000..954c46c07e --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/EventTarget.worker.js @@ -0,0 +1,23 @@ +importScripts("/resources/testharness.js"); + +test(function(t) { + var i = 0; + addEventListener("message", function listener(evt) { + t.step(function() { + ++i; + removeEventListener("message", listener, true); + }); + }, true); + self.dispatchEvent(new Event("message")); + self.dispatchEvent(new Event("message")); + assert_equals(i, 1); +}, "removeEventListener"); + +test(function() { + addEventListener("message", this.step_func(function(evt) { + assert_equals(evt.target, self); + }), true); + self.dispatchEvent(new Event("message")); +}, "target"); + +done(); diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/onmessage.worker.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/onmessage.worker.js new file mode 100644 index 0000000000..6f285caac3 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/onmessage.worker.js @@ -0,0 +1,40 @@ +importScripts("/resources/testharness.js"); + +test(function() { + self.onmessage = 1; + assert_equals(self.onmessage, null, + "attribute should return null after being set to a primitive"); +}, "Setting onmessage to 1"); + +test(function() { + var object = { + handleEvent: this.unreached_func() + }; + self.onmessage = object; + assert_equals(self.onmessage, object, + "attribute should return the object it was set to."); + + self.dispatchEvent(new Event("message")); +}, "Setting onmessage to an object"); + +test(function() { + var triggered = false; + var f = function(e) { triggered = true; }; + self.onmessage = f; + assert_equals(self.onmessage, f, + "attribute should return the function it was set to."); + + self.dispatchEvent(new Event("message")); + assert_true(triggered, "event handler should have been triggered"); +}, "Setting onmessage to a function"); + + +test(function() { + assert_not_equals(self.onmessage, null, + "attribute should not return null after being set to a function"); + self.onmessage = 1; + assert_equals(self.onmessage, null, + "attribute should return null after being set to a primitive"); +}, "Setting onmessage to 1 (again)"); + +done(); diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.html new file mode 100644 index 0000000000..be89478786 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.html @@ -0,0 +1,15 @@ + +e.ports in dedicated worker + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.js new file mode 100644 index 0000000000..c5cc9f8d9f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/event-ports-dedicated.js @@ -0,0 +1,3 @@ +onmessage = function(e) { + postMessage(e.ports instanceof Array && e.ports.length === 0); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.html new file mode 100644 index 0000000000..7c019a9993 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.html @@ -0,0 +1,22 @@ + +posting an imagedata (from a cloned canvas) in an array + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.js new file mode 100644 index 0000000000..76eaee366c --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/imagedata-cloned-canvas-in-array.js @@ -0,0 +1,10 @@ +onmessage = function(e) { + function processPixels(imagedata) { + var pixeldata = imagedata.data; + for (var i = 0; i < pixeldata.length; i = i+4) { + pixeldata[i] = 128; + } + postMessage(imagedata); + } + processPixels(e.data[0]); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.html new file mode 100644 index 0000000000..91ec632685 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.html @@ -0,0 +1,23 @@ + + +'message' event properties + + + +
+ diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.js new file mode 100644 index 0000000000..54a250005e --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/message-event.js @@ -0,0 +1 @@ +postMessage("test"); diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/return-value.worker.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/return-value.worker.js new file mode 100644 index 0000000000..521251699a --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/return-value.worker.js @@ -0,0 +1,8 @@ +importScripts("/resources/testharness.js"); + +test(function() { + var rv = postMessage(1); + assert_equals(rv, undefined); +}, "return value of postMessage"); + +done(); diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.html new file mode 100644 index 0000000000..1749644908 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.html @@ -0,0 +1,16 @@ + +Using dictionary as postMessage's second argument + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.js new file mode 100644 index 0000000000..0cb80f8fae --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-dictionary.js @@ -0,0 +1,7 @@ +onmessage = (event) => { + try { + postMessage(event.data, {transfer: [event.data]}); + } catch(e) { + postMessage(''+e); + } +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.html new file mode 100644 index 0000000000..8db06b4116 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.html @@ -0,0 +1,14 @@ + +Using [null] in postMessage's second argument + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.js new file mode 100644 index 0000000000..95a094234b --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null-in-array.js @@ -0,0 +1,5 @@ +try { + postMessage(false, [null]); +} catch(e) { + postMessage(e instanceof TypeError); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.html new file mode 100644 index 0000000000..68d9caabc5 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.html @@ -0,0 +1,14 @@ + +Using null in postMessage's second argument + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.js new file mode 100644 index 0000000000..6f6f9e799f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-null.js @@ -0,0 +1,5 @@ +try { + postMessage(1, null); +} catch(e) { + postMessage(e instanceof TypeError); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.html new file mode 100644 index 0000000000..c7dcb3c5c0 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.html @@ -0,0 +1,14 @@ + +Using undefined in postMessage's second argument + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.js new file mode 100644 index 0000000000..6f11443c4a --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/second-argument-undefined.js @@ -0,0 +1,5 @@ +try { + postMessage(1, undefined); +} catch(e) { + postMessage(''+e); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.html new file mode 100644 index 0000000000..5b3e014e1e --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.html @@ -0,0 +1,14 @@ + +setting postMessage + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.js new file mode 100644 index 0000000000..5426ebde0d --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/setting-postMessage.js @@ -0,0 +1,3 @@ +var x = postMessage; +postMessage = 1; +x(postMessage == 1); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.html new file mode 100644 index 0000000000..c7fbb0f956 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.html @@ -0,0 +1,18 @@ + +structured clone of ImageData + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.js new file mode 100644 index 0000000000..04cd7eea5b --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-imagedata.js @@ -0,0 +1,5 @@ +onmessage = function(e) { + var imagedata = e.data; + imagedata.data[0] = 128; + postMessage(imagedata); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.html b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.html new file mode 100644 index 0000000000..edf4fb7e0e --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.html @@ -0,0 +1,38 @@ + +structured clone of message + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.js b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.js new file mode 100644 index 0000000000..db456e1fba --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/DedicatedWorkerGlobalScope/postMessage/structured-clone-message.js @@ -0,0 +1,14 @@ +var err = new Error('foo'); +var date = new Date(); +// commented out bits are either tested elsewhere or not supported yet. or uncloneable. +var tests = [undefined, null, false, true, 1, NaN, Infinity, 'foo', date, /foo/, /* ImageData, File, FileData, FileList,*/ null/*self*/, + [undefined, null, false, true, 1, NaN, Infinity, 'foo', /*date, /foo/,*/ null/*self*/, /*[], {},*/ null/*err*/], + {a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', /*i:date, j:/foo/,*/ k:null/*self*/, /*l:[], m:{},*/ n:null/*err*/}, + null/*err*/]; +for (var i = 0; i < tests.length; ++i) { + try { + postMessage(tests[i]); + } catch(e) { + postMessage(''+e); + } +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.html b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.html new file mode 100644 index 0000000000..c3a52d12e8 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.html @@ -0,0 +1,17 @@ + +getting name + + +
+ diff --git a/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.js b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.js new file mode 100644 index 0000000000..acf89ca6f6 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/getting.js @@ -0,0 +1,9 @@ +addEventListener('connect', function(e) { + var passed; + switch (location.hash) { + case '#1': passed = name == ''; break; + case '#2': passed = name == 'a'; break; + case '#3': passed = name == '0'; break; + } + e.ports[0].postMessage(passed); +}, false); diff --git a/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.html b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.html new file mode 100644 index 0000000000..ddd8569710 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.html @@ -0,0 +1,15 @@ + +setting name + + +
+ diff --git a/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.js b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.js new file mode 100644 index 0000000000..c705e9c40a --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/name/setting.js @@ -0,0 +1,4 @@ +addEventListener('connect', function(e) { + name = 1; + e.ports[0].postMessage(name); +}, false); diff --git a/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.html b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.html new file mode 100644 index 0000000000..8a0f103d40 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.html @@ -0,0 +1,14 @@ + +onconnect + + +
+ diff --git a/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.js b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.js new file mode 100644 index 0000000000..34a2be51fc --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/SharedWorkerGlobalScope/onconnect.js @@ -0,0 +1,19 @@ +var results = []; +try { + self.onconnect = 1; + results.push(String(onconnect)); +} catch(e) { + results.push(''+e); +} +try { + self.onconnect = {handleEvent:function(){}}; + results.push(String(onconnect)); +} catch(e) { + results.push(''+e); +} +var f = function(e) { + results.push(e.data); + e.ports[0].postMessage(results); +}; +onconnect = f; +results.push(typeof onconnect); 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 0000000000..0905d07661 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.html @@ -0,0 +1,18 @@ + +close() and incoming message + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.js new file mode 100644 index 0000000000..b4f7e7fc05 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/incoming-message.js @@ -0,0 +1,5 @@ +onmessage = function(e) { + postMessage(1); + throw new Error(); +} +close(); \ No newline at end of file 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 0000000000..da7da66d25 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.html @@ -0,0 +1,18 @@ + +close() and sending messages + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.js new file mode 100644 index 0000000000..2e0a898288 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/sending-messages.js @@ -0,0 +1,3 @@ +postMessage(1); +close(); +postMessage(2); \ No newline at end of file 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 0000000000..2f0ba176d4 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.html @@ -0,0 +1,17 @@ + +close() and setInterval + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.js new file mode 100644 index 0000000000..d165d20eab --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setInterval.js @@ -0,0 +1,11 @@ +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); \ No newline at end of file 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 0000000000..2bddc0947f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.html @@ -0,0 +1,17 @@ + +close() and setTimeout + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.js new file mode 100644 index 0000000000..55eecb0557 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/close/setTimeout.js @@ -0,0 +1,7 @@ +function x() { + postMessage(1); + throw new Error(); +} +setTimeout(x, 0); +close(); +setTimeout(x, 0); \ No newline at end of file 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 0000000000..c8cd354348 --- /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(b"Location", b"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 0000000000..3da6b7484d --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.html @@ -0,0 +1,22 @@ + +members of WorkerLocation + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.js new file mode 100644 index 0000000000..37235eac83 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/members.js @@ -0,0 +1,3 @@ +postMessage([null, 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/post-location-members.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/post-location-members.js new file mode 100644 index 0000000000..e850b76b6e --- /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-module.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect-module.html new file mode 100644 index 0000000000..b1a14be8f7 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect-module.html @@ -0,0 +1,20 @@ + +WorkerLocation with redirects: module dedicated workers + + +
+ diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html new file mode 100644 index 0000000000..978a99ac8c --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect-sharedworker.html @@ -0,0 +1,9 @@ + +WorkerLocation with redirects: classic shared workers + + +
+ 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 0000000000..98a0e54760 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.html @@ -0,0 +1,28 @@ + + +WorkerLocation with redirects: classic dedicated workers + + +
+ + + + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.js new file mode 100644 index 0000000000..2db48544a2 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/redirect.js @@ -0,0 +1,7 @@ +importScripts('/resources/testharness.js'); +test(t => { + assert_equals(location.pathname, '/workers/interfaces/WorkerGlobalScope/location/redirect.js'); + assert_equals(location.search, '?a'); + assert_equals(location.hash, ''); +}); +done(); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/returns-same-object.any.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/returns-same-object.any.js new file mode 100644 index 0000000000..dd3560f040 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/returns-same-object.any.js @@ -0,0 +1,5 @@ +// META: global=worker + +test(function() { + assert_equals(location, location); +}, 'location === location'); 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 0000000000..7ea79b6897 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.html @@ -0,0 +1,23 @@ + +setting members of WorkerLocation + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.js new file mode 100644 index 0000000000..4c5c8a35ae --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/setting-members.js @@ -0,0 +1,13 @@ +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]); \ No newline at end of file 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 0000000000..ac8e64dcc8 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/location/worker-separate-file.html @@ -0,0 +1,28 @@ + + +location with a worker in separate file + + +
+ + + 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 0000000000..5f3999db66 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/exception-in-onerror.html @@ -0,0 +1,91 @@ + + + + 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 0000000000..7d4b03c6cd --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.html @@ -0,0 +1,22 @@ + +onerror, "handled" + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.js new file mode 100644 index 0000000000..e58fa4a515 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/handled.js @@ -0,0 +1,8 @@ +onerror = function(a, b, c, d) { + postMessage([a, b, c, d]); + return true; // the error is "handled" +} +function x() { + y(); +} +x(); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-DOMException.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-DOMException.html new file mode 100644 index 0000000000..df8c851475 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-DOMException.html @@ -0,0 +1,7 @@ + + + + + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-Error.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-Error.html new file mode 100644 index 0000000000..e026b6ebf0 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-classic-Error.html @@ -0,0 +1,7 @@ + + + + + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-helper.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-helper.js new file mode 100644 index 0000000000..6271329b03 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-helper.js @@ -0,0 +1,61 @@ +// The error's `message` values in Worker error event handlers are tested. +// While not explicitly specified in the HTML spec, we expect some information +// about thrown errors (e.g. original message, the string "TypeError", etc.) +// to appear in the `message`. + +function prepareHandler(t, error, expectedCount) { + let count = 0; + return t.step_func(e => { + e.preventDefault(); + + assert_regexp_match( + e.message, + /Throw in/, + 'e.message should contain the message of the thrown error'); + + if (error === 'DOMException-TypeError') { + assert_regexp_match(e.message, /TypeError/); + } + + ++count; + if (count >= expectedCount) { + t.done(); + } + }); +} + +function expectErrors(worker, error, expectedCount, title) { + async_test(t => { + worker.addEventListener('error', + prepareHandler(t, error, expectedCount)); + }, title+ ': listener'); + async_test(t => { + worker.onerror = prepareHandler(t, error, expectedCount); + }, title + ': handler'); +} + +function runTest(type, error) { + for (const location of ['toplevel', + 'setTimeout-function', + 'setTimeout-string', + 'onmessage', + 'onerror']) { + const worker = new Worker( + 'throw.js?throw-in-' + location + '&error=' + error, + {type}); + let expectedCount = 1; + if (location === 'onmessage') { + // This makes the worker's message handler to throw an error. + worker.postMessage('foo'); + } + if (location === 'onerror') { + // This makes the worker's message handler to throw an error, + // AND worker's error handler to throw another error. + // Therefore we expect two errors here. + worker.postMessage('foo'); + expectedCount = 2; + } + expectErrors(worker, error, expectedCount, + 'Throw ' + error + ' in ' + location + ': ' + type); + } +} diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-DOMException.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-DOMException.html new file mode 100644 index 0000000000..8ed873bc32 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-DOMException.html @@ -0,0 +1,7 @@ + + + + + diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-Error.html b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-Error.html new file mode 100644 index 0000000000..046ff969d6 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-Error.html @@ -0,0 +1,7 @@ + + + + + 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 0000000000..11d03d728b --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.html @@ -0,0 +1,28 @@ + +onerror, "not handled" + + +
+ diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.js new file mode 100644 index 0000000000..c3254b0ba7 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/not-handled.js @@ -0,0 +1,7 @@ +onerror = function(a, b, c, d) { + return false; // the error is "not handled" +} +function x() { + y(); +} +x(); \ No newline at end of file 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 0000000000..b3be772679 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.html @@ -0,0 +1,21 @@ + +onerror, "not handled" with only window.onerror defined + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.js new file mode 100644 index 0000000000..0daf488d6f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/propagate-to-window-onerror.js @@ -0,0 +1,4 @@ +function x() { + y(); +} +x(); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/throw.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/throw.js new file mode 100644 index 0000000000..704098a6d8 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/onerror/throw.js @@ -0,0 +1,34 @@ +const params = new URL(self.location.href).searchParams; + +self.createError = (message) => { + if (params.get('error') === 'DOMException-TypeError') { + return new DOMException(message, 'TypeError'); + } else { + return new Error(message); + } +}; + +onerror = function() { + if (params.has('throw-in-onerror')) { + throw createError('Throw in error handler'); + } + return false; +}; +onmessage = function() { + throw createError('Throw in message handler'); + return false; +}; + +if (params.has('throw-in-toplevel')) { + throw createError('Throw in toplevel'); +} + +// We don't use step_timeout() here, because we have to test the behavior of +// setTimeout() without wrappers. +if (params.has('throw-in-setTimeout-function')) { + setTimeout(() => { throw createError('Throw in setTimeout function') }, 0); +} + +if (params.has('throw-in-setTimeout-string')) { + setTimeout("throw createError('Throw in setTimeout string')", 0); +} diff --git a/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/self.any.js b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/self.any.js new file mode 100644 index 0000000000..64b4ee2fae --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerGlobalScope/self.any.js @@ -0,0 +1,19 @@ +// META: global=worker + +test(function() { + assert_equals(self, self); +}, 'self === self'); + +test(function() { + assert_true(self instanceof WorkerGlobalScope); +}, 'self instanceof WorkerGlobalScope'); + +test(function() { + assert_true('self' in self); +}, '\'self\' in self'); + +test(function() { + var x = self; + self = 1; + assert_equals(self, x); +}, 'self = 1'); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.html new file mode 100644 index 0000000000..9fe5e2b1bc --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.html @@ -0,0 +1,14 @@ + +setTimeout + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.js new file mode 100644 index 0000000000..bd5b7c4071 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/001.js @@ -0,0 +1 @@ +setTimeout(function() { postMessage(1) }, 10); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.html new file mode 100644 index 0000000000..1a10b3d0bb --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.html @@ -0,0 +1,13 @@ + +clearTimeout + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.js new file mode 100644 index 0000000000..a96c088442 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/002.js @@ -0,0 +1,2 @@ +var t = setTimeout(function() { postMessage(1); }, 10); +clearTimeout(t); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.html new file mode 100644 index 0000000000..119d109b5f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.html @@ -0,0 +1,14 @@ + +setInterval + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.js new file mode 100644 index 0000000000..e64e4e2179 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/003.js @@ -0,0 +1 @@ +setInterval(function() { postMessage(1); }, 10); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.html new file mode 100644 index 0000000000..83d7bf915f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.html @@ -0,0 +1,13 @@ + +clearInterval + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.js new file mode 100644 index 0000000000..e80d79a8e5 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/004.js @@ -0,0 +1,4 @@ +var t = setInterval(function() { + postMessage(1); +}, 10); +clearInterval(t); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.html new file mode 100644 index 0000000000..2a181d55d0 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.html @@ -0,0 +1,14 @@ + +setInterval when closing + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.js new file mode 100644 index 0000000000..125c224e7b --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/WindowTimers/005.js @@ -0,0 +1,3 @@ +self.close(); +var t = setInterval(function() {}, 10); +postMessage(t); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js new file mode 100644 index 0000000000..aa86c8ef17 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/001.worker.js @@ -0,0 +1,7 @@ +importScripts("/resources/testharness.js"); + +test(function() { + importScripts(); +}); + +done(); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js new file mode 100644 index 0000000000..1cacee5ccb --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/002.worker.js @@ -0,0 +1,11 @@ +importScripts("/resources/testharness.js"); + +test(function() { + var ran = false; + assert_throws_dom("SyntaxError", function() { + importScripts('data:text/javascript,ran=true','http://foo bar'); + }); + assert_false(ran, 'first argument to importScripts ran'); +}); + +done(); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.html new file mode 100644 index 0000000000..5dcd08aa15 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.html @@ -0,0 +1,14 @@ + +importScripts running scripts + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.js new file mode 100644 index 0000000000..6e378ef20f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/003.js @@ -0,0 +1,8 @@ +var x = 'a'; +try { + importScripts('data:text/javascript,x+="b"', + 'data:text/javascript,x+="c"'); +} catch(e) { + x += "d" +} +postMessage(x); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.html new file mode 100644 index 0000000000..62537e0888 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.html @@ -0,0 +1,15 @@ + +importScripts broken script + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.js new file mode 100644 index 0000000000..98040d0d48 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/004.js @@ -0,0 +1,13 @@ +var x = ''; +var exception; +try { + importScripts('data:text/javascript,x+="first script successful. "', + 'data:text/javascript,x+="FAIL (second script). "; for(;) break;', // doesn't compile + 'data:text/javascript,x+="FAIL (third script)"'); +} catch(ex) { + if (ex instanceof SyntaxError) + exception = true; + else + exception = String(ex); +} +postMessage([x, exception]); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.html new file mode 100644 index 0000000000..7ebbc1be55 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.html @@ -0,0 +1,15 @@ + +importScripts separate scripts + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.js new file mode 100644 index 0000000000..18c534efa9 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/005.js @@ -0,0 +1,9 @@ +var x; +var y; +try { + importScripts('data:text/javascript,x={', + 'data:text/javascript,}'); +} catch(e) { + y = true; +} +postMessage([x, y]); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.html new file mode 100644 index 0000000000..aec2fb1483 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.html @@ -0,0 +1,17 @@ + +importScripts uncaught exception + + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.js new file mode 100644 index 0000000000..fc170f790c --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/006.js @@ -0,0 +1,11 @@ +var x; +var y; +var z; +try { + importScripts('data:text/javascript,x=1', + 'data:text/javascript,throw 2', + 'data:text/javascript,z=3'); +} catch(e) { + y = e; +} +postMessage([x, y, z]); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.html new file mode 100644 index 0000000000..37e888365f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.html @@ -0,0 +1,17 @@ + +postMessage in importScripts + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.js new file mode 100644 index 0000000000..dc85216f3d --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/007.js @@ -0,0 +1,2 @@ +importScripts('data:text/javascript,postMessage(1)'); +postMessage(2); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.html new file mode 100644 index 0000000000..f72b79939c --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.html @@ -0,0 +1,14 @@ + +variables and functions crossing importScripts boundary + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.js new file mode 100644 index 0000000000..c957fcd635 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/008.js @@ -0,0 +1,3 @@ +var log = postMessage; +importScripts('data:text/javascript,function run() { log(true) }'); +run(); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.html new file mode 100644 index 0000000000..e0eb5488c2 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.html @@ -0,0 +1,20 @@ + +variables and functions crossing importScripts boundary, take 2 + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.js new file mode 100644 index 0000000000..4b86f8c303 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/009.js @@ -0,0 +1,3 @@ +var log = postMessage; +importScripts('data:text/javascript,function run() { for(var i = 0; i < 1000; ++i) { if (i == 500) log(true); } return 1; }'); +postMessage(run()); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.html new file mode 100644 index 0000000000..a6db49c4be --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.html @@ -0,0 +1,17 @@ + +importScripts(undefined) + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.js new file mode 100644 index 0000000000..4ec4a3b8c7 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/010.js @@ -0,0 +1,11 @@ +// prevent recursion +if ('beenThere' in self) { + throw 'undefined stringified to the empty string'; +} +beenThere = true; +try { + importScripts(undefined); + postMessage(got); +} catch(ex) { + postMessage(String(ex)); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.html new file mode 100644 index 0000000000..1bfb233497 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.html @@ -0,0 +1,17 @@ + +importScripts(null) + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.js new file mode 100644 index 0000000000..bd6fed5c0a --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/011.js @@ -0,0 +1,11 @@ +// prevent recursion +if ('beenThere' in self) { + throw 'null stringified to the empty string'; +} +beenThere = true; +try { + importScripts(null); + postMessage(got); +} catch(ex) { + postMessage(String(ex)); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.html new file mode 100644 index 0000000000..ab0778d0c7 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.html @@ -0,0 +1,17 @@ + +importScripts(1) + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.js new file mode 100644 index 0000000000..f4c887f7df --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/012.js @@ -0,0 +1,11 @@ +// prevent recursion +if ('beenThere' in self) { + throw '1 stringified to the empty string'; +} +beenThere = true; +try { + importScripts(1); + postMessage(got); +} catch(ex) { + postMessage(String(ex)); +} \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1 b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1 new file mode 100644 index 0000000000..18cea4ff0f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1 @@ -0,0 +1 @@ +var got = '1'; \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1.headers b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1.headers new file mode 100644 index 0000000000..a17a9a3a12 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/1.headers @@ -0,0 +1 @@ +Content-Type: application/javascript diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/blob-url.worker.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/blob-url.worker.js new file mode 100644 index 0000000000..71603bf314 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/blob-url.worker.js @@ -0,0 +1,40 @@ +importScripts("/resources/testharness.js"); + +function objectUrlFromScript(script) { + const blob = new Blob([script], { type: "text/javascript" }); + return URL.createObjectURL(blob); +} + +test((t) => { + self.run = false; + const blobScriptUrl = objectUrlFromScript(`self.run = true;`); + t.add_cleanup(() => URL.revokeObjectURL(blobScriptUrl)); + + importScripts(blobScriptUrl); + assert_true(self.run); +}, "Blob URLs work on importScripts"); + +test(() => { + self.run = false; + const blobScriptUrl = objectUrlFromScript(`self.run = true;`); + + URL.revokeObjectURL(blobScriptUrl); + + assert_throws_dom("NetworkError", () => { + importScripts(blobScriptUrl); + }); + assert_false(self.run); +}, "A revoked blob URL will fail"); + +test(() => { + self.run = false; + const runScriptUrl = objectUrlFromScript(`self.run = true;`); + const revokeScriptUrl = objectUrlFromScript( + `URL.revokeObjectURL(${JSON.stringify(runScriptUrl)});` + ); + + importScripts(revokeScriptUrl, runScriptUrl); + assert_true(self.run); +}, "Revoking a blob URL in an earlier script will not fail"); + +done(); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/catch.sub.any.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/catch.sub.any.js new file mode 100644 index 0000000000..52da60be91 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/catch.sub.any.js @@ -0,0 +1,47 @@ +// META: global=worker + +const crossOrigin = "https://{{hosts[alt][]}}:{{ports[https][0]}}"; +const redirectToCrossOrigin = "/common/redirect.py?location=" + crossOrigin; + +test(function() { + assert_throws_js(SyntaxError, function() { + importScripts("/workers/modules/resources/syntax-error.js"); + }); +}, "Same-origin syntax error"); + +test(function() { + assert_throws_js(Error, function() { + importScripts("/workers/modules/resources/throw.js"); + }); +}, "Same-origin throw"); + +// https://html.spec.whatwg.org/C/#run-a-classic-script +// Step 8.2. If rethrow errors is true and script's muted errors is true, then: +// Step 8.2.2. Throw a "NetworkError" DOMException. +test(function() { + assert_throws_dom("NetworkError", function() { + importScripts(crossOrigin + + "/workers/modules/resources/syntax-error.js"); + }); +}, "Cross-origin syntax error"); + +test(function() { + assert_throws_dom("NetworkError", function() { + importScripts(crossOrigin + + "/workers/modules/resources/throw.js"); + }); +}, "Cross-origin throw"); + +test(function() { + assert_throws_dom("NetworkError", function() { + importScripts(redirectToCrossOrigin + + "/workers/modules/resources/syntax-error.js"); + }); +}, "Redirect-to-cross-origin syntax error"); + +test(function() { + assert_throws_dom("NetworkError", function() { + importScripts(redirectToCrossOrigin + + "/workers/modules/resources/throw.js"); + }); +}, "Redirect-to-Cross-origin throw"); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null new file mode 100644 index 0000000000..8e54b66c50 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null @@ -0,0 +1 @@ +var got = 'null'; \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null.headers b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null.headers new file mode 100644 index 0000000000..a17a9a3a12 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/null.headers @@ -0,0 +1 @@ +Content-Type: application/javascript diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-cross-origin.sub.any.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-cross-origin.sub.any.js new file mode 100644 index 0000000000..4fd8914856 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-cross-origin.sub.any.js @@ -0,0 +1,8 @@ +// META: global=dedicatedworker,sharedworker +// META: script=report-error-helper.js +const crossOrigin = "https://{{hosts[alt][]}}:{{ports[https][0]}}"; +runTest( + crossOrigin + "/workers/modules/resources/syntax-error.js", + false, + "NetworkError" +); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-helper.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-helper.js new file mode 100644 index 0000000000..7fc6d0dd64 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-helper.js @@ -0,0 +1,80 @@ +setup({ allow_uncaught_exception:true }); + +// For SyntaxError, the line in doImportScripts() is expected to be reported +// as `e.lineno` etc. below. +// doImportScripts() is introduced here to prevent the line number from being +// affected by changes in runTest(), use of setTimeout(), etc. +function doImportScripts(url) { + importScripts(url); +} + +const t0 = async_test("WorkerGlobalScope error event: error"); +const t1 = async_test("WorkerGlobalScope error event: message"); +const t2 = async_test("WorkerGlobalScope error event: filename"); +const t3 = async_test("WorkerGlobalScope error event: lineno"); + +function runTest(importScriptUrl, shouldUseSetTimeout, expected) { + self.addEventListener("error", e => { + if (expected === "NetworkError") { + t0.step_func_done(() => { + assert_equals(e.error.constructor, DOMException, + "e.error should be a DOMException") + assert_equals(e.error.name, "NetworkError"); + })(); + + t1.step_func_done(() => { + assert_not_equals(e.message, "Script error.", + "e.message should not be muted to 'Script error.'"); + })(); + + // filename, lineno etc. should NOT point to the location within + // `syntax-error.js` (otherwise parse errors to be muted are + // leaked to JavaScript). + // we expect they point to the caller of `importScripts()`, + // while this is not explicitly stated in the spec. + t2.step_func_done(() => { + assert_equals(e.filename, self.location.origin + + '/workers/interfaces/WorkerUtils/importScripts/report-error-helper.js'); + })(); + t3.step_func_done(() => { + assert_equals(e.lineno, 8); + })(); + // We don't check `e.colno` for now, because browsers set different + // `colno` values. + } else if (expected === "SyntaxError") { + t0.step_func_done(() => { + assert_equals(e.error.constructor, SyntaxError); + assert_equals(e.error.name, "SyntaxError"); + })(); + + t1.step_func_done(() => { + assert_not_equals(e.message, "Script error.", + "e.message should not be muted to 'Script error.'"); + })(); + + // filename, lineno etc. are expected to point to the location within + // `syntax-error.js` because it is same-origin, + // while this is not explicitly stated in the spec. + t2.step_func_done(() => { + assert_equals(e.filename, self.location.origin + + '/workers/modules/resources/syntax-error.js'); + })(); + t3.step_func_done(() => { + assert_equals(e.lineno, 1); + })(); + // We don't check `e.colno` for now, because browsers set different + // `colno` values. + } + + // Because importScripts() throws, we call done() here. + done(); + }); + + if (shouldUseSetTimeout) { + setTimeout( + () => doImportScripts(importScriptUrl), + 0); + } else { + doImportScripts(importScriptUrl); + } +} diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-redirect-to-cross-origin.sub.any.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-redirect-to-cross-origin.sub.any.js new file mode 100644 index 0000000000..2b9600973f --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-redirect-to-cross-origin.sub.any.js @@ -0,0 +1,9 @@ +// META: global=dedicatedworker,sharedworker +// META: script=report-error-helper.js +const crossOrigin = "https://{{hosts[alt][]}}:{{ports[https][0]}}"; +runTest( + "/common/redirect.py?location=" + crossOrigin + + "/workers/modules/resources/syntax-error.js", + false, + "NetworkError" +); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-same-origin.sub.any.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-same-origin.sub.any.js new file mode 100644 index 0000000000..f7de416e11 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-same-origin.sub.any.js @@ -0,0 +1,7 @@ +// META: global=dedicatedworker,sharedworker +// META: script=report-error-helper.js +runTest( + "/workers/modules/resources/syntax-error.js", + false, + "SyntaxError" +); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-cross-origin.sub.any.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-cross-origin.sub.any.js new file mode 100644 index 0000000000..a1bbef7bc4 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-cross-origin.sub.any.js @@ -0,0 +1,8 @@ +// META: global=dedicatedworker,sharedworker +// META: script=report-error-helper.js +const crossOrigin = "https://{{hosts[alt][]}}:{{ports[https][0]}}"; +runTest( + crossOrigin + "/workers/modules/resources/syntax-error.js", + true, + "NetworkError" +); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-redirect-to-cross-origin.sub.any.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-redirect-to-cross-origin.sub.any.js new file mode 100644 index 0000000000..2755b337d3 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-redirect-to-cross-origin.sub.any.js @@ -0,0 +1,9 @@ +// META: global=dedicatedworker,sharedworker +// META: script=report-error-helper.js +const crossOrigin = "https://{{hosts[alt][]}}:{{ports[https][0]}}"; +runTest( + "/common/redirect.py?location=" + crossOrigin + + "/workers/modules/resources/syntax-error.js", + true, + "NetworkError" +); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-same-origin.sub.any.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-same-origin.sub.any.js new file mode 100644 index 0000000000..c4f70ebec9 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/report-error-setTimeout-same-origin.sub.any.js @@ -0,0 +1,7 @@ +// META: global=dedicatedworker,sharedworker +// META: script=report-error-helper.js +runTest( + "/workers/modules/resources/syntax-error.js", + true, + "SyntaxError" +); diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined new file mode 100644 index 0000000000..f99ba4be74 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined @@ -0,0 +1 @@ +var got = 'undefined'; \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined.headers b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined.headers new file mode 100644 index 0000000000..a17a9a3a12 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/importScripts/undefined.headers @@ -0,0 +1 @@ +Content-Type: application/javascript diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.html new file mode 100644 index 0000000000..4c76e2b699 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.html @@ -0,0 +1,14 @@ + +navigator.appName + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.js new file mode 100644 index 0000000000..a5af348ef1 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/002.js @@ -0,0 +1 @@ +postMessage(navigator.appName); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.html new file mode 100644 index 0000000000..86ab5aee48 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.html @@ -0,0 +1,14 @@ + +navigator.appVersion + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.js new file mode 100644 index 0000000000..ff92f8aadb --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/003.js @@ -0,0 +1 @@ +postMessage(navigator.appVersion); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.html new file mode 100644 index 0000000000..93eee00957 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.html @@ -0,0 +1,14 @@ + +navigator.platform + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.js new file mode 100644 index 0000000000..c1b575e43c --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/004.js @@ -0,0 +1 @@ +postMessage(navigator.platform); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.html new file mode 100644 index 0000000000..ad2899e62e --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.html @@ -0,0 +1,14 @@ + +navigator.userAgent + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.js new file mode 100644 index 0000000000..d62252d39b --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/005.js @@ -0,0 +1 @@ +postMessage(navigator.userAgent); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.html new file mode 100644 index 0000000000..e0f7386af3 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.html @@ -0,0 +1,14 @@ + +navigator.onLine + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.js new file mode 100644 index 0000000000..325fd0fbde --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/006.js @@ -0,0 +1 @@ +postMessage(navigator.onLine); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.html new file mode 100644 index 0000000000..8f9d38dd85 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.html @@ -0,0 +1,14 @@ + +readonlyness of members of Navigator + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.js new file mode 100644 index 0000000000..d0879da908 --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/007.js @@ -0,0 +1,9 @@ +var log = []; +var neverEncounteredValue = "This is not the value you are looking for."; +for (x in navigator) { + // this should silently fail and not throw per webidl + navigator[x] = neverEncounteredValue; + if (navigator[x] === neverEncounteredValue) + log.push(x); +} +postMessage(log.join(', ')); \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.html b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.html new file mode 100644 index 0000000000..535ab3a7cb --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.html @@ -0,0 +1,14 @@ + +navigator.language + + +
+ \ No newline at end of file diff --git a/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.js b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.js new file mode 100644 index 0000000000..e94ba4dfcf --- /dev/null +++ b/testing/web-platform/tests/workers/interfaces/WorkerUtils/navigator/language.js @@ -0,0 +1 @@ +postMessage(navigator.language); \ No newline at end of file -- cgit v1.2.3