mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
LibWeb: Only dump layout and text tree for the desired URL
Before this change, the rebaseline script would generate reference based on 'about:blank' (at least running it on my macOS system). This commit allows 'about:blank' through the assertion and only dumps the layout tree when theloaded URL matches the one we are interested in.
This commit is contained in:
parent
17b22250b6
commit
08c02ad888
1 changed files with 14 additions and 10 deletions
|
@ -282,18 +282,22 @@ static ErrorOr<TestResult> run_dump_test(HeadlessWebContentView& view, StringVie
|
|||
|
||||
if (mode == TestMode::Layout) {
|
||||
view.on_load_finish = [&](auto const& loaded_url) {
|
||||
VERIFY(url.equals(loaded_url, URL::ExcludeFragment::Yes));
|
||||
// This callback will be called for 'about:blank' first, then for the URL we actually want to dump
|
||||
VERIFY(url.equals(loaded_url, URL::ExcludeFragment::Yes) || url.equals(URL("about:blank")));
|
||||
|
||||
// NOTE: We take a screenshot here to force the lazy layout of SVG-as-image documents to happen.
|
||||
// It also causes a lot more code to run, which is good for finding bugs. :^)
|
||||
(void)view.take_screenshot();
|
||||
if (url.equals(loaded_url, URL::ExcludeFragment::Yes)) {
|
||||
// NOTE: We take a screenshot here to force the lazy layout of SVG-as-image documents to happen.
|
||||
// It also causes a lot more code to run, which is good for finding bugs. :^)
|
||||
(void)view.take_screenshot();
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append(view.dump_layout_tree().release_value_but_fixme_should_propagate_errors());
|
||||
builder.append("\n"sv);
|
||||
builder.append(view.dump_paint_tree().release_value_but_fixme_should_propagate_errors());
|
||||
result = builder.to_string().release_value_but_fixme_should_propagate_errors();
|
||||
loop.quit(0);
|
||||
StringBuilder builder;
|
||||
builder.append(view.dump_layout_tree().release_value_but_fixme_should_propagate_errors());
|
||||
builder.append("\n"sv);
|
||||
builder.append(view.dump_paint_tree().release_value_but_fixme_should_propagate_errors());
|
||||
result = builder.to_string().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
loop.quit(0);
|
||||
}
|
||||
};
|
||||
view.on_text_test_finish = {};
|
||||
} else if (mode == TestMode::Text) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue