Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

fix(fullscreen): remove historical page aliases

ldm0669173367de6
diff --git a/moli-benchmark/wpt-cross-current/failed-cases.txt b/moli-benchmark/wpt-cross-current/failed-cases.txt
index 58344fe01..7aeb3e201 100644
--- a/moli-benchmark/wpt-cross-current/failed-cases.txt
+++ b/moli-benchmark/wpt-cross-current/failed-cases.txt
@@ -2802,7 +2802,6 @@ fullscreen/api/document-fullscreen-enabled.html
fullscreen/api/document-onfullscreenerror.html
fullscreen/api/element-request-fullscreen-active-document.html
fullscreen/api/element-request-fullscreen-not-allowed.html
-fullscreen/api/historical.html
fullscreen/api/promises-reject.html
geolocation/non-secure-contexts.http.html
gyroscope/Gyroscope-supported-by-permissions-policy.html
diff --git a/moli-benchmark/wpt-cross-current/passed-cases.txt b/moli-benchmark/wpt-cross-current/passed-cases.txt
index 72c5f4488..51428a194 100644
--- a/moli-benchmark/wpt-cross-current/passed-cases.txt
+++ b/moli-benchmark/wpt-cross-current/passed-cases.txt
@@ -5054,6 +5054,7 @@ focus/iframe-focuses-parent-different-site.html
focus/iframe-focuses-parent-same-site.html
focus/scroll-matches-focus.html
fullscreen/api/document-fullscreen-enabled-active-document.html
+fullscreen/api/historical.html
fullscreen/rendering/fullscreen-pseudo-class-support.html
gyroscope/Gyroscope_insecure_context.html
hr-time/clamped-time-origin.html
diff --git a/moli-protocol-server/src/protocol_server/tests/classic.rs b/moli-protocol-server/src/protocol_server/tests/classic.rs
index 6768d32b0..84a3ea0be 100644
--- a/moli-protocol-server/src/protocol_server/tests/classic.rs
+++ b/moli-protocol-server/src/protocol_server/tests/classic.rs
@@ -14254,7 +14254,7 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
Method::POST,
&execute_path,
json!({
- "script": "return JSON.stringify({ innerWidth, innerHeight, outerWidth, outerHeight, screenWidth: screen.width, screenHeight: screen.height, availWidth: screen.availWidth, availHeight: screen.availHeight, hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, fullScreen: window.fullScreen, webkitIsFullScreen: document.webkitIsFullScreen });",
+ "script": "return JSON.stringify({ innerWidth, innerHeight, outerWidth, outerHeight, screenWidth: screen.width, screenHeight: screen.height, availWidth: screen.availWidth, availHeight: screen.availHeight, hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, hasFullScreen: 'fullScreen' in window, hasWebkitIsFullScreen: 'webkitIsFullScreen' in document });",
"args": []
}),
)
@@ -14279,8 +14279,8 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
"hasFocus": true,
"hidden": false,
"visibilityState": "visible",
- "fullScreen": false,
- "webkitIsFullScreen": false,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
})
);
@@ -14294,7 +14294,7 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
Method::POST,
&execute_path,
json!({
- "script": "return JSON.stringify({ hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, fullScreen: window.fullScreen, webkitIsFullScreen: document.webkitIsFullScreen });",
+ "script": "return JSON.stringify({ hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, hasFullScreen: 'fullScreen' in window, hasWebkitIsFullScreen: 'webkitIsFullScreen' in document });",
"args": []
}),
)
@@ -14311,8 +14311,8 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
"hasFocus": false,
"hidden": true,
"visibilityState": "hidden",
- "fullScreen": false,
- "webkitIsFullScreen": false,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
})
);
@@ -14335,7 +14335,7 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
Method::POST,
&execute_path,
json!({
- "script": "return JSON.stringify({ innerWidth, innerHeight, outerWidth, outerHeight, screenWidth: screen.width, screenHeight: screen.height, availWidth: screen.availWidth, availHeight: screen.availHeight, hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, fullScreen: window.fullScreen, webkitIsFullScreen: document.webkitIsFullScreen });",
+ "script": "return JSON.stringify({ innerWidth, innerHeight, outerWidth, outerHeight, screenWidth: screen.width, screenHeight: screen.height, availWidth: screen.availWidth, availHeight: screen.availHeight, hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, hasFullScreen: 'fullScreen' in window, hasWebkitIsFullScreen: 'webkitIsFullScreen' in document });",
"args": []
}),
)
@@ -14360,8 +14360,8 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
"hasFocus": true,
"hidden": false,
"visibilityState": "visible",
- "fullScreen": true,
- "webkitIsFullScreen": true,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
})
);
@@ -14391,7 +14391,7 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
Method::POST,
&execute_path,
json!({
- "script": "return JSON.stringify({ innerWidth, innerHeight, outerWidth, outerHeight, hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, fullScreen: window.fullScreen, webkitIsFullScreen: document.webkitIsFullScreen });",
+ "script": "return JSON.stringify({ innerWidth, innerHeight, outerWidth, outerHeight, hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, hasFullScreen: 'fullScreen' in window, hasWebkitIsFullScreen: 'webkitIsFullScreen' in document });",
"args": []
}),
)
@@ -14412,8 +14412,8 @@ async fn webdriver_classic_window_state_routes_use_headless_viewport_contract()
"hasFocus": true,
"hidden": false,
"visibilityState": "visible",
- "fullScreen": false,
- "webkitIsFullScreen": false,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
})
);
@@ -14489,32 +14489,32 @@ impl WindowPromptCommand {
"innerHeight": 480,
"hidden": true,
"visibilityState": "hidden",
- "fullScreen": false,
- "webkitIsFullScreen": false,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
}),
Self::Fullscreen => json!({
"innerWidth": moli_protocol_webdriver_classic::CLASSIC_HEADLESS_SCREEN_WIDTH,
"innerHeight": moli_protocol_webdriver_classic::CLASSIC_HEADLESS_SCREEN_HEIGHT,
"hidden": false,
"visibilityState": "visible",
- "fullScreen": true,
- "webkitIsFullScreen": true,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
}),
Self::Maximize => json!({
"innerWidth": moli_protocol_webdriver_classic::CLASSIC_HEADLESS_SCREEN_WIDTH,
"innerHeight": moli_protocol_webdriver_classic::CLASSIC_HEADLESS_AVAILABLE_HEIGHT,
"hidden": false,
"visibilityState": "visible",
- "fullScreen": false,
- "webkitIsFullScreen": false,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
}),
Self::GetRect | Self::SetRect => json!({
"innerWidth": self.expected_success_value()["width"],
"innerHeight": self.expected_success_value()["height"],
"hidden": false,
"visibilityState": "visible",
- "fullScreen": false,
- "webkitIsFullScreen": false,
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false,
}),
}
}
@@ -14611,7 +14611,7 @@ async fn assert_window_prompt_command_matches_chromium_wpt(command: WindowPrompt
Method::POST,
&format!("/session/{session_id}/execute/sync"),
json!({
- "script": "return JSON.stringify({ innerWidth, innerHeight, hidden: document.hidden, visibilityState: document.visibilityState, fullScreen: window.fullScreen, webkitIsFullScreen: document.webkitIsFullScreen });",
+ "script": "return JSON.stringify({ innerWidth, innerHeight, hidden: document.hidden, visibilityState: document.visibilityState, hasFullScreen: 'fullScreen' in window, hasWebkitIsFullScreen: 'webkitIsFullScreen' in document });",
"args": []
}),
)
diff --git a/moli-protocol/src/conn/dispatch_tests.rs b/moli-protocol/src/conn/dispatch_tests.rs
index 0b12045e6..dd7f1d04a 100644
--- a/moli-protocol/src/conn/dispatch_tests.rs
+++ b/moli-protocol/src/conn/dispatch_tests.rs
@@ -4446,10 +4446,8 @@ async fn devtools_command_applies_window_state_to_document_surface() {
"hasFocus": false,
"hidden": true,
"visibilityState": "hidden",
- "fullScreen": false,
- "fullScreenType": "boolean",
- "webkitIsFullScreen": false,
- "webkitIsFullScreenType": "boolean"
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false
})
);
@@ -4466,14 +4464,15 @@ async fn devtools_command_applies_window_state_to_document_surface() {
fullscreen_result.expect("fullscreen surface state should succeed"),
DevToolsCommandResult::Empty
);
- assert!(
+ assert_eq!(
conn.browser_context
.as_ref()
.expect("browser context")
.active_page_target()
.owner_state
- .window_fullscreen(),
- "SetWindowState fullscreen must update the target owner before applying document surfaces"
+ .window_surface_state,
+ TargetWindowSurfaceState::Fullscreen,
+ "SetWindowState fullscreen must update the target owner before applying document surfaces",
);
assert_eq!(
evaluate_document_surface_payload(&mut conn, target_context.clone()).await,
@@ -4481,10 +4480,8 @@ async fn devtools_command_applies_window_state_to_document_surface() {
"hasFocus": true,
"hidden": false,
"visibilityState": "visible",
- "fullScreen": true,
- "fullScreenType": "boolean",
- "webkitIsFullScreen": true,
- "webkitIsFullScreenType": "boolean"
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false
})
);
@@ -4507,10 +4504,8 @@ async fn devtools_command_applies_window_state_to_document_surface() {
"hasFocus": true,
"hidden": false,
"visibilityState": "visible",
- "fullScreen": false,
- "fullScreenType": "boolean",
- "webkitIsFullScreen": false,
- "webkitIsFullScreenType": "boolean"
+ "hasFullScreen": false,
+ "hasWebkitIsFullScreen": false
})
);
}
@@ -4525,7 +4520,7 @@ async fn evaluate_document_surface_payload(
context,
realm_id: None,
world_name: None,
- expression: "JSON.stringify({ hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, fullScreen: window.fullScreen, fullScreenType: typeof window.fullScreen, webkitIsFullScreen: document.webkitIsFullScreen, webkitIsFullScreenType: typeof document.webkitIsFullScreen })"
+ expression: "JSON.stringify({ hasFocus: document.hasFocus(), hidden: document.hidden, visibilityState: document.visibilityState, hasFullScreen: 'fullScreen' in window, hasWebkitIsFullScreen: 'webkitIsFullScreen' in document })"
.to_owned(),
await_promise: true,
user_gesture: false,
diff --git a/moli-protocol/src/conn/page_state/surfaces.rs b/moli-protocol/src/conn/page_state/surfaces.rs
index 2dce1723c..08f0035db 100644
--- a/moli-protocol/src/conn/page_state/surfaces.rs
+++ b/moli-protocol/src/conn/page_state/surfaces.rs
@@ -16,7 +16,6 @@ struct SurfaceOverrideInputs {
focus_emulation_enabled: bool,
active_target_surface: bool,
window_document_hidden: bool,
- window_fullscreen: bool,
}
impl SurfaceOverrideInputs {
@@ -38,10 +37,6 @@ impl SurfaceOverrideInputs {
.active_page_target()
.owner_state
.window_document_hidden(),
- window_fullscreen: browser_context
- .active_page_target()
- .owner_state
- .window_fullscreen(),
}
}
@@ -70,7 +65,6 @@ impl SurfaceOverrideInputs {
focus_emulation_enabled: state.effective_emulation_state.focus_emulation_enabled,
active_target_surface: false,
window_document_hidden: false,
- window_fullscreen: false,
}
}
@@ -94,10 +88,6 @@ impl SurfaceOverrideInputs {
}
}
- fn window_fullscreen(&self) -> bool {
- self.window_fullscreen
- }
-
fn navigator_online(&self) -> bool {
self.network_conditions
.is_none_or(|conditions| conditions.navigator_online())
@@ -438,7 +428,6 @@ impl BrowserContext {
let document_has_focus = inputs.document_has_focus();
let document_hidden = inputs.document_hidden();
let document_visibility_state = inputs.document_visibility_state();
- let window_fullscreen = inputs.window_fullscreen();
let source = format!(
"(function() {{
@@ -462,7 +451,6 @@ impl BrowserContext {
return navigatorOnline;
}}
}};
- defineGetter(globalThis, 'fullScreen', () => {window_fullscreen});
try {{
const geoState = globalThis.__moliGeolocationState || {{
nextWatchId: 1,
@@ -575,7 +563,6 @@ impl BrowserContext {
// overrides to win in the same realm.
defineGetter(document, 'hidden', () => {document_hidden});
defineGetter(document, 'visibilityState', () => {document_visibility_state});
- defineGetter(document, 'webkitIsFullScreen', () => {window_fullscreen});
try {{
Object.defineProperty(document, 'hasFocus', {{
configurable: true,
@@ -604,7 +591,6 @@ impl BrowserContext {
document_hidden = document_hidden,
document_visibility_state = json!(document_visibility_state),
document_has_focus = document_has_focus,
- window_fullscreen = window_fullscreen,
);
Some(DocumentStartScript {
diff --git a/moli-protocol/src/conn/state/target_state.rs b/moli-protocol/src/conn/state/target_state.rs
index 2b295caff..0ecc7de05 100644
--- a/moli-protocol/src/conn/state/target_state.rs
+++ b/moli-protocol/src/conn/state/target_state.rs
@@ -326,10 +326,6 @@ impl TargetWindowSurfaceState {
matches!(self, Self::Minimized)
}
- pub(crate) fn is_fullscreen(self) -> bool {
- matches!(self, Self::Fullscreen)
- }
-
pub(crate) fn label(self) -> &'static str {
match self {
Self::Normal => "normal",
@@ -839,10 +835,6 @@ impl TargetOwnerState {
self.window_surface_state.document_hidden()
}
- pub(crate) fn window_fullscreen(&self) -> bool {
- self.window_surface_state.is_fullscreen()
- }
-
pub(crate) fn is_default(&self) -> bool {
self.initial_empty_document.is_none()
&& self.committed_document_title.is_none()