1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +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

@ -50,7 +50,8 @@ JS::Value XMLHttpRequestConstructor::call(JS::Interpreter& interpreter)
JS::Value XMLHttpRequestConstructor::construct(JS::Interpreter& interpreter)
{
return interpreter.heap().allocate<XMLHttpRequestWrapper>(XMLHttpRequest::create());
auto& window = static_cast<WindowObject&>(interpreter.global_object());
return interpreter.heap().allocate<XMLHttpRequestWrapper>(XMLHttpRequest::create(window.impl()));
}
}