summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Bindings
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-12-08 23:45:53 +0000
committerAndreas Kling <kling@serenityos.org>2020-12-09 12:47:13 +0100
commit5e9f6f2e2c3890bf4704731a2eaf70ee448306ce (patch)
treed716876233bb080ed0c19acac62e424c348ca653 /Libraries/LibWeb/Bindings
parentbdb924522f5d1b64a7c644ecf738ad0d43facb5b (diff)
downloadserenity-5e9f6f2e2c3890bf4704731a2eaf70ee448306ce.zip
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
Diffstat (limited to 'Libraries/LibWeb/Bindings')
-rw-r--r--Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp
index 943fd0be02..636a7bd461 100644
--- a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp
+++ b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp
@@ -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&)