[Libreoffice-commits] online.git: loleaflet/js loleaflet/src
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 19 07:56:27 UTC 2020
loleaflet/js/global.js | 1 +
loleaflet/src/core/Socket.js | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit a09a0877d17ccee383403c4c4d6bd4427e6fcdde
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Mar 12 23:29:39 2020 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Mar 19 08:56:09 2020 +0100
loleaflet: ensure forward message if early websocket is connected
This should never happen, since the _onMessage is re-assigned when
loadDocument is called, but it is better to ensure to forward all
messages.
Change-Id: I9a792bc077b26f2f92c30c4e7851c9d2b2637bfb
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90449
Tested-by: Andras Timar <andras.timar at collabora.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index f98450fb0..a08c4cf3b 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -320,6 +320,7 @@
global.socket.onmessage = function (event) {
if (typeof global.socket._onMessage === 'function') {
+ global.socket._emptyQueue();
global.socket._onMessage(event);
} else {
global.queueMsg.push(event.data);
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index a173ef784..b4118479f 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -76,8 +76,11 @@ L.Socket = L.Class.extend({
}
// process messages for early socket connection
- if (socket && ((socket.readyState === 1 || socket.readyState === 0)) &&
- window.queueMsg && window.queueMsg.length > 0) {
+ this._emptyQueue();
+ },
+
+ _emptyQueue: function () {
+ if (window.queueMsg && window.queueMsg.length > 0) {
for (var it = 0; it < window.queueMsg.length; it++) {
this._onMessage({data: window.queueMsg[it]});
}
More information about the Libreoffice-commits
mailing list