mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
EventTarget constructor
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user