ConsoleGlobalObject.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Forward.h>
  8. #include <LibJS/Runtime/Completion.h>
  9. #include <LibJS/Runtime/GlobalObject.h>
  10. #include <LibWeb/HTML/Window.h>
  11. namespace WebContent {
  12. class ConsoleGlobalObject final : public JS::GlobalObject {
  13. JS_OBJECT(ConsoleGlobalObject, JS::GlobalObject);
  14. public:
  15. ConsoleGlobalObject(JS::Realm&, Web::HTML::Window&);
  16. virtual void initialize(JS::Realm&) override;
  17. virtual ~ConsoleGlobalObject() override = default;
  18. virtual JS::ThrowCompletionOr<Object*> internal_get_prototype_of() const override;
  19. virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override;
  20. virtual JS::ThrowCompletionOr<bool> internal_is_extensible() const override;
  21. virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override;
  22. virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const& name) const override;
  23. virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const& name, JS::PropertyDescriptor const& descriptor) override;
  24. virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override;
  25. virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value) const override;
  26. virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override;
  27. virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const& name) override;
  28. virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
  29. private:
  30. virtual void visit_edges(Visitor&) override;
  31. // $0, the DOM node currently selected in the inspector
  32. JS_DECLARE_NATIVE_FUNCTION($0_getter);
  33. Web::HTML::Window* m_window_object;
  34. };
  35. }