--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
@@ -24,17 +24,18 @@ add_task(async function testBrowserActio
await extension.startup();
let browser = await openPanel(extension, undefined, true);
async function checkSize(expected) {
let dims = await promiseContentDimensions(browser);
- is(dims.window.innerHeight, expected, `Panel window should be ${expected}px tall`);
+ Assert.lessOrEqual(Math.abs(dims.window.innerHeight - expected), 1,
+ `Panel window should be ${expected}px tall (was ${dims.window.innerHeight})`);
is(dims.body.clientHeight, dims.body.scrollHeight,
"Panel body should be tall enough to fit its contents");
// Tolerate if it is 1px too wide, as that may happen with the current resizing method.
ok(Math.abs(dims.window.innerWidth - expected) <= 1, `Panel window should be ${expected}px wide`);
is(dims.body.clientWidth, dims.body.scrollWidth,
"Panel body should be wide enough to fit its contents");
}
@@ -161,17 +162,17 @@ async function testPopupSize(standardsMo
let panelRect = panel.getBoundingClientRect();
if (arrowSide == "top") {
ok(panelRect.top, origPanelRect.top, "Panel has not moved downwards");
ok(panelRect.bottom >= origPanelRect.bottom, `Panel has not shrunk from original size (${panelRect.bottom} >= ${origPanelRect.bottom})`);
let screenBottom = browserWin.screen.availTop + browserWin.screen.availHeight;
let panelBottom = browserWin.mozInnerScreenY + panelRect.bottom;
- ok(panelBottom <= screenBottom, `Bottom of popup should be on-screen. (${panelBottom} <= ${screenBottom})`);
+ ok(Math.round(panelBottom) <= screenBottom, `Bottom of popup should be on-screen. (${panelBottom} <= ${screenBottom})`);
} else {
ok(panelRect.bottom, origPanelRect.bottom, "Panel has not moved upwards");
ok(panelRect.top <= origPanelRect.top, `Panel has not shrunk from original size (${panelRect.top} <= ${origPanelRect.top})`);
let panelTop = browserWin.mozInnerScreenY + panelRect.top;
ok(panelTop >= browserWin.screen.availTop, `Top of popup should be on-screen. (${panelTop} >= ${browserWin.screen.availTop})`);
}
};
@@ -205,32 +206,32 @@ async function testPopupSize(standardsMo
dims = await alterContent(browser, setClass, "big");
let win = dims.window;
ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
is(win.innerWidth, innerWidth, "Window width should not change");
ok(win.innerHeight >= innerHeight, `Window height should increase (${win.innerHeight} >= ${innerHeight})`);
- is(win.scrollMaxY, 0, "Document should not be vertically scrollable");
+ Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
checkPanelPosition();
info("Increase body children's width and height. " +
"Expect them to wrap, and the frame to grow vertically rather than widen.");
dims = await alterContent(browser, setClass, "bigger");
win = dims.window;
ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
is(win.innerWidth, innerWidth, "Window width should not change");
ok(win.innerHeight >= innerHeight, `Window height should increase (${win.innerHeight} >= ${innerHeight})`);
- is(win.scrollMaxY, 0, "Document should not be vertically scrollable");
+ Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
checkPanelPosition();
info("Increase body height beyond the height of the screen. " +
"Expect the panel to grow to accommodate, but not larger than the height of the screen.");
dims = await alterContent(browser, setClass, "huge");
@@ -249,17 +250,17 @@ async function testPopupSize(standardsMo
info("Restore original styling. Expect original dimensions.");
dims = await alterContent(browser, setClass, "");
win = dims.window;
is(getHeight(), height, "Browser height should return to its original value");
is(win.innerWidth, innerWidth, "Window width should not change");
is(win.innerHeight, innerHeight, "Window height should return to its original value");
- is(win.scrollMaxY, 0, "Document should not be vertically scrollable");
+ Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
checkPanelPosition();
await closeBrowserAction(extension, browserWin);
await extension.unload();
}