close websockets when the checkup is complete

pull/1/head
ansuz 4 years ago
parent b8796d4751
commit cba66d5db3

@ -173,10 +173,13 @@ define([
}).nThen(function () { }).nThen(function () {
// Iframe is loaded // Iframe is loaded
clearTimeout(to); clearTimeout(to);
console.log("removing sandbox iframe");
$('iframe#sbox-iframe').remove();
cb(true); cb(true);
}); });
}); });
var shared_websocket;
// Test Websocket // Test Websocket
var evWSError = Util.mkEvent(true); var evWSError = Util.mkEvent(true);
assert(function (_cb, msg) { assert(function (_cb, msg) {
@ -188,7 +191,7 @@ define([
])); ]));
})); }));
var ws = new WebSocket(NetConfig.getWebsocketURL()); var ws = shared_websocket = new WebSocket(NetConfig.getWebsocketURL());
var to = setTimeout(function () { var to = setTimeout(function () {
console.error('Websocket TIMEOUT'); console.error('Websocket TIMEOUT');
evWSError.fire(); evWSError.fire();
@ -207,6 +210,7 @@ define([
}); });
// Test login block // Test login block
var shared_realtime;
assert(function (_cb, msg) { assert(function (_cb, msg) {
var websocketErr = "No WebSocket available"; var websocketErr = "No WebSocket available";
var cb = Util.once(Util.both(_cb, function (status) { var cb = Util.once(Util.both(_cb, function (status) {
@ -268,7 +272,7 @@ define([
console.error("Can't create new channel. This may also be a websocket issue."); console.error("Can't create new channel. This may also be a websocket issue.");
return void cb(false); return void cb(false);
} }
RT = rt; shared_realtime = RT = rt;
var proxy = rt.proxy; var proxy = rt.proxy;
proxy.edPublic = opt.edPublic; proxy.edPublic = opt.edPublic;
proxy.edPrivate = opt.edPrivate; proxy.edPrivate = opt.edPrivate;
@ -334,7 +338,6 @@ define([
}).nThen(function () { }).nThen(function () {
cb(true); cb(true);
}); });
}); });
var sheetURL = '/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/index.html'; var sheetURL = '/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/index.html';
@ -511,7 +514,9 @@ define([
'This instance does not provide a valid ', 'This instance does not provide a valid ',
h('code', 'adminEmail'), h('code', 'adminEmail'),
' which can make it difficult to contact its adminstrator to report vulnerabilities or abusive content.', ' which can make it difficult to contact its adminstrator to report vulnerabilities or abusive content.',
" This can be configured on your instance's admin panel. Use the provided 'Flush cache' button for this change to take effect for all users." " This can be configured on your instance's admin panel. Use the provided ",
code("Flush cache'"),
" button for this change to take effect for all users.",
])); ]));
cb(email); cb(email);
}); });
@ -591,6 +596,7 @@ define([
try { try {
var msg = JSON.parse(event.data); var msg = JSON.parse(event.data);
if (msg.command === 'READY') { return void sandboxIframeReady.fire(); } if (msg.command === 'READY') { return void sandboxIframeReady.fire(); }
if (msg.q === "READY") { return; } // ignore messages from the usual sandboxed iframe
var txid = msg.txid; var txid = msg.txid;
if (!txid) { return console.log("no handler for ", txid); } if (!txid) { return console.log("no handler for ", txid); }
response.handle(txid, msg.content); response.handle(txid, msg.content);
@ -763,6 +769,14 @@ define([
$progress.remove(); $progress.remove();
$('body').prepend(report); $('body').prepend(report);
try {
console.log('closing shared websocket');
shared_websocket.close();
} catch (err) { console.error(err); }
try {
console.log('closing shared realtime');
shared_realtime.network.disconnect();
} catch (err) { console.error(err); }
}, function (i, total) { }, function (i, total) {
console.log('test '+ i +' completed'); console.log('test '+ i +' completed');
completed++; completed++;

Loading…
Cancel
Save