summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/test_bug851485.html
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 /layout/base/tests/test_bug851485.html
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 'layout/base/tests/test_bug851485.html')
-rw-r--r--layout/base/tests/test_bug851485.html86
1 files changed, 86 insertions, 0 deletions
diff --git a/layout/base/tests/test_bug851485.html b/layout/base/tests/test_bug851485.html
new file mode 100644
index 0000000000..a5f3488189
--- /dev/null
+++ b/layout/base/tests/test_bug851485.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=851485
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 851485</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 851485 **/
+
+SimpleTest.waitForExplicitFinish();
+
+var testRunning = false;
+async function runTest() {
+ if (testRunning) {
+ return;
+ }
+ testRunning = true;
+
+ var e = document.getElementsByTagName('iframe')[0];
+ var win = e.contentWindow;
+
+ var p = new Promise((r) => { win.addEventListener("hashchange", r, { once: true }); });
+ win.location.hash = '#anchor';
+ await p;
+
+ win.scrollTo(0, 500);
+
+ p = new Promise((r) => { e.addEventListener("load", r, { once: true }); });
+ win.location.reload();
+ await p;
+
+ is(win.location.hash, "#anchor", "We set the location's hash to 'anchor'");
+ // Allow a half pixel difference because the scroll position is aligned with
+ // screen pixels instead of CSS pixels (bug 1774315).
+ isfuzzy(win.scrollY, 500, 0.5, "Reloading keeps scroll position");
+
+ var link = win.document.getElementsByTagName('a')[0];
+ var anchor = win.document.getElementsByTagName('a')[1];
+ p = new Promise((r) => {
+ var observer = new IntersectionObserver((entries) => {
+ info("IntersectionObserver: entering callback")
+ if (entries.some((entry) => entry.isIntersecting)) {
+ info("IntersectionObserver: some entry isIntersecting; disconnecting")
+ observer.disconnect();
+ r();
+ }
+ });
+ observer.observe(anchor);
+ });
+ win.document.body.offsetHeight;
+ synthesizeMouseAtCenter(link, {type: "mousedown"}, win);
+ synthesizeMouseAtCenter(link, {type: "mouseup"}, win);
+ info("Sending click")
+ sendMouseEvent({type: "click"}, link, win);
+ await p;
+ let actualScroll = win.scrollY;
+ info("Promise resolved (for IntersectionObserver). win.scrollY is " +
+ actualScroll);
+
+ ok(actualScroll > 3000, "Scrolling after load works.");
+
+ SimpleTest.finish();
+}
+
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=851485">Mozilla Bug 851485</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+</div>
+<pre id="test">
+</pre>
+<iframe src="file_bug842853.html"></iframe>
+<script>
+
+</script>
+</body>
+</html>