1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibWeb: Bring XHR::open() closer to spec

FIXME addressed in open method:
 10. If async is false, the current global object is a Window object,
 and either this’s timeout is not 0 or this’s response type is not the
 empty string, then throw an "InvalidAccessError" DOMException.
This commit is contained in:
Smrtnyk 2022-11-04 18:12:21 +01:00 committed by Linus Groh
parent 8eec25b7ae
commit 71228a8d86

View file

@ -381,8 +381,13 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::open(String const& method_string, Stri
parsed_url.set_password(password);
}
// FIXME: 10. If async is false, the current global object is a Window object, and either thiss timeout is
// not 0 or thiss response type is not the empty string, then throw an "InvalidAccessError" DOMException.
// 10. If async is false, the current global object is a Window object, and either thiss timeout is
// not 0 or thiss response type is not the empty string, then throw an "InvalidAccessError" DOMException.
if (!async
&& is<HTML::Window>(HTML::current_global_object())
&& (m_timeout != 0 || m_response_type != Bindings::XMLHttpRequestResponseType::Empty)) {
return WebIDL::InvalidAccessError::create(realm(), "synchronous XMLHttpRequests do not support timeout and responseType");
}
// FIXME: 11. Terminate the ongoing fetch operated by the XMLHttpRequest object.