mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 12:46:06 +00:00
WebContent+LibWeb/CSS: Add debug request to dump CSS errors
This commit is contained in:
parent
01661503b9
commit
1adddb158a
Notes:
github-actions[bot]
2025-08-04 09:51:44 +00:00
Author: https://github.com/AtkinsSJ
Commit: 1adddb158a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5576
3 changed files with 17 additions and 1 deletions
|
@ -64,4 +64,13 @@ void ErrorReporter::report(ParsingError&& error)
|
|||
m_errors.set(move(error), { .occurrences = 1 });
|
||||
}
|
||||
|
||||
void ErrorReporter::dump() const
|
||||
{
|
||||
// TODO: Organise this in some way?
|
||||
dbgln("{} CSS errors reported:", m_errors.size());
|
||||
for (auto const& [error, metadata] : m_errors) {
|
||||
dbgln("- {} ({} occurrences)", serialize_parsing_error(error), metadata.occurrences);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ public:
|
|||
static ErrorReporter& the();
|
||||
|
||||
void report(ParsingError&&);
|
||||
void dump() const;
|
||||
|
||||
private:
|
||||
explicit ErrorReporter() = default;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2023, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include <LibWeb/ARIA/RoleType.h>
|
||||
#include <LibWeb/Bindings/MainThreadVM.h>
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/Parser/ErrorReporter.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Attr.h>
|
||||
#include <LibWeb/DOM/CharacterData.h>
|
||||
|
@ -352,6 +353,11 @@ void ConnectionFromClient::debug_request(u64 page_id, ByteString request, ByteSt
|
|||
return;
|
||||
}
|
||||
|
||||
if (request == "dump-all-css-errors") {
|
||||
Web::CSS::Parser::ErrorReporter::the().dump();
|
||||
return;
|
||||
}
|
||||
|
||||
if (request == "collect-garbage") {
|
||||
// NOTE: We use deferred_invoke here to ensure that GC runs with as little on the stack as possible.
|
||||
Core::deferred_invoke([] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue