Is https://docs.rs/web-sys/latest/web_sys/struct.DedicatedWorkerGlobalScope.html#method.set_onmessage quite unsafe to use?

Links:

The point here is: to use these set_onmessage functions safely, are we supposed to call .forget() afterwards (or by some other means ensure that the callback stays vaild)?

Why is this not unsafe ?