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

@ -272,7 +272,13 @@ impl RunningAppState {
Some(last_created_webview) => {
last_created_webview.focus();
},
None => self.servo.start_shutting_down(),
None if self.servoshell_preferences.webdriver_port.is_none() => {
self.servo.start_shutting_down()
},
None => {
// For WebDriver, don't shut down when last webview closed
// https://github.com/servo/servo/issues/37408
},
}
}