Test timeout to kill phantom viewers

This commit is contained in:
yflory
2019-01-30 15:49:45 +01:00
parent d989b6d6e4
commit cb89a5fdfe
2 changed files with 17 additions and 12 deletions

View File

@@ -1048,17 +1048,22 @@ define([
cb();
};
/*var onPing = function (data, cb) {
var onPing = function (data, cb) {
cb();
};
var timeout = false;
var onTimeout = function () {
//alert("Timeout");
};*/
// XXX
timeout = true;
common.onNetworkDisconnect.fire();
// FIXME: no UI in outer...
alert("Timeout error, please reload this tab");
};
var queries = {
/*PING: onPing,
TIMEOUT: onTimeout,*/
PING: onPing,
TIMEOUT: onTimeout,
REQUEST_LOGIN: requestLogin,
UPDATE_METADATA: common.changeMetadata,
UPDATE_TOKEN: function (data) {
@@ -1375,6 +1380,7 @@ define([
console.log('Outer ready');
Object.keys(queries).forEach(function (q) {
chan.on(q, function (data, cb) {
if (timeout) { return; }
try {
queries[q](data, cb);
} catch (e) {
@@ -1387,6 +1393,7 @@ define([
postMessage = function (cmd, data, cb, opts) {
cb = cb || function () {};
if (timeout) { return void cb ({error: 'TIMEOUT'}); }
chan.query(cmd, data, function (err, data) {
if (err) { return void cb ({error: err}); }
cb(data);