mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:42:43 +00:00 
			
		
		
		
	LibWeb+WebWorker: Convert Workers to use MessagePorts for postMessage
This aligns Workers and Window and MessagePorts to all use the same mechanism for transferring serialized messages across realms. It also allows transferring more message ports into a worker. Re-enable the Worker-echo test, as none of the MessagePort tests have themselves been flaky, and those are now using the same underlying implementation.
This commit is contained in:
		
							parent
							
								
									37f2d49818
								
							
						
					
					
						commit
						b10fee00eb
					
				
					 21 changed files with 159 additions and 222 deletions
				
			
		|  | @ -1,4 +1,14 @@ | |||
| let extraPort = null; | ||||
| 
 | ||||
| onmessage = evt => { | ||||
|     postMessage(evt.data, null); | ||||
|     if (evt.ports.length > 0) { | ||||
|         extraPort = evt.ports[0]; | ||||
|         extraPort.onmessage = evt => { | ||||
|             extraPort.postMessage("Extra Port got message: " + JSON.stringify(evt.data)); | ||||
|         }; | ||||
|         extraPort.postMessage("Worker got message port!"); | ||||
|     } else { | ||||
|         postMessage(evt.data); | ||||
|     } | ||||
| }; | ||||
| postMessage("loaded", null); | ||||
| postMessage("loaded"); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andrew Kaster
						Andrew Kaster