From f0b727eac28244e0fa24a6107dee44e83ad0f561 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Tue, 20 Feb 2018 13:30:16 -0600 Subject: Bug 1430173 - Add Timer Rounding tests backported from -central to -esr. r=baku, a=RyanVM MozReview-Commit-ID: Jl4WZAamgrI --HG-- extra : transplant_source : E%DC%91lU%1C%A4l%2C%C8%23PCz%EB%F2%81%25%1F%90 --- dom/tests/mochitest/general/mochitest.ini | 3 + .../general/test_reduce_time_precision.html | 143 +++++++++++++++++++++ dom/tests/mochitest/general/worker_child.js | 28 ++++ dom/tests/mochitest/general/worker_grandchild.js | 10 ++ 4 files changed, 184 insertions(+) mode change 100644 => 100755 dom/tests/mochitest/general/mochitest.ini create mode 100755 dom/tests/mochitest/general/test_reduce_time_precision.html create mode 100755 dom/tests/mochitest/general/worker_child.js create mode 100755 dom/tests/mochitest/general/worker_grandchild.js (limited to 'dom/tests/mochitest') diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini old mode 100644 new mode 100755 index d59527801..d00ea1d4b --- a/dom/tests/mochitest/general/mochitest.ini +++ b/dom/tests/mochitest/general/mochitest.ini @@ -43,6 +43,8 @@ support-files = frameStoragePrevented.html frameStorageChrome.html frameStorageNullprincipal.sjs + worker_child.js + worker_grandchild.js workerStorageAllowed.js workerStoragePrevented.js storagePermissionsUtils.js @@ -108,6 +110,7 @@ support-files = test_offsets.js [test_picture_mutations.html] [test_pointerPreserves3D.html] [test_pointerPreserves3DClip.html] +[test_reduce_time_precision.html] [test_resource_timing.html] [test_resource_timing_cross_origin.html] [test_resource_timing_frameset.html] diff --git a/dom/tests/mochitest/general/test_reduce_time_precision.html b/dom/tests/mochitest/general/test_reduce_time_precision.html new file mode 100755 index 000000000..6f149f28d --- /dev/null +++ b/dom/tests/mochitest/general/test_reduce_time_precision.html @@ -0,0 +1,143 @@ + + + + + + Test for Tor Bug 1517 and Mozilla Bug 1424341 + + + + + +Tor Bug 1517 +Mozilla Bug 1424341 + + + + + + + + + + diff --git a/dom/tests/mochitest/general/worker_child.js b/dom/tests/mochitest/general/worker_child.js new file mode 100755 index 000000000..fa340fc65 --- /dev/null +++ b/dom/tests/mochitest/general/worker_child.js @@ -0,0 +1,28 @@ +let timeStampCodes; +let worker = new Worker("worker_grandchild.js"); + +function listenToParent(event) { + self.removeEventListener("message", listenToParent); + timeStampCodes = event.data; + + let timeStamps = []; + for (let timeStampCode of timeStampCodes) { + timeStamps.push(eval(timeStampCode)); + } + // Send the timeStamps to the parent. + postMessage(timeStamps); + + // Tell the grandchild to start. + worker.postMessage(timeStampCodes); +} + +// The worker grandchild will send results back. +function listenToChild(event) { + worker.removeEventListener("message", listenToChild); + // Pass the results to the parent. + postMessage(event.data); + worker.terminate(); +} + +worker.addEventListener("message", listenToChild); +self.addEventListener("message", listenToParent); diff --git a/dom/tests/mochitest/general/worker_grandchild.js b/dom/tests/mochitest/general/worker_grandchild.js new file mode 100755 index 000000000..cd21508b2 --- /dev/null +++ b/dom/tests/mochitest/general/worker_grandchild.js @@ -0,0 +1,10 @@ +self.addEventListener("message", function(event) { + let timeStampCodes = event.data; + + let timeStamps = []; + for (let timeStampCode of timeStampCodes) { + timeStamps.push(eval(timeStampCode)); + } + // Send the timeStamps to the parent. + postMessage(timeStamps); +}); -- cgit v1.2.3