mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
LibWeb/FileAPI: Implement aborting a FileReader read
This fixes a timeout for the included WPT test.
This commit is contained in:
parent
33e80fbf51
commit
8e410f959c
Notes:
github-actions[bot]
2025-01-30 21:26:29 +00:00
Author: https://github.com/shannonbooth
Commit: 8e410f959c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3144
Reviewed-by: https://github.com/ADKaster ✅
5 changed files with 153 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2023-2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -10,6 +10,7 @@
|
|||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/EventLoop/Task.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::FileAPI {
|
||||
|
@ -101,6 +102,12 @@ private:
|
|||
|
||||
static WebIDL::ExceptionOr<Result> blob_package_data(JS::Realm& realm, ByteBuffer, FileReader::Type type, Optional<String> const&, Optional<String> const& encoding_name);
|
||||
|
||||
void queue_a_task(GC::Ref<GC::Function<void()>>);
|
||||
|
||||
// Internal state to handle aborting the FileReader.
|
||||
HashTable<HTML::TaskID> m_pending_tasks;
|
||||
bool m_is_aborted { false };
|
||||
|
||||
// A FileReader has an associated state, that is "empty", "loading", or "done". It is initially "empty".
|
||||
// https://w3c.github.io/FileAPI/#filereader-state
|
||||
State m_state { State::Empty };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue