comlink icon indicating copy to clipboard operation
comlink copied to clipboard

fix: Safer check before calling start()

Open tmcw opened this issue 1 year ago • 3 comments

In both of these cases, the ep variable is the scope, and in some cases there'll be a start() method available, and we want to call it. I'm not sure exactly why - such a method doesn't show up in GlobalWorkerScope but maybe it's somewhere else.

However, there might also just be a variable called start in your global scope, and it isn't a function, and Comlink will expect it to be callable. This PR compensates for that case by making sure that the value is a function before calling it.

tmcw avatar Feb 13 '24 21:02 tmcw

Checking in - is this module still maintained, any chance to check out this issue?

tmcw avatar Oct 11 '24 17:10 tmcw

I recommend checking out https://github.com/daniel-nagy/transporter

On Fri, 11 Oct 2024, 19:22 Tom MacWright, @.***> wrote:

Checking in - is this module still maintained, any chance to check out this issue?

— Reply to this email directly, view it on GitHub https://github.com/GoogleChromeLabs/comlink/pull/656#issuecomment-2407835841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVSGJ5PKSFJOEOCWF22UVDZ3ACMNAVCNFSM6AAAAABPZKRRIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBXHAZTKOBUGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ivancuric avatar Oct 11 '24 17:10 ivancuric

This fix is legit, and just in order to get it we are considering to fork. @benjamind @surma any chance to get this in a patch version soon?

If the DOM contains an element with id "start" it will break comlink because of this issue.

ShayMalchi avatar Jan 20 '25 19:01 ShayMalchi