mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Don't store Page on ResourceLoader
We only need a Page for file:// urls. At some point we probably needed it for other kinds of requests, but the current functionality doesn't need to store the Page pointer on the ResourceLoader.
This commit is contained in:
parent
a869a1c056
commit
8760825bb4
Notes:
github-actions[bot]
2025-02-18 18:37:01 +00:00
Author: https://github.com/ADKaster
Commit: 8760825bb4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3346
Reviewed-by: https://github.com/AtkinsSJ
4 changed files with 11 additions and 7 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <LibGfx/Font/WOFF2/Loader.h>
|
||||
#include <LibWeb/Animations/AnimationEffect.h>
|
||||
#include <LibWeb/Animations/DocumentTimeline.h>
|
||||
#include <LibWeb/Bindings/PrincipalHostDefined.h>
|
||||
#include <LibWeb/CSS/AnimationEvent.h>
|
||||
#include <LibWeb/CSS/CSSAnimation.h>
|
||||
#include <LibWeb/CSS/CSSFontFaceRule.h>
|
||||
|
@ -242,8 +243,12 @@ void FontLoader::start_loading_next_url()
|
|||
return;
|
||||
if (m_urls.is_empty())
|
||||
return;
|
||||
auto& style_computer_realm = m_style_computer.document().realm();
|
||||
auto& page = Bindings::principal_host_defined_page(HTML::principal_realm(style_computer_realm));
|
||||
|
||||
LoadRequest request;
|
||||
request.set_url(m_urls.take_first());
|
||||
request.set_page(page);
|
||||
|
||||
// HACK: We're crudely computing the referer value and shoving it into the
|
||||
// request until fetch infrastructure is used here.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <LibTextCodec/Decoder.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Bindings/HTMLLinkElementPrototype.h>
|
||||
#include <LibWeb/Bindings/PrincipalHostDefined.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/DOM/DOMTokenList.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -81,6 +82,7 @@ void HTMLLinkElement::inserted()
|
|||
// FIXME: Respect the "as" attribute.
|
||||
LoadRequest request;
|
||||
request.set_url(maybe_href.value());
|
||||
request.set_page(Bindings::principal_host_defined_page(HTML::principal_realm(realm())));
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
}
|
||||
} else if (m_relationship & Relationship::DNSPrefetch) {
|
||||
|
|
|
@ -334,11 +334,9 @@ void ResourceLoader::load(LoadRequest& request, GC::Root<SuccessCallback> succes
|
|||
}
|
||||
|
||||
if (url.scheme() == "file") {
|
||||
if (request.page())
|
||||
m_page = request.page();
|
||||
|
||||
if (!m_page.has_value()) {
|
||||
log_failure(request, "INTERNAL ERROR: No Page for request");
|
||||
auto page = request.page();
|
||||
if (!page) {
|
||||
log_failure(request, "INTERNAL ERROR: No Page for file scheme request");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -396,7 +394,7 @@ void ResourceLoader::load(LoadRequest& request, GC::Root<SuccessCallback> succes
|
|||
success_callback->function()(data, response_headers, {}, {});
|
||||
});
|
||||
|
||||
(*m_page)->client().request_file(move(file_request));
|
||||
page->client().request_file(move(file_request));
|
||||
|
||||
++m_pending_loads;
|
||||
if (on_load_counter_change)
|
||||
|
|
|
@ -93,7 +93,6 @@ private:
|
|||
Vector<String> m_preferred_languages = { "en"_string };
|
||||
NavigatorCompatibilityMode m_navigator_compatibility_mode;
|
||||
bool m_enable_do_not_track { false };
|
||||
Optional<GC::Ptr<Page>> m_page {};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue