LibWeb: Set Cookie header on <script> resource requests

This required changing the load_sync API to take a LoadRequest instead
of just a URL. Since HTMLScriptElement was the only (non-test) user of
this API, it didn't seem useful to instead add an overload of load_sync
for this.
This commit is contained in:
Timothy Flynn 2021-04-14 10:36:34 -04:00 committed by Andreas Kling
parent 3cc5286565
commit 347838a240
Notes: sideshowbarker 2024-07-18 20:19:03 +09:00
4 changed files with 14 additions and 6 deletions

View file

@ -224,10 +224,12 @@ void HTMLScriptElement::prepare_script()
}
if (m_script_type == ScriptType::Classic) {
auto request = LoadRequest::create_for_url_on_page(url, document().page());
// FIXME: This load should be made asynchronous and the parser should spin an event loop etc.
m_script_filename = url.basename();
ResourceLoader::the().load_sync(
url,
request,
[this, url](auto data, auto&, auto) {
if (data.is_null()) {
dbgln("HTMLScriptElement: Failed to load {}", url);