mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:32:45 +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
					
				
					 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
	
	 Luke Wilde
						Luke Wilde