LibWeb/XHR: Pass API URL character encoding

(cherry picked from commit 748e3c2e6c680fa78b24d7a2643fe79b234943d6)
This commit is contained in:
Bastian Müller 2024-10-19 16:16:22 -07:00 committed by Nico Weber
parent 62894c9d3f
commit da3b916ba3

View file

@ -19,12 +19,12 @@
#include <LibTextCodec/Decoder.h>
#include <LibWeb/Bindings/XMLHttpRequestPrototype.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/DOM/DocumentLoading.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/EventDispatcher.h>
#include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/DOM/XMLDocument.h>
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/Fetch/BodyInit.h>
#include <LibWeb/Fetch/Fetching/Fetching.h>
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
@ -482,8 +482,10 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::open(String const& method_string, Stri
auto normalized_method = Fetch::Infrastructure::normalize_method(method);
// 5. Let parsedURL be the result of parsing url with thiss relevant settings objects API base URL and thiss relevant settings objects API URL character encoding.
// FIXME: Pass in thiss relevant settings objects API URL character encoding.
auto parsed_url = DOMURL::parse(url, HTML::relevant_settings_object(*this).api_base_url(), {});
auto& relevant_settings_object = HTML::relevant_settings_object(*this);
auto api_base_url = relevant_settings_object.api_base_url();
auto api_url_character_encoding = relevant_settings_object.api_url_character_encoding();
auto parsed_url = DOMURL::parse(url, api_base_url, api_url_character_encoding);
// 6. If parsedURL is failure, then throw a "SyntaxError" DOMException.
if (!parsed_url.is_valid())