Reload worker on new version
parent
171d00a943
commit
3858d68a0a
|
@ -2129,6 +2129,10 @@ define([
|
|||
common.onNetworkReconnect.fire(data);
|
||||
});
|
||||
},
|
||||
FORCE_RELOAD: function () {
|
||||
// XXX not used
|
||||
common.onNewVersionReconnect.fire();
|
||||
},
|
||||
// OnlyOffice
|
||||
OO_EVENT: common.onlyoffice.onEvent.fire,
|
||||
// Mailbox
|
||||
|
|
|
@ -2990,6 +2990,20 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
Store.newVersionReload = function () {
|
||||
broadcast([], "NETWORK_RECONNECT");
|
||||
|
||||
/* // XXX NETWORK_RECONNECT only works when a manual /api/config is used
|
||||
// XXX The following code disconnect all tabs and asks for a page reload BUT
|
||||
// if the urlArgs has not changed, new tabs will stay on the same DISCONNECTED worker
|
||||
// XXX One solution is to change the FRESH mode token before sending the newVersion message
|
||||
Store.disconnect();
|
||||
broadcast([], "FORCE_RELOAD");
|
||||
if (self.CP_closeWorker) {
|
||||
setTimeout(self.CP_closeWorker, 200);
|
||||
}
|
||||
*/
|
||||
};
|
||||
Store.disconnect = function () {
|
||||
if (self.accountDeletion) { return; }
|
||||
if (!store.network) { return; }
|
||||
|
|
|
@ -711,8 +711,8 @@ define([
|
|||
}
|
||||
if (content.reload) {
|
||||
// We're going to force a disconnect, dismiss
|
||||
// XXX
|
||||
return void cb(true);
|
||||
ctx.Store.newVersionReload();
|
||||
return; // This message will be removed when reloading the worker
|
||||
}
|
||||
var uid = msg.uid;
|
||||
broadcasts[uid] = {
|
||||
|
|
|
@ -9,6 +9,20 @@ localStorage = {
|
|||
|
||||
self.tabs = {};
|
||||
|
||||
// XXX Not used for now
|
||||
self.CP_closeWorker = function () {
|
||||
Object.keys(self.tabs).forEach(function (id) {
|
||||
var obj = self.tabs[id];
|
||||
if (obj.port) { return; }
|
||||
console.error(id);
|
||||
try {
|
||||
obj.port.close();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var postMsg = function (client, data) {
|
||||
client.port.postMessage(data);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue