Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict mode violation in Chrome (with fix) #126

Open
asdf072 opened this issue Jan 29, 2024 · 3 comments
Open

Strict mode violation in Chrome (with fix) #126

asdf072 opened this issue Jan 29, 2024 · 3 comments

Comments

@asdf072
Copy link

asdf072 commented Jan 29, 2024

I recently started getting an error in Chrome. [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.

I tracked it down to the timeout function in the this.open method. The function in the setTimeout makes a direct call to websocket.close(). Line #227.

Using func.call() to help it define this seems to have cleared up the error. Can anyone see any unintended issues?

            var localWs = ws;
            var timeout = setTimeout(function() {
                if (self.debug || ReconnectingWebSocket.debugAll) {
                    console.debug('ReconnectingWebSocket', 'connection-timeout', self.url);
                }
                timedOut = true;
                //localWs.close(); // this causes a strict mode violation
                localWs.close.call(localWs); // better
                timedOut = false;
            }, self.timeoutInterval);
@asdf072
Copy link
Author

asdf072 commented Jan 29, 2024

But now, minifying breaks it ... Hm

@Tangee69
Copy link

  • _@ _

@bj00rn
Copy link

bj00rn commented Mar 22, 2024

@asdf072 try the fork project at https://github.com/partykit/partykit/tree/main/packages/partysocket and file an issue there if problem still

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants