1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +00:00

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
4 changed files with 14 additions and 6 deletions

View file

@ -209,8 +209,11 @@ void TestRunner::run()
// give a new parser the existing document to work on.
m_page_view->document()->remove_all_children();
Web::LoadRequest request;
request.set_url(page_to_load);
Web::ResourceLoader::the().load_sync(
page_to_load,
request,
[&](auto data, auto&, auto) {
Web::HTML::HTMLDocumentParser parser(*m_page_view->document(), data, "utf-8");
parser.run(page_to_load);
@ -315,8 +318,11 @@ JSFileResult TestRunner::run_file_test(const String& test_path)
JSFileResult file_result;
Web::LoadRequest request;
request.set_url(page_to_load);
Web::ResourceLoader::the().load_sync(
page_to_load,
request,
[&](auto data, auto&, auto) {
// Create a new parser and immediately get its document to replace the old interpreter.
auto document = Web::DOM::Document::create();