mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Remove unecessary dependence on Window from Fetch, XHR, FileAPI
These classes only needed Window to get at its realm. Pass a realm directly to construct Fetch, XMLHttpRequest and FileAPI classes.
This commit is contained in:
committed by
Linus Groh
parent
6a10352712
commit
4878a18ee7
Notes:
sideshowbarker
2024-07-17 06:28:06 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/4878a18ee7 Pull-request: https://github.com/SerenityOS/serenity/pull/15349 Reviewed-by: https://github.com/linusg ✅
@@ -4,28 +4,28 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/XHR/ProgressEvent.h>
|
||||
|
||||
namespace Web::XHR {
|
||||
|
||||
ProgressEvent* ProgressEvent::create(HTML::Window& window_object, FlyString const& event_name, ProgressEventInit const& event_init)
|
||||
ProgressEvent* ProgressEvent::create(JS::Realm& realm, FlyString const& event_name, ProgressEventInit const& event_init)
|
||||
{
|
||||
return window_object.heap().allocate<ProgressEvent>(window_object.realm(), window_object, event_name, event_init);
|
||||
return realm.heap().allocate<ProgressEvent>(realm, realm, event_name, event_init);
|
||||
}
|
||||
|
||||
ProgressEvent* ProgressEvent::create_with_global_object(HTML::Window& window_object, FlyString const& event_name, ProgressEventInit const& event_init)
|
||||
ProgressEvent* ProgressEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ProgressEventInit const& event_init)
|
||||
{
|
||||
return create(window_object, event_name, event_init);
|
||||
return create(realm, event_name, event_init);
|
||||
}
|
||||
|
||||
ProgressEvent::ProgressEvent(HTML::Window& window_object, FlyString const& event_name, ProgressEventInit const& event_init)
|
||||
: Event(window_object, event_name, event_init)
|
||||
ProgressEvent::ProgressEvent(JS::Realm& realm, FlyString const& event_name, ProgressEventInit const& event_init)
|
||||
: Event(realm, event_name, event_init)
|
||||
, m_length_computable(event_init.length_computable)
|
||||
, m_loaded(event_init.loaded)
|
||||
, m_total(event_init.total)
|
||||
{
|
||||
set_prototype(&window_object.cached_web_prototype("ProgressEvent"));
|
||||
set_prototype(&Bindings::cached_web_prototype(realm, "ProgressEvent"));
|
||||
}
|
||||
|
||||
ProgressEvent::~ProgressEvent() = default;
|
||||
|
||||
Reference in New Issue
Block a user