зеркало из https://github.com/mozilla/gecko-dev.git
85 строки
2.2 KiB
HTML
85 строки
2.2 KiB
HTML
<!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) => {
|
|
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>
|