LibWeb: Fix various typos

Corresponds to:
- https://github.com/whatwg/html/pull/10934
- https://github.com/whatwg/html/pull/10950
This commit is contained in:
Sam Atkins 2025-01-29 17:15:00 +00:00
parent c5d793c4a9
commit 3775f3399c
Notes: github-actions[bot] 2025-01-30 15:01:16 +00:00
13 changed files with 25 additions and 26 deletions

View file

@ -198,9 +198,9 @@ static GC::Ref<HTML::BrowsingContext> obtain_a_browsing_context_to_use_for_a_nav
// 9. If swapGroup is false, then:
if (!swap_group) {
// 1. If coopEnforcementResult's would need a browsing context group switch due to report-only is true,
// set browsing context's virtual browsing context group ID to a new unique identifier.
// set browsingContext's virtual browsing context group ID to a new unique identifier.
if (coop_enforcement_result.would_need_a_browsing_context_group_switch_due_to_report_only) {
// FIXME: set browsing context's virtual browsing context group ID to a new unique identifier.
// FIXME: set browsingContext's virtual browsing context group ID to a new unique identifier.
}
// 2. Return browsingContext.
@ -3945,7 +3945,7 @@ void Document::destroy_a_document_and_its_descendants(GC::Ptr<GC::Function<void(
// 3. Let numberDestroyed be 0.
IGNORE_USE_IN_ESCAPING_LAMBDA size_t number_destroyed = 0;
// 4. For each childNavigable of childNavigable's, queue a global task on the navigation and traversal task source
// 4. For each childNavigable of childNavigables, queue a global task on the navigation and traversal task source
// given childNavigable's active window to perform the following steps:
for (auto& child_navigable : child_navigables) {
HTML::queue_global_task(HTML::Task::Source::NavigationAndTraversal, *child_navigable->active_window(), GC::create_function(heap(), [&heap = heap(), &number_destroyed, child_navigable = child_navigable.ptr()] {

View file

@ -224,8 +224,7 @@ JS::ThrowCompletionOr<bool> cross_origin_set(JS::VM& vm, JS::Object& object, JS:
// 3. If desc.[[Set]] is present and its value is not undefined, then:
if (descriptor->set.has_value() && *descriptor->set) {
// FIXME: Spec issue, `setter` isn't being defined.
// 1. Perform ? Call(setter, Receiver, «V»).
// 1. Perform ? Call(desc.[[Set]], Receiver, « V »).
TRY(JS::call(vm, *descriptor->set, receiver, value));
// 2. Return true.

View file

@ -124,7 +124,7 @@ WebIDL::ExceptionOr<void> HTMLDialogElement::show()
if (has_attribute(AttributeNames::open))
return {};
// 5. Queue a dialog toggle event task given subject, "closed", and "open".
// 5. Queue a dialog toggle event task given this, "closed", and "open".
queue_a_dialog_toggle_event_task("closed"_string, "open"_string);
// 6. Add an open attribute to this, whose value is the empty string.

View file

@ -496,7 +496,7 @@ ErrorOr<void> HTMLImageElement::update_the_image_data(bool restart_animations, b
// then abort the image request for the current request and the pending request,
// set current request's state to unavailable, set pending request to null, and return.
// 3. Let previous URL be the current request's current URL.
// 3. Let previousURL be the current request's current URL.
auto previous_url = m_current_request->current_url();
// 4. Let selected source be null and selected pixel density be undefined.
@ -549,7 +549,7 @@ ErrorOr<void> HTMLImageElement::update_the_image_data(bool restart_animations, b
m_current_request->set_image_data(entry->image_data);
m_current_request->set_state(ImageRequest::State::CompletelyAvailable);
// 5. Prepare current request for presentation given img.
// 5. Prepare current request for presentation given the img element.
m_current_request->prepare_for_presentation(*this);
// 6. Set current request's current pixel density to selected pixel density.

View file

@ -1399,7 +1399,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::handle_src_attribute(String const& v
request->set_credentials_mode(Fetch::Infrastructure::Request::CredentialsMode::Include);
request->set_use_url_credentials(true);
// 4. Fetch request, with processResponseEndOfBody set to the following step given response response:
// 4. Fetch request, with processResponseEndOfBody set to the following steps given response response:
m_resource_request = SharedResourceRequest::get_or_create(realm, document().page(), request->url());
m_resource_request->add_callbacks(
[this, &realm]() {
@ -2376,13 +2376,15 @@ WebIDL::ExceptionOr<void> HTMLInputElement::step_up_or_down(bool is_down, WebIDL
}
// 8. If the element has a minimum, and value is less than that minimum, then set value to the smallest value that,
// when subtracted from the step base, is an integral multiple of the allowed value step, and that is more than or equal to minimum.
// when subtracted from the step base, is an integral multiple of the allowed value step, and that is more than
// or equal to that minimum.
if (maybe_minimum.has_value() && value < *maybe_minimum) {
value = AK::max(value, *maybe_minimum);
}
// 9. If the element has a maximum, and value is greater than that maximum, then set value to the largest value that,
// when subtracted from the step base, is an integral multiple of the allowed value step, and that is less than or equal to maximum.
// when subtracted from the step base, is an integral multiple of the allowed value step, and that is less than
// or equal to that maximum.
if (maybe_maximum.has_value() && value > *maybe_maximum) {
value = AK::min(value, *maybe_maximum);
}

View file

@ -98,7 +98,7 @@ void HTMLOrSVGElement<ElementBase>::inserted()
[[maybe_unused]] auto policy_container = element.shadow_including_root().document().policy_container();
// FIXME: 2. If CSP list contains a header-delivered Content Security Policy, and element has a
// nonce content attribute attr whose value is not the empty string, then:
// nonce content attribute whose value is not the empty string, then:
if (true && element.has_attribute(HTML::AttributeNames::nonce)) {
// 2.1. Let nonce be element's [[CryptographicNonce]].
auto nonce = m_cryptographic_nonce;

View file

@ -65,7 +65,7 @@ GC::Ptr<MimeType> MimeTypeArray::item(u32 index) const
auto& window = as<HTML::Window>(HTML::relevant_global_object(*this));
auto mime_types = window.pdf_viewer_mime_type_objects();
// 2. If index < mimeType's size, then return mimeTypes[index].
// 2. If index < mimeTypes's size, then return mimeTypes[index].
if (index < mime_types.size())
return mime_types[index];

View file

@ -605,8 +605,7 @@ GC::Ref<NavigationAPIMethodTracker> Navigation::add_an_upcoming_traverse_api_met
/* .committed_promise = */ committed_promise,
/* .finished_promise = */ finished_promise);
// 4. Set navigation's upcoming traverse API method trackers[key] to apiMethodTracker.
// FIXME: Fix spec typo key --> destinationKey
// 4. Set navigation's upcoming traverse API method trackers[destinationKey] to apiMethodTracker.
m_upcoming_traverse_api_method_trackers.set(destination_key, api_method_tracker);
// 5. Return apiMethodTracker.
@ -1116,9 +1115,8 @@ bool Navigation::inner_navigate_event_firing_algorithm(
if (navigation_type == Bindings::NavigationType::Traverse)
m_suppress_scroll_restoration_during_ongoing_navigation = true;
// FIXME: Fix spec typo "serialied"
// 7. If navigationType is "push" or "replace", then run the URL and history update steps given document and
// event's destination's URL, with serialiedData set to event's classic history API state and historyHandling
// event's destination's URL, with serializedData set to event's classic history API state and historyHandling
// set to navigationType.
if (navigation_type == Bindings::NavigationType::Push || navigation_type == Bindings::NavigationType::Replace) {
auto history_handling = navigation_type == Bindings::NavigationType::Push ? HistoryHandlingBehavior::Push : HistoryHandlingBehavior::Replace;

View file

@ -83,7 +83,7 @@ bool StackOfOpenElements::has_in_select_scope(FlyString const& tag_name) const
// https://html.spec.whatwg.org/multipage/parsing.html#has-an-element-in-the-specific-scope
// 1. Initialize node to be the current node (the bottommost node of the stack).
for (auto& node : m_elements.in_reverse()) {
// 2. If node is the target node, terminate in a match state.
// 2. If node is target node, terminate in a match state.
if (node->local_name() == tag_name)
return true;
// 3. Otherwise, if node is one of the element types in list, terminate in a failure state.
@ -92,8 +92,8 @@ bool StackOfOpenElements::has_in_select_scope(FlyString const& tag_name) const
return false;
// 4. Otherwise, set node to the previous entry in the stack of open elements and return to step 2.
}
// [4.] (This will never fail, since the loop will always terminate in the previous step if the top of the stack
// — an html element — is reached.)
// NOTE: This will never fail, since the loop will always terminate in the previous step if the top of the stack
// — an html element — is reached.
VERIFY_NOT_REACHED();
}

View file

@ -89,7 +89,7 @@ GC::Ptr<MimeType> Plugin::item(u32 index) const
auto& window = as<HTML::Window>(HTML::relevant_global_object(*this));
auto mime_types = window.pdf_viewer_mime_type_objects();
// 2. If index < mimeType's size, then return mimeTypes[index].
// 2. If index < mimeTypes's size, then return mimeTypes[index].
if (index < mime_types.size())
return mime_types[index];

View file

@ -29,8 +29,8 @@ create_potential_CORS_request(JS::VM& vm, URL::URL const& url, Optional<Fetch::I
if (cors_attribute_state == CORSSettingAttribute::Anonymous)
credentials_mode = Fetch::Infrastructure::Request::CredentialsMode::SameOrigin;
// 5. Let request be a new request whose URL is url, destination is destination, mode is mode, credentials mode is credentialsMode,
// and whose use-URL-credentials flag is set.
// 5. Return a new request whose URL is url, destination is destination, mode is mode, credentials mode is credentialsMode,
// and whose use-URL-credentials flag is set.
auto request = Fetch::Infrastructure::Request::create(vm);
request->set_url(url);
request->set_destination(destination);

View file

@ -419,7 +419,7 @@ void SourceSet::normalize_source_densities(DOM::Element const& element)
// 2. Otherwise, if the image source has a width descriptor,
// replace the width descriptor with a pixel density descriptor
// with a value of the width descriptor value divided by the source size and a unit of x.
// with a value of the width descriptor value divided by source size and a unit of x.
auto descriptor_value_set = false;
if (image_source.descriptor.has<ImageSource::WidthDescriptorValue>()) {
auto& width_descriptor = image_source.descriptor.get<ImageSource::WidthDescriptorValue>();

View file

@ -958,13 +958,13 @@ TraversableNavigable::CheckIfUnloadingIsCanceledResult TraversableNavigable::che
}
}
// 5. Let totalTasks be the size of documentsThatNeedBeforeunload.
// 5. Let totalTasks be the size of documentsToFireBeforeunload.
IGNORE_USE_IN_ESCAPING_LAMBDA auto total_tasks = documents_to_fire_beforeunload.size();
// 6. Let completedTasks be 0.
IGNORE_USE_IN_ESCAPING_LAMBDA size_t completed_tasks = 0;
// 7. For each document of documents, queue a global task on the navigation and traversal task source given document's relevant global object to run the steps:
// 7. For each document of documentsToFireBeforeunload, queue a global task on the navigation and traversal task source given document's relevant global object to run the steps:
for (auto& document : documents_to_fire_beforeunload) {
queue_global_task(Task::Source::NavigationAndTraversal, relevant_global_object(*document), GC::create_function(heap(), [document, &final_status, &completed_tasks, &unload_prompt_shown] {
// 1. Let (unloadPromptShownForThisDocument, unloadPromptCanceledByThisDocument) be the result of running the steps to fire beforeunload given document and unloadPromptShown.