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

Pranav Kant pranavk at collabora.co.uk
Thu May 24 08:38:20 UTC 2018


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

New commits:
commit e359480dac7e03cda7dee6dc726184d573d93ffd
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed May 2 23:19:48 2018 +0530

    loleaflet: close previous socket before connecting new one
    
    It's possible otherwise in some scenarios that multiple sockets are
    created in one browser tab while there should only be one for one
    browser tab.
    
    Change-Id: I242ba62effee24c4ab04367001459448b4ff5817
    Reviewed-on: https://gerrit.libreoffice.org/53749
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit 088658807ac2340344ffdabaec42885b15b8f62b)
    Reviewed-on: https://gerrit.libreoffice.org/53780
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 7bd33617a..f24599774 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -34,6 +34,9 @@ L.Socket = L.Class.extend({
 
 		var websocketURI = map.options.server + '/lool/' + encodeURIComponent(map.options.doc + '?' + $.param(map.options.docParams)) + '/ws' + wopiSrc;
 		try {
+			if (this.socket) {
+				this.close();
+			}
 			this.socket = new WebSocket(websocketURI);
 		} catch (e) {
 			this._map.fire('error', {msg: _('Oops, there is a problem connecting to LibreOffice Online : ').replace('LibreOffice Online', (typeof brandProductName !== 'undefined' ? brandProductName : 'LibreOffice Online')) + _('Cannot create websocket, please restart your browser.'), cmd: 'socket', kind: 'failed', id: 3});


More information about the Libreoffice-commits mailing list