1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:37:47 +00:00

Browser: Use OutOfProcessWebView for the Browser JavaScript console

Instead of building the web DOM by hand, we now load an empty document
into an OutOfProcessWebView, and then append things to it by sending
little snippets of JavaScript to the host process. :^)
This commit is contained in:
Andreas Kling 2021-08-24 16:57:57 +02:00
parent fd922cf92f
commit fe09f85414
2 changed files with 19 additions and 82 deletions

View file

@ -1,16 +1,15 @@
/*
* Copyright (c) 2020, Hunter Salyer <thefalsehonesty@gmail.com>
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "BrowserConsoleClient.h"
#include "History.h"
#include <LibGUI/Widget.h>
#include <LibJS/Forward.h>
#include <LibWeb/InProcessWebView.h>
#include <LibWeb/OutOfProcessWebView.h>
namespace Browser {
@ -19,7 +18,6 @@ class ConsoleWidget final : public GUI::Widget {
public:
virtual ~ConsoleWidget();
void set_interpreter(WeakPtr<JS::Interpreter>);
void handle_js_console_output(const String& method, const String& line);
void print_source_line(const StringView&);
void print_html(const StringView&);
@ -31,10 +29,7 @@ private:
ConsoleWidget();
RefPtr<GUI::TextBox> m_input;
RefPtr<Web::InProcessWebView> m_output_view;
RefPtr<Web::DOM::Element> m_output_container;
WeakPtr<JS::Interpreter> m_interpreter;
OwnPtr<BrowserConsoleClient> m_console_client;
RefPtr<Web::OutOfProcessWebView> m_output_view;
};
}