mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
WebContent+LibWeb+LibJS: Simplify injection of JS console globals
Instead of creating a new global object and proxying everything through it, we now evaluate console inputs inside a `with` environment. This seems to match the behavior of WebKit and Gecko in my basic testing, and removes the ConsoleGlobalObject which has been a source of confusion and invalid downcasts. The globals now live in a class called ConsoleGlobalObjectExtensions (renamed from ConsoleGlobalObject since it's no longer a global object). To make this possible, I had to add a way to override the initial lexical environment when calling JS::Interpreter::run(). This is plumbed via Web::HTML::ClassicScript::run().
This commit is contained in:
parent
23b07b3408
commit
fbf9cb3387
12 changed files with 187 additions and 292 deletions
|
@ -35,9 +35,7 @@ private:
|
|||
}
|
||||
|
||||
ConnectionFromClient& m_client;
|
||||
WeakPtr<JS::Realm> m_realm;
|
||||
JS::GCPtr<class ConsoleEnvironmentSettingsObject> m_console_settings;
|
||||
JS::Handle<ConsoleGlobalObject> m_console_global_object;
|
||||
JS::Handle<ConsoleGlobalEnvironmentExtensions> m_console_global_environment_extensions;
|
||||
|
||||
void clear_output();
|
||||
void print_html(DeprecatedString const& line);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue