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 <hcas...@collabora.com>
AuthorDate: Thu Mar 12 23:29:39 2020 -0400
Commit:     Andras Timar <andras.ti...@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.ti...@collabora.com>
    Reviewed-by: Andras Timar <andras.ti...@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]});
                        }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to