1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 21:57:35 +00:00

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

View file

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