diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/workers/support | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/workers/support')
12 files changed, 152 insertions, 0 deletions
diff --git a/testing/web-platform/tests/workers/support/ErrorEvent-error.js b/testing/web-platform/tests/workers/support/ErrorEvent-error.js new file mode 100644 index 000000000..930b54c0d --- /dev/null +++ b/testing/web-platform/tests/workers/support/ErrorEvent-error.js @@ -0,0 +1,9 @@ +onerror = function(message, location, line, col, error) { + postMessage({ source: "onerror", value: error }); +} + +addEventListener("error", function(e) { + postMessage({ source: "event listener", value: e.error }); +}); + +throw "hello"; diff --git a/testing/web-platform/tests/workers/support/ErrorEvent.js b/testing/web-platform/tests/workers/support/ErrorEvent.js new file mode 100644 index 000000000..22ea6d4fb --- /dev/null +++ b/testing/web-platform/tests/workers/support/ErrorEvent.js @@ -0,0 +1,10 @@ +onmessage = function(evt) +{ + throw(new Error(evt.data)); +} + +onerror = function(message, location, line, col) +{ + postMessage( {"message": message, "filename": location, "lineno": line, "colno": col} ); + return false; // "not handled" so the error propagates up to the Worker object +} diff --git a/testing/web-platform/tests/workers/support/ImportScripts.js b/testing/web-platform/tests/workers/support/ImportScripts.js new file mode 100644 index 000000000..7f2a2bcb5 --- /dev/null +++ b/testing/web-platform/tests/workers/support/ImportScripts.js @@ -0,0 +1,9 @@ +try +{ + importScripts("WorkerBasic.js"); +} +catch(ex) +{ + result = "Fail"; + postMessage(result); +} diff --git a/testing/web-platform/tests/workers/support/ImportScriptsNetworkErr.js b/testing/web-platform/tests/workers/support/ImportScriptsNetworkErr.js new file mode 100644 index 000000000..8179c8b10 --- /dev/null +++ b/testing/web-platform/tests/workers/support/ImportScriptsNetworkErr.js @@ -0,0 +1,15 @@ +var result = "Fail"; + +try +{ + importScripts("NonExistentFile.js"); +} +catch(ex) +{ + if (ex.code != null && ex.code == ex.NETWORK_ERR) + { + result = "Pass"; + } +} + +postMessage(result);
\ No newline at end of file diff --git a/testing/web-platform/tests/workers/support/Timer.js b/testing/web-platform/tests/workers/support/Timer.js new file mode 100644 index 000000000..a86a224db --- /dev/null +++ b/testing/web-platform/tests/workers/support/Timer.js @@ -0,0 +1,50 @@ +var count = 0; +var id; + +onmessage = function(evt) +{ + try + { + switch(evt.data) + { + case "TimeoutHandler": + count = 0; + id = setTimeout("TimeoutHandler()", 10); + postMessage('hello'); + break; + case "IntervalHandler": + count = 0; + id = setInterval("IntervalHandler()", 10); + postMessage('hello'); + break; + } + } + catch(ex) + { + postMessage("Fail"); + } +} + +function TimeoutHandler() +{ + count++; + postMessage("worker"); + + id = setTimeout("TimeoutHandler()", 10); + + if (count >= 2) + { + clearTimeout(id); + } +} + +function IntervalHandler() +{ + count++; + postMessage("worker"); + + if (count >= 2) + { + clearInterval(id); + } +} diff --git a/testing/web-platform/tests/workers/support/WorkerBasic.js b/testing/web-platform/tests/workers/support/WorkerBasic.js new file mode 100644 index 000000000..6bb6d32b1 --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerBasic.js @@ -0,0 +1,7 @@ +var result = "Fail"; + +onmessage = function(evt) +{ + result = "Pass"; + postMessage(result); +}
\ No newline at end of file diff --git a/testing/web-platform/tests/workers/support/WorkerClose.js b/testing/web-platform/tests/workers/support/WorkerClose.js new file mode 100644 index 000000000..81f99993d --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerClose.js @@ -0,0 +1,5 @@ +onmessage = function(evt) +{ + postMessage(evt.data); + self.close(); +}
\ No newline at end of file diff --git a/testing/web-platform/tests/workers/support/WorkerDataCloneErr.js b/testing/web-platform/tests/workers/support/WorkerDataCloneErr.js new file mode 100644 index 000000000..b7e8b0ae1 --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerDataCloneErr.js @@ -0,0 +1,15 @@ +var result = "Fail"; + +try +{ + postMessage(navigator); +} +catch(ex) +{ + if(ex.code != null && ex.code == ex.DATA_CLONE_ERR) + { + result = "Pass"; + } +} + +postMessage(result);
\ No newline at end of file diff --git a/testing/web-platform/tests/workers/support/WorkerLocation.js b/testing/web-platform/tests/workers/support/WorkerLocation.js new file mode 100644 index 000000000..a57e2fc66 --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerLocation.js @@ -0,0 +1,12 @@ +var obj = new Object(); +obj.location = location.toString(); +obj.href = location.href; +obj.protocol = location.protocol; +obj.host = location.host; +obj.hostname = location.hostname; +obj.port = location.port; +obj.pathname = location.pathname; +obj.search = location.search; +obj.hash = location.hash; + +postMessage(obj); diff --git a/testing/web-platform/tests/workers/support/WorkerNavigator.js b/testing/web-platform/tests/workers/support/WorkerNavigator.js new file mode 100644 index 000000000..084e45b24 --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerNavigator.js @@ -0,0 +1,8 @@ +var obj = new Object(); +obj.appName = navigator.appName; +obj.appVersion = navigator.appVersion; +obj.platform = navigator.platform; +obj.userAgent = navigator.userAgent; +obj.onLine = navigator.onLine; + +postMessage(obj); diff --git a/testing/web-platform/tests/workers/support/WorkerTerminate.js b/testing/web-platform/tests/workers/support/WorkerTerminate.js new file mode 100644 index 000000000..7c99e7ec5 --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerTerminate.js @@ -0,0 +1,10 @@ +onmessage = function(evt) +{ + for (var i=0; true; i++) + { + if (i%1000 == 0) + { + postMessage(i); + } + } +} diff --git a/testing/web-platform/tests/workers/support/WorkerText.txt b/testing/web-platform/tests/workers/support/WorkerText.txt new file mode 100644 index 000000000..e4eeb5391 --- /dev/null +++ b/testing/web-platform/tests/workers/support/WorkerText.txt @@ -0,0 +1,2 @@ +var result = "Pass"; +postMessage(result); |