mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
LibJS: Convert Console to use MarkedVector<Value>
Using a Vector<Value> is unsafe as GC cannot see the stored values. This is then vended to outside users of ConsoleClient, e.g. LibWeb and WebContent, which is then outside of LibJS's control. An example issue is if the client stores it for later use and forgets to visit the stored values, meaning they can be destroyed at any time. We can save the client from this by vending a MarkedVector<Value> to them.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibWeb/HTML/WorkerDebugConsoleClient.h>
|
||||
|
||||
@@ -52,7 +53,7 @@ JS::ThrowCompletionOr<JS::Value> WorkerDebugConsoleClient::printer(JS::Console::
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
||||
auto output = String::join(" ", arguments.get<Vector<JS::Value>>());
|
||||
auto output = String::join(" ", arguments.get<JS::MarkedVector<JS::Value>>());
|
||||
m_console.output_debug_message(log_level, output);
|
||||
|
||||
switch (log_level) {
|
||||
|
||||
Reference in New Issue
Block a user