1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:27:35 +00:00

LibWeb: Add spec comments and links to XHR members

This commit is contained in:
Linus Groh 2022-11-13 14:09:46 +00:00
parent 04eaff3bb4
commit 338ada66fa

View file

@ -83,34 +83,92 @@ private:
explicit XMLHttpRequest(HTML::Window&);
// Non-standard
JS::NonnullGCPtr<HTML::Window> m_window;
State m_state { State::Unsent };
Fetch::Infrastructure::Status m_status { 0 };
bool m_send { false };
u32 m_timeout { 0 };
String m_method;
AK::URL m_url;
Bindings::XMLHttpRequestResponseType m_response_type;
HashMap<String, String, CaseInsensitiveStringTraits> m_request_headers;
HashMap<String, String, CaseInsensitiveStringTraits> m_response_headers;
// https://xhr.spec.whatwg.org/#concept-xmlhttprequest-state
// state
// One of unsent, opened, headers received, loading, and done; initially unsent.
State m_state { State::Unsent };
// https://xhr.spec.whatwg.org/#send-flag
// send() flag
// A flag, initially unset.
bool m_send { false };
// https://xhr.spec.whatwg.org/#timeout
// timeout
// An unsigned integer, initially 0.
u32 m_timeout { 0 };
// FIXME: https://xhr.spec.whatwg.org/#cross-origin-credentials
// https://xhr.spec.whatwg.org/#request-method
// request method
// A method.
String m_method;
// https://xhr.spec.whatwg.org/#request-url
// request URL
// A URL.
AK::URL m_url;
// https://xhr.spec.whatwg.org/#author-request-headers
// author request headers
// A header list, initially empty.
HashMap<String, String, CaseInsensitiveStringTraits> m_request_headers;
// FIXME: https://xhr.spec.whatwg.org/#request-body
// https://xhr.spec.whatwg.org/#synchronous-flag
// synchronous flag
// A flag, initially unset.
bool m_synchronous { false };
// https://xhr.spec.whatwg.org/#upload-complete-flag
// upload complete flag
// A flag, initially unset.
bool m_upload_complete { false };
// https://xhr.spec.whatwg.org/#upload-listener-flag
// upload listener flag
// A flag, initially unset.
bool m_upload_listener { false };
// https://xhr.spec.whatwg.org/#timed-out-flag
// timed out flag
// A flag, initially unset.
bool m_timed_out { false };
// FIXME: https://xhr.spec.whatwg.org/#response
// https://xhr.spec.whatwg.org/#received-bytes
// received bytes
// A byte sequence, initially the empty byte sequence.
ByteBuffer m_received_bytes;
// https://xhr.spec.whatwg.org/#response-type
// response type
// One of the empty string, "arraybuffer", "blob", "document", "json", and "text"; initially the empty string.
Bindings::XMLHttpRequestResponseType m_response_type;
enum class Failure {
/// ????
};
// https://xhr.spec.whatwg.org/#response-object
// response object
// An object, failure, or null, initially null.
Variant<JS::Value, Failure, Empty> m_response_object;
// FIXME: https://xhr.spec.whatwg.org/#xmlhttprequest-fetch-controller
// https://xhr.spec.whatwg.org/#override-mime-type
// override MIME type
// A MIME type or null, initially null.
// NOTE: Can get a value when overrideMimeType() is invoked.
Optional<MimeSniff::MimeType> m_override_mime_type;
};