mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 00:38:48 +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:
parent
f04911e777
commit
05748ed607
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/Lubrsi
Commit: 05748ed607
Pull-request: https://github.com/SerenityOS/serenity/pull/13939
Reviewed-by: https://github.com/linusg
5 changed files with 42 additions and 28 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue