Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

  • This test gets skipped with pattern: os == 'android' OR os == 'linux' && os_version == '22.04' && arch == 'x86_64' && display == 'wayland' OR os == 'linux' && os_version == '24.04' && arch == 'x86_64'
  • Manifest: dom/tests/mochitest/general/mochitest.toml
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1369627</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"/>
</head>
<body>
<p id="display"></p>
<div id="content">
</div>
<pre id="test">
</pre>
<script>
/** Test for Bug 1369627 */
add_task(async function resizeby() {
await SimpleTest.promiseFocus();
const popup = window.open("about:blank", "_blank", "width=500,height=500");
is(popup.document.location.href, "about:blank");
is(popup.document.readyState, "complete");
// This fails flakily, see bug 1974454
is(popup.innerHeight, 500, "starting height is 500");
is(popup.innerWidth, 500, "starting width in 500");
// When this test was written, it said that resizeBy can occur sync without a resize event.
// Since bug 543435, window.open can fire a resize event.
// So there can be up to two resize, we only care for the correct innerWidth.
const resizeByDone = new Promise(resolve => {
const checkResized = () => {
info(`Checking target width: ${popup.innerWidth} vs ${550}`);
if (popup.innerWidth == 550) {
popup.removeEventListener("resize", checkResized);
resolve();
}
}
popup.addEventListener("resize", checkResized);
checkResized();
});
popup.resizeBy(50, 0);
await resizeByDone;
is(popup.innerHeight, 500, "ending height is 500");
is(popup.innerWidth, 550, "ending width is 550");
popup.close();
});
</script>
</body>
</html>