mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibWeb: Make FileAPI::Blob::create() buffer/type overload infallible
This commit is contained in:
parent
54a987ad45
commit
c7c6d7d9e1
3 changed files with 3 additions and 3 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
namespace Web::FileAPI {
|
namespace Web::FileAPI {
|
||||||
|
|
||||||
DOM::ExceptionOr<JS::NonnullGCPtr<Blob>> Blob::create(HTML::Window& window, ByteBuffer byte_buffer, String type)
|
JS::NonnullGCPtr<Blob> Blob::create(HTML::Window& window, ByteBuffer byte_buffer, String type)
|
||||||
{
|
{
|
||||||
return JS::NonnullGCPtr(*window.heap().allocate<Blob>(window.realm(), window, move(byte_buffer), move(type)));
|
return JS::NonnullGCPtr(*window.heap().allocate<Blob>(window.realm(), window, move(byte_buffer), move(type)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ class Blob : public Bindings::PlatformObject {
|
||||||
public:
|
public:
|
||||||
virtual ~Blob() override;
|
virtual ~Blob() override;
|
||||||
|
|
||||||
|
static JS::NonnullGCPtr<Blob> create(HTML::Window&, ByteBuffer, String type);
|
||||||
static DOM::ExceptionOr<JS::NonnullGCPtr<Blob>> create(HTML::Window&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
|
static DOM::ExceptionOr<JS::NonnullGCPtr<Blob>> create(HTML::Window&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
|
||||||
static DOM::ExceptionOr<JS::NonnullGCPtr<Blob>> create(HTML::Window&, ByteBuffer, String type);
|
|
||||||
static DOM::ExceptionOr<JS::NonnullGCPtr<Blob>> create_with_global_object(HTML::Window&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
|
static DOM::ExceptionOr<JS::NonnullGCPtr<Blob>> create_with_global_object(HTML::Window&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
|
||||||
|
|
||||||
// https://w3c.github.io/FileAPI/#dfn-size
|
// https://w3c.github.io/FileAPI/#dfn-size
|
||||||
|
|
|
@ -132,7 +132,7 @@ DOM::ExceptionOr<JS::Value> XMLHttpRequest::response()
|
||||||
}
|
}
|
||||||
// 6. Otherwise, if this’s response type is "blob", set this’s response object to a new Blob object representing this’s received bytes with type set to the result of get a final MIME type for this.
|
// 6. Otherwise, if this’s response type is "blob", set this’s response object to a new Blob object representing this’s received bytes with type set to the result of get a final MIME type for this.
|
||||||
else if (m_response_type == Bindings::XMLHttpRequestResponseType::Blob) {
|
else if (m_response_type == Bindings::XMLHttpRequestResponseType::Blob) {
|
||||||
auto blob_part = TRY(FileAPI::Blob::create(global_object(), m_received_bytes, get_final_mime_type().type()));
|
auto blob_part = FileAPI::Blob::create(global_object(), m_received_bytes, get_final_mime_type().type());
|
||||||
auto blob = TRY(FileAPI::Blob::create(global_object(), Vector<FileAPI::BlobPart> { JS::make_handle(*blob_part) }));
|
auto blob = TRY(FileAPI::Blob::create(global_object(), Vector<FileAPI::BlobPart> { JS::make_handle(*blob_part) }));
|
||||||
m_response_object = JS::Value(blob.ptr());
|
m_response_object = JS::Value(blob.ptr());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue