ladybird/Services/WebContent/ConsoleGlobalEnvironmentExtensions.h
Shannon Booth f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00

43 lines
1.4 KiB
C++

/*
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Completion.h>
#include <LibWeb/HTML/Window.h>
namespace WebContent {
class ConsoleGlobalEnvironmentExtensions final : public JS::Object {
JS_OBJECT(ConsoleGlobalEnvironmentExtensions, JS::Object);
GC_DECLARE_ALLOCATOR(ConsoleGlobalEnvironmentExtensions);
public:
ConsoleGlobalEnvironmentExtensions(JS::Realm&, Web::HTML::Window&);
virtual void initialize(JS::Realm&) override;
virtual ~ConsoleGlobalEnvironmentExtensions() override = default;
void set_most_recent_result(JS::Value result) { m_most_recent_result = move(result); }
private:
virtual void visit_edges(Visitor&) override;
// $0, the DOM node currently selected in the inspector
JS_DECLARE_NATIVE_FUNCTION($0_getter);
// $_, the value of the most recent expression entered into the console
JS_DECLARE_NATIVE_FUNCTION($__getter);
// $(selector, element), equivalent to `(element || document).querySelector(selector)`
JS_DECLARE_NATIVE_FUNCTION($_function);
// $$(selector, element), equivalent to `(element || document).querySelectorAll(selector)`
JS_DECLARE_NATIVE_FUNCTION($$_function);
GC::Ref<Web::HTML::Window> m_window_object;
JS::Value m_most_recent_result { JS::js_undefined() };
};
}