LibWeb: Update spec comments using "Type(Foo)" -> "is a Foo"

This commit is contained in:
Sam Atkins 2024-10-31 11:34:22 +00:00 committed by Alexander Kalenik
commit f31c18756b
Notes: github-actions[bot] 2024-10-31 13:02:41 +00:00
5 changed files with 12 additions and 12 deletions

View file

@ -60,7 +60,7 @@ static JS::ThrowCompletionOr<Vector<String>> convert_value_to_sequence_of_string
{
// FIXME: De-duplicate this from the IDL generator.
// An ECMAScript value V is converted to an IDL sequence<T> value as follows:
// 1. If Type(V) is not Object, throw a TypeError.
// 1. If V is not an Object, throw a TypeError.
if (!value.is_object())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, value.to_string_without_side_effects());
@ -188,7 +188,7 @@ JS::ThrowCompletionOr<void> CustomElementRegistry::define(String const& name, We
// 1. Let prototype be ? Get(constructor, "prototype").
auto prototype_value = TRY(constructor->callback->get(vm.names.prototype));
// 2. If Type(prototype) is not Object, then throw a TypeError exception.
// 2. If prototype is not an Object, then throw a TypeError exception.
if (!prototype_value.is_object())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObject, prototype_value.to_string_without_side_effects());

View file

@ -229,7 +229,7 @@ struct SerializeBitmapResult {
static ErrorOr<SerializeBitmapResult> serialize_bitmap(Gfx::Bitmap const& bitmap, StringView type, Optional<double> quality)
{
// If type is an image format that supports variable quality (such as "image/jpeg"), quality is given, and type is not "image/png", then,
// if Type(quality) is Number, and quality is in the range 0.0 to 1.0 inclusive, the user agent must treat quality as the desired quality level.
// if quality is a Number in the range 0.0 to 1.0 inclusive, the user agent must treat quality as the desired quality level.
// Otherwise, the user agent must use its default quality value, as if the quality argument had not been given.
if (quality.has_value() && !(*quality >= 0.0 && *quality <= 1.0))
quality = OptionalNone {};

View file

@ -169,7 +169,7 @@ public:
auto deep = false;
bool return_primitive_type = true;
// 4. If Type(value) is Undefined, Null, Boolean, Number, BigInt, or String, then return { [[Type]]: "primitive", [[Value]]: value }.
// 4. If value is undefined, null, a Boolean, a Number, a BigInt, or a String, then return { [[Type]]: "primitive", [[Value]]: value }.
if (value.is_undefined()) {
serialize_enum(m_serialized, ValueTag::UndefinedPrimitive);
} else if (value.is_null()) {
@ -193,7 +193,7 @@ public:
if (return_primitive_type)
return m_serialized;
// 5. If Type(value) is Symbol, then throw a "DataCloneError" DOMException.
// 5. If value is a Symbol, then throw a "DataCloneError" DOMException.
if (value.is_symbol())
return WebIDL::DataCloneError::create(*m_vm.current_realm(), "Cannot serialize Symbol"_string);