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>
<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>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1369627">Mozilla Bug 1369627</a>
<p id="display"></p>
<div id="content">
</div>
<pre id="test">
</pre>
<script>
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");
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.
// 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>