1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

Everywhere: Replace a bundle of dbg with dbgln.

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
asynts 2021-01-17 16:57:17 +01:00 committed by Andreas Kling
parent 5c5665c1e7
commit 7d783d8b84
9 changed files with 108 additions and 103 deletions

View file

@ -417,3 +417,28 @@ constexpr bool debug_tls = true;
#else #else
constexpr bool debug_tls = false; constexpr bool debug_tls = false;
#endif #endif
#ifdef DEBUG_SPAM
constexpr bool debug_spam = true;
#else
constexpr bool debug_spam = false;
#endif
#ifdef WRAPPER_GERNERATOR_DEBUG
constexpr bool debug_wrapper_generator = true;
#else
constexpr bool debug_wrapper_generator = false;
#endif
#ifdef PARSER_DEBUG
constexpr bool debug_parser = true;
#else
constexpr bool debug_parser = false;
#endif
#ifdef TOKENIZER_TRACE
constexpr bool debug_trace_tokenizer = true;
#else
constexpr bool debug_trace_tokenizer = false;
#endif

View file

@ -166,6 +166,7 @@ add_compile_definitions("WAITBLOCK_DEBUG")
add_compile_definitions("WAITQUEUE_DEBUG") add_compile_definitions("WAITQUEUE_DEBUG")
add_compile_definitions("WEAKABLE_DEBUG") add_compile_definitions("WEAKABLE_DEBUG")
add_compile_definitions("WINDOWMANAGER_DEBUG") add_compile_definitions("WINDOWMANAGER_DEBUG")
add_compile_definitions("WRAPPER_GERNERATOR_DEBUG")
add_compile_definitions("WSMESSAGELOOP_DEBUG") add_compile_definitions("WSMESSAGELOOP_DEBUG")
add_compile_definitions("DEBUG_SOCKET") add_compile_definitions("DEBUG_SOCKET")
add_compile_definitions("WSSCREEN_DEBUG") add_compile_definitions("WSSCREEN_DEBUG")

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <AK/Debug.h>
#include <AK/Endian.h> #include <AK/Endian.h>
#include <LibCore/ConfigFile.h> #include <LibCore/ConfigFile.h>
#include <LibCore/DateTime.h> #include <LibCore/DateTime.h>
@ -37,8 +38,6 @@
# include <sys/ioctl.h> # include <sys/ioctl.h>
#endif #endif
//#define TLS_DEBUG
namespace { namespace {
struct OIDChain { struct OIDChain {
OIDChain* root { nullptr }; OIDChain* root { nullptr };
@ -407,9 +406,7 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8*
hash.initialize(Crypto::Hash::HashKind::SHA512); hash.initialize(Crypto::Hash::HashKind::SHA512);
break; break;
default: default:
#ifdef TLS_DEBUG dbgln<debug_tls>("Unsupported hash mode {}", (u32)cert.key_algorithm);
dbg() << "Unsupported hash mode " << (u32)cert.key_algorithm;
#endif
// fallback to md5, it will fail later // fallback to md5, it will fail later
hash.initialize(Crypto::Hash::HashKind::MD5); hash.initialize(Crypto::Hash::HashKind::MD5);
break; break;
@ -439,9 +436,7 @@ Optional<Certificate> TLSv12::parse_asn1(ReadonlyBytes buffer, bool) const
_parse_asn1(m_context, cert, buffer.data(), buffer.size(), 1, fields, nullptr, 0, nullptr, nullptr); _parse_asn1(m_context, cert, buffer.data(), buffer.size(), 1, fields, nullptr, 0, nullptr, nullptr);
#ifdef TLS_DEBUG dbgln<debug_tls>("Certificate issued for {} by {}", cert.subject, cert.issuer_subject);
dbg() << "Certificate issued for " << cert.subject << " by " << cert.issuer_subject;
#endif
return cert; return cert;
} }
@ -459,9 +454,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
u32 certificate_total_length = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2]; u32 certificate_total_length = buffer[0] * 0x10000 + buffer[1] * 0x100 + buffer[2];
#ifdef TLS_DEBUG dbgln<debug_tls>("total length: {}", certificate_total_length);
dbg() << "total length: " << certificate_total_length;
#endif
if (certificate_total_length <= 4) if (certificate_total_length <= 4)
return 3 * certificate_total_length; return 3 * certificate_total_length;
@ -508,7 +501,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
} }
++certificates_in_chain; ++certificates_in_chain;
if (buffer.size() < (size_t)res_cert + 3) { if (buffer.size() < (size_t)res_cert + 3) {
dbg() << "not enough data to read cert size (" << buffer.size() << " < " << res_cert + 3 << ")"; dbgln("not enough data to read cert size ({} < {})", buffer.size(), res_cert + 3);
break; break;
} }
size_t certificate_size_specific = buffer[res_cert] * 0x10000 + buffer[res_cert + 1] * 0x100 + buffer[res_cert + 2]; size_t certificate_size_specific = buffer[res_cert] * 0x10000 + buffer[res_cert + 1] * 0x100 + buffer[res_cert + 2];
@ -516,7 +509,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
remaining -= 3; remaining -= 3;
if (certificate_size_specific > remaining) { if (certificate_size_specific > remaining) {
dbg() << "invalid certificate size (expected " << remaining << " but got " << certificate_size_specific << ")"; dbgln("invalid certificate size (expected {} but got {})", remaining, certificate_size_specific);
break; break;
} }
remaining -= certificate_size_specific; remaining -= certificate_size_specific;
@ -531,7 +524,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
res_cert += certificate_size_specific; res_cert += certificate_size_specific;
} while (remaining > 0); } while (remaining > 0);
if (remaining) { if (remaining) {
dbg() << "extraneous " << remaining << " bytes left over after parsing certificates"; dbgln("extraneous {} bytes left over after parsing certificates", remaining);
} }
size -= certificate_size + 3; size -= certificate_size + 3;
res += certificate_size; res += certificate_size;
@ -540,7 +533,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
return (i8)Error::UnsupportedCertificate; return (i8)Error::UnsupportedCertificate;
if ((size_t)res != buffer.size()) if ((size_t)res != buffer.size())
dbg() << "some data left unread: " << (size_t)res << " bytes out of " << buffer.size(); dbgln("some data left unread: {} bytes out of {}", res, buffer.size());
return res; return res;
} }
@ -548,7 +541,7 @@ ssize_t TLSv12::handle_certificate(ReadonlyBytes buffer)
void TLSv12::consume(ReadonlyBytes record) void TLSv12::consume(ReadonlyBytes record)
{ {
if (m_context.critical_error) { if (m_context.critical_error) {
dbg() << "There has been a critical error (" << (i8)m_context.critical_error << "), refusing to continue"; dbgln("There has been a critical error ({}), refusing to continue", (i8)m_context.critical_error);
return; return;
} }
@ -556,9 +549,7 @@ void TLSv12::consume(ReadonlyBytes record)
return; return;
} }
#ifdef TLS_DEBUG dbgln<debug_tls>("Consuming {} bytes", record.size());
dbg() << "Consuming " << record.size() << " bytes";
#endif
m_context.message_buffer.append(record.data(), record.size()); m_context.message_buffer.append(record.data(), record.size());
@ -567,29 +558,27 @@ void TLSv12::consume(ReadonlyBytes record)
size_t size_offset { 3 }; // read the common record header size_t size_offset { 3 }; // read the common record header
size_t header_size { 5 }; size_t header_size { 5 };
#ifdef TLS_DEBUG
dbg() << "message buffer length " << buffer_length; dbgln<debug_tls>("message buffer length {}", buffer_length);
#endif
while (buffer_length >= 5) { while (buffer_length >= 5) {
auto length = AK::convert_between_host_and_network_endian(*(u16*)m_context.message_buffer.offset_pointer(index + size_offset)) + header_size; auto length = AK::convert_between_host_and_network_endian(*(u16*)m_context.message_buffer.offset_pointer(index + size_offset)) + header_size;
if (length > buffer_length) { if (length > buffer_length) {
#ifdef TLS_DEBUG dbgln<debug_tls>("Need more data: {} > {}", length, buffer_length);
dbg() << "Need more data: " << length << " | " << buffer_length;
#endif
break; break;
} }
auto consumed = handle_message(m_context.message_buffer.bytes().slice(index, length)); auto consumed = handle_message(m_context.message_buffer.bytes().slice(index, length));
#ifdef TLS_DEBUG if constexpr (debug_tls) {
if (consumed > 0) if (consumed > 0)
dbg() << "consumed " << (size_t)consumed << " bytes"; dbgln("consumed {} bytes", consumed);
else else
dbg() << "error: " << (int)consumed; dbgln("error: {}", consumed);
#endif }
if (consumed != (i8)Error::NeedMoreData) { if (consumed != (i8)Error::NeedMoreData) {
if (consumed < 0) { if (consumed < 0) {
dbg() << "Consumed an error: " << (int)consumed; dbgln("Consumed an error: {}", consumed);
if (!m_context.critical_error) if (!m_context.critical_error)
m_context.critical_error = (i8)consumed; m_context.critical_error = (i8)consumed;
m_context.error_code = (Error)consumed; m_context.error_code = (Error)consumed;
@ -608,7 +597,7 @@ void TLSv12::consume(ReadonlyBytes record)
} }
} }
if (m_context.error_code != Error::NoError && m_context.error_code != Error::NeedMoreData) { if (m_context.error_code != Error::NoError && m_context.error_code != Error::NeedMoreData) {
dbg() << "consume error: " << (i8)m_context.error_code; dbgln("consume error: {}", (i8)m_context.error_code);
m_context.message_buffer.clear(); m_context.message_buffer.clear();
return; return;
} }
@ -639,7 +628,7 @@ void TLSv12::ensure_hmac(size_t digest_size, bool local)
hash_kind = Crypto::Hash::HashKind::SHA512; hash_kind = Crypto::Hash::HashKind::SHA512;
break; break;
default: default:
dbg() << "Failed to find a suitable hash for size " << digest_size; dbgln("Failed to find a suitable hash for size {}", digest_size);
break; break;
} }
@ -656,14 +645,14 @@ bool Certificate::is_valid() const
if (!not_before.is_empty()) { if (!not_before.is_empty()) {
if (now.is_before(not_before)) { if (now.is_before(not_before)) {
dbg() << "certificate expired (not yet valid, signed for " << not_before << ")"; dbgln("certificate expired (not yet valid, signed for {})", not_before);
return false; return false;
} }
} }
if (!not_after.is_empty()) { if (!not_after.is_empty()) {
if (!now.is_before(not_after)) { if (!now.is_before(not_after)) {
dbg() << "certificate expired (expiry date " << not_after << ")"; dbgln("certificate expired (expiry date {})", not_after);
return false; return false;
} }
} }
@ -677,13 +666,13 @@ void TLSv12::try_disambiguate_error() const
switch ((AlertDescription)m_context.critical_error) { switch ((AlertDescription)m_context.critical_error) {
case AlertDescription::HandshakeFailure: case AlertDescription::HandshakeFailure:
if (!m_context.cipher_spec_set) { if (!m_context.cipher_spec_set) {
dbg() << "- No cipher suite in common with " << m_context.SNI; dbgln("- No cipher suite in common with {}", m_context.SNI);
} else { } else {
dbgln("- Unknown internal issue"); dbgln("- Unknown internal issue");
} }
break; break;
case AlertDescription::InsufficientSecurity: case AlertDescription::InsufficientSecurity:
dbg() << "- No cipher suite in common with " << m_context.SNI << " (the server is oh so secure)"; dbgln("- No cipher suite in common with {} (the server is oh so secure)", m_context.SNI);
break; break;
case AlertDescription::ProtocolVersion: case AlertDescription::ProtocolVersion:
dbgln("- The server refused to negotiate with TLS 1.2 :("); dbgln("- The server refused to negotiate with TLS 1.2 :(");
@ -739,7 +728,7 @@ void TLSv12::set_root_certificates(Vector<Certificate> certificates)
for (auto& cert : certificates) { for (auto& cert : certificates) {
if (!cert.is_valid()) if (!cert.is_valid())
dbg() << "Certificate for " << cert.subject << " by " << cert.issuer_subject << " is invalid, things may or may not work!"; dbgln("Certificate for {} by {} is invalid, things may or may not work!", cert.subject, cert.issuer_subject);
// FIXME: Figure out what we should do when our root certs are invalid. // FIXME: Figure out what we should do when our root certs are invalid.
} }
m_context.root_ceritificates = move(certificates); m_context.root_ceritificates = move(certificates);
@ -774,18 +763,18 @@ bool Context::verify_chain() const
for (auto& it : chain) { for (auto& it : chain) {
if (it.key == it.value) { // Allow self-signed certificates. if (it.key == it.value) { // Allow self-signed certificates.
if (!roots.contains(it.key)) if (!roots.contains(it.key))
dbg() << "Self-signed warning: Certificate for " << it.key << " is self-signed"; dbgln("Self-signed warning: Certificate for {} is self-signed", it.key);
continue; continue;
} }
auto ref = chain.get(it.value); auto ref = chain.get(it.value);
if (!ref.has_value()) { if (!ref.has_value()) {
dbg() << "Certificate for " << it.key << " is not signed by anyone we trust (" << it.value << ")"; dbgln("Certificate for {} is not signed by anyone we trust ({})", it.key, it.value);
return false; return false;
} }
if (ref.value() == it.key) // Allow (but warn about) mutually recursively signed cert A <-> B. if (ref.value() == it.key) // Allow (but warn about) mutually recursively signed cert A <-> B.
dbg() << "Co-dependency warning: Certificate for " << ref.value() << " is issued by " << it.key << ", which itself is issued by " << ref.value(); dbgln("Co-dependency warning: Certificate for {} is issued by {}, which itself is issued by {}", ref.value(), it.key, ref.value());
} }
return true; return true;

View file

@ -25,6 +25,7 @@
*/ */
#include <AK/ByteBuffer.h> #include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/GenericLexer.h> #include <AK/GenericLexer.h>
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <AK/LexicalPath.h> #include <AK/LexicalPath.h>
@ -373,23 +374,30 @@ int main(int argc, char** argv)
interface->fully_qualified_name = interface->name; interface->fully_qualified_name = interface->name;
} }
#if 0 if constexpr (debug_wrapper_generator) {
dbgln("Attributes:"); dbgln("Attributes:");
for (auto& attribute : interface->attributes) { for (auto& attribute : interface->attributes) {
dbg() << " " << (attribute.readonly ? "Readonly " : "") dbgln(" {}{}{} {}",
<< attribute.type.name << (attribute.type.nullable ? "?" : "") attribute.readonly ? "readonly " : "",
<< " " << attribute.name; attribute.type.name,
} attribute.type.nullable ? "?" : "",
attribute.name);
}
dbgln("Functions:"); dbgln("Functions:");
for (auto& function : interface->functions) { for (auto& function : interface->functions) {
dbg() << " " << function.return_type.name << (function.return_type.nullable ? "?" : "") dbgln(" {}{} {}",
<< " " << function.name; function.return_type.name,
for (auto& parameter : function.parameters) { function.return_type.nullable ? "?" : "",
dbg() << " " << parameter.type.name << (parameter.type.nullable ? "?" : "") << " " << parameter.name; function.name);
for (auto& parameter : function.parameters) {
dbgln(" {}{} {}",
parameter.type.name,
parameter.type.nullable ? "?" : "",
parameter.name);
}
} }
} }
#endif
if (header_mode) if (header_mode)
generate_header(*interface); generate_header(*interface);

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <AK/Debug.h>
#include <LibGUI/Button.h> #include <LibGUI/Button.h>
#include <LibGUI/TextBox.h> #include <LibGUI/TextBox.h>
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
@ -71,15 +72,15 @@ void HTMLIFrameElement::load_src(const String& value)
{ {
auto url = document().complete_url(value); auto url = document().complete_url(value);
if (!url.is_valid()) { if (!url.is_valid()) {
dbg() << "iframe failed to load URL: Invalid URL: " << value; dbgln("iframe failed to load URL: Invalid URL: {}", value);
return; return;
} }
if (url.protocol() == "file" && document().origin().protocol() != "file") { if (url.protocol() == "file" && document().origin().protocol() != "file") {
dbg() << "iframe failed to load URL: Security violation: " << document().url() << " may not load " << url; dbgln("iframe failed to load URL: Security violation: {} may not load {}", document().url(), url);
return; return;
} }
dbg() << "Loading iframe document from " << value; dbgln("Loading iframe document from {}", value);
m_content_frame->loader().load(url, FrameLoader::Type::IFrame); m_content_frame->loader().load(url, FrameLoader::Type::IFrame);
} }

