webdriver: Keep constellation alive and Open new top-level browsing context with new session request when none is open (#37410)

Keep Constellation alive even when all browsing context closed in
WebDriver mode. In this case, when creating a new session, we would open
a new top-level browsing context.

Fixes: #37408
Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\close_window\close.py
--product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-07-30 14:41:58 +08:00 committed by GitHub
parent 0e18057863
commit 8b3e7b1c6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 50 additions and 41 deletions

View file

@ -146,17 +146,16 @@ pub enum WebDriverCommandMsg {
Option<Rect<f32, CSSPixel>>,
IpcSender<Option<RasterImage>>,
),
/// Create a new webview that loads about:blank. The constellation will use
/// Create a new webview that loads about:blank. The embedder will use
/// the provided channels to return the top level browsing context id
/// associated with the new webview, and a notification when the initial
/// load is complete.
NewWebView(IpcSender<WebViewId>, IpcSender<WebDriverLoadStatus>),
/// associated with the new webview, and sets a "load status sender" if provided.
NewWebView(IpcSender<WebViewId>, Option<IpcSender<WebDriverLoadStatus>>),
/// Close the webview associated with the provided id.
CloseWebView(WebViewId),
/// Focus the webview associated with the provided id.
/// Sends back a bool indicating whether the focus was successfully set.
FocusWebView(WebViewId, IpcSender<bool>),
/// Get focused webview.
/// Get focused webview. For now, this is only used when start new session.
GetFocusedWebView(IpcSender<Option<WebViewId>>),
/// Check whether top-level browsing context is open.
IsWebViewOpen(WebViewId, IpcSender<bool>),