Skip to content

Commit ec80eec

Browse files
committed
fix(ios): refuse unread lit-panel window frames
1 parent 4d6f523 commit ec80eec

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerXCTestEventBridge.m‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ static RunnerApplicationScreenFailure RunnerReadLitPanelCandidate(
218218
}
219219
}];
220220
*frame = readFrame;
221-
if (exception != nil || !present || !AgentDeviceForegroundFrameIsMeasurable(readFrame)) {
221+
if (exception != nil) {
222+
return RunnerApplicationScreenFailureUnresolvedScreen;
223+
}
224+
if (!present || !AgentDeviceForegroundFrameIsMeasurable(readFrame)) {
222225
return RunnerApplicationScreenFailureUnresolvedWindow;
223226
}
224227
return RunnerReadResolvedWindowScreen(candidate, readFrame, screen, displayID);

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+XCTestEventBridgeTests.swift‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,20 @@ extension RunnerTests {
325325
XCTAssertNil(walk.window)
326326
}
327327

328+
func testLitPanelWindowRefusesAFrameReadExceptionBeforeAnyLaterWindow() {
329+
let laterWindows: [[NSObject]] = [
330+
[],
331+
[DisplayWindowFixture(frame: Self.innerHome, displayID: 3)],
332+
[DisplayWindowFixture(frame: Self.outerStatusBar, displayID: 1)],
333+
]
334+
for later in laterWindows {
335+
let walk = resolveLitPanelWindow([FramelessWindowFixture()] + later)
336+
XCTAssertEqual(walk.failure, .unresolvedScreen)
337+
XCTAssertNil(walk.window)
338+
XCTAssertTrue(walk.frame.isNull)
339+
}
340+
}
341+
328342
/// An app that occupies part of the lit panel has no full-panel box; being on the lit display is
329343
/// still the fact the first-window route could not establish.
330344
func testLitPanelWindowBooksTheLargestWindowOnTheLitDisplay() {

0 commit comments

Comments
 (0)