summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/test_bug851485.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/base/tests/test_bug851485.html
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.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.html78
1 files changed, 78 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..161ee5abc8
--- /dev/null
+++ b/layout/base/tests/test_bug851485.html
@@ -0,0 +1,78 @@
+<!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'");
+ is(win.scrollY, 500, "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) => {
+ if (entries.some((entry) => entry.isIntersecting)) {
+ observer.disconnect();
+ r();
+ }
+ });
+ observer.observe(anchor);
+ });
+ win.document.body.offsetHeight;
+ synthesizeMouseAtCenter(link, {type: "mousedown"}, win);
+ synthesizeMouseAtCenter(link, {type: "mouseup"}, win);
+ sendMouseEvent({type: "click"}, link, win);
+ await p;
+
+ ok(win.scrollY > 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>