mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
LibWeb: Make 'optional BufferSource' IDL arguments actually optional
Previously this was compiled to require an object despite the IDL file specifying 'optional'. This commit makes IDLGenerator respect this modifier, and fixes the only affected instance.
This commit is contained in:
committed by
Andreas Kling
parent
540ea9f1c4
commit
0e3fb39a0a
@@ -44,11 +44,14 @@ JS::ThrowCompletionOr<void> TextDecoder::initialize(JS::Realm& realm)
|
||||
}
|
||||
|
||||
// https://encoding.spec.whatwg.org/#dom-textdecoder-decode
|
||||
WebIDL::ExceptionOr<DeprecatedString> TextDecoder::decode(JS::Handle<JS::Object> const& input) const
|
||||
WebIDL::ExceptionOr<DeprecatedString> TextDecoder::decode(Optional<JS::Handle<JS::Object>> const& input) const
|
||||
{
|
||||
if (!input.has_value())
|
||||
return TRY_OR_THROW_OOM(vm(), m_decoder.to_utf8({}));
|
||||
|
||||
// FIXME: Implement the streaming stuff.
|
||||
|
||||
auto data_buffer_or_error = WebIDL::get_buffer_source_copy(*input.cell());
|
||||
auto data_buffer_or_error = WebIDL::get_buffer_source_copy(*input->cell());
|
||||
if (data_buffer_or_error.is_error())
|
||||
return WebIDL::OperationError::create(realm(), "Failed to copy bytes from ArrayBuffer");
|
||||
auto& data_buffer = data_buffer_or_error.value();
|
||||
|
||||
Reference in New Issue
Block a user