[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/src

Jan Holesovsky kendy at collabora.com
Thu Apr 26 17:24:47 UTC 2018


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

New commits:
commit 133d36b9b8e313528318758d01936deef41db6fa
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 ce05a4a6d..ad654fc57 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -84,12 +84,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