diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index ab177ba156..f9373b29eb 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -352,6 +353,16 @@ static ErrorOr run_ref_test(HeadlessWebContentView& view, StringView static ErrorOr run_test(HeadlessWebContentView& view, StringView input_path, StringView expectation_path, TestMode mode, bool dump_failed_ref_tests) { + // Clear the current document. + // FIXME: Implement a debug-request to do this more thoroughly. + auto promise = Core::Promise::construct(); + view.on_load_finish = [&](auto) { + promise->resolve({}); + }; + view.on_text_test_finish = {}; + view.load(URL("about:blank"sv)); + MUST(promise->await()); + s_current_test_path = input_path; switch (mode) { case TestMode::Text: