[Libreoffice-commits] online.git: loleaflet/src

Jan Holesovsky kendy at collabora.com
Thu Apr 26 18:32:28 UTC 2018


 loleaflet/src/core/Socket.js |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 27a4f70a555a7d8cb597c0c33fe37e8abab0a9ef
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Apr 25 17:23:03 2018 +0200

    SendMessage needs to accept Blob too.
    
    Make the condition more readable when at that.
    
    Change-Id: Ibcabfc2b57eb4ebd8f1ad8bb5ee71010e52e8e3c
    Reviewed-on: https://gerrit.libreoffice.org/53525
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index edf143af6..4275a3d7c 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -87,12 +87,20 @@ L.Socket = L.Class.extend({
 	},
 
 	sendMessage: function (msg, coords) {
-		if ((!msg.startsWith('useractive') && !msg.startsWith('userinactive') && !this._map._active) ||
-		    this._map._fatal) {
-			// Avoid communicating when we're inactive.
+		if (this._map._fatal) {
+			// Avoid communicating when we're in fatal state
 			return;
 		}
 
+		if (!this._map._active) {
+			// Avoid communicating when we're inactive.
+			if (typeof msg !== 'string')
+				return;
+
+			if (!msg.startsWith('useractive') && !msg.startsWith('userinactive'))
+				return;
+		}
+
 		var socketState = this.socket.readyState;
 		if (socketState === 2 || socketState === 3) {
 			this._map.loadDocument();


More information about the Libreoffice-commits mailing list