2020-06-03 14:34:52 -07:00
|
|
|
/*
|
2021-04-22 16:53:07 -07:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2022-12-14 19:18:10 +00:00
|
|
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
2020-06-03 14:34:52 -07:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-03 14:34:52 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibJS/Runtime/NativeFunction.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
class ProxyConstructor final : public NativeFunction {
|
2020-06-21 15:14:02 +02:00
|
|
|
JS_OBJECT(ProxyConstructor, NativeFunction);
|
|
|
|
|
2020-06-03 14:34:52 -07:00
|
|
|
public:
|
2023-01-28 12:33:35 -05:00
|
|
|
virtual ThrowCompletionOr<void> initialize(Realm&) override;
|
2022-03-14 10:25:06 -06:00
|
|
|
virtual ~ProxyConstructor() override = default;
|
2020-06-03 14:34:52 -07:00
|
|
|
|
2021-10-20 21:16:30 +01:00
|
|
|
virtual ThrowCompletionOr<Value> call() override;
|
2022-12-14 19:18:10 +00:00
|
|
|
virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
|
2020-06-03 14:34:52 -07:00
|
|
|
|
|
|
|
private:
|
2022-08-28 23:51:28 +02:00
|
|
|
explicit ProxyConstructor(Realm&);
|
|
|
|
|
2020-06-03 14:34:52 -07:00
|
|
|
virtual bool has_constructor() const override { return true; }
|
2021-06-08 21:48:43 +01:00
|
|
|
|
2021-10-29 01:06:57 +03:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(revocable);
|
2020-06-03 14:34:52 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|