mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
LibWeb: Refactor XHR (almost) exactly to the spec
This makes XHR now rely on Fetch, which allows it to correct send Origin and Referer headers, CORS-preflight and filtering and many other goodies. The main thing that's missing is Streams, which means we can't properly produce progress events or switch to the Loading ready state. This also doesn't implement the Document responseType just yet.
This commit is contained in:
parent
90cc45b7ec
commit
d036862f2b
11 changed files with 782 additions and 203 deletions
|
@ -2,6 +2,7 @@
|
|||
#import <DOM/EventHandler.idl>
|
||||
#import <Fetch/BodyInit.idl>
|
||||
#import <XHR/XMLHttpRequestEventTarget.idl>
|
||||
#import <XHR/XMLHttpRequestUpload.idl>
|
||||
|
||||
enum XMLHttpRequestResponseType {
|
||||
"",
|
||||
|
@ -13,7 +14,7 @@ enum XMLHttpRequestResponseType {
|
|||
};
|
||||
|
||||
// https://xhr.spec.whatwg.org/#xmlhttprequest
|
||||
[Exposed=(Window,DedicatedWorker,SharedWorker)]
|
||||
[Exposed=(Window,DedicatedWorker,SharedWorker), UseNewAKString]
|
||||
interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
||||
|
||||
constructor();
|
||||
|
@ -26,14 +27,16 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
|||
|
||||
readonly attribute unsigned short readyState;
|
||||
readonly attribute unsigned short status;
|
||||
readonly attribute ByteString statusText;
|
||||
readonly attribute DOMString responseText;
|
||||
readonly attribute any response;
|
||||
attribute XMLHttpRequestResponseType responseType;
|
||||
attribute unsigned long timeout;
|
||||
attribute boolean withCredentials;
|
||||
[SameObject] readonly attribute XMLHttpRequestUpload upload;
|
||||
|
||||
undefined open(DOMString method, DOMString url);
|
||||
undefined open(ByteString method, USVString url, boolean async, optional USVString? username = {}, optional USVString? password = {});
|
||||
undefined open(ByteString method, USVString url, boolean async, optional USVString? username = null, optional USVString? password = null);
|
||||
undefined setRequestHeader(DOMString name, DOMString value);
|
||||
undefined send(optional (Document or XMLHttpRequestBodyInit)? body = null);
|
||||
undefined abort();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue