summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/tentative
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/performance-timeline/tentative
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/performance-timeline/tentative')
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/detached-frame.html28
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-cross-origin-grandchild.sub.html32
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-same-origin-grandchild.sub.html32
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-one-cross-origin-child-one-same-origin-grandchild.sub.html37
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-one-remote-child.sub.html36
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-cross-origin-child.sub.html56
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-same-origin-grandchild.html37
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child.html37
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/include-frames-two-local-children.html56
-rw-r--r--testing/web-platform/tests/performance-timeline/tentative/performance-entry-source.html33
10 files changed, 384 insertions, 0 deletions
diff --git a/testing/web-platform/tests/performance-timeline/tentative/detached-frame.html b/testing/web-platform/tests/performance-timeline/tentative/detached-frame.html
new file mode 100644
index 0000000000..d5753dbcd7
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/detached-frame.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(async () => {
+ performance.clearResourceTimings()
+
+ // Create child iframe.
+ const childFrame = document.createElement('iframe')
+ childFrame.src = "../resources/child-frame.html"
+ document.body.appendChild(childFrame)
+
+ // wait until the child frame's onload event fired
+ await new Promise(r => childFrame.addEventListener("load", r));
+
+ const childWindow = childFrame.contentWindow;
+ // Detach the child frame
+ document.body.removeChild(childFrame);
+
+ const entries = childWindow.performance.getEntries(true);
+ const parent_entries = performance.getEntries(true);
+}, "GetEntries of a detached parent frame does not crash");
+</script>
+
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-cross-origin-grandchild.sub.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-cross-origin-grandchild.sub.html
new file mode 100644
index 0000000000..1886f040ec
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-cross-origin-grandchild.sub.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ // Create child iframe with an embedded frame that is same-origin with its parent but cross-origin with the current frame.
+ const crossOriginChildFrame = document.createElement('iframe')
+ crossOriginChildFrame.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/performance-timeline/resources/parent-frame-with-same-origin-child.html"
+ document.body.appendChild(crossOriginChildFrame)
+
+ // Listen for postMessage() from child frame.
+ window.addEventListener("message", e => {
+ // 0 entries for parent, 4 for child, 2 for grandchild.
+ assert_equals(e.data, 6)
+
+ const entries = performance.getEntries(true)
+
+ // 3 entries for parent, 0 for child, 0 for grandchild.
+ assert_equals(entries.length, 3)
+
+ resolve()
+ })
+ })
+}, "GetEntries of a Cross-Origin child frame with one Cross-Origin grandchild frame")
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-same-origin-grandchild.sub.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-same-origin-grandchild.sub.html
new file mode 100644
index 0000000000..16142ca953
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-from-child-same-origin-grandchild.sub.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ // Create child iframe with an embedded frame that is cross-origin with its parent but same-origin with the current frame.
+ const crossOriginChildFrame = document.createElement('iframe')
+ crossOriginChildFrame.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/performance-timeline/resources/parent-frame-with-cross-origin-child.sub.html"
+ document.body.appendChild(crossOriginChildFrame)
+
+ // Listen for postMessage() from child frame.
+ window.addEventListener("message", e => {
+ // 0 entries for parent, 4 for child, 0 for grandchild.
+ assert_equals(e.data, 4)
+
+ const entries = performance.getEntries(true)
+
+ // 3 entries for parent, 0 for child, 2 for grandchild.
+ assert_equals(entries.length, 5)
+
+ resolve()
+ })
+ })
+}, "GetEntries of a Cross-Origin child frame with one Same-Origin grandchild frame")
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-cross-origin-child-one-same-origin-grandchild.sub.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-cross-origin-child-one-same-origin-grandchild.sub.html
new file mode 100644
index 0000000000..8aa5df778f
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-cross-origin-child-one-same-origin-grandchild.sub.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ // Create child iframe with an embedded frame that is cross-origin with its parent, but same-origin with the current frame.
+ const crossOriginChildFrame = document.createElement('iframe')
+ crossOriginChildFrame.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/performance-timeline/resources/parent-frame-with-cross-origin-child.sub.html"
+ document.body.appendChild(crossOriginChildFrame)
+
+ // Listen for postMessage() from grandchild frame.
+ window.addEventListener("message", () => {
+ const entries = performance.getEntries(true)
+ const navigationEntries = performance.getEntriesByType("navigation", true)
+ const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
+
+ // 3 entries for parent, 0 for child, 2 for grandchild.
+ assert_equals(entries.length, 5)
+
+ // 1 entry for parent, 1 for grandchild.
+ assert_equals(navigationEntries.length, 2)
+
+ // 1 entry for grandchild.
+ assert_equals(markedEntries.length, 1)
+
+ resolve()
+ })
+ })
+}, "GetEntries of a parent Frame with one Cross-Origin child and one Same-Origin grandchild")
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-remote-child.sub.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-remote-child.sub.html
new file mode 100644
index 0000000000..61e7a1f648
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-remote-child.sub.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ // Create Remote child iframe.
+ const childFrame = document.createElement('iframe')
+ childFrame.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/resources/child-frame.html"
+ document.body.appendChild(childFrame)
+
+ childFrame.addEventListener("load", () => {
+ const entries = performance.getEntries(true)
+ const navigationEntries = performance.getEntriesByType("navigation", true)
+ const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
+
+ // 3 entries for parent, 0 for child.
+ assert_equals(entries.length, 3)
+
+ // 1 entry for parent.
+ assert_equals(navigationEntries.length, 1)
+
+ // 0 entries.
+ assert_equals(markedEntries.length, 0)
+
+ resolve()
+ })
+ })
+}, "GetEntries of a parent Frame with one Cross-Origin child")
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-cross-origin-child.sub.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-cross-origin-child.sub.html
new file mode 100644
index 0000000000..b20bde93ee
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-cross-origin-child.sub.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ let sameOriginFrameLoaded = false
+ let crossOriginFrameLoaded = false
+
+ // Create first child iframe.
+ const sameOriginChildFrame = document.createElement('iframe')
+ sameOriginChildFrame.src = "../resources/child-frame.html"
+ document.body.appendChild(sameOriginChildFrame)
+
+ sameOriginChildFrame.addEventListener("load", () => {
+ sameOriginFrameLoaded = true
+ if (crossOriginFrameLoaded)
+ verifyPerformanceEntries()
+ })
+
+ // Create second child iframe.
+ const crossOriginChildFrame = document.createElement('iframe')
+ crossOriginChildFrame.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/resources/child-frame.html"
+ document.body.appendChild(crossOriginChildFrame)
+
+ crossOriginChildFrame.addEventListener("load", () => {
+ crossOriginFrameLoaded = true
+ if (sameOriginFrameLoaded)
+ verifyPerformanceEntries()
+ })
+
+ function verifyPerformanceEntries() {
+ const entries = performance.getEntries(true)
+ const navigationEntries = performance.getEntriesByType("navigation", true)
+ const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
+
+ // 4 entries for parent, 2 for local child, 0 for remote child.
+ assert_equals(entries.length, 6)
+
+ // 1 entry for parent, 1 for local child.
+ assert_equals(navigationEntries.length, 2)
+
+ // 1 entry for local child.
+ assert_equals(markedEntries.length, 1)
+
+ resolve()
+ }
+ })
+}, "GetEntries of a parent Frame with one Cross-Origin child and one Same-Origin child")
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-same-origin-grandchild.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-same-origin-grandchild.html
new file mode 100644
index 0000000000..10ccea3da8
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child-one-same-origin-grandchild.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ // Create child iframe with an embedded frame that is cross-origin with its parent, but same-origin with the current frame.
+ const childFrame = document.createElement('iframe')
+ childFrame.src = "../resources/parent-frame-with-cross-origin-child.sub.html"
+ document.body.appendChild(childFrame)
+
+ // Listen for postMessage() from grandchild frame.
+ window.addEventListener("message", () => {
+ const entries = performance.getEntries(true)
+ const navigationEntries = performance.getEntriesByType("navigation", true)
+ const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
+
+ // 4 entries for parent, 3 for child, 2 for grandchild.
+ assert_equals(entries.length, 9)
+
+ // 1 entry for parent, 1 for child, 1 for grandchild.
+ assert_equals(navigationEntries.length, 3)
+
+ // 1 entry for child, 1 for grandchild.
+ assert_equals(markedEntries.length, 2)
+
+ resolve()
+ })
+ })
+}, "GetEntries of a parent Frame with one Same-Origin child and one Same-Origin grandchild")
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child.html
new file mode 100644
index 0000000000..73dc417fe6
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-same-origin-child.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ // Create child iframe.
+ const childFrame = document.createElement('iframe')
+ childFrame.src = "../resources/child-frame.html"
+ document.body.appendChild(childFrame)
+
+ // On-load event handler to assert size of entries.
+ childFrame.addEventListener("load", () => {
+ const entries = performance.getEntries(true)
+ const navigationEntries = performance.getEntriesByType("navigation", true)
+ const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
+
+ // 3 entries for parent, 2 for child.
+ assert_equals(entries.length, 5)
+
+ // 1 entry for parent, 1 for child.
+ assert_equals(navigationEntries.length, 2)
+
+ // 1 entry for child.
+ assert_equals(markedEntries.length, 1)
+
+ resolve()
+ })
+ })
+}, "GetEntries of a parent Frame with one Same-Origin child");
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/include-frames-two-local-children.html b/testing/web-platform/tests/performance-timeline/tentative/include-frames-two-local-children.html
new file mode 100644
index 0000000000..01d4844522
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/include-frames-two-local-children.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ performance.clearResourceTimings()
+
+ let childFrameOneLoaded = false
+ let childFrameTwoLoaded = false
+
+ // Create first child iframe.
+ const childFrameOne = document.createElement('iframe')
+ childFrameOne.src = "../resources/child-frame.html"
+ document.body.appendChild(childFrameOne)
+
+ childFrameOne.addEventListener("load", () => {
+ childFrameOneLoaded = true
+ if (childFrameTwoLoaded)
+ verifyPerformanceEntries()
+ })
+
+ // Create second child iframe.
+ const childFrameTwo = document.createElement('iframe')
+ childFrameTwo.src = "../resources/child-frame.html"
+ document.body.appendChild(childFrameTwo)
+
+ childFrameTwo.addEventListener("load", () => {
+ childFrameTwoLoaded = true
+ if (childFrameOneLoaded)
+ verifyPerformanceEntries()
+ })
+
+ function verifyPerformanceEntries() {
+ const entries = performance.getEntries(true)
+ const navigationEntries = performance.getEntriesByType("navigation", true)
+ const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
+
+ // 4 entries for parent, 2 for each child
+ assert_equals(entries.length, 8)
+
+ // 1 entry for parent, 1 for each child.
+ assert_equals(navigationEntries.length, 3)
+
+ // 1 entry for each child.
+ assert_equals(markedEntries.length, 2)
+
+ resolve()
+ }
+ })
+}, "GetEntries of a parent Frame with two Same-Origin children")
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/performance-timeline/tentative/performance-entry-source.html b/testing/web-platform/tests/performance-timeline/tentative/performance-entry-source.html
new file mode 100644
index 0000000000..5e51ddbbe4
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/tentative/performance-entry-source.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+</body>
+<script>
+promise_test(() => {
+ return new Promise(resolve => {
+ const navigationEntries = performance.getEntriesByType("navigation")
+ const parentEntry = navigationEntries[0]
+
+ // Parent NavigationTiming source is current window.
+ assert_equals(parentEntry.source, window)
+
+ // Create child iframe.
+ const childFrame = document.createElement('iframe')
+ childFrame.src = "../resources/child-frame.html"
+ document.body.appendChild(childFrame)
+
+ childFrame.addEventListener('load', () => {
+ const markedEntries = performance.getEntriesByName("entry-name", undefined, true)
+ const childEntry = markedEntries[0]
+
+ // Child PerformanceMark source is the child's Window.
+ assert_equals(childEntry.source, childFrame.contentWindow)
+
+ resolve()
+ })
+ })
+}, "PerformanceEntry source is equal to its respective Window")
+</script> \ No newline at end of file