tests: characterisation e2e for screen, popup geometry, iframe click origin and css-media hooks

This commit is contained in:
feder-cr committed 2026-11-21 20:52:05 +01:00
1 parent 5d84475d98
commit c6d3ded241
5 files changed
+434

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
"""A popup opened the way a page opens one, and what it reads of its own window.
Shared by `test_popup_geometry_is_the_declared_frame_e2e.py` and by the inner-size test of
`test_fingerprint_surface.py`: both need a popup (`window.open` with features, from a click) whose document may carry an
iframe of another site (so, under Fission, in another process), and both read the window geometry from inside it.
The popup is read with a CONDITION, not a pause: the reading is repeated (with the client's events being read between two
looks) until the caller's `ready` holds or 30 s have passed, and the last reading is returned either way, so the caller's
assertion names what was read when it never settled.
"""
from __future__ import annotations
from typing import Any, Callable, Dict, Optional
from _fission_frames import Sites, wait_frame
from _waits import wait_until
#: The scale at which the declared window frame is the one of `WINDOW_FRAME_BY_DPR[1.0]`: border 8, popup UI 72, default
#: position 4 (device pixels, and CSS pixels at 1.0). The screen is the one the other surface tests pin.
PIN = {"screen.width": 1920, "screen.height": 1080, "screen.dpr": 1.0}
#: Engine off: `zoom.stealth.fpp.hw_seed` 0 is a bare binary, which every hook of the geometry answers with Mozilla's own
#: path (`gfx::StealthEngineActive()`).
ENGINE_OFF = {"zoom.stealth.fpp.hw_seed": 0}
READ = """() => ({iw: innerWidth, ih: innerHeight, ow: outerWidth, oh: outerHeight,
sx: screenX, sy: screenY, mx: mozInnerScreenX, my: mozInnerScreenY})"""
def frame_of_the_declaration():
"""The window frame the core declares at scale 1.0: what the engine adds to a popup's inner size."""
from invisible_core.constants import WINDOW_FRAME_BY_DPR
return WINDOW_FRAME_BY_DPR[1.0]
def _plausible(reading: Dict[str, Any]) -> bool:
"""Every size of every window read is above 0: the window (and its frame, if any) has been laid out."""
return all(r["iw"] > 0 and r["ih"] > 0 and r["ow"] > 0 and r["oh"] > 0
for r in (reading["popup"], reading["frame"]) if r is not None)
def read_popup(binary: str, extra_prefs: Optional[Dict[str, Any]] = None, iframe: bool = False,
ready: Optional[Callable[[Dict[str, Any]], bool]] = None) -> Dict[str, Any]:
"""Open `window.open(url, 'p', 'width=500,height=400')` from a click and read it.
Returns `{"popup": {...}, "frame": {...} or None}` with `iw ih ow oh sx sy mx my` (innerWidth, innerHeight,
outerWidth, outerHeight, screenX, screenY, mozInnerScreenX, mozInnerScreenY) of the popup and, with `iframe`, of its
iframe (another site, 200x150). `ready(reading)` says when the reading has settled (default: every size above 0).
"""
from invisible_playwright import InvisiblePlaywright
with Sites() as s:
s.route("A", "/main", "<!doctype html><title>main</title><button id='open' onclick=\"window.open('%s', 'p', "
"'width=500,height=400')\">open</button>" % s.url("A", "/popup"))
frame_html = ("<iframe id='f' src='%s' style='position:absolute;left:0;top:0;width:200px;height:150px;border:0'>"
"</iframe>" % s.url("B", "/frame")) if iframe else ""
s.route("A", "/popup", "<!doctype html><title>popup</title>" + frame_html)
s.route("B", "/frame", "<!doctype html><title>frame</title>")
with InvisiblePlaywright(seed=42, pin=PIN, binary_path=binary, headless=True, humanize=False,
extra_prefs=extra_prefs) as browser:
page = browser.new_page()
page.goto(s.url("A", "/main"), wait_until="load", timeout=30000)
with page.expect_popup(timeout=30000) as info:
page.click("#open", timeout=30000)
popup = info.value
popup.wait_for_load_state("load", timeout=30000)
frame = wait_frame(popup, s.origin["B"], "/frame", seconds=30) if iframe else None
seen: Dict[str, Any] = {}
def settled() -> bool:
seen["now"] = {"popup": popup.evaluate(READ), "frame": frame.evaluate(READ) if frame else None}
return _plausible(seen["now"]) and (ready is None or bool(ready(seen["now"])))
wait_until(settled, 30, lambda: popup.wait_for_timeout(100))
return seen["now"]
@@ -0,0 +1,93 @@
"""A real click inside an iframe: `screenX - clientX` is the iframe's own `mozInnerScreenX`.
What it fixes: the relation a page checks with one subtraction on every mouse event, `event.screenX - event.clientX ==
window.mozInnerScreenX` (and the same on Y), INSIDE an iframe placed at (220, 150) of the page. The defect of 2026-08-10:
`mozInnerScreenX/Y` answered the origin of the top-level content to every window, so the iframe read (top origin) while
its events still carried the iframe's offset, and `screenX - clientX` was 220 against a `mozInnerScreenX` of 0.
Engine hook: `fingerprint/screen-window/geometry` of the engine series: `nsGlobalWindowOuter::GetMozInnerScreenX/Y` and
`Event::GetScreenCoords` both add the ONE content origin shift (`nsGlobalWindowOuter::StealthContentOriginShift`, declared
window against real one) to the window's OWN real rectangle, so the offset between frames stays true at every depth.
Control, in the same test: the top window's `mozInnerScreenX/Y` is a different number (the iframe sits 220 and 150 CSS
pixels off it). The test asserts the iframe's `mozInnerScreenX/Y` is the top's plus the iframe's rectangle, and that what
the events carry (`screenX - clientX`) is NOT the top's origin: a window that answered the top origin to every frame fails
both.
The click is a real one (`page.mouse.click` at a point inside the iframe, the pointer events the engine makes), not a
dispatched event. The page and the iframe are one site, so the page may read the iframe's `mozInnerScreenX`.
"""
from __future__ import annotations
import pytest
from _fission_frames import Sites
from _waits import wait_until
pytestmark = pytest.mark.e2e
LEFT, TOP = 220, 150
PARENT = """<!doctype html><meta charset=utf-8><title>parent</title>
<style>html,body{margin:0;padding:0;height:100%%}
#f{position:absolute;left:%dpx;top:%dpx;width:360px;height:220px;border:0}</style>
<body><iframe id=f src="/child"></iframe>
<script>
window.__geom = () => {
const w = document.getElementById('f').contentWindow;
const r = document.getElementById('f').getBoundingClientRect();
return {top_x: window.mozInnerScreenX, top_y: window.mozInnerScreenY,
ifr_x: w.mozInnerScreenX, ifr_y: w.mozInnerScreenY, rect_x: r.x, rect_y: r.y};
};
</script>""" % (LEFT, TOP)
CHILD = """<!doctype html><meta charset=utf-8><title>child</title>
<style>html,body{margin:0;padding:0;height:100%}
#g{position:absolute;left:30px;top:40px;width:220px;height:130px;background:#06c}</style>
<body><div id=g>y</div>
<script>
window.__ev = [];
for (const t of ['mousemove', 'mousedown', 'mouseup', 'click']) {
window.addEventListener(t, e => {
window.__ev.push({t: t, cx: e.clientX, cy: e.clientY, sx: e.screenX, sy: e.screenY});
}, true);
}
window.__inner = () => [window.mozInnerScreenX, window.mozInnerScreenY];
</script>"""
def test_a_real_click_in_an_iframe_has_the_screen_origin_of_the_iframe(firefox_binary):
from invisible_playwright import InvisiblePlaywright
with Sites() as s:
s.route("A", "/parent", PARENT)
s.route("A", "/child", CHILD)
with InvisiblePlaywright(seed=42, binary_path=firefox_binary, headless=True, humanize=False) as browser:
page = browser.new_page()
page.goto(s.url("A", "/parent"), wait_until="load", timeout=30000)
geom = page.evaluate("() => window.__geom()")
frame = page.frames[1]
frame.evaluate("() => { window.__ev = []; }")
# a point inside the blue square of the iframe, in the coordinates of the page
page.mouse.click(LEFT + 30 + 100, TOP + 40 + 60)
kinds = {"mousedown", "mouseup", "click"}
assert wait_until(lambda: kinds <= {e["t"] for e in frame.evaluate("() => window.__ev")}, 30,
lambda: page.wait_for_timeout(100)), (
"the iframe heard %r of the click" % [e["t"] for e in frame.evaluate("() => window.__ev")])
events = frame.evaluate("() => window.__ev")
inner = frame.evaluate("() => window.__inner()")
# the iframe is where it was put, and answers its OWN origin: the top's plus the iframe's rectangle
assert (geom["rect_x"], geom["rect_y"]) == (LEFT, TOP)
assert (geom["ifr_x"], geom["ifr_y"]) == (geom["top_x"] + geom["rect_x"], geom["top_y"] + geom["rect_y"]), (
"the iframe reads mozInnerScreen (%r, %r), the page's is (%r, %r) and the iframe sits at (%d, %d)"
% (geom["ifr_x"], geom["ifr_y"], geom["top_x"], geom["top_y"], LEFT, TOP))
assert (inner[0], inner[1]) != (geom["top_x"], geom["top_y"]), "the iframe answers the origin of the top-level content"
clicks = [e for e in events if e["t"] == "click"]
assert clicks, "no click event in the iframe: %r" % events
for e in events:
assert e["sx"] - e["cx"] == inner[0], (
"%s in the iframe: screenX - clientX = %r against mozInnerScreenX = %r" % (e["t"], e["sx"] - e["cx"], inner[0]))
assert e["sy"] - e["cy"] == inner[1], (
"%s in the iframe: screenY - clientY = %r against mozInnerScreenY = %r" % (e["t"], e["sy"] - e["cy"], inner[1]))
# the control: the top window's origin is NOT what the events carry
assert (e["sx"] - e["cx"], e["sy"] - e["cy"]) != (geom["top_x"], geom["top_y"])
@@ -0,0 +1,121 @@
"""The size and pointer media queries answer the declaration, not the host.
What it fixes, from the page's side (`matchMedia`):
* `(device-width: Wpx)` / `(device-height: Hpx)` are the declared screen (`zoom.stealth.screen.width/height`), not the
host's monitor.
* `(pointer: ...)` / `(any-pointer: ...)` / `(hover: ...)` are the declared pointer capabilities
(`zoom.stealth.pointer.primary` / `.all`, the bitmask Coarse 1, Fine 2, Hover 4), not the host's (a Windows machine
with a digitizer adds Coarse by itself).
* A context made with `has_touch=True` (Juggler's touch override) still reads a COARSE pointer when a fine one is
declared: the override of the context decides before the declaration does.
Engine hook: `fingerprint/screen-window/css-media` of the engine series (`layout/style/nsMediaFeatures.cpp`:
`GetDeviceSize`, `GetPointerCapabilities`; the declarations in `StealthMediaFeatures.h`).
Negative controls, in the same test: the device size is read with the screen declaration ABSENT (engine off and the three
screen prefs 0: a bare binary), which is the host's screen; the pointer is read with the declaration absent (-1 on both
prefs: the compiled default / the host's answer); and has_touch is read in a context without it, on the same launch.
Linux and Windows run the same assertions: the declared values are the ones no runner has (a 2731x1537 screen; a coarse
primary pointer on a machine with a mouse).
"""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.e2e
#: A screen no runner has.
SCREEN = {"screen.width": 2731, "screen.height": 1537, "screen.dpr": 1.0}
#: Bare binary and no screen declared: the page reads the host.
NO_SCREEN = {"zoom.stealth.fpp.hw_seed": 0, "zoom.stealth.screen.width": 0, "zoom.stealth.screen.height": 0,
"zoom.stealth.screen.color_depth": 0}
COARSE, FINE, HOVER = 1, 2, 4
QUERIES = {name: "matchMedia('%s').matches" % query for name, query in {
"pointer_coarse": "(pointer: coarse)", "pointer_fine": "(pointer: fine)",
"any_coarse": "(any-pointer: coarse)", "any_fine": "(any-pointer: fine)",
"hover_none": "(hover: none)", "any_hover_none": "(any-hover: none)"}.items()}
READ_POINTER = "() => ({%s})" % ", ".join("%s: %s" % (k, v) for k, v in QUERIES.items())
def _launch(binary, pin=None, extra_prefs=None):
from invisible_playwright import InvisiblePlaywright
return InvisiblePlaywright(seed=42, pin=pin, binary_path=binary, headless=True, humanize=False,
extra_prefs=extra_prefs)
def _read_pointer(binary, primary, every):
with _launch(binary, extra_prefs={"zoom.stealth.pointer.primary": primary,
"zoom.stealth.pointer.all": every}) as browser:
page = browser.new_page()
page.goto("about:blank", timeout=30000)
return page.evaluate(READ_POINTER)
def test_a_declared_pointer_is_what_the_media_queries_read(firefox_binary):
declared = _read_pointer(firefox_binary, COARSE, COARSE)
assert declared == {"pointer_coarse": True, "pointer_fine": False, "any_coarse": True, "any_fine": False,
"hover_none": True, "any_hover_none": True}, (
"a coarse pointer without hover is declared and the page reads %r" % declared)
# The control: the declaration absent (-1) is not that machine. A fine pointer with hover is the declaration of a
# desktop; the host without a declaration answers its own, and it is not a coarse one without hover.
undeclared = _read_pointer(firefox_binary, -1, -1)
assert undeclared != declared, "with no pointer declared the page reads the same as with a coarse one: %r" % undeclared
assert undeclared["pointer_coarse"] is False and undeclared["any_coarse"] is False, (
"with no pointer declared the page reads %r" % undeclared)
fine = _read_pointer(firefox_binary, FINE | HOVER, FINE | HOVER)
assert fine == {"pointer_coarse": False, "pointer_fine": True, "any_coarse": False, "any_fine": True,
"hover_none": False, "any_hover_none": False}, (
"a fine pointer with hover is declared and the page reads %r" % fine)
def test_has_touch_reads_a_coarse_pointer_even_when_a_fine_one_is_declared(firefox_binary):
with _launch(firefox_binary, extra_prefs={"zoom.stealth.pointer.primary": FINE | HOVER,
"zoom.stealth.pointer.all": FINE | HOVER}) as browser:
plain = browser.new_context().new_page()
plain.goto("about:blank", timeout=30000)
touch = browser.new_context(has_touch=True).new_page()
touch.goto("about:blank", timeout=30000)
without = plain.evaluate(READ_POINTER)
with_touch = touch.evaluate(READ_POINTER)
# the control: the same launch, a context without the override, reads the declared fine pointer
assert without["pointer_fine"] is True and without["pointer_coarse"] is False, (
"a context without has_touch reads %r under a declared fine pointer" % without)
assert with_touch["pointer_coarse"] is True and with_touch["pointer_fine"] is False, (
"a context with has_touch reads %r under a declared fine pointer: the touch override must win" % with_touch)
assert with_touch["any_coarse"] is True, "any-pointer in a has_touch context reads %r" % with_touch
def _read_device_size(binary, pin, extra_prefs=None):
with _launch(binary, pin=pin, extra_prefs=extra_prefs) as browser:
page = browser.new_page()
page.goto("about:blank", timeout=30000)
return page.evaluate("""([w, h]) => ({
screen_w: screen.width, screen_h: screen.height,
device_width: matchMedia('(device-width: ' + w + 'px)').matches,
device_height: matchMedia('(device-height: ' + h + 'px)').matches,
own_width: matchMedia('(device-width: ' + screen.width + 'px)').matches,
own_height: matchMedia('(device-height: ' + screen.height + 'px)').matches})""",
[SCREEN["screen.width"], SCREEN["screen.height"]])
def test_the_device_size_media_queries_read_the_declared_screen(firefox_binary):
declared = _read_device_size(firefox_binary, SCREEN)
assert declared["device_width"] is True and declared["device_height"] is True, (
"(device-width: 2731px) and (device-height: 1537px) do not match under a declared 2731x1537 screen: %r" % declared)
assert (declared["screen_w"], declared["screen_h"]) == (2731, 1537)
# The control: the screen declaration absent is the host's screen, and the same query does not match.
host = _read_device_size(firefox_binary, SCREEN, extra_prefs=NO_SCREEN)
assert host["own_width"] is True and host["own_height"] is True, (
"the device size the media queries read is not the screen the page reads: %r" % host)
assert host["device_width"] is False and host["device_height"] is False, (
"(device-width: 2731px) matches with no screen declared: the control reads the declaration, %r" % host)
+84
View File
@@ -313,3 +313,87 @@ def test_webgl_readpixels_no_masking_signature(page):
f"WebGL readPixels shows {res['spikes']} high-frequency noise spikes "
f"(pixelscan-maskable); the stealth noise must be a smooth gamma remap."
)
# ===========================================================================
# The declared screen, and the inner size of the top level (characterisation of
# the engine hooks fingerprint/screen-window/screen: nsScreen.cpp, nsPresContext.cpp)
# ===========================================================================
#: A screen no runner has: 2731x1537, a 41 px taskbar, 30-bit colour, at scale 1.0.
_DECLARED_SCREEN = {"screen.width": 2731, "screen.height": 1537, "screen.taskbar_px": 41,
"screen.color_depth": 30, "screen.dpr": 1.0}
#: The declaration absent: a bare binary (engine off) with the three screen prefs at 0, which the engine reads as
#: "not declared" and answers from the host.
_NO_SCREEN_DECLARED = {"zoom.stealth.fpp.hw_seed": 0, "zoom.stealth.screen.width": 0,
"zoom.stealth.screen.height": 0, "zoom.stealth.screen.color_depth": 0}
_READ_SCREEN = """() => ({width: screen.width, height: screen.height, availWidth: screen.availWidth,
availHeight: screen.availHeight, pixelDepth: screen.pixelDepth,
colorDepth: screen.colorDepth})"""
def _read_screen(firefox_binary, extra_prefs=None):
with InvisiblePlaywright(seed=42, pin=_DECLARED_SCREEN, binary_path=firefox_binary, headless=True,
extra_prefs=extra_prefs) as browser:
page = browser.new_page()
page.goto("about:blank", timeout=30_000)
return page.evaluate(_READ_SCREEN)
@pytest.mark.e2e
def test_a_declared_screen_that_no_runner_has_is_what_the_page_reads(firefox_binary):
"""The page reads the screen the core declares (nsScreen::GetRect, GetAvailRect, PixelDepth), not the host's.
The available height is the declared height less the declared taskbar (2731x1537, taskbar 41, depth 30 -> availWidth
2731, availHeight 1496). The control is the same launch with the declaration absent (engine off, the three screen prefs
at 0): the page then reads the host's screen, and none of the declared numbers.
"""
declared = _read_screen(firefox_binary)
assert declared == {"width": 2731, "height": 1537, "availWidth": 2731, "availHeight": 1537 - 41,
"pixelDepth": 30, "colorDepth": 30}, "the page reads %r under a declared 2731x1537 screen" % declared
host = _read_screen(firefox_binary, extra_prefs=_NO_SCREEN_DECLARED)
for key in ("width", "height", "availWidth", "availHeight", "pixelDepth"):
assert host[key] != declared[key], (
"with the declaration absent screen.%s reads %r, the declared value: the control reads the declaration "
"(%r)" % (key, host[key], host))
@pytest.mark.e2e
def test_the_inner_size_of_the_top_is_synced_with_the_engine_active_and_not_without(firefox_binary):
"""A popup's iframe reads the top level's inner size (nsPresContext::UpdateInnerSizeSpoofedForRFP).
With the engine active the top-level inner size is synced to every process of the browsing context, so an iframe of
another site in a popup (200x150, in its own process) answers the outer size of the POPUP: the top's inner size plus the
declared frame, 2 * border wide and popup UI + border high, and not the size of its own 200x150. The popup itself
answers the same. The control is the same page with the engine off (`zoom.stealth.fpp.hw_seed` 0): the synced field
is not filled and neither window reads the declared frame.
"""
from _popup_geometry import ENGINE_OFF, frame_of_the_declaration, read_popup
frame = frame_of_the_declaration()
extra = (2 * frame.border, frame.popup_ui + frame.border)
def synced(reading):
top = reading["popup"]
return (reading["frame"]["ow"], reading["frame"]["oh"]) == (top["iw"] + extra[0], top["ih"] + extra[1])
on = read_popup(firefox_binary, iframe=True, ready=synced)
top, inner = on["popup"], on["frame"]
assert (top["ow"], top["oh"]) == (top["iw"] + extra[0], top["ih"] + extra[1]), (
"the popup reads outer %dx%d for inner %dx%d, the declared frame adds %r" % (top["ow"], top["oh"], top["iw"],
top["ih"], extra))
assert (inner["ow"], inner["oh"]) == (top["iw"] + extra[0], top["ih"] + extra[1]), (
"the iframe of the popup reads outer %dx%d, the top level's inner %dx%d plus the declared frame %r is %dx%d (the "
"iframe's own inner size is %dx%d)" % (inner["ow"], inner["oh"], top["iw"], top["ih"], extra,
top["iw"] + extra[0], top["ih"] + extra[1], inner["iw"], inner["ih"]))
assert (inner["iw"], inner["ih"]) != (top["iw"], top["ih"]), "the iframe has the size of the popup: the read proves nothing"
off = read_popup(firefox_binary, extra_prefs=ENGINE_OFF, iframe=True)
off_top, off_inner = off["popup"], off["frame"]
assert (off_inner["ow"], off_inner["oh"]) != (off_top["iw"] + extra[0], off_top["ih"] + extra[1]), (
"with the engine off the iframe of a popup also reads the top's inner size plus the declared frame: %r" % off)
assert (off_top["ow"], off_top["oh"]) != (off_top["iw"] + extra[0], off_top["ih"] + extra[1]), (
"with the engine off the popup also reads the declared frame: %r" % off)
@@ -0,0 +1,60 @@
"""A popup reads the window frame the core declares, not the one of the host.
What it fixes: the geometry of a window a page opens with `window.open(url, 'p', 'width=500,height=400')`, read from
inside the popup. A popup is its real inner size plus the declared frame (retail Windows Firefox, measured by the core at
scale 1.0: a border of 8 on the left, right and bottom, the popup UI of 72 above the content, and a default position of
4,4 when the page names no left/top):
* `outerWidth == innerWidth + 2 * border`
* `outerHeight == innerHeight + popup_ui + border`
* `screenX == screenY ==` the declared default position (the page named none)
* `mozInnerScreenX == screenX + border`, `mozInnerScreenY == screenY + popup_ui`
Engine hook: `fingerprint/screen-window/geometry` of the engine series (`nsGlobalWindowOuter::GetOuterSize`,
`GetScreenXY`, `GetMozInnerScreenX/Y`, with the content origin shift of `StealthScreenCoords`) and
`fingerprint/screen-window/popup-position` (`nsWindowWatcher`, the default position of a popup).
Negative control, in the same test: the same page in a launch with the engine OFF (`zoom.stealth.fpp.hw_seed` 0, a bare
binary) reads the host's popup, which has no declared frame (a headless popup has none: outer == inner), so the sizes
that the declaration adds are not there. The test asserts the two readings DIFFER, so a hook that stops answering from
the declaration turns it red.
Why a page reads it: `outerWidth - innerWidth`, `screenX` and `mozInnerScreenX/Y` are one line each, and a popup whose
frame is not a Windows frame is a browser that does not run on Windows. Linux and Windows run the same assertions: the
declaration, not the host, is what is read.
"""
from __future__ import annotations
import pytest
from _popup_geometry import ENGINE_OFF, frame_of_the_declaration, read_popup
pytestmark = pytest.mark.e2e
def test_a_popup_is_its_inner_size_plus_the_declared_frame(firefox_binary):
frame = frame_of_the_declaration()
declared = (2 * frame.border, frame.popup_ui + frame.border)
def has_the_frame(reading):
p = reading["popup"]
return (p["ow"] - p["iw"], p["oh"] - p["ih"]) == declared
on = read_popup(firefox_binary, ready=has_the_frame)["popup"]
assert (on["ow"] - on["iw"], on["oh"] - on["ih"]) == declared, (
"the popup reads outer %dx%d for inner %dx%d: the frame is %r, the declaration is %r"
% (on["ow"], on["oh"], on["iw"], on["ih"], (on["ow"] - on["iw"], on["oh"] - on["ih"]), declared))
assert (on["sx"], on["sy"]) == (frame.popup_position, frame.popup_position), (
"a popup that names no position reads screen %r, the declared default is %d" % ((on["sx"], on["sy"]),
frame.popup_position))
assert on["mx"] == pytest.approx(on["sx"] + frame.border, abs=0.01), (
"mozInnerScreenX %r is not screenX %r plus the border %d" % (on["mx"], on["sx"], frame.border))
assert on["my"] == pytest.approx(on["sy"] + frame.popup_ui, abs=0.01), (
"mozInnerScreenY %r is not screenY %r plus the popup UI %d" % (on["my"], on["sy"], frame.popup_ui))
# The control: the engine off is the host's popup, and none of the declared relations holds.
off = read_popup(firefox_binary, extra_prefs=ENGINE_OFF)["popup"]
assert (off["ow"] - off["iw"], off["oh"] - off["ih"]) != declared, (
"with the engine off the popup also reads the declared frame %r: the control reads the declaration, so the "
"test cannot tell a hook that answers from one that does not" % (declared,))
assert abs(off["my"] - off["sy"] - frame.popup_ui) > 0.01, (
"with the engine off mozInnerScreenY is also screenY + %d: the control reads the declaration" % frame.popup_ui)