summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/leaktests/window-frames.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/shadow-dom/leaktests/window-frames.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/leaktests/window-frames.html')
-rw-r--r--testing/web-platform/tests/shadow-dom/leaktests/window-frames.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/web-platform/tests/shadow-dom/leaktests/window-frames.html b/testing/web-platform/tests/shadow-dom/leaktests/window-frames.html
new file mode 100644
index 0000000000..5ba2531ff2
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/leaktests/window-frames.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name='author' title='Google' href='http://www.google.com'>
+<meta name='assert' content='Shadow DOM should not leak via window.frames.'>
+<link rel='help' href='https://w3c.github.io/webcomponents/spec/shadow/'>
+<script src='/resources/testharness.js'></script>
+<script src='/resources/testharnessreport.js'></script>
+</head>
+<body>
+<div id='log'></div>
+<iframe src='about:blank' name='mainFrame1'></iframe>
+<div id='host-open'></div>
+<div id='host-closed'></div>
+</body>
+<script>
+'use strict';
+
+var host_open = document.getElementById('host-open');
+var root_open = host_open.attachShadow({mode: 'open'});
+root_open.innerHTML = '<iframe src="about:blank" name="shadowFrame1"></iframe>';
+
+var host_closed = document.getElementById('host-closed');
+var root_closed = host_closed.attachShadow({mode: 'closed'});
+root_closed.innerHTML = '<iframe src="about:blank" name="shadowFrame2"></iframe>';
+
+test(() => {
+ assert_equals(window.frames.length, 1, 'window.frames should return only frames in document.');
+ assert_equals(window.frames[0].name, 'mainFrame1', 'window.frames[0] should be mainFrame1.');
+ assert_equals(window.frames['mainFrame1'], window.frames[0], 'window.frames[\'mainFrame1\'] should be equal to mainFrame1.');
+ assert_equals(window.frames['shadowFrame1'], undefined, 'shadowFrame1 should not leak.');
+ assert_equals(window.frames['shadowFrame2'], undefined, 'shadowFrame2 should not leak.');
+
+}, 'window.frames should not leak frames in Shadow DOM.');
+</script>
+</html>