Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Errors

/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
/* This test is based on
*/
"use strict";
requestLongerTimeout(2);
Services.scriptloader.loadSubScript(
this
);
Services.scriptloader.loadSubScript(
this
);
async function runOneTest(filename) {
function httpURL(sfilename) {
let chromeURL = getRootDirectory(gTestPath) + sfilename;
return chromeURL.replace(
);
}
const url = httpURL(filename);
const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
const { rect } = await SpecialPowers.spawn(
tab.linkedBrowser,
[],
async () => {
const container = content.document.getElementById("container");
// Get the area in the screen coords where the position:sticky element is.
let containerRect = container.getBoundingClientRect();
containerRect.x += content.window.mozInnerScreenX;
containerRect.y += content.window.mozInnerScreenY;
await content.wrappedJSObject.promiseApzFlushedRepaints();
await content.wrappedJSObject.waitUntilApzStable();
let w = {},
h = {};
SpecialPowers.DOMWindowUtils.getScrollbarSizes(
content.document.documentElement,
w,
h
);
// Reduce the scrollbar width from the sticky area.
containerRect.width -= w.value;
return {
rect: containerRect,
};
}
);
const reference = await getSnapshot({
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height,
});
await SpecialPowers.spawn(tab.linkedBrowser, [], async () => {
// start the toggling the position on a setInterval which triggers the bug
content.wrappedJSObject.doTest();
});
// have to try many times to capture the bug
for (let i = 0; i < 100; i++) {
let snapshot = await getSnapshot({
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height,
});
is(snapshot, reference, "should be same " + filename);
}
BrowserTestUtils.removeTab(tab);
}
add_task(async () => {
await runOneTest("helper_oopif_reconstruct.html");
await runOneTest("helper_oopif_reconstruct_nested.html");
});