View file

@ -25,6 +25,7 @@
*/ */
#include <AK/ByteBuffer.h> #include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <AK/URL.h> #include <AK/URL.h>
#include <LibCore/File.h> #include <LibCore/File.h>
#include <LibWeb/CSS/Parser/CSSParser.h> #include <LibWeb/CSS/Parser/CSSParser.h>
@ -61,11 +62,11 @@ void HTMLLinkElement::resource_did_load()
if (!resource()->has_encoded_data()) if (!resource()->has_encoded_data())
return; return;
dbg() << "HTMLLinkElement: Resource did load, looks good! " << href(); dbgln("HTMLLinkElement: Resource did load, looks good! {}", href());
auto sheet = parse_css(CSS::ParsingContext(document()), resource()->encoded_data()); auto sheet = parse_css(CSS::ParsingContext(document()), resource()->encoded_data());
if (!sheet) { if (!sheet) {
dbg() << "HTMLLinkElement: Failed to parse stylesheet: " << href(); dbgln("HTMLLinkElement: Failed to parse stylesheet: {}", href());
return; return;
} }

View file

@ -26,6 +26,7 @@
//#define PARSER_DEBUG //#define PARSER_DEBUG
#include <AK/Debug.h>
#include <AK/Utf32View.h> #include <AK/Utf32View.h>
#include <LibTextCodec/Decoder.h> #include <LibTextCodec/Decoder.h>
#include <LibWeb/DOM/Comment.h> #include <LibWeb/DOM/Comment.h>
@ -47,9 +48,9 @@
namespace Web::HTML { namespace Web::HTML {
#define PARSE_ERROR() \ #define PARSE_ERROR() \
do { \ do { \
dbg() << "Parse error! " << __PRETTY_FUNCTION__ << " @ " << __LINE__; \ dbgln("Parse error! {} @ {}", __PRETTY_FUNCTION__, __LINE__); \
} while (0) } while (0)
static Vector<FlyString> s_quirks_public_ids = { static Vector<FlyString> s_quirks_public_ids = {
@ -142,9 +143,8 @@ void HTMLDocumentParser::run(const URL& url)
break; break;
auto& token = optional_token.value(); auto& token = optional_token.value();
#ifdef PARSER_DEBUG dbgln<debug_parser>("[{}] {}", insertion_mode_name(), token.to_string());
dbg() << "[" << insertion_mode_name() << "] " << token.to_string();
#endif
// FIXME: If the adjusted current node is a MathML text integration point and the token is a start tag whose tag name is neither "mglyph" nor "malignmark" // FIXME: If the adjusted current node is a MathML text integration point and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"
// FIXME: If the adjusted current node is a MathML text integration point and the token is a character token // FIXME: If the adjusted current node is a MathML text integration point and the token is a character token
// FIXME: If the adjusted current node is a MathML annotation-xml element and the token is a start tag whose tag name is "svg" // FIXME: If the adjusted current node is a MathML annotation-xml element and the token is a start tag whose tag name is "svg"
@ -159,9 +159,7 @@ void HTMLDocumentParser::run(const URL& url)
} }
if (m_stop_parsing) { if (m_stop_parsing) {
#ifdef PARSER_DEBUG dbgln<debug_parser>("Stop parsing{}! :^)", m_parsing_fragment ? " fragment" : "");
dbg() << "Stop parsing" << (m_parsing_fragment ? " fragment" : "") << "! :^)";
#endif
break; break;
} }
} }
@ -1407,7 +1405,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
generate_implied_end_tags(HTML::TagNames::li); generate_implied_end_tags(HTML::TagNames::li);
if (current_node().local_name() != HTML::TagNames::li) { if (current_node().local_name() != HTML::TagNames::li) {
PARSE_ERROR(); PARSE_ERROR();
dbg() << "Expected <li> current node, but had <" << current_node().local_name() << ">"; dbgln("Expected <li> current node, but had <{}>", current_node().local_name());
} }
m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::li); m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::li);
return; return;

