mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
HackStudio: Add evaluate expression popup to debugger
This implements a dialog that can be used to evaluate a JS expression in the HackStudio's Debugger context. It also implements simple C++ Variable <-> JS Value conversion, allowing for JS expressions to read/write variables in the debugger scope. Currently, C++ structs are mapped to JS objects by way of a JS proxy, however this leads to issues when printing, so this will be changed in a later commit.
This commit is contained in:
parent
bee16bb83a
commit
60d329a186
7 changed files with 378 additions and 1 deletions
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGUI/Dialog.h>
|
||||
#include <LibWeb/InProcessWebView.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
class EvaluateExpressionDialog : public GUI::Dialog {
|
||||
C_OBJECT(EvaluateExpressionDialog);
|
||||
|
||||
public:
|
||||
explicit EvaluateExpressionDialog(Window* parent_window);
|
||||
|
||||
private:
|
||||
void build(Window* parent_window);
|
||||
void handle_evaluation(const String& expression);
|
||||
void set_output(const StringView& html);
|
||||
|
||||
NonnullOwnPtr<JS::Interpreter> m_interpreter;
|
||||
RefPtr<GUI::TextBox> m_text_editor;
|
||||
RefPtr<Web::InProcessWebView> m_output_view;
|
||||
RefPtr<Web::DOM::Element> m_output_container;
|
||||
RefPtr<GUI::Button> m_evaluate_button;
|
||||
RefPtr<GUI::Button> m_close_button;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue