summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/measure-memory/resources/worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/measure-memory/resources/worker.js')
-rw-r--r--testing/web-platform/tests/measure-memory/resources/worker.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/web-platform/tests/measure-memory/resources/worker.js b/testing/web-platform/tests/measure-memory/resources/worker.js
new file mode 100644
index 0000000000..000df12729
--- /dev/null
+++ b/testing/web-platform/tests/measure-memory/resources/worker.js
@@ -0,0 +1,9 @@
+self.onmessage = function(message) {
+ const length = message.data.bytes;
+ self.root = new Uint8Array(length);
+ // Set some elements to disable potential copy-on-write optimizations.
+ for (let i = 0; i < length; i += 256) {
+ self.root[i] = 1;
+ }
+ postMessage(self.location.href);
+}