-
Notifications
You must be signed in to change notification settings - Fork 230
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
Method console.warn invoked with wrong context #484
Comments
ok, thanks for reporting! so just to be sure:
? |
You're welcome.
BTW, for the sake of consistency, let me suggest that |
This is causing issue in IE 11. It breaks the add in that we are working on. It breaks on the same line as mentioned by @vla74
I have also enable debug mode in AB |
@om26er @oberstet Thank you for the fix. @hmistry-lz As we're also facing issue #485, we decided to stick to AB version <19.10.1, waiting for the availability of fixes. Otherwise a workaround might consist in redefining |
@vla74 @hmistry-lz I have released autobahn-js 20.4.1, with contains the fix for this bug as well. Kindly try that. |
@om26er We're not integrating Autobahn-js project directly but rather |
That is done now https://github.com/crossbario/autobahn-js-browser |
Many thanks for this new release. I confirm that it solves the issue for our Smart TVs. Note: It seems that this 20.4 branch introduced the use of async / await syntax. I've had to polyfill this. |
Hi,
We're running Autobahn JS on various terminal types, including Samsung and LG Smart TVs (Chromium-based browsers).
With these Smart TVs, when the established connection is closed (for example after stopping the Crossbar server), we get JS errors like:
In this case the AB connection's
onclose
handler is not called, and thereby our code is not aware that reconnection must be attempted.This issue appeared from ABJS v19.10.1.
Connection handler
self._transport.onclose
calls:https://github.com/crossbario/autobahn-js/blob/v19.10.1/packages/autobahn/lib/connection.js#L343
The log module defines its
warn
method as a direct reference to DOMconsole.warn
:https://github.com/crossbario/autobahn-js/blob/master/packages/autobahn/lib/log.js#L23
Execution of AB's
log.warn
does not cause issue on desktop browsers (Chrome, Firefox, Edge, IE11). However it fails on the affected Smart TVs because thewarn
Function
is executed with athis
context which is not theconsole
object.The Smart TV browsers may have a specific behaviour requiring this context (like redirecting the browser logs to an internal debugging system...).
To work on such platforms, Autobahn log module code should be something like:
Note: AB's
log.debug
method should not be affected by this issue, as its code uses the console context.Beyond the specific case of these Smart TV platforms, from a more general OOP point of view, the method of an object's instance should not be called outside of the context of this instance.
Thanks
The text was updated successfully, but these errors were encountered: