summaryrefslogtreecommitdiffstats
path: root/dom/events/test/test_bug1412775.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/events/test/test_bug1412775.xhtml
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/events/test/test_bug1412775.xhtml')
-rw-r--r--dom/events/test/test_bug1412775.xhtml66
1 files changed, 66 insertions, 0 deletions
diff --git a/dom/events/test/test_bug1412775.xhtml b/dom/events/test/test_bug1412775.xhtml
new file mode 100644
index 0000000000..3146a489f1
--- /dev/null
+++ b/dom/events/test/test_bug1412775.xhtml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1412775
+-->
+<window title="Mozilla Bug 1412775"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="init()">
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+ <script src="chrome://mochikit/content/chrome-harness.js"></script>
+
+ <!-- test code goes here -->
+ <script type="application/javascript">
+ <![CDATA[
+
+ /** Test for Bug 1412775 **/
+ var win;
+ function init() {
+ SimpleTest.waitForExplicitFinish();
+ win = window.browsingContext.topChromeWindow.open("window_bug1412775.xhtml", "_new", "chrome");
+ win.onload = function() {
+ var b = win.document.getElementById("browser");
+ var d = b.contentWindow.document;
+ var e = new d.defaultView.Event("foo");
+ var didCallChromeSide = false;
+ var didCallContentSide = false;
+ /* eslint-disable-next-line no-shadow */
+ b.addEventListener("foo", function(e) {
+ didCallChromeSide = true;
+ var path = e.composedPath();
+ var mm = d.defaultView.docShell.messageManager;
+ is(path.length, 5, "Should have 5 items in composedPath in chrome.");
+ is(path[0], mm, "BrowserChildGlobal is the chrome handler.");
+ is(path[1], b, "browser element should be in the path.");
+ is(path[2], b.parentNode, "window element should be in the path.");
+ is(path[3], win.document, "Document object should be in the path.");
+ is(path[4], win, "Window object should be in the path.");
+ }, true, true);
+ /* eslint-disable-next-line no-shadow */
+ d.addEventListener("foo", function(e) {
+ didCallContentSide = true;;
+ var path = e.composedPath();
+ is(path.length, 4, "Should have 4 items in composedPath in content.");
+ is(path[0], d.body, "body element should be in the path.");
+ is(path[1], d.documentElement, "html element should be in the path.");
+ is(path[2], d, "Document object should be in the path.");
+ is(path[3], d.defaultView, "Window object should be in the path.");
+ }, true, true);
+ d.body.dispatchEvent(e);
+ ok(didCallChromeSide, "didCallChromeSide");
+ ok(didCallContentSide, "didCallContentSide");
+ win.close();
+ SimpleTest.finish();
+ }
+ }
+
+ ]]>
+ </script>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1412775"
+ target="_blank">Mozilla Bug 1412775</a>
+ </body>
+</window>