summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/po-resource.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/performance-timeline/po-resource.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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/performance-timeline/po-resource.html')
-rw-r--r--testing/web-platform/tests/performance-timeline/po-resource.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/performance-timeline/po-resource.html b/testing/web-platform/tests/performance-timeline/po-resource.html
new file mode 100644
index 000000000..00c173eea
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/po-resource.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<meta charset=utf-8>
+<title>PerformanceObservers: resource</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="performanceobservers.js"></script>
+<h1>PerformanceObservers: resource</h1>
+<p>
+New resources will <a href="https://w3c.github.io/performance-timeline/#dfn-queue-a-performanceentry">queue a PerformanceEntry</a>.
+</p>
+<div id="log"></div>
+<script>
+ async_test(function (t) {
+ function path(pathname) {
+ var filename = pathname.substring(pathname.lastIndexOf('/')+1);
+ return pathname.substring(0, pathname.length - filename.length);
+ }
+ var gUniqueCounter = 0;
+ function generateUniqueValues() {
+ return Date.now() + "-" + (++gUniqueCounter);
+ }
+ var stored_entries = [];
+ var img_location = document.location.origin + path(document.location.pathname)
+ + "resources/square.png?random=";
+ var img1 = img_location + generateUniqueValues();
+ var img2 = img_location + generateUniqueValues();
+ var observer = new PerformanceObserver(
+ t.step_func(function (entryList, obs) {
+ stored_entries =
+ stored_entries.concat(entryList.getEntriesByType("resource"));
+ if (stored_entries.length >= 2) {
+ checkEntries(stored_entries,
+ [{ entryType: "resource", name: img1},
+ { entryType: "resource", name: img2}]);
+ observer.disconnect();
+ t.done();
+ }
+ })
+ );
+ observer.observe({entryTypes: ["resource"]});
+ var img = document.createElement("img");
+ img.src = img1;
+ document.body.appendChild(img);
+ img = document.createElement("img");
+ img.src = img2;
+ document.body.appendChild(img);
+ }, "resource entries are observable");
+</script>