eclipse-paho / eclipse-paho/paho.mqtt.javascript
QoS 0 still accesses localStorage
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 466
- PR merge metrics
- No merged PRs in 30d
Description
[This comment][1] suggests that using QoS 0 would prevent the use of `localStorage`.
> if the network connection or browser fails. If you do not wish for the Local Storage to be used, please do not use this client, or only use QoS 0 to send and receive messages.
However, when using QoS 0 I still receive an exception about access to localStorage being denied in Chrome; it works in Firefox.
> Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
I am loading my code into an iframe on another webpage on a separate domain which perhaps has something to do with it. That said however, it'd be useful if using QoS 0 actually prevented the use of localStorage as it's not necessary. Looking at [the code here][2], that's not the case.
It seems that this PR https://github.com/eclipse/paho.mqtt.javascript/pull/191 would indirectly fix my issue as the Exception would no longer crash my application, but doesn't address the fact that QoS 0 doesn't disable localStorage usage.
[1]: https://github.com/eclipse/paho.mqtt.javascript/blob/master/utility/index.html#L62
[2]: https://github.com/eclipse/paho.mqtt.javascript/blob/413f72920575f699f895ad1016283c053da9d4f0/src/paho-mqtt.js#L109
Contributor guide
Assessment
This issue has not been assessed yet.