mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Update spec comments using "Type(Foo)" -> "is a Foo"
This commit is contained in:
parent
00e613c7df
commit
f31c18756b
Notes:
github-actions[bot]
2024-10-31 13:02:41 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/f31c18756bf Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2079
5 changed files with 12 additions and 12 deletions
|
@ -233,7 +233,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::internal_set(JS::PropertyKey const&
|
|||
return true;
|
||||
}
|
||||
|
||||
// 2. If O implements an interface with a named property setter and Type(P) is String, then:
|
||||
// 2. If O implements an interface with a named property setter and P is a String, then:
|
||||
if (m_legacy_platform_object_flags->has_named_property_setter && property_name.is_string()) {
|
||||
// 1. Invoke the named property setter on O with P and V.
|
||||
TRY(throw_dom_exception_if_needed(vm, [&] { return invoke_named_property_setter(MUST(String::from_byte_string(property_name.as_string())), value); }));
|
||||
|
@ -277,7 +277,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::internal_define_own_property(JS::Pro
|
|||
return true;
|
||||
}
|
||||
|
||||
// 2. If O supports named properties, O does not implement an interface with the [Global] extended attribute, Type(P) is String, and P is not an unforgeable property name of O, then:
|
||||
// 2. If O supports named properties, O does not implement an interface with the [Global] extended attribute, P is a String, and P is not an unforgeable property name of O, then:
|
||||
// FIXME: Check if P is not an unforgeable property name of O
|
||||
if (m_legacy_platform_object_flags->supports_named_properties && !m_legacy_platform_object_flags->has_global_interface_extended_attribute && property_name.is_string()) {
|
||||
auto const property_name_as_string = MUST(FlyString::from_deprecated_fly_string(property_name.as_string()));
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -1411,7 +1411,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStream>> readable_stream_from_itera
|
|||
// 4. Return the result of reacting to nextPromise with the following fulfillment steps, given iterResult:
|
||||
auto react_result = WebIDL::react_to_promise(*next_promise,
|
||||
JS::create_heap_function(realm.heap(), [&vm, stream](JS::Value iter_result) -> WebIDL::ExceptionOr<JS::Value> {
|
||||
// 1. If Type(iterResult) is not Object, throw a TypeError.
|
||||
// 1. If iterResult is not an Object, throw a TypeError.
|
||||
if (!iter_result.is_object())
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "iterResult is not an Object"sv };
|
||||
|
||||
|
@ -1468,7 +1468,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStream>> readable_stream_from_itera
|
|||
// 8. Return the result of reacting to returnPromise with the following fulfillment steps, given iterResult:
|
||||
auto react_result = WebIDL::react_to_promise(*return_promise,
|
||||
JS::create_heap_function(realm.heap(), [](JS::Value iter_result) -> WebIDL::ExceptionOr<JS::Value> {
|
||||
// 1. If Type(iterResult) is not Object, throw a TypeError.
|
||||
// 1. If iterResult is not an Object, throw a TypeError.
|
||||
if (!iter_result.is_object())
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "iterResult is not an Object"sv };
|
||||
|
||||
|
@ -5328,7 +5328,7 @@ void transform_stream_unblock_write(TransformStream& stream)
|
|||
// https://streams.spec.whatwg.org/#is-non-negative-number
|
||||
bool is_non_negative_number(JS::Value value)
|
||||
{
|
||||
// 1. If Type(v) is not Number, return false.
|
||||
// 1. If v is not a Number, return false.
|
||||
if (!value.is_number())
|
||||
return false;
|
||||
|
||||
|
@ -5347,7 +5347,7 @@ bool is_non_negative_number(JS::Value value)
|
|||
// https://streams.spec.whatwg.org/#can-transfer-array-buffer
|
||||
bool can_transfer_array_buffer(JS::ArrayBuffer const& array_buffer)
|
||||
{
|
||||
// 1. Assert: Type(O) is Object.
|
||||
// 1. Assert: O is an Object.
|
||||
// 2. Assert: O has an [[ArrayBufferData]] internal slot.
|
||||
|
||||
// 3. If ! IsDetachedBuffer(O) is true, return false.
|
||||
|
@ -5367,7 +5367,7 @@ WebIDL::ExceptionOr<JS::Value> clone_as_uint8_array(JS::Realm& realm, WebIDL::Ar
|
|||
{
|
||||
auto& vm = realm.vm();
|
||||
|
||||
// 1. Assert: Type(O) is Object.
|
||||
// 1. Assert: O is an Object.
|
||||
// 2. Assert: O has an [[ViewedArrayBuffer]] internal slot.
|
||||
|
||||
// 3. Assert: ! IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is false.
|
||||
|
|
Loading…
Reference in a new issue