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

LibWeb: Support relative URL's in XMLHttpRequest

In order to complete a relative URL, we need a Document. Fix this by
giving XMLHttpRequest a pointer to its window object. Then we can go
from the window to the document, and then we're home free. :^)
This commit is contained in:
Andreas Kling 2020-04-08 21:18:41 +02:00
parent 4ffac713b9
commit 4036f15728
3 changed files with 11 additions and 5 deletions

View file

@ -42,7 +42,7 @@ class XMLHttpRequest final
public:
using WrapperType = Bindings::XMLHttpRequestWrapper;
static NonnullRefPtr<XMLHttpRequest> create() { return adopt(*new XMLHttpRequest); }
static NonnullRefPtr<XMLHttpRequest> create(Window& window) { return adopt(*new XMLHttpRequest(window)); }
virtual ~XMLHttpRequest() override;
@ -58,7 +58,9 @@ private:
virtual void unref_event_target() override { unref(); }
virtual void dispatch_event(NonnullRefPtr<Event>) override;
XMLHttpRequest();
explicit XMLHttpRequest(Window&);
NonnullRefPtr<Window> m_window;
String m_method;
String m_url;