ConsoleGlobalObject.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2021, 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. namespace Web::Bindings {
  11. class WindowObject;
  12. }
  13. namespace WebContent {
  14. class ConsoleGlobalObject final : public JS::GlobalObject {
  15. JS_OBJECT(ConsoleGlobalObject, JS::GlobalObject);
  16. public:
  17. ConsoleGlobalObject(Web::Bindings::WindowObject&);
  18. virtual ~ConsoleGlobalObject() override;
  19. virtual JS::ThrowCompletionOr<Object*> internal_get_prototype_of() const override;
  20. virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override;
  21. virtual JS::ThrowCompletionOr<bool> internal_is_extensible() const override;
  22. virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override;
  23. virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const& name) const override;
  24. virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const& name, JS::PropertyDescriptor const& descriptor) override;
  25. virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override;
  26. virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value) const override;
  27. virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override;
  28. virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const& name) override;
  29. virtual JS::ThrowCompletionOr<JS::MarkedValueList> internal_own_property_keys() const override;
  30. virtual void initialize_global_object() override;
  31. private:
  32. virtual void visit_edges(Visitor&) override;
  33. // Because $0 is not a nice C++ function name
  34. JS_DECLARE_NATIVE_FUNCTION(inspected_node_getter);
  35. Web::Bindings::WindowObject* m_window_object;
  36. };
  37. }