summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-11-20 14:22:14 +0100
committerAndreas Kling <kling@serenityos.org>2022-11-21 10:08:50 +0100
commit7d45927d412d26637dd17e628ba9c1052e103f43 (patch)
tree22a1ad78da1557a23c59a9646670409ebdc7a9a9 /Userland/Libraries/LibWeb
parent7b9138be55117be1921f9ba2676e50c34b0e511f (diff)
downloadserenity-7d45927d412d26637dd17e628ba9c1052e103f43.zip
LibWeb: Rename HTMLScriptElement "non-blocking" to "force async"
This has been renamed in the spec, so let's do it here too.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp2
-rw-r--r--Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp4
4 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
index e647c23119..1e0f0d0f4c 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 0deedae34f..94d37a041e 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<T>, DOM::Document& document) { m_parser_document = &document; }
template<OneOf<XMLDocumentBuilder, HTMLParser> T>
- void set_non_blocking(Badge<T>, bool b) { m_non_blocking = b; }
+ void set_force_async(Badge<T>, bool b) { m_force_async = b; }
template<OneOf<XMLDocumentBuilder, HTMLParser> T>
void set_already_started(Badge<T>, bool b) { m_already_started = b; }
@@ -71,7 +71,7 @@ public:
JS::GCPtr<DOM::Document> 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 62e042e8cc..8939464015 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<HTMLScriptElement>(*element);
script_element.set_parser_document(Badge<HTMLParser> {}, document());
- script_element.set_non_blocking(Badge<HTMLParser> {}, false);
+ script_element.set_force_async(Badge<HTMLParser> {}, 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 dd808688d5..1c3f70f9ae 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<XML::Name,
auto node = DOM::create_element(m_document, name, {});
// When an XML parser with XML scripting support enabled creates a script element,
- // it must have its parser document set and its "non-blocking" flag must be unset.
+ // it must have its parser document set and its "force async" flag must be unset.
// FIXME: If the parser was created as part of the XML fragment parsing algorithm, then the element must be marked as "already started" also.
if (m_scripting_support == XMLScriptingSupport::Enabled && HTML::TagNames::script == name) {
auto& script_element = static_cast<HTML::HTMLScriptElement&>(*node);
script_element.set_parser_document(Badge<XMLDocumentBuilder> {}, m_document);
- script_element.set_non_blocking(Badge<XMLDocumentBuilder> {}, false);
+ script_element.set_force_async(Badge<XMLDocumentBuilder> {}, 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).