diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index e647c231193..1e0f0d0f4cb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -132,7 +132,7 @@ void HTMLScriptElement::prepare_script() // 4. If parser document is non-null and the element does not have an async attribute, then set the element's "non-blocking" flag to true. if (parser_document && !has_attribute(HTML::AttributeNames::async)) { - m_non_blocking = true; + m_force_async = true; } // 5. Let source text be the element's child text content. @@ -184,7 +184,7 @@ void HTMLScriptElement::prepare_script() // 9. If parser document is non-null, then set the element's parser document back to parser document and set the element's "non-blocking" flag to false. if (parser_document) { m_parser_document = parser_document; - m_non_blocking = false; + m_force_async = false; } // 10. Set the element's "already started" flag. @@ -366,8 +366,8 @@ void HTMLScriptElement::prepare_script() // -> If the script's type is "classic", and the element has a src attribute, and the element does not have an async attribute, and the element does not have the "non-blocking" flag set // -> If the script's type is "module", and the element does not have an async attribute, and the element does not have the "non-blocking" flag set - else if ((m_script_type == ScriptType::Classic && has_attribute(HTML::AttributeNames::src) && !has_attribute(HTML::AttributeNames::async) && !m_non_blocking) - || (m_script_type == ScriptType::Module && !has_attribute(HTML::AttributeNames::async) && !m_non_blocking)) { + else if ((m_script_type == ScriptType::Classic && has_attribute(HTML::AttributeNames::src) && !has_attribute(HTML::AttributeNames::async) && !m_force_async) + || (m_script_type == ScriptType::Module && !has_attribute(HTML::AttributeNames::async) && !m_force_async)) { // Add the element to the end of the list of scripts that will execute in order as soon as possible associated with the element's preparation-time document. m_preparation_time_document->add_script_to_execute_in_order_as_soon_as_possible({}, *this); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h index 0deedae34fa..94d37a041e2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h @@ -21,7 +21,7 @@ class HTMLScriptElement final public: virtual ~HTMLScriptElement() override; - bool is_non_blocking() const { return m_non_blocking; } + bool is_force_async() const { return m_force_async; } bool is_ready_to_be_parser_executed() const { return m_ready_to_be_parser_executed; } bool failed_to_load() const { return m_failed_to_load; } @@ -29,7 +29,7 @@ public: void set_parser_document(Badge, DOM::Document& document) { m_parser_document = &document; } template T> - void set_non_blocking(Badge, bool b) { m_non_blocking = b; } + void set_force_async(Badge, bool b) { m_force_async = b; } template T> void set_already_started(Badge, bool b) { m_already_started = b; } @@ -71,7 +71,7 @@ public: JS::GCPtr m_preparation_time_document; // https://html.spec.whatwg.org/multipage/scripting.html#script-force-async - bool m_non_blocking { false }; + bool m_force_async { false }; // https://html.spec.whatwg.org/multipage/scripting.html#already-started bool m_already_started { false }; diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 62e042e8cc1..8939464015b 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -806,7 +806,7 @@ void HTMLParser::handle_in_head(HTMLToken& token) auto element = create_element_for(token, Namespace::HTML, *adjusted_insertion_location.parent); auto& script_element = verify_cast(*element); script_element.set_parser_document(Badge {}, document()); - script_element.set_non_blocking(Badge {}, false); + script_element.set_force_async(Badge {}, false); script_element.set_source_line_number({}, token.start_position().line + 1); // FIXME: This +1 is incorrect for script tags whose script does not start on a new line if (m_parsing_fragment) { diff --git a/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp b/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp index dd808688d51..1c3f70f9ae8 100644 --- a/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp +++ b/Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp @@ -66,12 +66,12 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap(*node); script_element.set_parser_document(Badge {}, m_document); - script_element.set_non_blocking(Badge {}, false); + script_element.set_force_async(Badge {}, false); } if (HTML::TagNames::template_ == m_current_node->node_name()) { // When an XML parser would append a node to a template element, it must instead append it to the template element's template contents (a DocumentFragment node).