libservo: Make FormControl responses completely asynchronous (#39709)

Before responses to `FormControl` requests were handled synchronous in
script (ie they would block the page). This change makes it so that they
are handled asynchronously, with their responses filtering back through
the Constellation. This should fix many WPT tests when run with
WebDriver.

Testing: There are some WebDriver-based test for this, but they do
not quite pass yet. More investigation is required, but this is
necessary to get them to pass.
Fixes: #39652
Fixes: #37013

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
Martin Robinson
2025-10-08 11:06:17 +02:00
committed by GitHub
parent a77d03998c
commit 89dfb3ee49
18 changed files with 330 additions and 136 deletions

View File

@@ -50,8 +50,8 @@ use devtools_traits::{
};
use embedder_traits::user_content_manager::UserContentManager;
use embedder_traits::{
FocusSequenceNumber, JavaScriptEvaluationError, JavaScriptEvaluationId, MediaSessionActionType,
Theme, ViewportDetails, WebDriverScriptCommand,
EmbedderControlId, FocusSequenceNumber, FormControlResponse, JavaScriptEvaluationError,
JavaScriptEvaluationId, MediaSessionActionType, Theme, ViewportDetails, WebDriverScriptCommand,
};
use euclid::default::Rect;
use fonts::{FontContext, SystemFontServiceProxy};
@@ -1913,6 +1913,9 @@ impl ScriptThread {
ScriptThreadMessage::RequestScreenshotReadiness(pipeline_id) => {
self.handle_request_screenshot_readiness(pipeline_id);
},
ScriptThreadMessage::EmbedderControlResponse(id, response) => {
self.handle_embedder_control_response(id, response, can_gc);
},
}
}
@@ -3886,6 +3889,20 @@ impl ScriptThread {
};
window.request_screenshot_readiness();
}
fn handle_embedder_control_response(
&self,
id: EmbedderControlId,
response: FormControlResponse,
can_gc: CanGc,
) {
let Some(document) = self.documents.borrow().find_document(id.pipeline_id) else {
return;
};
document
.embedder_controls()
.handle_embedder_control_response(id, response, can_gc);
}
}
impl Drop for ScriptThread {