Implement {Worker,DedicatedWorkerGlobalScope}.onmessage.