LibWeb: Disallow construction of XMLHttpRequest without 'new'

The XMLHttpRequest interface only has a constructor and isn't supposed
to be callable as a function.
https://xhr.spec.whatwg.org/#constructors
This commit is contained in:
Linus Groh 2020-12-08 23:45:53 +00:00 committed by Andreas Kling
parent bdb924522f
commit 5e9f6f2e2c
Notes: sideshowbarker 2024-07-19 00:57:53 +09:00

View file

@ -57,7 +57,8 @@ XMLHttpRequestConstructor::~XMLHttpRequestConstructor()
JS::Value XMLHttpRequestConstructor::call()
{
return construct(*this);
vm().throw_exception<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "XMLHttpRequest");
return {};
}
JS::Value XMLHttpRequestConstructor::construct(Function&)