test-web: Improve WebContent crash handling
Two fixes for crash handling: 1. Re-setup output capture after WebContent respawns. When WebContent crashes, a new process is spawned with new stdout/stderr pipes. We need to set up new notifiers to drain them, otherwise the new WebContent blocks on write() when its pipe buffer fills up. 2. Disconnect child view crash handlers between tests. Child views (from window.open, iframes, etc.) persist after a test completes. If they crash later, we don't want that to affect subsequent tests.
This commit is contained in:
parent
07138af5ef
commit
794ba270a2
1 changed files with 10 additions and 1 deletions
|
|
@ -958,8 +958,14 @@ static void set_ui_callbacks_for_tests(TestWebView& view)
|
|||
};
|
||||
|
||||
view.on_web_content_crashed = [&view]() {
|
||||
if (auto test = s_test_by_view.get(&view); test.has_value())
|
||||
// Re-setup output capture for the respawned WebContent process
|
||||
// (handle_web_content_process_crash already ran and respawned it)
|
||||
s_output_captures.remove(&view);
|
||||
setup_output_capture_for_view(view);
|
||||
|
||||
if (auto test = s_test_by_view.get(&view); test.has_value()) {
|
||||
view.on_test_complete({ *test.value(), TestResult::Crashed });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1139,6 +1145,9 @@ static ErrorOr<int> run_tests(Core::AnonymousBuffer const& theme, Web::DevicePix
|
|||
view->on_reference_test_metadata = {};
|
||||
view->on_set_test_timeout = {};
|
||||
|
||||
// Disconnect child crash handlers so old child crashes don't affect the next test
|
||||
view->disconnect_child_crash_handlers();
|
||||
|
||||
// Don't try to reset zoom if WebContent crashed - it's gone
|
||||
if (result.result != TestResult::Crashed)
|
||||
view->reset_zoom();
|
||||
|
|
|
|||
Loading…
Reference in a new issue