mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -267,7 +267,7 @@ void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLTok
|
|||
handle_after_after_frameset(token);
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ HTMLDocumentParser::AdjustedInsertionLocation HTMLDocumentParser::find_appropria
|
|||
return { downcast<HTMLTemplateElement>(last_template.element)->content(), nullptr };
|
||||
}
|
||||
if (!last_table.element) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
// Guaranteed not to be a template element (it will be the html element),
|
||||
// so no need to check the parent is a template.
|
||||
return { m_stack_of_open_elements.elements().first(), nullptr };
|
||||
|
@ -903,7 +903,7 @@ void HTMLDocumentParser::reconstruct_the_active_formatting_elements()
|
|||
|
||||
ssize_t index = m_list_of_active_formatting_elements.entries().size() - 1;
|
||||
RefPtr<DOM::Element> entry = m_list_of_active_formatting_elements.entries().at(index).element;
|
||||
ASSERT(entry);
|
||||
VERIFY(entry);
|
||||
|
||||
Rewind:
|
||||
if (index == 0) {
|
||||
|
@ -912,7 +912,7 @@ Rewind:
|
|||
|
||||
--index;
|
||||
entry = m_list_of_active_formatting_elements.entries().at(index).element;
|
||||
ASSERT(entry);
|
||||
VERIFY(entry);
|
||||
|
||||
if (!m_stack_of_open_elements.contains(*entry))
|
||||
goto Rewind;
|
||||
|
@ -920,7 +920,7 @@ Rewind:
|
|||
Advance:
|
||||
++index;
|
||||
entry = m_list_of_active_formatting_elements.entries().at(index).element;
|
||||
ASSERT(entry);
|
||||
VERIFY(entry);
|
||||
|
||||
Create:
|
||||
// FIXME: Hold on to the real token!
|
||||
|
@ -1140,7 +1140,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
|
|||
if (m_stack_of_open_elements.elements().size() == 1
|
||||
|| m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body
|
||||
|| m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
return;
|
||||
}
|
||||
m_frameset_ok = false;
|
||||
|
@ -1158,7 +1158,7 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
|
|||
|
||||
if (m_stack_of_open_elements.elements().size() == 1
|
||||
|| m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1863,7 +1863,7 @@ void HTMLDocumentParser::increment_script_nesting_level()
|
|||
|
||||
void HTMLDocumentParser::decrement_script_nesting_level()
|
||||
{
|
||||
ASSERT(m_script_nesting_level);
|
||||
VERIFY(m_script_nesting_level);
|
||||
--m_script_nesting_level;
|
||||
}
|
||||
|
||||
|
@ -1917,7 +1917,7 @@ void HTMLDocumentParser::handle_text(HTMLToken& token)
|
|||
if (the_script->failed_to_load())
|
||||
return;
|
||||
|
||||
ASSERT(the_script->is_ready_to_be_parser_executed());
|
||||
VERIFY(the_script->is_ready_to_be_parser_executed());
|
||||
|
||||
if (m_aborted)
|
||||
return;
|
||||
|
@ -1926,13 +1926,13 @@ void HTMLDocumentParser::handle_text(HTMLToken& token)
|
|||
|
||||
// FIXME: Handle tokenizer insertion point stuff here too.
|
||||
|
||||
ASSERT(script_nesting_level() == 0);
|
||||
VERIFY(script_nesting_level() == 0);
|
||||
increment_script_nesting_level();
|
||||
|
||||
the_script->execute_script();
|
||||
|
||||
decrement_script_nesting_level();
|
||||
ASSERT(script_nesting_level() == 0);
|
||||
VERIFY(script_nesting_level() == 0);
|
||||
m_parser_pause_flag = false;
|
||||
|
||||
// FIXME: Handle tokenizer insertion point stuff here too.
|
||||
|
@ -1955,7 +1955,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_context()
|
|||
m_stack_of_open_elements.pop();
|
||||
|
||||
if (current_node().local_name() == HTML::TagNames::html)
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context()
|
||||
|
@ -1964,7 +1964,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context()
|
|||
m_stack_of_open_elements.pop();
|
||||
|
||||
if (current_node().local_name() == HTML::TagNames::html)
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context()
|
||||
|
@ -1973,7 +1973,7 @@ void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context()
|
|||
m_stack_of_open_elements.pop();
|
||||
|
||||
if (current_node().local_name() == HTML::TagNames::html)
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::handle_in_row(HTMLToken& token)
|
||||
|
@ -2068,7 +2068,7 @@ void HTMLDocumentParser::handle_in_cell(HTMLToken& token)
|
|||
}
|
||||
if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) {
|
||||
if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::td) && !m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::th)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
PARSE_ERROR();
|
||||
return;
|
||||
}
|
||||
|
@ -2109,7 +2109,7 @@ void HTMLDocumentParser::handle_in_table_text(HTMLToken& token)
|
|||
}
|
||||
|
||||
for (auto& pending_token : m_pending_table_character_tokens) {
|
||||
ASSERT(pending_token.is_character());
|
||||
VERIFY(pending_token.is_character());
|
||||
if (!pending_token.is_parser_whitespace()) {
|
||||
// If any of the tokens in the pending table character tokens list
|
||||
// are character tokens that are not ASCII whitespace, then this is a parse error:
|
||||
|
@ -2401,7 +2401,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token)
|
|||
|
||||
if (token.is_end_tag() && token.tag_name() == HTML::TagNames::select) {
|
||||
if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
PARSE_ERROR();
|
||||
return;
|
||||
}
|
||||
|
@ -2414,7 +2414,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token)
|
|||
PARSE_ERROR();
|
||||
|
||||
if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2427,7 +2427,7 @@ void HTMLDocumentParser::handle_in_select(HTMLToken& token)
|
|||
PARSE_ERROR();
|
||||
|
||||
if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2459,7 +2459,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token)
|
|||
{
|
||||
if (token.is_end_tag() && token.tag_name() == HTML::TagNames::caption) {
|
||||
if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
PARSE_ERROR();
|
||||
return;
|
||||
}
|
||||
|
@ -2479,7 +2479,7 @@ void HTMLDocumentParser::handle_in_caption(HTMLToken& token)
|
|||
if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr))
|
||||
|| (token.is_end_tag() && token.tag_name() == HTML::TagNames::table)) {
|
||||
if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
PARSE_ERROR();
|
||||
return;
|
||||
}
|
||||
|
@ -2634,7 +2634,7 @@ void HTMLDocumentParser::handle_in_template(HTMLToken& token)
|
|||
|
||||
if (token.is_end_of_file()) {
|
||||
if (!m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
stop_parsing();
|
||||
return;
|
||||
}
|
||||
|
@ -2849,7 +2849,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken&
|
|||
PARSE_ERROR();
|
||||
for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
|
||||
if (node == m_stack_of_open_elements.first()) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
return;
|
||||
}
|
||||
// FIXME: See the above FIXME
|
||||
|
@ -2870,7 +2870,7 @@ void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken&
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::reset_the_insertion_mode_appropriately()
|
||||
|
@ -2935,14 +2935,14 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately()
|
|||
}
|
||||
|
||||
if (node->local_name() == HTML::TagNames::frameset) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
m_insertion_mode = InsertionMode::InFrameset;
|
||||
return;
|
||||
}
|
||||
|
||||
if (node->local_name() == HTML::TagNames::html) {
|
||||
if (!m_head_element) {
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
m_insertion_mode = InsertionMode::BeforeHead;
|
||||
return;
|
||||
}
|
||||
|
@ -2952,7 +2952,7 @@ void HTMLDocumentParser::reset_the_insertion_mode_appropriately()
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(m_parsing_fragment);
|
||||
VERIFY(m_parsing_fragment);
|
||||
m_insertion_mode = InsertionMode::InBody;
|
||||
}
|
||||
|
||||
|
@ -2965,7 +2965,7 @@ const char* HTMLDocumentParser::insertion_mode_name() const
|
|||
ENUMERATE_INSERTION_MODES
|
||||
#undef __ENUMERATE_INSERTION_MODE
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
DOM::Document& HTMLDocumentParser::document()
|
||||
|
|
|
@ -55,7 +55,7 @@ String HTMLToken::to_string() const
|
|||
builder.append("EndOfFile");
|
||||
break;
|
||||
case HTMLToken::Type::Invalid:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (type() == HTMLToken::Type::StartTag || type() == HTMLToken::Type::EndTag) {
|
||||
|
|
|
@ -75,9 +75,9 @@ public:
|
|||
|
||||
u32 code_point() const
|
||||
{
|
||||
ASSERT(is_character());
|
||||
VERIFY(is_character());
|
||||
Utf8View view(m_comment_or_character.data.string_view());
|
||||
ASSERT(view.length() == 1);
|
||||
VERIFY(view.length() == 1);
|
||||
return *view.begin();
|
||||
}
|
||||
|
||||
|
@ -100,19 +100,19 @@ public:
|
|||
|
||||
String tag_name() const
|
||||
{
|
||||
ASSERT(is_start_tag() || is_end_tag());
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
return m_tag.tag_name.to_string();
|
||||
}
|
||||
|
||||
bool is_self_closing() const
|
||||
{
|
||||
ASSERT(is_start_tag() || is_end_tag());
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
return m_tag.self_closing;
|
||||
}
|
||||
|
||||
bool has_acknowledged_self_closing_flag() const
|
||||
{
|
||||
ASSERT(is_self_closing());
|
||||
VERIFY(is_self_closing());
|
||||
return m_tag.self_closing_acknowledged;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
|
||||
StringView attribute(const FlyString& attribute_name)
|
||||
{
|
||||
ASSERT(is_start_tag() || is_end_tag());
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
for (auto& attribute : m_tag.attributes) {
|
||||
if (attribute_name == attribute.local_name_builder.string_view())
|
||||
return attribute.value_builder.string_view();
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
|
||||
void adjust_tag_name(const FlyString& old_name, const FlyString& new_name)
|
||||
{
|
||||
ASSERT(is_start_tag() || is_end_tag());
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
if (old_name == m_tag.tag_name.string_view()) {
|
||||
m_tag.tag_name.clear();
|
||||
m_tag.tag_name.append(new_name);
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
|
||||
void adjust_attribute_name(const FlyString& old_name, const FlyString& new_name)
|
||||
{
|
||||
ASSERT(is_start_tag() || is_end_tag());
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
for (auto& attribute : m_tag.attributes) {
|
||||
if (old_name == attribute.local_name_builder.string_view()) {
|
||||
attribute.local_name_builder.clear();
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
|
||||
void adjust_foreign_attribute(const FlyString& old_name, const FlyString& prefix, const FlyString& local_name, const FlyString& namespace_)
|
||||
{
|
||||
ASSERT(is_start_tag() || is_end_tag());
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
for (auto& attribute : m_tag.attributes) {
|
||||
if (old_name == attribute.local_name_builder.string_view()) {
|
||||
attribute.prefix_builder.clear();
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
|
||||
void drop_attributes()
|
||||
{
|
||||
ASSERT(is_start_tag() || is_end_tag());
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
m_tag.attributes.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace Web::HTML {
|
|||
{
|
||||
|
||||
#define END_STATE \
|
||||
ASSERT_NOT_REACHED(); \
|
||||
VERIFY_NOT_REACHED(); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
|
@ -2610,7 +2610,7 @@ void HTMLTokenizer::create_new_token(HTMLToken::Type type)
|
|||
HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding)
|
||||
{
|
||||
auto* decoder = TextCodec::decoder_for(encoding);
|
||||
ASSERT(decoder);
|
||||
VERIFY(decoder);
|
||||
m_decoded_input = decoder->to_utf8(input);
|
||||
m_utf8_view = Utf8View(m_decoded_input);
|
||||
m_utf8_iterator = m_utf8_view.begin();
|
||||
|
@ -2640,7 +2640,7 @@ void HTMLTokenizer::will_emit(HTMLToken& token)
|
|||
|
||||
bool HTMLTokenizer::current_end_tag_token_is_appropriate() const
|
||||
{
|
||||
ASSERT(m_current_token.is_end_tag());
|
||||
VERIFY(m_current_token.is_end_tag());
|
||||
if (!m_last_emitted_start_tag.is_start_tag())
|
||||
return false;
|
||||
return m_current_token.tag_name() == m_last_emitted_start_tag.tag_name();
|
||||
|
|
|
@ -152,7 +152,7 @@ private:
|
|||
ENUMERATE_TOKENIZER_STATES
|
||||
#undef __ENUMERATE_TOKENIZER_STATE
|
||||
};
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void will_emit(HTMLToken&);
|
||||
|
|
|
@ -45,7 +45,7 @@ bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vec
|
|||
if (list.contains_slow(node.local_name()))
|
||||
return false;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const
|
||||
|
@ -62,7 +62,7 @@ bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, con
|
|||
if (list.contains_slow(node.local_name()))
|
||||
return false;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue