зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1677689 - Make layout/base/tests/test_bug851485.html more reliable so it works with Fission too. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D97271
This commit is contained in:
Родитель
0419f83422
Коммит
4869b7ad1a
|
@ -100,7 +100,6 @@ support-files = bug851445_helper.html
|
||||||
[test_bug851485.html]
|
[test_bug851485.html]
|
||||||
skip-if =
|
skip-if =
|
||||||
toolkit == 'android' # Bug 1355821
|
toolkit == 'android' # Bug 1355821
|
||||||
fission # Hangs, undefined assertion name - got 4904, expected 500
|
|
||||||
[test_bug858459.html]
|
[test_bug858459.html]
|
||||||
skip-if = toolkit == 'android' # Bug 1355822
|
skip-if = toolkit == 'android' # Bug 1355822
|
||||||
[test_bug968148.html]
|
[test_bug968148.html]
|
||||||
|
|
|
@ -14,48 +14,50 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=851485
|
||||||
/** Test for Bug 851485 **/
|
/** Test for Bug 851485 **/
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
SimpleTest.requestFlakyTimeout("untriaged");
|
|
||||||
|
|
||||||
function delayedVerifyScroll(win) {
|
var testRunning = false;
|
||||||
ok(win.scrollY > 3000);
|
async function runTest() {
|
||||||
SimpleTest.finish();
|
if (testRunning) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
testRunning = true;
|
||||||
|
|
||||||
function verifyScroll(event) {
|
var e = document.getElementsByTagName('iframe')[0];
|
||||||
var win = event.target.defaultView;
|
var win = e.contentWindow;
|
||||||
win.onscroll = "";
|
|
||||||
setTimeout(function(){delayedVerifyScroll(win)},500)
|
|
||||||
}
|
|
||||||
|
|
||||||
function clickLink(link,win) {
|
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;
|
win.document.body.offsetHeight;
|
||||||
synthesizeMouseAtCenter(link, {type: "mousedown"}, win);
|
synthesizeMouseAtCenter(link, {type: "mousedown"}, win);
|
||||||
synthesizeMouseAtCenter(link, {type: "mouseup"}, win);
|
synthesizeMouseAtCenter(link, {type: "mouseup"}, win);
|
||||||
sendMouseEvent({type: "click"}, link, win);
|
sendMouseEvent({type: "click"}, link, win);
|
||||||
}
|
await p;
|
||||||
|
|
||||||
function verifyAfterLoad() {
|
ok(win.scrollY > 3000, "Scrolling after load works.");
|
||||||
var e = document.getElementsByTagName('iframe')[0];
|
|
||||||
var win = e.contentWindow;
|
|
||||||
if (win.location.hash != '') {
|
|
||||||
is(win.scrollY,500);
|
|
||||||
var link = win.document.getElementsByTagName('a')[0];
|
|
||||||
win.onscroll = verifyScroll;
|
|
||||||
clickLink(link,win);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function runTest() {
|
SimpleTest.finish();
|
||||||
var e = document.getElementsByTagName('iframe')[0];
|
|
||||||
var win = e.contentWindow;
|
|
||||||
if (win.location.hash != '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
win.location.hash='#anchor'
|
|
||||||
win.scrollTo(0,500);
|
|
||||||
e.setAttribute("onload","verifyAfterLoad()");
|
|
||||||
win.location.reload()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче