[Libreoffice-commits] online.git: 2 commits - loleaflet/js loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Mar 6 13:31:30 UTC 2019
loleaflet/js/global.js | 11 +++++++++++
loleaflet/src/core/Socket.js | 29 +----------------------------
2 files changed, 12 insertions(+), 28 deletions(-)
New commits:
commit f5791f9e1f7b4c77cba62158fe342c248f715284
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Mar 6 15:29:17 2019 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Mar 6 15:30:49 2019 +0200
Send the HULLO message to the mobile app native code already in global.js
Apparently the connect() function in Socket.js is now dead code?
Now the iOS app seems to work as before.
Change-Id: Ib6c2b9a08e818ec8f4b5dbdfbf75f507c4bb7069
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index bc1e96e05..3057361af 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -134,5 +134,16 @@
}
global.socket.binaryType = 'arraybuffer';
+
+ if (window.ThisIsAMobileApp) {
+ // This corresponds to the initial GET request when creating a WebSocket
+ // connection and tells the app's code that it is OK to start invoking
+ // TheFakeWebSocket's onmessage handler. The app code that handles this
+ // special message knows the document to be edited anyway, and can send it
+ // on as necessary to the Online code.
+ window.postMobileMessage('HULLO');
+ // A FakeWebSocket is immediately open.
+ this.socket.onopen();
+ }
}
}(window));
commit 9dee58271840f0f6167b9ad1377d60a40097cbf3
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Mar 6 15:28:25 2019 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Mar 6 15:28:54 2019 +0200
Bin the now duplicate and unnecessary FakeWebSocket things in Socket.js
global.js now defines windows.FakeWebSocket.
Change-Id: I9a430a684769ab071838e4e3e30372f26f761139
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 3fe3cb2c7..5b0b48888 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -5,33 +5,6 @@
/* global _ vex $ errorMessages Uint8Array brandProductName brandProductFAQURL */
-window.fakeWebSocketCounter = 0;
-function FakeWebSocket() {
- this.binaryType = 'arraybuffer';
- this.bufferedAmount = 0;
- this.extensions = '';
- this.protocol = '';
- this.readyState = 1;
- this.id = window.fakeWebSocketCounter++;
- this.sendCounter = 0;
- this.onclose = function() {
- };
- this.onerror = function() {
- };
- this.onmessage = function() {
- };
- this.onopen = function() {
- };
-}
-
-FakeWebSocket.prototype.close = function() {
-}
-
-FakeWebSocket.prototype.send = function(data) {
- this.sendCounter++;
- window.postMobileMessage(data);
-}
-
L.Socket = L.Class.extend({
ProtocolVersionNumber: '0.1',
ReconnectCount: 0,
@@ -59,7 +32,7 @@ L.Socket = L.Class.extend({
this.close();
}
if (window.ThisIsAMobileApp) {
- this.socket = new FakeWebSocket();
+ this.socket = new window.FakeWebSocket();
window.TheFakeWebSocket = this.socket;
} else {
var wopiSrc = '';
More information about the Libreoffice-commits
mailing list