1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

LibWeb: Invent a method to stop an in-progress fetch without errors

The HTMLMediaElement will need to stop fetching processes when its load
algorithm is invoked while a fetch is ongoing. We don't have a way to
really stop the process, due to the way it runs on nested deferred task
invocations. So for now, this swaps the fetch callbacks (e.g. to process
a fetch response) with empty callbacks.
This commit is contained in:
Timothy Flynn 2023-04-19 09:15:16 -04:00 committed by Andreas Kling
parent 1fb0c7826b
commit 8d4d01d99a
3 changed files with 26 additions and 0 deletions

View file

@ -6,11 +6,13 @@
#pragma once
#include <AK/Badge.h>
#include <LibJS/Forward.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibJS/SafeFunction.h>
#include <LibWeb/Fetch/Infrastructure/FetchTimingInfo.h>
#include <LibWeb/Forward.h>
namespace Web::Fetch::Infrastructure {
@ -39,6 +41,10 @@ public:
void abort(JS::Realm&, Optional<JS::Value>);
void terminate();
void set_fetch_params(Badge<FetchParams>, JS::NonnullGCPtr<FetchParams> fetch_params) { m_fetch_params = fetch_params; }
void stop_fetch();
private:
FetchController();
@ -67,6 +73,8 @@ private:
// next manual redirect steps (default null)
// Null or an algorithm accepting nothing.
Optional<JS::SafeFunction<void()>> m_next_manual_redirect_steps;
JS::GCPtr<FetchParams> m_fetch_params;
};
}