View file

@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <AK/Debug.h>
#include <LibTextCodec/Decoder.h> #include <LibTextCodec/Decoder.h>
#include <LibWeb/HTML/Parser/Entities.h> #include <LibWeb/HTML/Parser/Entities.h>
#include <LibWeb/HTML/Parser/HTMLToken.h> #include <LibWeb/HTML/Parser/HTMLToken.h>
@ -35,12 +36,10 @@ namespace Web::HTML {
#pragma GCC diagnostic ignored "-Wunused-label" #pragma GCC diagnostic ignored "-Wunused-label"
//#define TOKENIZER_TRACE
#ifdef TOKENIZER_TRACE #ifdef TOKENIZER_TRACE
# define PARSE_ERROR() \ # define PARSE_ERROR() \
do { \ do { \
dbg() << "Parse error (tokenization)" << __PRETTY_FUNCTION__ << " @ " << __LINE__; \ dbgln("Parse error (tokenization) {} @ {}", __PRETTY_FUNCTION__, __LINE__) \
} while (0) } while (0)
#else #else
# define PARSE_ERROR() # define PARSE_ERROR()
@ -222,9 +221,7 @@ Optional<u32> HTMLTokenizer::next_code_point()
return {}; return {};
m_prev_utf8_iterator = m_utf8_iterator; m_prev_utf8_iterator = m_utf8_iterator;
++m_utf8_iterator; ++m_utf8_iterator;
#ifdef TOKENIZER_TRACE dbgln<debug_trace_tokenizer>("(Tokenizer) Next code_point: {}", (char)*m_prev_utf8_iterator);
dbg() << "(Tokenizer) Next code_point: " << (char)*m_prev_utf8_iterator;
#endif
return *m_prev_utf8_iterator; return *m_prev_utf8_iterator;
} }
@ -2621,23 +2618,17 @@ HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding)
void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state) void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state)
{ {
#ifdef TOKENIZER_TRACE dbgln<debug_trace_tokenizer>("[{}] Switch to {}", state_name(m_state), state_name(new_state));
dbg() << "[" << state_name(m_state) << "] Switch to " << state_name(new_state);
#endif
} }
void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state) void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state)
{ {
#ifdef TOKENIZER_TRACE dbgln<debug_trace_tokenizer>("[{}] Reconsume in {}", state_name(m_state), state_name(new_state));
dbg() << "[" << state_name(m_state) << "] Reconsume in " << state_name(new_state);
#endif
} }
void HTMLTokenizer::switch_to(Badge<HTMLDocumentParser>, State new_state) void HTMLTokenizer::switch_to(Badge<HTMLDocumentParser>, State new_state)
{ {
#ifdef TOKENIZER_TRACE dbgln<debug_trace_tokenizer>("[{}] Parser switches tokenizer state to {}", state_name(m_state), state_name(new_state));
dbg() << "[" << state_name(m_state) << "] Parser switches tokenizer state to " << state_name(new_state);
#endif
m_state = new_state; m_state = new_state;
} }

View file

@ -26,6 +26,7 @@
#include "WebContentClient.h" #include "WebContentClient.h"
#include "OutOfProcessWebView.h" #include "OutOfProcessWebView.h"
#include <AK/Debug.h>
namespace Web { namespace Web {
@ -55,9 +56,7 @@ void WebContentClient::handle([[maybe_unused]] const Messages::WebContentClient:
void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateContentRect& message) void WebContentClient::handle(const Messages::WebContentClient::DidInvalidateContentRect& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentClient::DidInvalidateContentRect! content_rect={}", message.content_rect());
dbg() << "handle: WebContentClient::DidInvalidateContentRect! content_rect=" << message.content_rect();
#endif
// FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting // FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting
m_view.notify_server_did_invalidate_content_rect({}, message.content_rect()); m_view.notify_server_did_invalidate_content_rect({}, message.content_rect());
@ -73,33 +72,25 @@ void WebContentClient::handle(const Messages::WebContentClient::DidChangeSelecti
void WebContentClient::handle(const Messages::WebContentClient::DidLayout& message) void WebContentClient::handle(const Messages::WebContentClient::DidLayout& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentClient::DidLayout! content_size={}", message.content_size());
dbg() << "handle: WebContentClient::DidLayout! content_size=" << message.content_size();
#endif
m_view.notify_server_did_layout({}, message.content_size()); m_view.notify_server_did_layout({}, message.content_size());
} }
void WebContentClient::handle(const Messages::WebContentClient::DidChangeTitle& message) void WebContentClient::handle(const Messages::WebContentClient::DidChangeTitle& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentClient::DidChangeTitle! title={}", message.title());
dbg() << "handle: WebContentClient::DidChangeTitle! title=" << message.title();
#endif
m_view.notify_server_did_change_title({}, message.title()); m_view.notify_server_did_change_title({}, message.title());
} }
void WebContentClient::handle(const Messages::WebContentClient::DidRequestScrollIntoView& message) void WebContentClient::handle(const Messages::WebContentClient::DidRequestScrollIntoView& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentClient::DidRequestScrollIntoView! rect={}", message.rect());
dbg() << "handle: WebContentClient::DidRequestScrollIntoView! rect=" << message.rect();
#endif
m_view.notify_server_did_request_scroll_into_view({}, message.rect()); m_view.notify_server_did_request_scroll_into_view({}, message.rect());
} }
void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& message) void WebContentClient::handle(const Messages::WebContentClient::DidHoverLink& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentClient::DidHoverLink! url={}", message.url());
dbg() << "handle: WebContentClient::DidHoverLink! url=" << message.url();
#endif
m_view.notify_server_did_hover_link({}, message.url()); m_view.notify_server_did_hover_link({}, message.url());
} }