1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibJS+WebContent+js: Bring console.trace() to spec

The spec very kindly defines `Printer` as accepting
"Implementation-specific representations of printable things such as a
stack trace or group." for the `args`. We make use of that here by
passing the `Trace` itself to `Printer`, instead of having to produce a
representation of the stack trace in advance and then pass that to
`Printer`. That both avoids the hassle of tracking whether the data has
been html-encoded or not, and means clients don't have to implement the
whole `trace()` algorithm, but only the code needed to output the trace.
This commit is contained in:
Sam Atkins 2021-12-10 13:48:38 +00:00 committed by Andreas Kling
parent ce694490f3
commit ff5e07d718
5 changed files with 68 additions and 50 deletions

View file

@ -25,8 +25,7 @@ public:
private:
virtual void clear() override;
virtual JS::Value trace() override;
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, Vector<JS::Value>&) override;
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, Variant<Vector<JS::Value>, JS::Console::Trace>) override;
ClientConnection& m_client;
WeakPtr<JS::Interpreter> m_interpreter;