EventTarget constructor

This commit is contained in:
sjorsdonkers
2025-07-08 13:21:52 +02:00
committed by Sjors
parent d6ace3f695
commit 2873aa5f81
2 changed files with 13 additions and 1 deletions

View File

@@ -2131,7 +2131,6 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
const info = v8.FunctionCallbackInfo.initFromV8(raw_info);
var caller = Caller(JsContext, State).init(info);
defer caller.deinit();
// See comment above. We generateConstructor on all types
// in order to create the FunctionTemplate, but there might
// not be an actual "constructor" function. So if someone
@@ -2139,6 +2138,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
// a constructor function, we'll return an error.
if (@hasDecl(Struct, "constructor") == false) {
const iso = caller.isolate;
log.warn(.js, "Illegal constructor call", .{ .name = @typeName(Struct) });
const js_exception = iso.throwException(createException(iso, "Illegal Constructor"));
info.getReturnValue().set(js_exception);
return;