summaryrefslogtreecommitdiffstats
path: root/testing/talos/talos/tests/perf-reftest-singletons/link-style-cache-1.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/talos/talos/tests/perf-reftest-singletons/link-style-cache-1.html')
-rw-r--r--testing/talos/talos/tests/perf-reftest-singletons/link-style-cache-1.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/testing/talos/talos/tests/perf-reftest-singletons/link-style-cache-1.html b/testing/talos/talos/tests/perf-reftest-singletons/link-style-cache-1.html
new file mode 100644
index 0000000000..80351b420a
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest-singletons/link-style-cache-1.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<script src="util.js"></script>
+<body>
+<script>
+const styles = `:host { background: red; width: 100px; height: 100px; display: block; }`.repeat(3000);
+const blob = URL.createObjectURL(new Blob([styles], { type: 'text/css' }));
+customElements.define("custom-element", class CustomElement extends HTMLElement {
+ connectedCallback() {
+ this.attachShadow({ mode: "open" });
+ const link = document.createElement("link");
+ link.rel = "stylesheet";
+ link.href = blob;
+ this.shadowRoot.appendChild(link);
+ }
+});
+
+perf_start();
+
+for (let i = 0; i < 1000; ++i)
+ document.body.appendChild(document.createElement("custom-element"));
+
+onload = function() {
+ flush_layout(document.body);
+ perf_finish();
+};
+</script>