mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02: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:
Notes:
sideshowbarker
2024-07-18 01:43:16 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/d036862f2b Pull-request: https://github.com/SerenityOS/serenity/pull/17669 Reviewed-by: https://github.com/davidot Reviewed-by: https://github.com/linusg ✅
28
Userland/Libraries/LibWeb/XHR/XMLHttpRequestUpload.cpp
Normal file
28
Userland/Libraries/LibWeb/XHR/XMLHttpRequestUpload.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/XMLHttpRequestUploadPrototype.h>
|
||||
#include <LibWeb/XHR/XMLHttpRequestUpload.h>
|
||||
|
||||
namespace Web::XHR {
|
||||
|
||||
XMLHttpRequestUpload::XMLHttpRequestUpload(JS::Realm& realm)
|
||||
: XMLHttpRequestEventTarget(realm)
|
||||
{
|
||||
}
|
||||
|
||||
XMLHttpRequestUpload::~XMLHttpRequestUpload() = default;
|
||||
|
||||
JS::ThrowCompletionOr<void> XMLHttpRequestUpload::initialize(JS::Realm& realm)
|
||||
{
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::XMLHttpRequestUploadPrototype>(realm, "XMLHttpRequestUpload"));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user